[openib-general] [PATCH] osmtest: Add rudimentary SA MultiPathRecord tests

Hal Rosenstock halr at voltaire.com
Tue May 9 10:22:33 PDT 2006


osmtest: Add rudimentary SA MultiPathRecord tests

Signed-off-by: Hal Rosenstock <halr at voltaire.com>
Index: osmtest/osmtest.c
===================================================================
--- osmtest/osmtest.c	(revision 7007)
+++ osmtest/osmtest.c	(working copy)
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2006 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -1009,6 +1010,75 @@ osmtest_get_path_rec_by_guid_pair( IN os
   return ( status );
 }
 
+#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
+/**********************************************************************
+ **********************************************************************/
+static ib_api_status_t
+osmtest_get_multipath_rec( IN osmtest_t * const p_osmt,
+                           IN osmv_multipath_req_t *p_request,
+                           IN osmtest_req_context_t *p_context)
+{
+  cl_status_t status = IB_SUCCESS;
+  osmv_query_req_t req;
+
+  OSM_LOG_ENTER( &p_osmt->log,  osmtest_get_multipath_rec );
+
+  /*
+   * Do a blocking query for this record in the subnet.
+   * The result is returned in the result field of the caller's
+   * context structure.
+   *
+   * The query structures are locals.
+   */
+  cl_memclr( &req, sizeof( req ) );
+
+  p_context->p_osmt = p_osmt;
+  req.timeout_ms = p_osmt->opt.transaction_timeout;
+  req.retry_cnt = p_osmt->opt.retry_count;
+  req.flags = OSM_SA_FLAGS_SYNC;
+  req.query_context = p_context;
+  req.pfn_query_cb = osmtest_query_res_cb;
+
+  req.query_type = OSMV_QUERY_MULTIPATH_REC;
+
+  req.p_query_input = p_request;
+  req.sm_key = 0;
+
+  status = osmv_query_sa( p_osmt->h_bind, &req );
+  if( status != IB_SUCCESS )
+    {
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_get_multipath_rec: ERR 0068: "
+               "ib_query failed (%s)\n", ib_get_err_str( status ) );
+      goto Exit;
+    }
+
+  status = p_context->result.status;
+
+  if( status != IB_SUCCESS )
+    {
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_get_multipath_rec: ERR 0069: "
+               "ib_query failed (%s)\n", ib_get_err_str( status ) );
+
+      if( status == IB_REMOTE_ERROR )
+        {
+          osm_log( &p_osmt->log, OSM_LOG_ERROR,
+                   "osmtest_get_multipath_rec: "
+                   "Remote error = %s\n",
+                   ib_get_mad_status_str( osm_madw_get_mad_ptr
+                                          ( p_context->result.
+                                            p_result_madw ) ) );
+        }
+      goto Exit;
+    }
+
+ Exit:
+  OSM_LOG_EXIT( &p_osmt->log );
+  return ( status );
+}
+#endif
+
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
@@ -3896,6 +3966,8 @@ osmtest_validate_path_rec( IN osmtest_t 
 }
 
 #ifdef VENDOR_RMPP_SUPPORT
+ib_net64_t portguid = 0;
+
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
@@ -3953,6 +4025,8 @@ osmtest_validate_all_node_recs( IN osmte
                    ib_get_err_str( status ) );
           goto Exit;
         }
+     if (!portguid)
+       portguid = p_rec->node_info.port_guid;
     }
 
   status = osmtest_check_missing_nodes( p_osmt );
