Hey Sasha,

As discussed in the other thread, --loop_ports will now iterate through
all ports no matter what with this patch.

Al

-- 
Albert Chu
[EMAIL PROTECTED]
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From 802725d818e1657b18ad5c70b301b1a3e76bf2f4 Mon Sep 17 00:00:00 2001
From: Albert Chu <[EMAIL PROTECTED]>
Date: Thu, 9 Oct 2008 16:38:48 -0700
Subject: [PATCH] when --loop_ports is specified always iterate, when --all_ports is specified without AllPortSelect support, iterate through ports


Signed-off-by: Albert Chu <[EMAIL PROTECTED]>
---
 infiniband-diags/man/perfquery.8 |   17 +++++++----------
 infiniband-diags/src/perfquery.c |   34 ++++++++++++++++------------------
 2 files changed, 23 insertions(+), 28 deletions(-)

diff --git a/infiniband-diags/man/perfquery.8 b/infiniband-diags/man/perfquery.8
index 4688697..c112347 100644
--- a/infiniband-diags/man/perfquery.8
+++ b/infiniband-diags/man/perfquery.8
@@ -29,18 +29,15 @@ show extended port counters rather than (basic) port counters.
 Note that extended port counters attribute is optional.
 .TP
 \fB\-a\fR, \fB\-\-all_ports\fR
-show aggregated counters for all ports of the destination lid.
-Note all ports support is optional.
+show aggregated counters for all ports of the destination lid
+or reset all counters for all ports.  If the destination lid
+does not support the AllPortSelect flag, all ports will be
+iterated through to emulate AllPortSelect behavior.
 .TP
 \fB\-l\fR, \fB\-\-loop_ports\fR
-If all ports are selected by the user (the \fB\-a\fR option or port
-255) and the node/port does not support the AllPortSelect capability,
-this option will inform perfquery to iterate through all potential
-ports instead of outputting an error.  This option is particularly
-useful in combination with the \fB\-R\fR option, so that counters can
-be reset without hitting an AllPortSelect error.  When used with
-outputting port counters, multiple port counter outputs will be output
-rather than a single aggregate output.
+If all ports are selected by the user (either through the
+\fB\-\fR option or port 255) iterate through each port
+rather than doing than aggregate operation.
 .TP
 \fB\-r\fR, \fB\-\-reset_after_read\fR
 reset counters after read
diff --git a/infiniband-diags/src/perfquery.c b/infiniband-diags/src/perfquery.c
index f6bf86f..0d1b061 100644
--- a/infiniband-diags/src/perfquery.c
+++ b/infiniband-diags/src/perfquery.c
@@ -134,7 +134,7 @@ main(int argc, char **argv)
 	int ca_port = 0;
 	int extended = 0;
 	uint16_t cap_mask;
-	int allports = 0;
+	int all_ports_loop = 0;
 	int loop_ports = 0;
 	int node_type, num_ports = 0;
 	uint8_t data[IB_SMP_DATA_SIZE];
@@ -244,33 +244,32 @@ main(int argc, char **argv)
 		if (!all && port == ALL_PORTS)
 			IBERROR("AllPortSelect not supported");
 		if (all)
-			allports = 1;
+			all_ports_loop = 1;
 	}
 
-	if (allports == 1) {
+	if (all_ports_loop || (loop_ports && (all || port == ALL_PORTS))) {
 		if (smp_query(data, &portid, IB_ATTR_NODE_INFO, 0, 0) < 0)
 			IBERROR("smp query nodeinfo failed");
 		node_type = mad_get_field(data, 0, IB_NODE_TYPE_F);
 		mad_decode_field(data, IB_NODE_NPORTS_F, &num_ports);
-		if (loop_ports) {
-			if (!num_ports)
-				IBERROR("smp query nodeinfo: num ports invalid");
-
-			if (node_type == IB_NODE_SWITCH) {
-				if (smp_query(data, &portid, IB_ATTR_SWITCH_INFO, 0, 0) < 0)
-					IBERROR("smp query nodeinfo failed");
-				enhancedport0 = mad_get_field(data, 0, IB_SW_ENHANCED_PORT0_F);
-				if (enhancedport0)
-					start_port = 0;
-			}
+		if (!num_ports)
+			IBERROR("smp query nodeinfo: num ports invalid");
+
+		if (node_type == IB_NODE_SWITCH) {
+			if (smp_query(data, &portid, IB_ATTR_SWITCH_INFO, 0, 0) < 0)
+				IBERROR("smp query nodeinfo failed");
+			enhancedport0 = mad_get_field(data, 0, IB_SW_ENHANCED_PORT0_F);
+			if (enhancedport0)
+				start_port = 0;
 		}
+		if (all_ports_loop && !loop_ports)
+			IBWARN("Emulating AllPortSelect by iterating through all ports");
 	}
 
 	if (reset_only)
 		goto do_reset;
 
-	if (allports && loop_ports) {
-		IBWARN("Emulating AllPortSelect by iterating through all ports");
+	if (all_ports_loop || (loop_ports && (all || port == ALL_PORTS))) {
 		for (i = start_port; i <= num_ports; i++)
 			dump_perfcounters(extended, timeout, cap_mask, &portid, i);
 	}
@@ -282,8 +281,7 @@ main(int argc, char **argv)
 
 do_reset:
 
-	if (allports && loop_ports) {
-		IBWARN("Emulating AllPortSelect by iterating through all ports");
+	if (all_ports_loop || (loop_ports && (all || port == ALL_PORTS))) {
 		for (i = start_port; i <= num_ports; i++)
 			reset_counters(extended, timeout, mask, &portid, i);
 	}
-- 
1.5.4.5

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to