# HG changeset patch # User Alex Chiu # Date 1357756301 28800 # Node ID 1132a517894c43de4c0ecef9b787eda8de14f0b9 # Parent b4ded87d6dab678f7eb4a06181a4841385b2c235 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0 diff -r b4ded87d6dab -r 1132a517894c 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 #include @@ -100,16 +100,46 @@ #include #include -@@ -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)) @@ -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 #include