[openib-general] [PATCH] osm: reviewing osmtest - osmt_multicast.c
Yevgeny Kliteynik
kliteyn at dev.mellanox.co.il
Thu Oct 19 08:26:47 PDT 2006
In case osmtest failed to remove some MC group,
dumping all the MC groups that still remain,
and their member.
--
Yevgeny
Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
Index: osmtest/osmt_multicast.c
===================================================================
--- osmtest/osmt_multicast.c (revision 9907)
+++ osmtest/osmt_multicast.c (working copy)
@@ -57,6 +57,86 @@
/**********************************************************************
**********************************************************************/
+static void
+__osmt_print_all_multicast_records(
+ IN osmtest_t * const p_osmt)
+{
+ int i;
+ ib_api_status_t status;
+ osmv_query_req_t req;
+ osmv_user_query_t user;
+ osmtest_req_context_t context;
+ ib_member_rec_t * mcast_record;
+
+ memset( &context, 0, sizeof( context ) );
+ memset( &req, 0, sizeof( req ) );
+ memset( &user, 0, sizeof( user ) );
+
+ user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
+ user.attr_offset = ib_get_attr_offset(sizeof(*mcast_record));
+
+ req.query_type = OSMV_QUERY_USER_DEFINED;
+ req.timeout_ms = p_osmt->opt.transaction_timeout;
+ req.retry_cnt = 1;
+ req.flags = OSM_SA_FLAGS_SYNC;
+ context.p_osmt = p_osmt;
+ req.query_context = &context;
+ req.pfn_query_cb = osmtest_query_res_cb;
+ req.p_query_input = &user;
+
+ /* UnTrusted - get the multicast groups */
+ req.sm_key = 0;
+ status = osmv_query_sa(p_osmt->h_bind, &req);
+
+ if (status != IB_SUCCESS || context.result.status != IB_SUCCESS)
+ {
+ osm_log( &p_osmt->log, OSM_LOG_ERROR,
+ "__osmt_print_all_multicast_records: ERR 02B5: "
+ "Failed getting the multicast groups records - %s/%s\n",
+ ib_get_err_str(status),
+ ib_get_err_str(context.result.status) );
+ return;
+ }
+
+ osm_log( &p_osmt->log, OSM_LOG_INFO,
+ "\n |------------------------------------------|"
+ "\n | Remaining Multicast Groups |"
+ "\n |------------------------------------------|\n" );
+
+ for (i = 0; i < context.result.result_cnt; i++) {
+ mcast_record = osmv_get_query_mc_rec(context.result.p_result_madw, i);
+ osm_dump_mc_record(&p_osmt->log, mcast_record,OSM_LOG_INFO);
+ }
+
+ /* Trusted - now get the multicast group members */
+ req.sm_key = OSM_DEFAULT_SM_KEY;
+ status = osmv_query_sa(p_osmt->h_bind, &req);
+
+ if (status != IB_SUCCESS || context.result.status != IB_SUCCESS)
+ {
+ osm_log( &p_osmt->log, OSM_LOG_ERROR,
+ "__osmt_print_all_multicast_records: ERR 02B6: "
+ "Failed getting the multicast group members records - %s/%s\n",
+ ib_get_err_str(status),
+ ib_get_err_str(context.result.status) );
+ return;
+ }
+
+ osm_log( &p_osmt->log, OSM_LOG_INFO,
+ "\n |--------------------------------------------------|"
+ "\n | Remaining Multicast Group Memebers |"
+ "\n |--------------------------------------------------|\n" );
+
+ for (i = 0; i < context.result.result_cnt; i++) {
+ mcast_record = osmv_get_query_mc_rec(context.result.p_result_madw, i);
+ osm_dump_mc_record(&p_osmt->log, mcast_record,OSM_LOG_INFO);
+ }
+
+}
+
+/**********************************************************************
+ **********************************************************************/
+
static
cl_status_t
__match_mgids(
@@ -3403,10 +3483,6 @@ osmt_run_mcast_flow( IN osmtest_t * cons
cl_ntoh64(p_mgrp->mcmember_rec.mgid.unicast.interface_id),
mlid );
got_error = TRUE;
-
- /**
- * ToDo: Query all the group members of this MC Group
- **/
}
else
{
@@ -3421,7 +3497,10 @@ osmt_run_mcast_flow( IN osmtest_t * cons
}
if (got_error)
+ {
status = IB_ERROR;
+ __osmt_print_all_multicast_records(p_osmt);
+ }
}
Exit:
OSM_LOG_EXIT( &p_osmt->log );
More information about the general
mailing list