[openib-general] [PATCHv2] OpenSM/osm_sa_path_record.c: Support SL in PathRecord requests based on whether or not QoS is enabled

Hal Rosenstock halr at voltaire.com
Fri Jul 14 04:10:28 PDT 2006


OpenSM/osm_sa_path_record.c: Support SL in PathRecord requests based on
whether or not QoS is enabled

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

Index: opensm/osm_sa_path_record.c
===================================================================
--- opensm/osm_sa_path_record.c	(revision 8507)
+++ opensm/osm_sa_path_record.c	(working copy)
@@ -66,6 +66,7 @@
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_multicast.h>
+#include <opensm/osm_partition.h>
 
 #define OSM_PR_RCV_POOL_MIN_SIZE    64
 #define OSM_PR_RCV_POOL_GROW_SIZE   64
@@ -164,6 +165,7 @@ __osm_pr_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_api_status_t          status = IB_SUCCESS;
@@ -174,6 +176,7 @@ __osm_pr_rcv_get_path_parms(
   uint8_t                  required_mtu;
   uint8_t                  required_rate;
   uint8_t                  required_pkt_life;
+  uint8_t                  sl;
   ib_net16_t               dest_lid;
 
   OSM_LOG_ENTER( p_rcv->p_log, __osm_pr_rcv_get_path_parms );
@@ -548,7 +551,6 @@ __osm_pr_rcv_get_path_parms(
   p_parms->mtu = mtu;
   p_parms->rate = rate;
   p_parms->pkt_life = pkt_life;
-  p_parms->sl = OSM_DEFAULT_SL;
 
   if( comp_mask & IB_PR_COMPMASK_RAWTRAFFIC &&
       cl_ntoh32( p_pr->hop_flow_raw ) & ( 1<<31 ) )
@@ -560,8 +562,9 @@ __osm_pr_rcv_get_path_parms(
     {
       osm_log( p_rcv->p_log, OSM_LOG_ERROR,
                "__osm_pr_rcv_get_path_parms: ERR 1F1A: "
-               "Ports do not share specified P_Key\n");
+               "Ports do not share specified P_Key 0x%4x\n", cl_ntoh16(pkey));
       status = IB_NOT_FOUND;
+      goto Exit;
     }
   }
   else
@@ -573,9 +576,32 @@ __osm_pr_rcv_get_path_parms(
                "__osm_pr_rcv_get_path_parms: ERR 1F1B: "
                "Ports do not have any shared P_Keys\n");
       status = IB_NOT_FOUND;
+      goto Exit;
     }
   }
+
+  p_prtn = (osm_prtn_t *)cl_qmap_get(&p_rcv->p_subn->prtn_pkey_tbl,
+                                     cl_ntoh16(pkey & ~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 */
+    sl = OSM_DEFAULT_SL;
+    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
+             "__osm_pr_rcv_get_path_parms: ERR 1F1C: "
+             "No partition found for P_Key 0x%04x - using default SL %d\n", cl_ntoh16(pkey), sl );
+  }
+  else
+    sl = p_prtn->sl;
+
+  if ( ( comp_mask & IB_PR_COMPMASK_SL ) && ib_path_rec_sl( p_pr ) != sl )
+  {
+    status = IB_NOT_FOUND;
+    goto Exit;
+  }
+
   p_parms->pkey = pkey;
+  p_parms->sl = sl;
 
  Exit:
   OSM_LOG_EXIT( p_rcv->p_log );
@@ -613,7 +639,7 @@ __osm_pr_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);
 
@@ -987,18 +1013,6 @@ __osm_pr_rcv_get_end_points(
     into the endpoints.
   */
 
-  if( comp_mask & IB_PR_COMPMASK_SL )
-  {
-    if( p_pr->sl != OSM_DEFAULT_SL )
-    {
-      if ( p_sa_mad->method == IB_MAD_METHOD_GET )
-        sa_status = IB_SA_MAD_STATUS_NO_RECORDS;
-      *pp_src_port = 0;
-      *pp_dest_port = 0;
-      goto Exit;
-    }
-  }
-
   if( comp_mask & IB_PR_COMPMASK_SGID )
   {
     *pp_src_port = (osm_port_t*)cl_qmap_get(
@@ -1414,7 +1428,7 @@ __osm_pr_match_mgrp_attributes(
 
   if( comp_mask & IB_PR_COMPMASK_SL )
   {
-    if( ( p_pr->sl & 0xf ) != sl )
+    if( ib_path_rec_sl( p_pr ) != sl )
       goto Exit;
   }
 
@@ -1422,7 +1436,7 @@ __osm_pr_match_mgrp_attributes(
   if( ( comp_mask & IB_PR_COMPMASK_NUMBPATH ) &&
       ( p_sa_mad->method != IB_MAD_METHOD_GET ) )
   {
-    if( ( p_pr->num_path & 0x7f ) == 0 )
+    if( ib_path_rec_num_path( p_pr ) == 0 )
       goto Exit;
   }
 







More information about the general mailing list