[openib-general] [PATCH] osmtest/osmtest.c: Add SMInfo record test

Hal Rosenstock halr at voltaire.com
Wed Jul 5 11:03:42 PDT 2006


osmtest/osmtest.c: Add SMInfo record test

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

Index: osmtest/osmtest.c
===================================================================
--- osmtest/osmtest.c	(revision 8390)
+++ osmtest/osmtest.c	(working copy)
@@ -4667,6 +4667,84 @@ osmtest_get_lft_rec_by_lid( IN osmtest_t
   OSM_LOG_EXIT( &p_osmt->log );
   return ( status );
 }
+
+/**********************************************************************
+ **********************************************************************/
+ib_api_status_t
+osmtest_sminfo_record_request(
+        IN osmtest_t * const p_osmt,
+        IN OUT osmtest_req_context_t * const p_context )
+{
+  ib_api_status_t status = IB_SUCCESS;
+  osmv_user_query_t user;
+  osmv_query_req_t req;
+  ib_sminfo_record_t record;
+  ib_mad_t *p_mad;
+
+  OSM_LOG_ENTER( &p_osmt->log, osmtest_sminfo_record_request );
+
+  /*
+   * Do a blocking query for these records in the subnet.
+   * The result is returned in the result field of the caller's
+   * context structure.
+   *
+   * The query structures are locals.
+   */
+  memset( &req, 0, sizeof( req ) );
+  memset( &user, 0, sizeof( user ) );
+  memset( &record, 0, sizeof( record ) );
+
+  p_context->p_osmt = p_osmt;
+  user.attr_id = IB_MAD_ATTR_SMINFO_RECORD;
+  user.attr_offset = cl_ntoh16( ( uint16_t ) ( sizeof( record ) >> 3 ) );
+  user.p_attr = &record;
+
+  req.query_type = OSMV_QUERY_USER_DEFINED;
+  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.p_query_input = &user;
+  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_sminfo_record_request: ERR 008C: "
+             "ib_query failed (%s)\n", ib_get_err_str( status ) );
+    goto Exit;
+  }
+
+  status = p_context->result.status;
+
+  if( status != IB_SUCCESS )
+  {
+    if (status != IB_INVALID_PARAMETER)
+    {
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_sminfo_record_request: ERR 008D: "
+               "ib_query failed (%s)\n", ib_get_err_str( status ) );
+    }
+    if( status == IB_REMOTE_ERROR )
+    {
+      p_mad = osm_madw_get_mad_ptr( p_context->result.p_result_madw );
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_sminfo_record_request: "
+               "Remote error = %s\n",
+               ib_get_mad_status_str( p_mad ));
+
+      status = (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK );
+    }
+    goto Exit;
+  }
+
+ Exit:
+  OSM_LOG_EXIT( &p_osmt->log );
+  return ( status );
+}
 #endif
 
 /**********************************************************************
@@ -5451,6 +5529,12 @@ osmtest_validate_against_db( IN osmtest_
   if ( status != IB_SUCCESS )
     goto Exit;
 
+  /* SMInfoRecord test */
+  memset( &context, 0, sizeof( context ) );
+  status = osmtest_sminfo_record_request( p_osmt, &context );
+  if ( status != IB_SUCCESS )
+    goto Exit;
+
   if (lmc != 0)
   {
     test_lid = cl_ntoh16( p_osmt->local_port.lid + 1 );







More information about the general mailing list