[ofa-general] [PATCH 2/2] perfquery: add PortXmtDataSL/PortRcvDataSL read and reset
Or Gerlitz
ogerlitz at voltaire.com
Thu Feb 26 04:39:50 PST 2009
perfquery PortXmtDataSL/PortRcvDataSL (IBA A13.6.5/6) support
Signed-off-by: Or Gerlitz <ogerlitz at voltaire.com>
Index: management/infiniband-diags/src/perfquery.c
===================================================================
--- management.orig/infiniband-diags/src/perfquery.c
+++ management/infiniband-diags/src/perfquery.c
@@ -307,7 +307,50 @@ static void reset_counters(int extended,
}
}
-static int reset, reset_only, all_ports, loop_ports, port, extended;
+static int reset, reset_only, all_ports, loop_ports, port, extended, xmt_sl, rcv_sl;
+
+void xmt_sl_query(ib_portid_t *portid, int port, int mask)
+{
+ char buf[1024];
+
+ if (reset_only) {
+ if (!port_performance_xmt_sl_reset(pc, portid, port, mask, ibd_timeout))
+ IBERROR("perfslreset");
+ return;
+ }
+
+ if (!port_performance_xmt_sl_query(pc, portid, port, ibd_timeout))
+ IBERROR("perfslquery");
+
+ mad_dump_perfcounters_xmt_sl(buf, sizeof buf, pc, sizeof pc);
+ printf("# Port counters: %s port %d\n%s", portid2str(portid), port, buf);
+
+ if(reset)
+ if (!port_performance_xmt_sl_reset(pc, portid, port, mask, ibd_timeout))
+ IBERROR("perfslreset");
+}
+
+void rcv_sl_query(ib_portid_t *portid, int port, int mask)
+{
+ char buf[1024];
+
+ if (reset_only) {
+ if (!port_performance_rcv_sl_reset(pc, portid, port, mask, ibd_timeout))
+ IBERROR("perfslreset");
+ return;
+ }
+
+ if (!port_performance_rcv_sl_query(pc, portid, port, ibd_timeout))
+ IBERROR("perfslquery");
+
+ mad_dump_perfcounters_rcv_sl(buf, sizeof buf, pc, sizeof pc);
+ printf("# Port counters: %s port %d\n%s", portid2str(portid), port, buf);
+
+ if(reset)
+ if (!port_performance_rcv_sl_reset(pc, portid, port, mask, ibd_timeout))
+ IBERROR("perfslreset");
+}
+
static int process_opt(void *context, int ch, char *optarg)
{
@@ -315,6 +358,12 @@ static int process_opt(void *context, in
case 'x':
extended = 1;
break;
+ case 's':
+ xmt_sl = 1;
+ break;
+ case 'S':
+ rcv_sl = 1;
+ break;
case 'a':
all_ports++;
port = ALL_PORTS;
@@ -349,6 +398,8 @@ int main(int argc, char **argv)
const struct ibdiag_opt opts[] = {
{ "extended", 'x', 0, NULL, "show extended port counters" },
+ { "xmtsl", 's', 0, NULL, "show Xmt SL port counters" },
+ { "rcvsl", 'S', 0, NULL, "show Rcv SL port counters" },
{ "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" },
@@ -405,6 +456,16 @@ int main(int argc, char **argv)
all_ports_loop = 1;
}
+ if (xmt_sl) {
+ xmt_sl_query(&portid, port, mask);
+ exit(0);
+ }
+
+ if (rcv_sl) {
+ rcv_sl_query(&portid, port, mask);
+ exit(0);
+ }
+
if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) {
if (smp_query(data, &portid, IB_ATTR_NODE_INFO, 0, 0) < 0)
IBERROR("smp query nodeinfo failed");
More information about the general
mailing list