15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0 s11u1-sru 0.175.1.4.0.2.0 S11.1SRU4.2
authorAlex Chiu <Alex.Chiu@Oracle.COM>
Wed, 09 Jan 2013 10:31:41 -0800
branchs11u1-sru
changeset 2462 1132a517894c
parent 2455 b4ded87d6dab
child 2469 0b02cc321ac6
15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
components/open-fabrics/libibmad/patches/base.patch
--- a/components/open-fabrics/libibmad/patches/base.patch	Thu Dec 27 13:45:25 2012 -0800
+++ b/components/open-fabrics/libibmad/patches/base.patch	Wed Jan 09 10:31:41 2013 -0800
@@ -91,7 +91,7 @@
  }
 diff -r -u /tmp/libibmad-1.3.7/src/resolve.c libibmad-1.3.7/src/resolve.c
 --- /tmp/libibmad-1.3.7/src/resolve.c	Wed Feb 16 02:12:53 2011
-+++ libibmad-1.3.7/src/resolve.c	Thu Oct  4 23:29:01 2012
++++ libibmad-1.3.7/src/resolve.c	Wed Jan  9 09:41:48 2013
 @@ -40,6 +40,7 @@
  #include <stdlib.h>
  #include <string.h>
@@ -100,16 +100,46 @@
  
  #include <infiniband/umad.h>
  #include <infiniband/mad.h>
[email protected]@ -104,12 +105,18 @@
[email protected]@ -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);
[email protected]@ -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;
[email protected]@ -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))
@@ -239,7 +269,7 @@
  		snprintf(buf, bufsz, "%06x", *(uint32_t *) val & 0xffffff);
 diff -r -u /tmp/libibmad-1.3.7/src/sa.c libibmad-1.3.7/src/sa.c
 --- /tmp/libibmad-1.3.7/src/sa.c	Wed Feb 16 02:12:53 2011
-+++ libibmad-1.3.7/src/sa.c	Thu Oct  4 23:29:02 2012
++++ libibmad-1.3.7/src/sa.c	Mon Oct  8 01:46:30 2012
 @@ -38,6 +38,7 @@
  #include <stdio.h>
  #include <stdlib.h>