[openib-general] [PATCHv2] OpenSM/osm_lid_mgr.c: Support enhanced switch port 0 for LMC > 0

Hal Rosenstock halr at voltaire.com
Thu Jun 29 08:09:33 PDT 2006


OpenSM/osm_lid_mgr.c: Support enhanced switch port 0 for LMC > 0

Base port 0 is constrained to have LMC of 0 whereas enhanced switch port
0 is not. Support enhanced switch port 0 is more like CA and router
ports in terms of LMC.

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: opensm/osm_lid_mgr.c
===================================================================
--- opensm/osm_lid_mgr.c	(revision 8277)
+++ opensm/osm_lid_mgr.c	(working copy)
@@ -94,6 +94,7 @@
 #include <opensm/osm_lid_mgr.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
+#include <opensm/osm_switch.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_msgdef.h>
 #include <vendor/osm_vendor_api.h>
@@ -351,6 +352,8 @@ __osm_lid_mgr_init_sweep(
   osm_lid_mgr_range_t *p_range = NULL;
   osm_port_t          *p_port;
   cl_qmap_t           *p_port_guid_tbl;
+  osm_switch_t        *p_sw;
+  ib_switch_info_t    *p_si;
   uint8_t              lmc_num_lids = (uint8_t)(1 << p_mgr->p_subn->opt.lmc);
   uint16_t             lmc_mask;
   uint16_t             req_lid, num_lids;
@@ -436,7 +439,20 @@ __osm_lid_mgr_init_sweep(
            IB_NODE_TYPE_SWITCH )
         num_lids = lmc_num_lids;
       else
-        num_lids = 1;
+      {
+        /* Determine if enhanced switch port 0 */
+        p_sw = osm_get_switch_by_guid(p_mgr->p_subn,
+                                      osm_node_get_node_guid(osm_port_get_parent_node(p_port)));
+        if (p_sw && (p_si = osm_switch_get_si_ptr(p_sw)) &&
+            ib_switch_info_is_enhanced_port0(p_si))
+        {
+          num_lids = lmc_num_lids;
+        }
+        else
+        {
+          num_lids = 1;
+        }
+      }
 
       if ((num_lids != 1) &&
           (((db_min_lid & lmc_mask) != db_min_lid) ||
@@ -539,7 +555,18 @@ __osm_lid_mgr_init_sweep(
           }
           else
           {
-            num_lids = 1;
+            /* Determine if enhanced switch port 0 */
+            p_sw = osm_get_switch_by_guid(p_mgr->p_subn,
+                                          osm_node_get_node_guid(osm_port_get_parent_node(p_port)));
+            if (p_sw && (p_si = osm_switch_get_si_ptr(p_sw)) &&
+                ib_switch_info_is_enhanced_port0(p_si))
+            {
+              num_lids = lmc_num_lids;
+            }
+            else
+            {
+              num_lids = 1;
+            }
           }
 
           /* Make sure the lid is aligned */
@@ -798,6 +825,8 @@ __osm_lid_mgr_get_port_lid(
   uint8_t  num_lids = (1 << p_mgr->p_subn->opt.lmc);
   int      lid_changed = 0;
   uint16_t lmc_mask;
+  osm_switch_t        *p_sw;
+  ib_switch_info_t    *p_si;
 
   OSM_LOG_ENTER( p_mgr->p_log, __osm_lid_mgr_get_port_lid );
 
@@ -809,10 +838,19 @@ __osm_lid_mgr_get_port_lid(
   /* get the lid from the guid2lid */
   guid = cl_ntoh64( osm_port_get_guid( p_port ) );
 
-  /* if the port is a switch then we only need one lid */
+  /* if the port is a switch with base switch port 0 then we only need one lid */
   if( osm_node_get_type( osm_port_get_parent_node( p_port ) ) ==
       IB_NODE_TYPE_SWITCH )
-    num_lids = 1;
+  {
+    /* Determine if base switch port 0 */
+    p_sw = osm_get_switch_by_guid(p_mgr->p_subn,
+                                  osm_node_get_node_guid(osm_port_get_parent_node(p_port)));
+    if (p_sw && (p_si = osm_switch_get_si_ptr(p_sw)) &&
+        !ib_switch_info_is_enhanced_port0(p_si))
+    {
+      num_lids = 1;
+    }
+  }
 
   /* if the port matches the guid2lid */
   if (!osm_db_guid2lid_get( p_mgr->p_g2l, guid, &min_lid, &max_lid))







More information about the general mailing list