[openib-general] [PATCHv3 2/3] OpenSM/osm_sa_path_record.c: Support SL in PathRecord requests

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


OpenSM/osm_sa_path_record.c: Support SL in PathRecord requests

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

Index: opensm/osm_sa_path_record.c
===================================================================
--- opensm/osm_sa_path_record.c	(revision 8579)
+++ 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 );
@@ -556,7 +559,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 ) )
@@ -568,8 +570,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 PKey 0x%04x\n", cl_ntoh16(pkey));
       status = IB_NOT_FOUND;
+      goto Exit;
     }
   }
   else
@@ -579,11 +582,34 @@ __osm_pr_rcv_get_path_parms(
     {
       osm_log( p_rcv->p_log, OSM_LOG_ERROR,
                "__osm_pr_rcv_get_path_parms: ERR 1F1B: "
-               "Ports do not have any shared P_Keys\n");
+               "Ports do not have any shared PKeys\n");
       status = IB_NOT_FOUND;
+      goto Exit;
     }
   }
+
+  p_prtn = (osm_prtn_t *)cl_qmap_get(&p_rcv->p_subn->prtn_pkey_tbl,
+                                     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 */
+    sl = OSM_DEFAULT_SL;
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "__osm_pr_rcv_get_path_parms: ERR 1F1C: "
+             "No partition found for PKey 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 );
@@ -621,7 +647,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);
 
@@ -1002,18 +1028,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(
@@ -1780,7 +1794,7 @@ osm_pr_rcv_process(
     if ( p_mgrp )
     {
       /* Make sure the rest of the PathRecord matches the MC group attributes */
-      status = __osm_pr_match_mgrp_attributes( p_rcv, p_madw, p_mgrp);
+      status = __osm_pr_match_mgrp_attributes( p_rcv, p_madw, p_mgrp );
       if ( status == IB_SUCCESS )
       {
         p_pr_item = (osm_pr_item_t*)cl_qlock_pool_get( &p_rcv->pr_pool );
@@ -1812,7 +1826,7 @@ osm_pr_rcv_process(
 	  /* SL, Hop Limit, and Flow Label */
           ib_member_get_sl_flow_hop( p_mgrp->mcmember_rec.sl_flow_hop,
                                      &sl, &flow_label, &hop_limit );
-	  p_pr_item->path_rec.sl = sl;
+	  p_pr_item->path_rec.sl = cl_hton16( sl );
           p_pr_item->path_rec.hop_flow_raw = (uint32_t)(hop_limit) |
                                              (flow_label << 8);
 







More information about the general mailing list