[ofa-general] [PATCH] infiniband-diags/pergquery: Add support for optional PortXmitDiscardDetails counter

Hal Rosenstock hnrose at comcast.net
Wed Sep 23 06:00:17 PDT 2009


Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
---
diff --git a/infiniband-diags/man/perfquery.8 b/infiniband-diags/man/perfquery.8
index 2a80f30..4510e7d 100644
--- a/infiniband-diags/man/perfquery.8
+++ b/infiniband-diags/man/perfquery.8
@@ -1,4 +1,4 @@
-.TH PERFQUERY 8 "March 10, 2009" "OpenIB" "OpenIB Diagnostics"
+.TH PERFQUERY 8 "September 21, 2009" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 perfquery \- query InfiniBand port counters
@@ -6,6 +6,7 @@ perfquery \- query InfiniBand port counters
 .SH SYNOPSIS
 .B perfquery
 [\-d(ebug)] [\-G(uid)] [\-x|\-\-extended] [\-X|\-\-xmtsl] [\-S|\-\-rcvsl]
+[\-D|\-\-xmtdisc]
 [-a(ll_ports)] [-l(oop_ports)] [-r(eset_after_read)] [-R(eset_only)]
 [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)] [\-h(elp)]
 [<lid|guid> [[port] [reset_mask]]]
@@ -38,6 +39,9 @@ show transmit data SL counter. This is an optional counter for QoS.
 \fB\-S\fR, \fB\-\-rcvsl\fR
 show receive data SL counter. This is an optional counter for QoS.
 .TP
+\fB\-D\fR, \fB\-\-xmtdisc\fR
+show transmit discard details. This is an optional counter.
+.TP
 \fB\-a\fR, \fB\-\-all_ports\fR
 show aggregated counters for all ports of the destination lid
 or reset all counters for all ports.  If the destination lid
diff --git a/infiniband-diags/src/perfquery.c b/infiniband-diags/src/perfquery.c
index d70af9e..74f9235 100644
--- a/infiniband-diags/src/perfquery.c
+++ b/infiniband-diags/src/perfquery.c
@@ -344,7 +344,7 @@ static void reset_counters(int extended, int timeout, int mask,
 }
 
 static int reset, reset_only, all_ports, loop_ports, port, extended, xmt_sl,
-    rcv_sl;
+    rcv_sl, xmt_disc;
 
 void xmt_sl_query(ib_portid_t * portid, int port, int mask)
 {
@@ -396,6 +396,33 @@ void rcv_sl_query(ib_portid_t * portid, int port, int mask)
 			IBERROR("perfslreset");
 }
 
+void xmt_disc_query(ib_portid_t * portid, int port, int mask)
+{
+	char buf[1024];
+
+	if (reset_only) {
+		if (!performance_reset_via(pc, portid, port, mask, ibd_timeout,
+					   IB_GSI_PORT_XMIT_DISCARD_DETAILS,
+					   srcport))
+		IBERROR("xmtdiscreset");
+		return;
+	}
+
+	if (!pma_query_via(pc, portid, port, ibd_timeout,
+			   IB_GSI_PORT_XMIT_DISCARD_DETAILS, srcport))
+		IBERROR("xmtdiscquery");
+
+	mad_dump_perfcounters_xmt_disc(buf, sizeof buf, pc, sizeof pc);
+	printf("# PortXmitDiscardDetails: %s port %d\n%s", portid2str(portid),
+	       port, buf);
+
+	if (reset)
+		if (!performance_reset_via(pc, portid, port, mask, ibd_timeout,
+					   IB_GSI_PORT_XMIT_DISCARD_DETAILS,
+					   srcport))
+			IBERROR("xmtdiscreset");
+}
+
 static int process_opt(void *context, int ch, char *optarg)
 {
 	switch (ch) {
@@ -408,6 +435,9 @@ static int process_opt(void *context, int ch, char *optarg)
 	case 'S':
 		rcv_sl = 1;
 		break;
+	case 'D':
+		xmt_disc = 1;
+		break;
 	case 'a':
 		all_ports++;
 		port = ALL_PORTS;
@@ -446,6 +476,7 @@ int main(int argc, char **argv)
 		{"extended", 'x', 0, NULL, "show extended port counters"},
 		{"xmtsl", 'X', 0, NULL, "show Xmt SL port counters"},
 		{"rcvsl", 'S', 0, NULL, "show Rcv SL port counters"},
+		{"xmtdisc", 'D', 0, NULL, "show Xmt Discard Details"},
 		{"all_ports", 'a', 0, NULL, "show aggregated counters"},
 		{"loop_ports", 'l', 0, NULL, "iterate through each port"},
 		{"reset_after_read", 'r', 0, NULL, "reset counters after read"},
@@ -516,6 +547,11 @@ int main(int argc, char **argv)
 		goto done;
 	}
 
+	if (xmt_disc) {
+		xmt_disc_query(&portid, port, mask);
+		goto done;
+	}
+
 	if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) {
 		if (smp_query_via(data, &portid, IB_ATTR_NODE_INFO, 0, 0,
 				  srcport) < 0)



More information about the general mailing list