[openib-general] [PATCHv2 3/3] OpenSM/osm_sa_multipath_record.c: Support SL in MultiPathRecord requests

Hal Rosenstock halr at voltaire.com
Wed Jul 19 03:27:07 PDT 2006


OpenSM/osm_sa_multipath_record.c: Support SL in MultiPathRecord requests

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

Index: opensm/osm_sa_multipath_record.c
===================================================================
--- opensm/osm_sa_multipath_record.c	(revision 8574)
+++ opensm/osm_sa_multipath_record.c	(working copy)
@@ -62,6 +62,7 @@
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
+#include <opensm/osm_partition.h>
 #include <vendor/osm_vendor.h>
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
@@ -164,6 +165,7 @@ __osm_mpr_rcv_get_path_parms(
   const osm_physp_t*		p_physp;
   const osm_physp_t*		p_dest_physp;
   const osm_switch_t*		p_sw;
+  const osm_prtn_t*		p_prtn;
   const ib_port_info_t*		p_pi;
   const cl_qmap_t*		p_sw_tbl;
   ib_slvl_table_t*            	p_slvl_tbl;
@@ -193,28 +195,55 @@ __osm_mpr_rcv_get_path_parms(
   mtu = ib_port_info_get_neighbor_mtu( p_pi );
   rate = ib_port_info_compute_rate( p_pi );
 
-  if ( comp_mask & IB_MPR_COMPMASK_SL )
-    required_sl = ib_multipath_rec_sl( p_mpr );
-  else
-    required_sl = OSM_DEFAULT_SL;
-
-  if ( comp_mask & IB_MPR_COMPMASK_PKEY ) {
+  if ( comp_mask & IB_MPR_COMPMASK_RAWTRAFFIC &&
+       cl_ntoh32( p_mpr->hop_flow_raw ) & ( 1<<31 ) )
+    required_pkey = 0;
+  else if ( comp_mask & IB_MPR_COMPMASK_PKEY ) {
     required_pkey = p_mpr->pkey;
-    if ( !osm_physp_has_pkey( p_rcv->p_log, required_pkey, p_physp ) ||
-         !osm_physp_has_pkey( p_rcv->p_log, required_pkey, p_dest_physp ) ) {
-      osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-	       "__osm_mpr_rcv_get_path_parms: "
-	       "path not found for PKey = 0x%04x\n"
+    if( !osm_physp_share_this_pkey( p_physp, p_dest_physp, required_pkey ) ) {
+      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+	       "__osm_mpr_rcv_get_path_parms: ERR 4518: "
+	       "Ports do not share specified PKey 0x%04x\n"
 	       "\t\tsrc %Lx dst %Lx\n",
 	       cl_ntoh16( required_pkey ),
 	       cl_ntoh64( osm_physp_get_port_guid( p_physp ) ),
 	       cl_ntoh64( osm_physp_get_port_guid( p_dest_physp ) ) );
-
       status = IB_NOT_FOUND;
       goto Exit;
     }
-  } else
-    required_pkey = IB_DEFAULT_PKEY;
+  } else {
+    required_pkey = osm_physp_find_common_pkey( p_physp, p_dest_physp );
+    if ( !required_pkey ) {
+      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+               "__osm_mpr_rcv_get_path_parms: ERR 4519: "
+               "Ports do not have any shared PKeys\n"
+               "\t\tsrc %Lx dst %Lx\n",
+               cl_ntoh64( osm_physp_get_port_guid( p_physp ) ),
+               cl_ntoh64( osm_physp_get_port_guid( p_dest_physp ) ) );
+      status = IB_NOT_FOUND;
+      goto Exit;
+    }
+  }
+
+  p_prtn = (osm_prtn_t *)cl_qmap_get(&p_rcv->p_subn->prtn_pkey_tbl,
+				     required_pkey & cl_ntoh16((uint16_t)~0x8000));
+  if ( p_prtn == (osm_prtn_t *)cl_qmap_end(&p_rcv->p_subn->prtn_pkey_tbl) )
+  {
+    /* this may be possible when pkey tables are created somehow in
+       previous runs or things are going wrong here */
+    required_sl = OSM_DEFAULT_SL;
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "__osm_mpr_rcv_get_path_parms: ERR 451A: "
+             "No partition found for PKey 0x%04x - using default SL %d\n", cl_ntoh16(required_pkey), required_sl );
+  }
+  else
+    required_sl = p_prtn->sl;
+
+  if ( ( comp_mask & IB_MPR_COMPMASK_SL ) && ib_multipath_rec_sl( p_mpr ) != required_sl )
+  {
+    status = IB_NOT_FOUND;
+    goto Exit;
+  }
 
   /*
     Walk the subnet object from source to destination,
@@ -641,7 +670,7 @@ __osm_mpr_rcv_build_pr(
   p_pr->slid = cl_hton16( src_lid_ho );
 
   p_pr->pkey = p_parms->pkey;
-  p_pr->sl = p_parms->sl;
+  p_pr->sl = cl_hton16( p_parms->sl );
   p_pr->mtu = (uint8_t)( p_parms->mtu | 0x80 );
   p_pr->rate = (uint8_t)( p_parms->rate | 0x80 );
 







More information about the general mailing list