# HG changeset patch # User Alex Chiu # Date 1354294834 28800 # Node ID 0dc41b42eadb952731ba1d103f777d8dcfe148b6 # Parent 23c7e5d8bebfdc675ec176262a087c25170cc4c8 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0 diff -r 23c7e5d8bebf -r 0dc41b42eadb components/open-fabrics/libibmad/patches/base.patch --- a/components/open-fabrics/libibmad/patches/base.patch Fri Nov 30 01:32:53 2012 -0800 +++ b/components/open-fabrics/libibmad/patches/base.patch Fri Nov 30 09:00:34 2012 -0800 @@ -111,16 +111,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))