[openib-general] [PATCH] [MINOR] OpenSM/SA: Minor reordering of SA rcv_process functions to be more consistent

Hal Rosenstock halr at voltaire.com
Wed Jul 12 13:23:41 PDT 2006


OpenSM/SA: Minor reordering of SA rcv_process functions to be more
consistent
Also, some cosmetic changes

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

Index: opensm/osm_sa_guidinfo_record.c
===================================================================
--- opensm/osm_sa_guidinfo_record.c	(revision 8491)
+++ opensm/osm_sa_guidinfo_record.c	(working copy)
@@ -426,6 +426,18 @@ osm_gir_rcv_process(
 
   CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_GUIDINFO_RECORD );
 
+  /* we only support SubnAdmGet and SubnAdmGetTable methods */
+  if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
+       (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) )
+  {
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "osm_gir_rcv_process: ERR 5105: "
+             "Unsupported Method (%s)\n",
+             ib_get_sa_method_str( p_rcvd_mad->method ) );
+    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
+    goto Exit;
+  }
+
   /* update the requester physical port. */
   p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
                                           p_rcv->p_subn,
@@ -438,17 +450,6 @@ osm_gir_rcv_process(
     goto Exit;
   }
 
-  if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
-       (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_gir_rcv_process: ERR 5105: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
   if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
     osm_dump_guidinfo_record( p_rcv->p_log, p_rcvd_rec, OSM_LOG_DEBUG );
 
Index: opensm/osm_sa_lft_record.c
===================================================================
--- opensm/osm_sa_lft_record.c	(revision 8491)
+++ opensm/osm_sa_lft_record.c	(working copy)
@@ -303,8 +303,8 @@ __osm_lftr_rcv_by_comp_mask(
  **********************************************************************/
 void
 osm_lftr_rcv_process(
-  IN osm_lftr_rcv_t*         const p_rcv,
-  IN const osm_madw_t*       const p_madw )
+  IN osm_lftr_rcv_t*        const p_rcv,
+  IN const osm_madw_t*      const p_madw )
 {
   const ib_sa_mad_t*        p_rcvd_mad;
   const ib_lft_record_t*    p_rcvd_rec;
@@ -333,6 +333,17 @@ osm_lftr_rcv_process(
 
   CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_LFT_RECORD );
 
+  /* we only support SubnAdmGet and SubnAdmGetTable methods */
+  if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
+       (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) ) {
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "osm_lftr_rcv_process: ERR 4408: "
+             "Unsupported Method (%s)\n",
+             ib_get_sa_method_str( p_rcvd_mad->method ) );
+    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
+    goto Exit;
+  }
+
   /* update the requester physical port. */
   p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
                                           p_rcv->p_subn,
@@ -345,16 +356,6 @@ osm_lftr_rcv_process(
     goto Exit;
   }
 
