[openib-general] [PATCH] OpenSM: SubnAdmGet PathRecord should assume NumbPath of 1

Hal Rosenstock halr at voltaire.com
Wed Dec 7 04:05:48 PST 2005


OpenSM: SubnAdmGet PathRecord should assume NumbPath of 1 (1.2 erratum)

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

Index: opensm/osm_sa_path_record.c
===================================================================
--- opensm/osm_sa_path_record.c	(revision 4335)
+++ opensm/osm_sa_path_record.c	(working copy)
@@ -709,13 +709,15 @@ __osm_pr_rcv_get_lid_pair_path(
 static void
 __osm_pr_rcv_get_port_pair_paths(
   IN osm_pr_rcv_t*         const p_rcv,
-  IN const ib_path_rec_t*     const p_pr,
+  IN const osm_madw_t*     const p_madw,
   IN const osm_port_t*     const p_req_port,
   IN const osm_port_t*     const p_src_port,
   IN const osm_port_t*     const p_dest_port,
   IN const ib_net64_t         comp_mask,
   IN cl_qlist_t*           const p_list )
 {
+  const ib_path_rec_t*     p_pr;
+  const ib_sa_mad_t*       p_sa_mad;
   osm_pr_item_t*           p_pr_item;
   uint16_t              src_lid_min_ho;
   uint16_t              src_lid_max_ho;
@@ -752,6 +754,9 @@ __osm_pr_rcv_get_port_pair_paths(
     goto Exit;
   }
 
+  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
+  p_pr = (ib_path_rec_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
+
   /*
     We shouldn't be here if the paths are disqualified in some way...
     Thus, we assume every possible connection is valid.
@@ -842,10 +847,14 @@ __osm_pr_rcv_get_port_pair_paths(
   preference = 0;
   path_num = 0;
 
-  if( comp_mask & IB_PR_COMPMASK_NUMBPATH )
-    iterations = p_pr->num_path & 0x7F;
+  /* If SubnAdmGet, assume NumbPaths 1 (1.2 erratum) */
+  if (p_sa_mad->method != IB_MAD_METHOD_GET)
+    if( comp_mask & IB_PR_COMPMASK_NUMBPATH )
+      iterations = p_pr->num_path & 0x7F;
+    else
+      iterations = (uintn_t)(-1);
   else
-    iterations = (uintn_t)(-1);
+    iterations = 1;
 
   while( path_num < iterations )
   {
@@ -1101,7 +1110,7 @@ __osm_pr_rcv_get_end_points(
 static void
 __osm_pr_rcv_process_world(
   IN osm_pr_rcv_t*         const p_rcv,
-  IN const ib_path_rec_t*     const p_pr,
+  IN const osm_madw_t*     const p_madw,
   IN const osm_port_t*     const requestor_port,
   IN const ib_net64_t         comp_mask,
   IN cl_qlist_t*           const p_list )
@@ -1128,7 +1137,7 @@ __osm_pr_rcv_process_world(
     p_src_port = (osm_port_t*)cl_qmap_head( p_tbl );
     while( p_src_port != (osm_port_t*)cl_qmap_end( p_tbl ) )
     {
-      __osm_pr_rcv_get_port_pair_paths( p_rcv, p_pr, requestor_port, p_src_port,
+      __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw, requestor_port, p_src_port,
                                         p_dest_port, comp_mask, p_list );
 
       p_src_port = (osm_port_t*)cl_qmap_next( &p_src_port->map_item );
@@ -1145,7 +1154,7 @@ __osm_pr_rcv_process_world(
 static void
 __osm_pr_rcv_process_half(
   IN osm_pr_rcv_t*         const p_rcv,
-  IN const ib_path_rec_t*     const p_pr,
+  IN const osm_madw_t*     const p_madw,
   IN const osm_port_t*     const requestor_port,
   IN const osm_port_t*     const p_src_port,
   IN const osm_port_t*     const p_dest_port,
@@ -1172,7 +1181,7 @@ __osm_pr_rcv_process_half(
     p_port = (osm_port_t*)cl_qmap_head( p_tbl );
     while( p_port != (osm_port_t*)cl_qmap_end( p_tbl ) )
     {
-      __osm_pr_rcv_get_port_pair_paths( p_rcv, p_pr, requestor_port, p_src_port,
+      __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw , requestor_port, p_src_port,
                                         p_port, comp_mask, p_list );
       p_port = (osm_port_t*)cl_qmap_next( &p_port->map_item );
     }
@@ -1185,7 +1194,7 @@ __osm_pr_rcv_process_half(
     p_port = (osm_port_t*)cl_qmap_head( p_tbl );
     while( p_port != (osm_port_t*)cl_qmap_end( p_tbl ) )
     {
-      __osm_pr_rcv_get_port_pair_paths( p_rcv, p_pr, requestor_port, p_port,
+      __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw, requestor_port, p_port,
                                         p_dest_port, comp_mask, p_list );
       p_port = (osm_port_t*)cl_qmap_next( &p_port->map_item );
     }
@@ -1199,7 +1208,7 @@ __osm_pr_rcv_process_half(
 static void
 __osm_pr_rcv_process_pair(
   IN osm_pr_rcv_t*         const p_rcv,
-  IN const ib_path_rec_t*     const p_pr,
+  IN const osm_madw_t*     const p_madw,
   IN const osm_port_t*     const requestor_port,
   IN const osm_port_t*     const p_src_port,
   IN const osm_port_t*     const p_dest_port,
@@ -1208,7 +1217,7 @@ __osm_pr_rcv_process_pair(
 {
   OSM_LOG_ENTER( p_rcv->p_log, __osm_pr_rcv_process_pair );
 
-  __osm_pr_rcv_get_port_pair_paths( p_rcv, p_pr, requestor_port, p_src_port,
+  __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw, requestor_port, p_src_port,
                                     p_dest_port, comp_mask, p_list );
 
   OSM_LOG_EXIT( p_rcv->p_log );
@@ -1413,7 +1422,8 @@ __osm_pr_match_mgrp_attributes(
       goto Exit;
   }
 
-  if( comp_mask & IB_PR_COMPMASK_NUMBPATH )
+  /* If SubnAdmGet, assume NumbPaths of 1 (1.2 erratum) */
+  if( ( comp_mask & IB_PR_COMPMASK_NUMBPATH ) && ( p_sa_mad->method != IB_MAD_METHOD_GET ) )
   {
     if( ( p_pr->num_path & 0x7f ) == 0 )
       goto Exit;
@@ -1513,7 +1523,7 @@ __osm_pr_rcv_respond(
 
   /*
    * C15-0.1.30:
-   * If we do a SubAdmGet and got more than one record it is an error !
+   * If we do a SubnAdmGet and got more than one record it is an error !
    */
   if ( (p_rcvd_mad->method == IB_MAD_METHOD_GET) &&
        (num_rec > 1)) {
@@ -1720,22 +1730,22 @@ osm_pr_rcv_process(
   if( p_src_port )
   {
     if( p_dest_port )
-      __osm_pr_rcv_process_pair( p_rcv, p_pr, requestor_port, p_src_port, p_dest_port,
+      __osm_pr_rcv_process_pair( p_rcv, p_madw, requestor_port, p_src_port, p_dest_port,
                                  p_sa_mad->comp_mask, &pr_list );
     else
-      __osm_pr_rcv_process_half( p_rcv, p_pr, requestor_port, p_src_port, NULL,
+      __osm_pr_rcv_process_half( p_rcv, p_madw, requestor_port, p_src_port, NULL,
                                  p_sa_mad->comp_mask, &pr_list );
   }
   else
   {
     if( p_dest_port )
-      __osm_pr_rcv_process_half( p_rcv, p_pr, requestor_port, NULL, p_dest_port,
+      __osm_pr_rcv_process_half( p_rcv, p_madw, requestor_port, NULL, p_dest_port,
                                  p_sa_mad->comp_mask, &pr_list );
     else
       /*
         Katie, bar the door!
       */
-      __osm_pr_rcv_process_world( p_rcv, p_pr, requestor_port,
+      __osm_pr_rcv_process_world( p_rcv, p_madw, requestor_port,
                                   p_sa_mad->comp_mask, &pr_list );
   }
   goto Unlock;






More information about the general mailing list