[ofa-general] [PATCH] infiniband-diags/perfquery.c: Fix extended counter reset mask

Hal Rosenstock hnrose at comcast.net
Sat Sep 26 14:17:26 PDT 2009


to not have any bits on for reserved components

Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
---
diff --git a/infiniband-diags/src/perfquery.c b/infiniband-diags/src/perfquery.c
index d70af9e..5d4046b 100644
--- a/infiniband-diags/src/perfquery.c
+++ b/infiniband-diags/src/perfquery.c
@@ -91,6 +91,8 @@ struct perf_count perf_count =
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 struct perf_count_ext perf_count_ext = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 
+int not_def_mask = 0;
+
 #define ALL_PORTS 0xFF
 
 /* Notes: IB semantics is to cap counters if count has exceeded limits.
@@ -337,8 +339,10 @@ static void reset_counters(int extended, int timeout, int mask,
 					   IB_GSI_PORT_COUNTERS, srcport))
 			IBERROR("perf reset");
 	} else {
-		if (!performance_reset_via(pc, portid, port, mask, timeout,
-					   IB_GSI_PORT_COUNTERS_EXT, srcport))
+		if (!performance_reset_via(pc, portid, port,
+					   not_def_mask ? mask : mask & 0xff,
+					   timeout, IB_GSI_PORT_COUNTERS_EXT,
+					   srcport))
 			IBERROR("perf ext reset");
 	}
 }
@@ -476,8 +480,10 @@ int main(int argc, char **argv)
 
 	if (argc > 1)
 		port = strtoul(argv[1], 0, 0);
-	if (argc > 2)
+	if (argc > 2) {
 		mask = strtoul(argv[2], 0, 0);
+		not_def_mask = 1;
+	}
 
 	srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 4);
 	if (!srcport)



More information about the general mailing list