-  if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
-       (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) ) {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_lftr_rcv_process: ERR 4408: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
   cl_qlist_init( &rec_list );
 
   context.p_rcvd_rec     = p_rcvd_rec;
Index: opensm/osm_sa_link_record.c
===================================================================
--- opensm/osm_sa_link_record.c	(revision 8491)
+++ opensm/osm_sa_link_record.c	(working copy)
@@ -716,7 +716,9 @@ osm_lr_rcv_process(
   p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
   p_lr = (ib_link_record_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
 
-  /* we only support SubnAdmGet and SubnAdmGetTable Methods */
+  CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_LINK_RECORD );
+
+  /* we only support SubnAdmGet and SubnAdmGetTable methods */
   if ( (p_sa_mad->method != IB_MAD_METHOD_GET) &&
        (p_sa_mad->method != IB_MAD_METHOD_GETTABLE)) {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
@@ -727,8 +729,6 @@ osm_lr_rcv_process(
     goto Exit;
   }
 
-  CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_LINK_RECORD );
-
   /* update the requester physical port. */
   p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
                                           p_rcv->p_subn,
Index: opensm/osm_sa_mcmember_record.c
===================================================================
--- opensm/osm_sa_mcmember_record.c	(revision 8491)
+++ opensm/osm_sa_mcmember_record.c	(working copy)
@@ -1386,7 +1386,7 @@ osm_mcmr_rcv_create_new_mgrp(
 Process a request for leaving the group
 **********************************************************************/
 static void
-osm_mcmr_rcv_leave_mgrp(
+__osm_mcmr_rcv_leave_mgrp(
   IN osm_mcmr_recv_t* const p_rcv,
   IN const osm_madw_t* const p_madw )
 {
@@ -1403,7 +1403,7 @@ osm_mcmr_rcv_leave_mgrp(
   uint8_t port_join_state;
   uint8_t new_join_state;
  
-  OSM_LOG_ENTER( p_rcv->p_log, osm_mcmr_rcv_leave_mgrp );
+  OSM_LOG_ENTER( p_rcv->p_log, __osm_mcmr_rcv_leave_mgrp );
 
   p_mgrp = NULL;
   p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
@@ -1443,7 +1443,7 @@ osm_mcmr_rcv_leave_mgrp(
       if (new_join_state)
       {
         osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-                 "osm_mcmr_rcv_leave_mgrp: "
+                 "__osm_mcmr_rcv_leave_mgrp: "
                  "After update JoinState != 0. Updating from 0x%X to 0x%X\n",
                  port_join_state,
                  new_join_state
@@ -1466,7 +1466,7 @@ osm_mcmr_rcv_leave_mgrp(
         if(status != IB_SUCCESS)
         {
           osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-                   "osm_mcmr_rcv_leave_mgrp: ERR 1B09: "
+                   "__osm_mcmr_rcv_leave_mgrp: ERR 1B09: "
                    "osm_sm_mcgrp_leave failed\n" );
         }
 
@@ -1479,7 +1479,7 @@ osm_mcmr_rcv_leave_mgrp(
     {
       CL_PLOCK_RELEASE( p_rcv->p_lock );
       osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_mcmr_rcv_leave_mgrp: ERR 1B25: "
+               "__osm_mcmr_rcv_leave_mgrp: ERR 1B25: "
                "Received an invalid delete request on "
                "MGID: 0x%016" PRIx64 " : "
                "0x%016" PRIx64 " for "
@@ -1499,7 +1499,7 @@ osm_mcmr_rcv_leave_mgrp(
   {
     CL_PLOCK_RELEASE( p_rcv->p_lock );
     osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_mcmr_rcv_leave_mgrp: "
+             "__osm_mcmr_rcv_leave_mgrp: "
              "Multicast group not present failed\n" );
     sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
     osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
@@ -1519,9 +1519,8 @@ osm_mcmr_rcv_leave_mgrp(
 /**********************************************************************
  Handle a join (or create) request
 **********************************************************************/
-static
-void
-osm_mcmr_rcv_join_mgrp(
+static void
+__osm_mcmr_rcv_join_mgrp(
   IN osm_mcmr_recv_t* const p_rcv,
   IN const osm_madw_t* const p_madw )
 {
@@ -1542,7 +1541,7 @@ osm_mcmr_rcv_join_mgrp(
   osm_mcast_req_type_t req_type;
   uint8_t join_state;
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_mcmr_rcv_join_mgrp );
+  OSM_LOG_ENTER( p_rcv->p_log, __osm_mcmr_rcv_join_mgrp );
 
   p_mgrp = NULL;
   p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
@@ -1556,7 +1555,7 @@ osm_mcmr_rcv_join_mgrp(
   if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
   {
     osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_mcmr_rcv_join_mgrp: "
+             "__osm_mcmr_rcv_join_mgrp: "
              "Dump of incoming record\n" );
     osm_dump_mc_record( p_rcv->p_log, &mcmember_rec, OSM_LOG_DEBUG );
   }
@@ -1572,7 +1571,7 @@ osm_mcmr_rcv_join_mgrp(
     CL_PLOCK_RELEASE( p_rcv->p_lock );
 
     osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_mcmr_rcv_join_mgrp: "
+             "__osm_mcmr_rcv_join_mgrp: "
              "Unknown port GUID 0x%016" PRIx64 "\n",
              portguid );
     sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
@@ -1598,7 +1597,7 @@ osm_mcmr_rcv_join_mgrp(
     CL_PLOCK_RELEASE( p_rcv->p_lock );
 
     osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_mcmr_rcv_join_mgrp: "
+             "__osm_mcmr_rcv_join_mgrp: "
              "port and requester don't share pkey\n" );
     sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
     osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
@@ -1617,7 +1616,7 @@ osm_mcmr_rcv_join_mgrp(
     {
       CL_PLOCK_RELEASE( p_rcv->p_lock );
       osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_mcmr_rcv_join_mgrp: ERR 1B10: "
+               "__osm_mcmr_rcv_join_mgrp: ERR 1B10: "
                "Provided Join State != FullMember - required for create, "
                "MGID: 0x%016" PRIx64 " : "
                "0x%016" PRIx64 "\n",
@@ -1651,7 +1650,7 @@ osm_mcmr_rcv_join_mgrp(
     else
     {
       osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_mcmr_rcv_join_mgrp: ERR 1B11: "
+               "__osm_mcmr_rcv_join_mgrp: ERR 1B11: "
                "method = %s, "
                "scope_state = 0x%x, "
                "component mask = 0x%016" PRIx64 ", "
@@ -1715,7 +1714,7 @@ osm_mcmr_rcv_join_mgrp(
   if (!valid)
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mcmr_rcv_join_mgrp: ERR 1B12: "
+             "__osm_mcmr_rcv_join_mgrp: ERR 1B12: "
              "__validate_more_comp_fields, __validate_port_caps, "
              "or JoinState = 0 failed from port 0x%016" PRIx64 ", "
              "sending IB_SA_MAD_STATUS_REQ_INVALID\n",
@@ -1748,7 +1747,7 @@ osm_mcmr_rcv_join_mgrp(
     if (!valid)
     {
       osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_mcmr_rcv_join_mgrp: ERR 1B13: "
+               "__osm_mcmr_rcv_join_mgrp: ERR 1B13: "
                "__validate_modify failed, "
                "sending IB_SA_MAD_STATUS_REQ_INVALID\n" );
 
@@ -1803,7 +1802,7 @@ osm_mcmr_rcv_join_mgrp(
   if (status != IB_SUCCESS)
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mcmr_rcv_join_mgrp: ERR 1B14: "
+             "__osm_mcmr_rcv_join_mgrp: ERR 1B14: "
              "osm_sm_mcgrp_join failed, "
              "sending IB_SA_MAD_STATUS_NO_RESOURCES\n" );
 
@@ -2070,15 +2069,15 @@ __osm_sa_mcm_by_comp_mask_cb(
 /**********************************************************************
  Handle a query request
 **********************************************************************/
-void
-osm_mcmr_query_mgrp(IN osm_mcmr_recv_t*  const p_rcv,
-                    IN const osm_madw_t* const p_madw)
+static void
+__osm_mcmr_query_mgrp(IN osm_mcmr_recv_t*  const p_rcv,
+                      IN const osm_madw_t* const p_madw)
 {
-  const ib_sa_mad_t*          p_rcvd_mad;
+  const ib_sa_mad_t*       p_rcvd_mad;
   const ib_member_rec_t*   p_rcvd_rec;
   cl_qlist_t               rec_list;
   osm_madw_t*              p_resp_madw;
-  ib_sa_mad_t*          p_resp_sa_mad;
+  ib_sa_mad_t*             p_resp_sa_mad;
   ib_member_rec_t*         p_resp_rec;
   uint32_t                 num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
@@ -2087,23 +2086,17 @@ osm_mcmr_query_mgrp(IN osm_mcmr_recv_t* 
   uint32_t                 i;
   osm_sa_mcmr_search_ctxt_t   context;
   osm_mcmr_item_t*         p_rec_item;
-  ib_api_status_t       status;
+  ib_api_status_t          status;
   ib_net64_t               comp_mask;
   osm_physp_t*             p_req_physp;
   boolean_t                trusted_req;
 
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_mcmr_query_mgrp );
-
-  CL_ASSERT( p_madw );
+  OSM_LOG_ENTER( p_rcv->p_log, __osm_mcmr_query_mgrp );
 
   p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
   p_rcvd_rec = (ib_member_rec_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
   comp_mask = p_rcvd_mad->comp_mask;
 
-  CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_MCMEMBER_RECORD );
-
   /*
     if sm_key is not zero and does not match we never get here
     see main SA receiver
@@ -2117,7 +2110,7 @@ osm_mcmr_query_mgrp(IN osm_mcmr_recv_t* 
   if (p_req_physp == NULL)
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mcmr_query_mgrp: ERR 1B04: "
+             "__osm_mcmr_query_mgrp: ERR 1B04: "
              "Cannot find requester physical port\n" );
     goto Exit;
   }
@@ -2149,7 +2142,7 @@ osm_mcmr_query_mgrp(IN osm_mcmr_recv_t* 
   if ( (p_rcvd_mad->method == IB_MAD_METHOD_GET) &&
        (num_rec > 1)) {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mcmr_query_mgrp: ERR 1B05: "
+             "__osm_mcmr_query_mgrp: ERR 1B05: "
              "Got more than one record for SubnAdmGet (%u)\n",
              num_rec );
     osm_sa_send_error( p_rcv->p_resp, p_madw,
@@ -2172,7 +2165,7 @@ osm_mcmr_query_mgrp(IN osm_mcmr_recv_t* 
   if (trim_num_rec < num_rec)
   {
     osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_mcmr_query_mgrp: "
+             "__osm_mcmr_query_mgrp: "
              "Number of records:%u trimmed to:%u to fit in one MAD\n",
              num_rec, trim_num_rec );
     num_rec = trim_num_rec;
@@ -2180,7 +2173,7 @@ osm_mcmr_query_mgrp(IN osm_mcmr_recv_t* 
 #endif
 
   osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_mcmr_query_mgrp: "
+           "__osm_mcmr_query_mgrp: "
            "Returning %u records\n", num_rec );
 
   if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
@@ -2200,7 +2193,7 @@ osm_mcmr_query_mgrp(IN osm_mcmr_recv_t* 
   if( !p_resp_madw )
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mcmr_query_mgrp: ERR 1B16: "
+             "__osm_mcmr_query_mgrp: ERR 1B16: "
              "osm_mad_pool_get failed\n" );
 
     for( i = 0; i < num_rec; i++ )
@@ -2278,7 +2271,7 @@ osm_mcmr_query_mgrp(IN osm_mcmr_recv_t* 
   if(status != IB_SUCCESS)
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mcmr_query_mgrp: ERR 1B17: "
+             "__osm_mcmr_query_mgrp: ERR 1B17: "
              "osm_vendor_send status = %s\n",
              ib_get_err_str(status) );
     goto Exit;
@@ -2310,6 +2303,8 @@ osm_mcmr_rcv_process(
   p_recvd_mcmember_rec =
     (ib_member_rec_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
 
+  CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_MCMEMBER_RECORD );
+
   switch (p_sa_mad->method)
   {
   case IB_MAD_METHOD_SET:
@@ -2338,7 +2333,7 @@ osm_mcmr_rcv_process(
     /*
      * Join or Create Multicast Group
      */
-    osm_mcmr_rcv_join_mgrp(p_rcv, p_madw);
+    __osm_mcmr_rcv_join_mgrp(p_rcv, p_madw);
     break;
   case IB_MAD_METHOD_DELETE:
     valid = __check_join_comp_mask(p_sa_mad->comp_mask);
@@ -2358,14 +2353,14 @@ osm_mcmr_rcv_process(
     /*
      * Leave Multicast Group
      */
-    osm_mcmr_rcv_leave_mgrp(p_rcv, p_madw);
+    __osm_mcmr_rcv_leave_mgrp(p_rcv, p_madw);
     break;
   case IB_MAD_METHOD_GET:
   case IB_MAD_METHOD_GETTABLE:
     /*
      * Querying a Multicast Group
      */
-    osm_mcmr_query_mgrp(p_rcv, p_madw);
+    __osm_mcmr_query_mgrp(p_rcv, p_madw);
     break;
   default:
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
Index: opensm/osm_sa_multipath_record.c
===================================================================
--- opensm/osm_sa_multipath_record.c	(revision 8491)
+++ opensm/osm_sa_multipath_record.c	(working copy)
@@ -1424,17 +1424,6 @@ osm_mpr_rcv_process(
 
   CL_ASSERT( p_madw );
 
-  /* update the requester physical port. */
-  requester_port = osm_get_port_by_mad_addr( p_rcv->p_log,  p_rcv->p_subn,
-                                             osm_madw_get_mad_addr_ptr( p_madw ) );
-  if ( requester_port == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mpr_rcv_process: ERR 4517: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
   p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
   p_mpr = (ib_multipath_rec_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
 
@@ -1449,6 +1438,7 @@ osm_mpr_rcv_process(
     goto Exit;
   }
 
+  /* we only support SubnAdmGetMulti method */
   if ( p_sa_mad->method != IB_MAD_METHOD_GETMULTI ) {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
 	     "osm_mpr_rcv_process: ERR 4513: "
@@ -1458,6 +1448,17 @@ osm_mpr_rcv_process(
     goto Exit;
   }
 
+  /* update the requester physical port. */
+  requester_port = osm_get_port_by_mad_addr( p_rcv->p_log,  p_rcv->p_subn,
+                                             osm_madw_get_mad_addr_ptr( p_madw ) );
+  if ( requester_port == NULL )
+  {
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "osm_mpr_rcv_process: ERR 4517: "
+             "Cannot find requester physical port\n" );
+    goto Exit;
+  }
+
   if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
     osm_dump_multipath_record( p_rcv->p_log, p_mpr, OSM_LOG_DEBUG );
 
Index: opensm/osm_sa_node_record.c
===================================================================
--- opensm/osm_sa_node_record.c	(revision 8491)
+++ opensm/osm_sa_node_record.c	(working copy)
@@ -427,6 +427,17 @@ osm_nr_rcv_process(
 
   CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_NODE_RECORD );
 
+  /* we only support SubnAdmGet and SubnAdmGetTable methods */
+  if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
+       (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) ) {
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "osm_nr_rcv_process: ERR 1D05: "
+             "Unsupported Method (%s)\n",
+             ib_get_sa_method_str( p_rcvd_mad->method ) );
+    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
+    goto Exit;
+  }
+
   /* update the requester physical port. */
   p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
                                           p_rcv->p_subn,
@@ -439,16 +450,6 @@ osm_nr_rcv_process(
     goto Exit;
   }
 
-  if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
-       (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) ) {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_nr_rcv_process: ERR 1D05: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
   if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
     osm_dump_node_record( p_rcv->p_log, p_rcvd_rec, OSM_LOG_DEBUG );
 
Index: opensm/osm_sa_path_record.c
===================================================================
--- opensm/osm_sa_path_record.c	(revision 8491)
+++ opensm/osm_sa_path_record.c	(working copy)
@@ -1414,7 +1414,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 +1422,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;
   }
 
@@ -1665,22 +1665,12 @@ osm_pr_rcv_process(
 
   CL_ASSERT( p_madw );
 
-  /* update the requester physical port. */
-  requester_port = osm_get_port_by_mad_addr( p_rcv->p_log, p_rcv->p_subn,
-                                             osm_madw_get_mad_addr_ptr( p_madw ) );
-  if( requester_port == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_pr_rcv_process: ERR 1F16: "
-             "Cannot find requester physical port\n" );
-    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 );
 
   CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_PATH_RECORD );
 
+  /* we only support SubnAdmGet and SubnAdmGetTable methods */
   if ((p_sa_mad->method != IB_MAD_METHOD_GET) &&
       (p_sa_mad->method != IB_MAD_METHOD_GETTABLE)) {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
@@ -1691,6 +1681,17 @@ osm_pr_rcv_process(
     goto Exit;
   }
 
+  /* update the requester physical port. */
+  requester_port = osm_get_port_by_mad_addr( p_rcv->p_log, p_rcv->p_subn,
+                                             osm_madw_get_mad_addr_ptr( p_madw ) );
+  if( requester_port == NULL )
+  {
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "osm_pr_rcv_process: ERR 1F16: "
+             "Cannot find requester physical port\n" );
+    goto Exit;
+  }
+
   if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
     osm_dump_path_record( p_rcv->p_log, p_pr, OSM_LOG_DEBUG );
 
Index: opensm/osm_sa_pkey_record.c
===================================================================
--- opensm/osm_sa_pkey_record.c	(revision 8491)
+++ opensm/osm_sa_pkey_record.c	(working copy)
@@ -348,18 +348,7 @@ osm_pkey_rec_rcv_process(
 
   CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_PKEY_TBL_RECORD );
 
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_pkey_rec_rcv_process: ERR 4604: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
+  /* we only support SubnAdmGet and SubnAdmGetTable methods */
   if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
        (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) )
   {
@@ -370,7 +359,7 @@ osm_pkey_rec_rcv_process(
     osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
     goto Exit;
   }
- 
+
   /*
      p922 - P_KeyTableRecords shall only be provided in response
      to trusted requests.
@@ -388,6 +377,18 @@ osm_pkey_rec_rcv_process(
     goto Exit;
   }
 
+  /* update the requester physical port. */
+  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+                                          p_rcv->p_subn,
+                                          osm_madw_get_mad_addr_ptr(p_madw) );
+  if (p_req_physp == NULL)
+  {
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "osm_pkey_rec_rcv_process: ERR 4604: "
+             "Cannot find requester physical port\n" );
+    goto Exit;
+  }
+
   p_pkey = (ib_pkey_table_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
 
   cl_qlist_init( &rec_list );
Index: opensm/osm_sa_portinfo_record.c
===================================================================
--- opensm/osm_sa_portinfo_record.c	(revision 8491)
+++ opensm/osm_sa_portinfo_record.c	(working copy)
@@ -638,6 +638,18 @@ osm_pir_rcv_process(
 
   CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_PORTINFO_RECORD );
 
+  /* we only support SubnAdmGet and SubnAdmGetTable methods */
+  if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
+       (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) )
+  {
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "osm_pir_rcv_process: ERR 2105: "
+             "Unsupported Method (%s)\n",
+             ib_get_sa_method_str( p_rcvd_mad->method ) );
+    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
+    goto Exit;
+  }
+
   /* update the requester physical port. */
   p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
                                           p_rcv->p_subn,
@@ -650,17 +662,6 @@ osm_pir_rcv_process(
     goto Exit;
   }
 
-  if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
-       (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_pir_rcv_process: ERR 2105: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
   if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
     osm_dump_portinfo_record( p_rcv->p_log, p_rcvd_rec, OSM_LOG_DEBUG );
 
Index: opensm/osm_sa_service_record.c
===================================================================
--- opensm/osm_sa_service_record.c	(revision 8491)
+++ opensm/osm_sa_service_record.c	(working copy)
@@ -795,6 +795,8 @@ osm_sr_rcv_process_get_method(
   p_recvd_service_rec =
     (ib_service_record_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
 
+  CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_SERVICE_RECORD );
+
   if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
   {
     osm_dump_service_record( p_rcv->p_log,
Index: opensm/osm_sa_slvl_record.c
===================================================================
--- opensm/osm_sa_slvl_record.c	(revision 8491)
+++ opensm/osm_sa_slvl_record.c	(working copy)
@@ -333,6 +333,18 @@ osm_slvl_rec_rcv_process(
 
   CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_SLVL_RECORD );
 
+  /* we only support SubnAdmGet and SubnAdmGetTable methods */
+  if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
+       (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) )
+  {
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "osm_slvl_rec_rcv_process: ERR 2604: "
+             "Unsupported Method (%s)\n",
+             ib_get_sa_method_str( p_rcvd_mad->method ) );
+    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
+    goto Exit;
+  }
+
   /* update the requester physical port. */
   p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
                                           p_rcv->p_subn,
@@ -345,17 +357,6 @@ osm_slvl_rec_rcv_process(
     goto Exit;
   }
 
-  if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
-       (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_slvl_rec_rcv_process: ERR 2604: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
   p_slvl_tbl = (ib_slvl_table_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
 
   cl_qlist_init( &rec_list );
Index: opensm/osm_sa_sminfo_record.c
===================================================================
--- opensm/osm_sa_sminfo_record.c	(revision 8491)
+++ opensm/osm_sa_sminfo_record.c	(working copy)
@@ -149,6 +149,18 @@ osm_smir_rcv_process(
 
   CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_SMINFO_RECORD );
 
+  /* we only support SubnAdmGet and SubnAdmGetTable methods */
+  if ( (p_sa_mad->method != IB_MAD_METHOD_GET) &&
+       (p_sa_mad->method != IB_MAD_METHOD_GETTABLE) )
+  {
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "osm_smir_rcv_process: ERR 2804: "
+             "Unsupported Method (%s)\n",
+             ib_get_sa_method_str( p_sa_mad->method ) );
+    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
+    goto Exit;
+  }
+
   /* update the requester physical port. */
   p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
                                           p_rcv->p_subn,
@@ -161,17 +173,6 @@ osm_smir_rcv_process(
     goto Exit;
   }
 
-  if ( (p_sa_mad->method != IB_MAD_METHOD_GET) &&
-       (p_sa_mad->method != IB_MAD_METHOD_GETTABLE) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_smir_rcv_process: ERR 2804: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_sa_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
   if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
     osm_dump_sm_info_record( p_rcv->p_log, p_sminfo_rec, OSM_LOG_DEBUG );
 
Index: opensm/osm_sa_vlarb_record.c
===================================================================
--- opensm/osm_sa_vlarb_record.c	(revision 8491)
+++ opensm/osm_sa_vlarb_record.c	(working copy)
@@ -345,18 +345,6 @@ osm_vlarb_rec_rcv_process(
 
   OSM_LOG_ENTER( p_rcv->p_log, osm_vlarb_rec_rcv_process );
 
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_vlarb_rec_rcv_process: ERR 2A04: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
   CL_ASSERT( p_madw );
 
   p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
@@ -365,6 +353,7 @@ osm_vlarb_rec_rcv_process(
 
   CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_VLARB_RECORD );
 
+  /* we only support SubnAdmGet and SubnAdmGetTable methods */
   if ( (p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
        (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) )
   {
@@ -376,6 +365,18 @@ osm_vlarb_rec_rcv_process(
     goto Exit;
   }
 
+  /* update the requester physical port. */
+  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+                                          p_rcv->p_subn,
+                                          osm_madw_get_mad_addr_ptr(p_madw) );
+  if (p_req_physp == NULL)
+  {
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+             "osm_vlarb_rec_rcv_process: ERR 2A04: "
+             "Cannot find requester physical port\n" );
+    goto Exit;
+  }
+
   p_vl_arb = (ib_vl_arb_table_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
 
   cl_qlist_init( &rec_list );







More information about the general mailing list