@@ -4647,6 +4721,10 @@ static ib_api_status_t
 osmtest_validate_against_db( IN osmtest_t * const p_osmt )
 {
   ib_api_status_t status = IB_SUCCESS;
+#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
+  osmtest_req_context_t context;
+  osmv_multipath_req_t request;
+#endif
 
   OSM_LOG_ENTER( &p_osmt->log, osmtest_validate_against_db );
 
@@ -4660,6 +4738,98 @@ osmtest_validate_against_db( IN osmtest_
   if( status != IB_SUCCESS )
     goto Exit;
 
+#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
+  cl_memclr( &context, sizeof( context ) );
+  cl_memclr( &request, sizeof( request ) );
+  request.comp_mask = IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT;
+  request.sgid_count = 1;
+  request.dgid_count = 1;
+  ib_gid_set_default( &request.gids[0], portguid );
+  ib_gid_set_default( &request.gids[1], portguid );
+  status = osmtest_get_multipath_rec( p_osmt, &request, &context );
+  if( status != IB_SUCCESS )
+    goto Exit;
+
+  cl_memclr( &context, sizeof( context ) );
+  cl_memclr( &request, sizeof( request ) );
+  status = osmtest_get_multipath_rec( p_osmt, &request, &context );
+  if( status == IB_SUCCESS )
+    goto Exit;
+  else
+  {
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_get_multipath_rec: "
+               "IS EXPECTED ERROR ^^^^\n");
+  }
+
+  cl_memclr( &context, sizeof( context ) );
+  cl_memclr( &request, sizeof( request ) );
+  request.comp_mask = IB_MPR_COMPMASK_SGIDCOUNT;
+  request.sgid_count = 1;
+  ib_gid_set_default( &request.gids[0], portguid );
+  status = osmtest_get_multipath_rec( p_osmt, &request, &context );
+  if( status == IB_SUCCESS ) 
+    goto Exit;
+  else
+  {
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_get_multipath_rec: "
+               "IS EXPECTED ERROR ^^^^\n");
+  }
+
+  cl_memclr( &context, sizeof( context ) );
+  cl_memclr( &request, sizeof( request ) );
+  request.comp_mask = IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT;
+  request.sgid_count = 1;
+  request.dgid_count = 1;
+  ib_gid_set_default( &request.gids[0], portguid );
+  /* Set IPoIB broadcast MGID */
+  request.gids[1].unicast.prefix = CL_HTON64(0xff12401bffff0000ULL);
+  request.gids[1].unicast.interface_id = CL_HTON64(0x00000000ffffffffULL);
+  status = osmtest_get_multipath_rec( p_osmt, &request, &context );
+  if( status == IB_SUCCESS )
+    goto Exit;
+  else
+  {
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_get_multipath_rec: "
+               "IS EXPECTED ERROR ^^^^\n");
+  }
+
+  cl_memclr( &context, sizeof( context ) );
+  request.comp_mask = IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT;
+  request.sgid_count = 1;
+  request.dgid_count = 1;
+  /* Set IPoIB broadcast MGID */
+  request.gids[0].unicast.prefix = CL_HTON64(0xff12401bffff0000ULL);
+  request.gids[0].unicast.interface_id = CL_HTON64(0x00000000ffffffffULL);
+  ib_gid_set_default( &request.gids[1], portguid );
+  status = osmtest_get_multipath_rec( p_osmt, &request, &context );
+  if( status == IB_SUCCESS )
+    goto Exit;
+  else
+  {
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_get_multipath_rec_gid_ipoib_bcast: "
+               "IS EXPECTED ERROR ^^^^\n");
+  }
+
+  cl_memclr( &context, sizeof( context ) );
+  cl_memclr( &request, sizeof( request ) );
+  request.comp_mask = IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT |
+                      IB_MPR_COMPMASK_NUMBPATH;
+  request.sgid_count = 2;
+  request.dgid_count = 2;
+  request.num_path = 2;
+  ib_gid_set_default( &request.gids[0], portguid );
+  ib_gid_set_default( &request.gids[1], portguid );
+  ib_gid_set_default( &request.gids[2], portguid );
+  ib_gid_set_default( &request.gids[3], portguid );
+  status = osmtest_get_multipath_rec( p_osmt, &request, &context );
+  if( status != IB_SUCCESS )
+    goto Exit;
+#endif
+
 #ifdef VENDOR_RMPP_SUPPORT
   if (! p_osmt->opt.ignore_path_records)
     {






More information about the general mailing list