Hey Sasha,

Fixes the enhanced port 0 issue Hal referred to in the previous thread.

Al

-- 
Albert Chu
[EMAIL PROTECTED]
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From cd7726543c2e0f6569a02806875ec1935d213c01 Mon Sep 17 00:00:00 2001
From: Albert Chu <[EMAIL PROTECTED]>
Date: Wed, 8 Oct 2008 17:28:40 -0700
Subject: [PATCH] support ehanced port 0 with --loop_ports


Signed-off-by: Albert Chu <[EMAIL PROTECTED]>
---
 infiniband-diags/src/perfquery.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/infiniband-diags/src/perfquery.c b/infiniband-diags/src/perfquery.c
index 0e8eef2..69cbdf0 100644
--- a/infiniband-diags/src/perfquery.c
+++ b/infiniband-diags/src/perfquery.c
@@ -144,6 +144,8 @@ main(int argc, char **argv)
 	int loop_ports = 0;
 	int node_type, num_ports = 0;
 	uint8_t data[IB_SMP_DATA_SIZE];
+	int start_port = 1;
+	int enhancedport0;
 	int i;
 
 	static char const str_opts[] = "C:P:s:t:dGealrRVhu";
@@ -272,8 +274,18 @@ main(int argc, char **argv)
 				IBERROR("smp query nodeinfo: %d ports; only 1 supported for AllPortSelect simulation", num_ports);
 			port = num_ports;
 		}
-		else if (!num_ports)
-			IBERROR("smp query nodeinfo: num ports invalid");
+		else {
+			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 (reset_only)
@@ -281,7 +293,7 @@ main(int argc, char **argv)
 
 	if (allports && loop_ports) {
 		IBWARN("Emulating AllPortSelect by iterating through all ports");
-		for (i = 1; i <= num_ports; i++)
+		for (i = start_port; i <= num_ports; i++)
 			dump_perfcounters(extended, 0, timeout, cap_mask, &portid, i);
 	}
 	else
@@ -294,7 +306,7 @@ do_reset:
 
 	if (allports && loop_ports) {
 		IBWARN("Emulating AllPortSelect by iterating through all ports");
-		for (i = 1; i <= num_ports; i++)
+		for (i = start_port; i <= num_ports; i++)
 			reset_counters(extended, timeout, mask, &portid, i);
 	}
 	else
-- 
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