[openib-general] [PATCH] osmtest: Support LMC > 0
Hal Rosenstock
halr at voltaire.com
Fri Jun 9 06:11:56 PDT 2006
osmtest: Support LMC > 0
Signed-off-by: Hal Rosenstock <halr at voltaire.com>
Index: osmtest/osmtest.c
===================================================================
--- osmtest/osmtest.c (revision 7839)
+++ osmtest/osmtest.c (working copy)
@@ -1609,6 +1609,74 @@ osmtest_stress_port_recs_small( IN osmte
}
/**********************************************************************
+ **********************************************************************/
+ib_api_status_t
+osmtest_get_local_port_lmc( IN osmtest_t * const p_osmt,
+ OUT uint8_t * const p_lmc )
+{
+ osmtest_req_context_t context;
+ ib_portinfo_record_t *p_rec;
+ uint32_t i;
+ cl_status_t status;
+ uint32_t num_recs = 0;
+
+ OSM_LOG_ENTER( &p_osmt->log, osmtest_get_local_port_lmc );
+
+ memset( &context, 0, sizeof( context ) );
+
+ /*
+ * Do a blocking query for our own PortRecord in the subnet.
+ */
+ status = osmtest_get_port_rec( p_osmt,
+ cl_ntoh16(p_osmt->local_port.lid),
+ &context );
+
+ if( status != IB_SUCCESS )
+ {
+ osm_log( &p_osmt->log, OSM_LOG_ERROR,
+ "osmtest_get_local_port_lmc: ERR 001A: "
+ "osmtest_get_port_rec failed (%s)\n",
+ ib_get_err_str( status ) );
+ goto Exit;
+ }
+
+ num_recs = context.result.result_cnt;
+
+ if( osm_log_is_active( &p_osmt->log, OSM_LOG_VERBOSE ) )
+ {
+ osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+ "osmtest_get_local_port_lmc: "
+ "Received %u records\n", num_recs );
+ }
+
+ for( i = 0; i < num_recs; i++ )
+ {
+ p_rec = osmv_get_query_portinfo_rec( context.result.p_result_madw, i );
+ osm_dump_portinfo_record( &p_osmt->log, p_rec, OSM_LOG_VERBOSE );
+ if ( p_lmc)
+ {
+ *p_lmc = ib_port_info_get_lmc( &p_rec->port_info );
+ osm_log( &p_osmt->log, OSM_LOG_DEBUG,
+ "osmtest_get_local_port_lmc: "
+ "LMC %d\n", *p_lmc );
+ }
+ }
+
+ Exit:
+ /*
+ * Return the IB query MAD to the pool as necessary.
+ */
+ if( context.result.p_result_madw != NULL )
+ {
+ osm_mad_pool_put( &p_osmt->mad_pool, context.result.p_result_madw );
+ context.result.p_result_madw = NULL;
+ }
+
+ OSM_LOG_EXIT( &p_osmt->log );
+ return ( status );
+}
+
+/**********************************************************************
* Use a wrong SM_Key in a simple port query and report success if
* failed.
**********************************************************************/
@@ -3100,6 +3168,7 @@ osmtest_validate_path_data( IN osmtest_t
IN const ib_path_rec_t * const p_rec )
{
cl_status_t status = IB_SUCCESS;
+ uint8_t lmc = 0;
OSM_LOG_ENTER( &p_osmt->log, osmtest_validate_path_data );
@@ -3111,17 +3180,38 @@ osmtest_validate_path_data( IN osmtest_t
cl_ntoh16( p_rec->slid ), cl_ntoh16( p_rec->dlid ) );
}
- /*
- * Has this record already been returned?
- */
- if( p_path->count != 0 )
+ status = osmtest_get_local_port_lmc( p_osmt, &lmc );
+
+ /* HACK: Assume uniform LMC across endports in the subnet */
+ /* In absence of this assumption, validation of this is much more complicated */
+ if ( lmc == 0 )
{
- osm_log( &p_osmt->log, OSM_LOG_ERROR,
- "osmtest_validate_path_data: ERR 0056: "
- "Already received path SLID 0x%X to DLID 0x%X\n",
- cl_ntoh16( p_rec->slid ), cl_ntoh16( p_rec->dlid ) );
- status = IB_ERROR;
- goto Exit;
+ /*
+ * Has this record already been returned?
+ */
+ if( p_path->count != 0 )
+ {
+ osm_log( &p_osmt->log, OSM_LOG_ERROR,
+ "osmtest_validate_path_data: ERR 0056: "
+ "Already received path SLID 0x%X to DLID 0x%X\n",
+ cl_ntoh16( p_rec->slid ), cl_ntoh16( p_rec->dlid ) );
+ status = IB_ERROR;
+ goto Exit;
+ }
+ }
+ else
+ {
+ /* Also, this doesn't detect fewer than the correct number of paths being returned */
+ if ( p_path->count >= ( 1 << lmc ) * ( 1 << lmc ) )
+ {
+ osm_log( &p_osmt->log, OSM_LOG_ERROR,
+ "osmtest_validate_path_data: ERR 0052: "
+ "Already received path SLID 0x%X to DLID 0x%X count %d LMC %d\n",
+ cl_ntoh16( p_rec->slid ), cl_ntoh16( p_rec->dlid ),
+ p_path->count, lmc );
+ status = IB_ERROR;
+ goto Exit;
+ }
}
++p_path->count;
More information about the general
mailing list