components/open-fabrics/libibmad/patches/base.patch
branchs11-update
changeset 2459 8037cea4458f
parent 2407 772750492a43
child 2585 9c368d4da1e5
--- a/components/open-fabrics/libibmad/patches/base.patch	Mon Jan 07 12:59:02 2013 -0800
+++ b/components/open-fabrics/libibmad/patches/base.patch	Thu Jan 10 13:34:12 2013 -0800
@@ -91,7 +91,7 @@
  }
 diff -r -u /tmp/libibmad-1.3.7/src/mad.c libibmad-1.3.7/src/mad.c
 --- /tmp/libibmad-1.3.7/src/mad.c	Wed Feb 16 02:12:53 2011
-+++ libibmad-1.3.7/src/mad.c	Wed Oct 10 10:28:45 2012
++++ libibmad-1.3.7/src/mad.c	Mon Nov 12 09:27:48 2012
 @@ -61,6 +61,7 @@
  		trid = random();
  	}
@@ -111,16 +111,46 @@
  
  #include <infiniband/umad.h>
  #include <infiniband/mad.h>
-@@ -104,12 +105,18 @@
+@@ -57,10 +58,18 @@
+ 
+ 	memset(sm_id, 0, sizeof(*sm_id));
+ 
+-	if (!smp_query_via(portinfo, &self, IB_ATTR_PORT_INFO, 0, 0, srcport))
++	if (!smp_query_via(portinfo, &self, IB_ATTR_PORT_INFO, 0, 0, srcport)) {
++		if (!errno)
++			errno = EIO;
+ 		return -1;
++	}
  
- 	if (!sm_id) {
+ 	mad_decode_field(portinfo, IB_PORT_SMLID_F, &lid);
++	if (lid == 0) {
++		if (!errno)
++			errno = EIO;
++		return -1;
++	}
+ 	mad_decode_field(portinfo, IB_PORT_SMSL_F, &sm_id->sl);
+ 
+ 	return ib_portid_set(sm_id, lid, 0, 0);
+@@ -95,7 +104,7 @@
+ 			ib_portid_t * sm_id, int timeout,
+ 			const struct ibmad_port *srcport)
+ {
+-	ib_portid_t sm_portid;
++	ib_portid_t sm_portid = { 0 };
+ 	uint8_t buf[IB_SA_DATA_SIZE] = { 0 };
+ 	ib_portid_t self = { 0 };
+ 	uint64_t selfguid, prefix;
+@@ -102,14 +111,19 @@
+ 	ibmad_gid_t selfgid;
+ 	uint8_t nodeinfo[64];
+ 
+-	if (!sm_id) {
++	if (!sm_id)
  		sm_id = &sm_portid;
--		if (ib_resolve_smlid_via(sm_id, timeout, srcport) < 0)
-+		if (ib_resolve_smlid_via(sm_id, timeout, srcport) < 0) {
-+			if (!errno)
-+				errno = EIO;
++
++	if (!sm_id->lid) {
+ 		if (ib_resolve_smlid_via(sm_id, timeout, srcport) < 0)
  			return -1;
-+		}
  	}
  
 -	if (!smp_query_via(nodeinfo, &self, IB_ATTR_NODE_INFO, 0, 0, srcport))