[openib-general] Re[PATCH] Opensm - running on system with 2 hcas

Yael Kalka yael at mellanox.co.il
Thu Jan 5 00:24:31 PST 2006


Hi Hal,

When trying to run OpenSM on a system with 2 hca cards, we noticed
that there is a problem with the osm_vendor_get_all_port_attr.
What happens is that we are saving the port 0 for each hca, though
this data is relevant for the default port only once.
The result is that if running with -g 0, we get 5 ports instead of 4,
and the third port (which was the data copied as the default port for
the second hca) is not valid.
The following patch fixes this.

Thanks,
Yael

Signed-off-by:  Yael Kalka <yael at mellanox.co.il>

Index: libvendor/osm_vendor_ibumad.c
===================================================================
--- libvendor/osm_vendor_ibumad.c       (revision 4760)
+++ libvendor/osm_vendor_ibumad.c       (working copy)
@@ -637,18 +637,24 @@ osm_vendor_get_all_port_attr(
                umad_release_port(&def_port);
        }
 
+   j = 0;
        if (p_attr_array) {
                /* set the port guid, lid, and sm lid in the port attr struct */
                for (i = 0; i < *p_num_ports; i++) {
-                       p_attr_array[i].port_guid = portguids[i];
-                       p_attr_array[i].lid = lids[i];
-                       if (i == 0)
-                               p_attr_array[i].sm_lid = sm_lid;
+        if (i > 0 && portguids[i] == 0) {
+          continue;
+        }
+                       p_attr_array[j].port_guid = portguids[i];
+                       p_attr_array[j].lid = lids[i];
+                       if (j == 0)
+                               p_attr_array[j].sm_lid = sm_lid;
                        else
-                               p_attr_array[i].sm_lid = p_vend->umad_port.sm_lid;
-                       p_attr_array[i].link_state = linkstates[i];
+                               p_attr_array[j].sm_lid = p_vend->umad_port.sm_lid;
+                       p_attr_array[j].link_state = linkstates[i];
+         j++;
                }
                r = 0;
+      *p_num_ports = j;
        } else
                r = IB_INSUFFICIENT_MEMORY;




More information about the general mailing list