[ofa-general] [PATCH] infiniband-diags/saquery.c: In print_multicast_group_records, only query NodeRecords when needed

Hal Rosenstock hrosenstock at xsigo.com
Tue Jun 10 11:12:31 PDT 2008


infiniband-diags/saquery.c: In print_multicast_group_records, only query
NodeRecords when needed. This is a minor optimization.

Signed-off-by: Hal Rosenstock <hal at xsigo.com>

diff --git a/infiniband-diags/src/saquery.c b/infiniband-diags/src/saquery.c
index e727940..13c4ea0 100644
--- a/infiniband-diags/src/saquery.c
+++ b/infiniband-diags/src/saquery.c
@@ -1048,9 +1048,12 @@ print_multicast_group_records(osm_bind_handle_t bind_handle, int members)
 		return (status);
 	mc_group_result = result;
 
-	status  = get_all_records(bind_handle, IB_MAD_ATTR_NODE_RECORD, node_attr_offset, 0);
-	if (status != IB_SUCCESS)
-		goto return_mc;
+	if (members) {
+		status  = get_all_records(bind_handle, IB_MAD_ATTR_NODE_RECORD,
+					  node_attr_offset, 0);
+		if (status != IB_SUCCESS)
+			goto return_mc;
+	}
 
 	for (i = 0; i < mc_group_result.result_cnt; i++) {
 		mcast_record = osmv_get_query_mc_rec(mc_group_result.p_result_madw, i);
@@ -1060,7 +1063,8 @@ print_multicast_group_records(osm_bind_handle_t bind_handle, int members)
 			print_multicast_member_record(mcast_record);
 	}
 
-	return_mad();
+	if (members)
+		return_mad();
 
 return_mc:
 	/* return_mad for the mc_group_result */





More information about the general mailing list