Skip to contentSkip to conversation

libibmad: Added smp_query/set _status_via functions

PATCH Applied Hal Rosenstock 2 participants 2 messages Apr 5, 2011 – Apr 8, 2011 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/2 libibmad: Added smp_query/set _status_via functions

The smp_query/set functions do not return the MAD status. The new extended API allows getting the SMP MAD status, and to differentiate between timeout on MAD response and response with bad status.

---
Change since v1:
Proper formatting

include/infiniband/mad.h +9 -1
index a0b368a..5d18ec3 100644
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
  * Copyright (c) 2009 HNR Consulting.  All rights reserved.
- * Copyright (c) 2009-2010 Mellanox Technologies LTD.  All rights reserved.
+ * Copyright (c) 2009-2011 Mellanox Technologies LTD.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -981,6 +981,14 @@ MAD_EXPORT uint8_t *smp_query_via(void *buf, ib_portid_t * id, unsigned attrid,
 MAD_EXPORT uint8_t *smp_set_via(void *buf, ib_portid_t * id, unsigned attrid,
 				unsigned mod, unsigned timeout,
 				const struct ibmad_port *srcport);
+MAD_EXPORT uint8_t *smp_query_status_via(void *rcvbuf, ib_portid_t * portid,
+					 unsigned attrid, unsigned mod,
+					 unsigned timeout, int *rstatus,
+					 const struct ibmad_port *srcport);
+MAD_EXPORT uint8_t *smp_set_status_via(void *data, ib_portid_t * portid,
+				       unsigned attrid, unsigned mod,
+				       unsigned timeout, int *rstatus,
+				       const struct ibmad_port *srcport);
 
 /* sa.c */
 uint8_t *sa_call(void *rcvbuf, ib_portid_t * portid, ib_sa_call_t * sa,
src/libibmad.map +2 -0
index 5778e3e..1e6a028 100644
@@ -101,7 +101,9 @@ IBMAD_1.3 {
 		ib_vendor_call;
 		ib_vendor_call_via;
 		smp_query_via;
+		smp_query_status_via;
 		smp_set_via;
+		smp_set_status_via;
 		ib_path_query_via;
 		ib_resolve_smlid_via;
 		ib_resolve_guid_via;
src/rpc.c +3 -0
index c5246fe..a702046 100644
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
  * Copyright (c) 2009 HNR Consulting.  All rights reserved.
+ * Copyright (c) 2011 Mellanox Technologies LTD.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -243,6 +244,8 @@ void *mad_rpc(const struct ibmad_port *port, ib_rpc_t * rpc,
 			redirect = 0;
 	}
 
+	rpc->rstatus = status;
+
 	if (status != 0) {
 		ERRS("MAD completed with error status 0x%x; dport (%s)",
 		     status, portid2str(dport));
src/smp.c +33 -8

74 lines not on this page · raw message

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 4D9B6C40.5010801-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

Applied
#2 lore raw

Thanks applied,
Ira

Quoted 162 lines · On Tue, 5 Apr 2011 12:23:44 -0700 Hal Rosenstock…

The smp_query/set functions do not return the MAD status. The new extended API allows getting the SMP MAD status, and to differentiate between timeout on MAD response and response with bad status.

---
Change since v1:
Proper formatting

include/infiniband/mad.h +9 -1
index a0b368a..5d18ec3 100644
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
  * Copyright (c) 2009 HNR Consulting.  All rights reserved.
- * Copyright (c) 2009-2010 Mellanox Technologies LTD.  All rights reserved.
+ * Copyright (c) 2009-2011 Mellanox Technologies LTD.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -981,6 +981,14 @@ MAD_EXPORT uint8_t *smp_query_via(void *buf, ib_portid_t * id, unsigned attrid,
 MAD_EXPORT uint8_t *smp_set_via(void *buf, ib_portid_t * id, unsigned attrid,
 				unsigned mod, unsigned timeout,
 				const struct ibmad_port *srcport);
+MAD_EXPORT uint8_t *smp_query_status_via(void *rcvbuf, ib_portid_t * portid,
+					 unsigned attrid, unsigned mod,
+					 unsigned timeout, int *rstatus,
+					 const struct ibmad_port *srcport);
+MAD_EXPORT uint8_t *smp_set_status_via(void *data, ib_portid_t * portid,
+				       unsigned attrid, unsigned mod,
+				       unsigned timeout, int *rstatus,
+				       const struct ibmad_port *srcport);
 
 /* sa.c */
 uint8_t *sa_call(void *rcvbuf, ib_portid_t * portid, ib_sa_call_t * sa,
src/libibmad.map +2 -0
index 5778e3e..1e6a028 100644
@@ -101,7 +101,9 @@ IBMAD_1.3 {
 		ib_vendor_call;
 		ib_vendor_call_via;
 		smp_query_via;
+		smp_query_status_via;
 		smp_set_via;
+		smp_set_status_via;
 		ib_path_query_via;
 		ib_resolve_smlid_via;
 		ib_resolve_guid_via;
src/rpc.c +3 -0
index c5246fe..a702046 100644
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
  * Copyright (c) 2009 HNR Consulting.  All rights reserved.
+ * Copyright (c) 2011 Mellanox Technologies LTD.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -243,6 +244,8 @@ void *mad_rpc(const struct ibmad_port *port, ib_rpc_t * rpc,
 			redirect = 0;
 	}
 
+	rpc->rstatus = status;
+
 	if (status != 0) {
 		ERRS("MAD completed with error status 0x%x; dport (%s)",
 		     status, portid2str(dport));
src/smp.c +33 -9
index 3ff58ce..a337663 100644
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
+ * Copyright (c) 2011 Mellanox Technologies LTD.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -45,11 +46,12 @@
 #undef DEBUG
 #define DEBUG 	if (ibdebug)	IBWARN
 
-uint8_t *smp_set_via(void *data, ib_portid_t * portid, unsigned attrid,
-		     unsigned mod, unsigned timeout,
-		     const struct ibmad_port *srcport)
+uint8_t *smp_set_status_via(void *data, ib_portid_t * portid, unsigned attrid,
+			    unsigned mod, unsigned timeout, int *rstatus,
+			    const struct ibmad_port *srcport)
 {
 	ib_rpc_t rpc = { 0 };
+	uint8_t *res;
 
 	DEBUG("attr 0x%x mod 0x%x route %s", attrid, mod, portid2str(portid));
 	if ((portid->lid <= 0) ||
@@ -69,7 +71,18 @@ uint8_t *smp_set_via(void *data, ib_portid_t * portid, unsigned attrid,
 	portid->sl = 0;
 	portid->qp = 0;
 
-	return mad_rpc(srcport, &rpc, portid, data, data);
+	res = mad_rpc(srcport, &rpc, portid, data, data);
+	if (rstatus)
+		*rstatus = rpc.rstatus;
+	return res;
+}
+
+uint8_t *smp_set_via(void *data, ib_portid_t * portid, unsigned attrid,
+		     unsigned mod, unsigned timeout,
+		     const struct ibmad_port *srcport)
+{
+	return smp_set_status_via(data, portid, attrid, mod, timeout, NULL,
+				  srcport);
 }
 
 uint8_t *smp_set(void *data, ib_portid_t * portid, unsigned attrid,
@@ -78,11 +91,12 @@ uint8_t *smp_set(void *data, ib_portid_t * portid, unsigned attrid,
 	return smp_set_via(data, portid, attrid, mod, timeout, ibmp);
 }
 
-uint8_t *smp_query_via(void *rcvbuf, ib_portid_t * portid, unsigned attrid,
-		       unsigned mod, unsigned timeout,
-		       const struct ibmad_port * srcport)
+uint8_t *smp_query_status_via(void *rcvbuf, ib_portid_t * portid,
+			      unsigned attrid, unsigned mod, unsigned timeout,
+			      int *rstatus, const struct ibmad_port * srcport)
 {
 	ib_rpc_t rpc = { 0 };
+	uint8_t *res;
 
 	DEBUG("attr 0x%x mod 0x%x route %s", attrid, mod, portid2str(portid));
 	rpc.method = IB_MAD_METHOD_GET;
@@ -102,7 +116,18 @@ uint8_t *smp_query_via(void *rcvbuf, ib_portid_t * portid, unsigned attrid,
 	portid->sl = 0;
 	portid->qp = 0;
 
-	return mad_rpc(srcport, &rpc, portid, rcvbuf, rcvbuf);
+	res = mad_rpc(srcport, &rpc, portid, rcvbuf, rcvbuf);
+	if (rstatus)
+		*rstatus = rpc.rstatus;
+	return res;
+}
+
+uint8_t *smp_query_via(void *rcvbuf, ib_portid_t * portid, unsigned attrid,
+		       unsigned mod, unsigned timeout,
+		       const struct ibmad_port * srcport)
+{
+	return smp_query_status_via(rcvbuf, portid, attrid, mod, timeout, NULL,
+				    srcport);
 }
 
 uint8_t *smp_query(void *rcvbuf, ib_portid_t * portid, unsigned attrid,
--

To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 9 lines
Ira Weiny
Math Programmer/Computer Scientist
Lawrence Livermore National Lab
925-423-8008
[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html