[openib-general] [PATCH] OpenSM Assigning Duplicate LIDs

Jan Daley jdaley at systemfabricworks.com
Fri Aug 6 14:07:33 PDT 2004


Hi,

I ran across a scenario in which the SM would assign the same lid to
multiple nodes.  The problem occurs when two nodes that have the same
lid are placed into a subnet that doesn't have an SM running.  When
OpenSM is started, it preserves the existing lids without checking for
duplicates.



Index: opensm/osm_lid_mgr.c
===================================================================
--- opensm/osm_lid_mgr.c	(revision 590)
+++ opensm/osm_lid_mgr.c	(working copy)
@@ -878,6 +878,7 @@
   osm_lid_mgr_t*           const p_mgr = (osm_lid_mgr_t*)context;
   osm_physp_t*          p_physp;
   cl_ptr_vector_t*         p_tbl;
+  osm_port_t*           temp_port;
 
   OSM_LOG_ENTER( p_mgr->p_log, __osm_lid_mgr_process_foreign );
 
@@ -912,19 +913,33 @@
              min_lid_ho, max_lid_ho );
   }
 
-  /*
-    Place this port into the port ptr vector.
-    And update the PortInfo attribute template.
-  */
-  for( lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++ )
-    cl_ptr_vector_set( p_tbl, lid_ho, p_port );
+  if (CL_SUCCESS == cl_ptr_vector_at(p_tbl, min_lid_ho,
(void*)&temp_port)
+      && NULL != temp_port)
+  {
+    /*
+      If something is already there, we need to find a new
+      lid range for this port.  Process it like it is unassigned.
+    */
+    __osm_lid_mgr_process_unassigned(p_object, context);
+  }
+  else
+  {
+    /*
+      Place this port into the port ptr vector.
+      And update the PortInfo attribute template.
+    */
+    for( lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++ )
+    {
+      cl_ptr_vector_set( p_tbl, lid_ho, p_port );
+    }
 
-  /*
-    Set the PortInfo for the Physical Port associated
-    with this Port.
-  */
-  p_physp = osm_port_get_default_phys_ptr( p_port );
-  __osm_lid_mgr_set_physp_pi( p_mgr, p_physp, cl_hton16( min_lid_ho )
);
+    /*
+      Set the PortInfo for the Physical Port associated
+      with this Port.
+    */
+    p_physp = osm_port_get_default_phys_ptr( p_port );
+    __osm_lid_mgr_set_physp_pi( p_mgr, p_physp, cl_hton16( min_lid_ho )
);
+  }
 
   OSM_LOG_EXIT( p_mgr->p_log );
 }



Jan Daley
System Fabric Works
(512) 343-6101 x 13







More information about the general mailing list