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

Hal Rosenstock halr at voltaire.com
Thu Jun 29 08:15:49 PDT 2006


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

In __osm_sa_pir_create, handle enhanced switch port 0 (and the
possibility that it's LMC > 0)

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

Index: opensm/osm_sa_portinfo_record.c
===================================================================
--- opensm/osm_sa_portinfo_record.c	(revision 8277)
+++ opensm/osm_sa_portinfo_record.c	(working copy)
@@ -60,6 +60,7 @@
 #include <opensm/osm_sa_portinfo_record.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
+#include <opensm/osm_switch.h>
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
@@ -197,24 +198,34 @@ __osm_sa_pir_create(
   uint16_t                    max_lid_ho;
   uint16_t                    base_lid_ho;
   uint16_t                    match_lid_ho;
+  osm_physp_t                *p_node_physp;
+  osm_switch_t               *p_sw;
+  ib_switch_info_t           *p_si;
 
   OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_pir_create );
 
-  if(p_physp->p_node->node_info.node_type == IB_NODE_TYPE_SWITCH)
+  if (p_physp->p_node->node_info.node_type == IB_NODE_TYPE_SWITCH)
   {
-    lmc = 0;
-    base_lid_ho = cl_ntoh16(
-      osm_physp_get_base_lid(
-        osm_node_get_physp_ptr(p_physp->p_node, 0))
-      );
-    max_lid_ho = base_lid_ho;
+    p_node_physp = osm_node_get_physp_ptr( p_physp->p_node, 0 );
+    base_lid_ho = cl_ntoh16( osm_physp_get_base_lid( p_node_physp ) );
+    p_sw = osm_get_switch_by_guid( p_rcv->p_subn, 
+             osm_physp_get_port_guid( p_node_physp ) );
+    if (!p_sw || !(p_si = osm_switch_get_si_ptr( p_sw )) ||
+        !ib_switch_info_is_enhanced_port0( p_si ))
+    {
+      lmc = 0;
+    }
+    else
+    {
+      lmc = osm_physp_get_lmc( p_node_physp );
+    }
   }
   else
   {
     lmc = osm_physp_get_lmc( p_physp );
     base_lid_ho = cl_ntoh16( osm_physp_get_base_lid( p_physp ) );
-    max_lid_ho = (uint16_t)( base_lid_ho + (1 << lmc) - 1 );
   }
+  max_lid_ho = (uint16_t)( base_lid_ho + (1 << lmc) - 1 );
 
   if( p_ctxt->comp_mask & IB_PIR_COMPMASK_LID )
   {







More information about the general mailing list