Hello community,
here is the log from the commit of package infiniband-diags
checked in at Tue Oct 28 00:05:22 CET 2008.
--------
--- infiniband-diags/infiniband-diags.changes 2008-09-11 14:30:08.000000000 +0200
+++ /d/STABLE/infiniband-diags/infiniband-diags.changes 2008-10-27 23:26:42.698262000 +0100
@@ -1,0 +2,5 @@
+Mon Oct 27 23:26:24 CET 2008 - jjolly@suse.de
+
+- Updated to version from the OFED 1.4 rc3
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ infiniband-diags.spec ++++++
--- /var/tmp/diff_new_pack.S15730/_old 2008-10-28 00:04:54.000000000 +0100
+++ /var/tmp/diff_new_pack.S15730/_new 2008-10-28 00:04:55.000000000 +0100
@@ -21,7 +21,7 @@
Name: infiniband-diags
Summary: OpenIB InfiniBand Diagnostic Tools
Version: 1.4.1
-Release: 1
+Release: 4
License: BSD 3-Clause; GPL v2 or later
Group: Productivity/Networking/Diagnostic
Source0: %{name}-%{version}.tar.bz2
@@ -64,6 +64,8 @@
%{perl_vendorarch}/IBswcountlimits.pm
%changelog
+* Tue Oct 28 2008 jjolly@suse.de
+- Updated to version from the OFED 1.4 rc3
* Thu Sep 11 2008 jjolly@suse.de
- Updated to 1.4.1 from the OFED 1.4 RC1
* Wed Mar 05 2008 jjolly@suse.de
++++++ infiniband-diags-1.4.1.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/infiniband-diags.spec new/infiniband-diags-1.4.1/infiniband-diags.spec
--- old/infiniband-diags-1.4.1/infiniband-diags.spec 2008-09-08 13:55:24.000000000 +0200
+++ new/infiniband-diags-1.4.1/infiniband-diags.spec 2008-10-19 14:05:19.000000000 +0200
@@ -1,11 +1,11 @@
-%define RELEASE @RELEASE@
+%define RELEASE 1.ofed1.4.rc3
%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
Summary: OpenFabrics Alliance InfiniBand Diagnostic Tools
Name: infiniband-diags
Version: 1.4.1
-Release: 1.ofed1.4.rc1
+Release: 1.ofed1.4.rc3
License: GPLv2 or BSD
Group: System Environment/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/man/ibclearcounters.8 new/infiniband-diags-1.4.1/man/ibclearcounters.8
--- old/infiniband-diags-1.4.1/man/ibclearcounters.8 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/man/ibclearcounters.8 2008-10-19 14:04:35.000000000 +0200
@@ -5,8 +5,7 @@
.SH SYNOPSIS
.B ibclearcounters
-[\-h] [\-N | \-nocolor] [<topology-file> | \-C ca_name
-\-P ca_port \-t(imeout) timeout_ms]
+[\-h] [<topology-file> | \-C ca_name \-P ca_port \-t(imeout) timeout_ms]
.SH DESCRIPTION
.PP
@@ -15,8 +14,6 @@
.SH OPTIONS
.PP
-\-N | \-nocolor use mono rather than color mode
-.PP
\-C use the specified ca_name.
.PP
\-P use the specified ca_port.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/man/ibnetdiscover.8 new/infiniband-diags-1.4.1/man/ibnetdiscover.8
--- old/infiniband-diags-1.4.1/man/ibnetdiscover.8 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/man/ibnetdiscover.8 2008-10-19 14:04:35.000000000 +0200
@@ -68,20 +68,6 @@
.PP
\-V show the version info.
-# Addressing flags
-.PP
-\-D use directed path address arguments. The path
- is a comma separated list of out ports.
- Examples:
- "0" # self port
- "0,1,2,1,4" # out via port 1, then out via port 2, ...
-.PP
-\-G use GUID address argument. In most cases, it is the Port GUID.
- Example:
- "0x08f1040023"
-.PP
-\-s <smlid> use 'smlid' as the target lid for SM/SA queries.
-
# Other common flags:
.PP
\-C use the specified ca_name.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/man/ibtracert.8 new/infiniband-diags-1.4.1/man/ibtracert.8
--- old/infiniband-diags-1.4.1/man/ibtracert.8 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/man/ibtracert.8 2008-10-19 14:04:35.000000000 +0200
@@ -43,8 +43,6 @@
\-d raise the IB debugging level.
May be used several times (-ddd or -d -d -d).
.PP
-\-e show send and receive errors (timeouts and others)
-.PP
\-h show the usage message
.PP
\-v increase the application verbosity level.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/man/perfquery.8 new/infiniband-diags-1.4.1/man/perfquery.8
--- old/infiniband-diags-1.4.1/man/perfquery.8 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/man/perfquery.8 2008-10-19 14:04:35.000000000 +0200
@@ -5,7 +5,7 @@
.SH SYNOPSIS
.B perfquery
-[\-d(ebug)] [\-G(uid)] [-e(xtended)] [-a(ll_ports)] [-r(eset_after_read)] [-R(eset_only)] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)] [\-h(elp)] [ [[port] [reset_mask]]]
+[\-d(ebug)] [\-G(uid)] [-e(xtended)] [-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)] [ [[port] [reset_mask]]]
.SH DESCRIPTION
.PP
@@ -18,6 +18,8 @@
that represent Data (e.g. PortXmitData and PortRcvData) indicate octets
divided by 4 rather than just octets.
+Note: Inputting a port of 255 indicates an operation be performed on all ports.
+
.SH OPTIONS
.PP
@@ -27,8 +29,15 @@
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 (either through the
+\fB\-a\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 -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/scripts/ibclearcounters.in new/infiniband-diags-1.4.1/scripts/ibclearcounters.in
--- old/infiniband-diags-1.4.1/scripts/ibclearcounters.in 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/scripts/ibclearcounters.in 2008-10-19 14:04:35.000000000 +0200
@@ -3,7 +3,7 @@
IBPATH=${IBPATH:-@IBSCRIPTPATH@}
function usage() {
- echo Usage: `basename $0` "[-h] [-N | -nocolor] [<topology-file>" \
+ echo Usage: `basename $0` "[-h] [<topology-file>" \
"| -C ca_name -P ca_port -t(imeout) timeout_ms]"
exit -1
}
@@ -26,9 +26,6 @@
-h)
usage
;;
- -N|-nocolor)
- gflags=-N
- ;;
-P | -C | -t | -timeout)
case $2 in
-*)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/scripts/ibclearerrors.in new/infiniband-diags-1.4.1/scripts/ibclearerrors.in
--- old/infiniband-diags-1.4.1/scripts/ibclearerrors.in 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/scripts/ibclearerrors.in 2008-10-19 14:04:35.000000000 +0200
@@ -65,6 +65,12 @@
rv=$?
echo "$text" | awk '
+function clear_all_errors(lid, port)
+{
+ if (system("'$IBPATH'/perfquery'"$ca_info"' '$gflags' -R -a " lid " " port " 0x0fff"))
+ nodeerr++
+}
+
function clear_errors(lid, port)
{
if (system("'$IBPATH'/perfquery'"$ca_info"' '$gflags' -R " lid " " port " 0x0fff"))
@@ -79,7 +85,7 @@
lid = substr($0, index($0, "port 0 lid ") + 11)
lid = substr(lid, 1, index(lid, " ") - 1)
- clear_errors(lid, 255)
+ clear_all_errors(lid, 255)
}
/^\[/ {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/scripts/ibprintswitch.pl new/infiniband-diags-1.4.1/scripts/ibprintswitch.pl
--- old/infiniband-diags-1.4.1/scripts/ibprintswitch.pl 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/scripts/ibprintswitch.pl 2008-10-19 14:04:35.000000000 +0200
@@ -1,5 +1,6 @@
#!/usr/bin/perl
#
+# Copyright (c) 2008 Voltaire, Inc. All rights reserved.
# Copyright (c) 2006 The Regents of the University of California.
#
# Produced at Lawrence Livermore National Laboratory.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/scripts/ibqueryerrors.pl new/infiniband-diags-1.4.1/scripts/ibqueryerrors.pl
--- old/infiniband-diags-1.4.1/scripts/ibqueryerrors.pl 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/scripts/ibqueryerrors.pl 2008-10-19 14:04:35.000000000 +0200
@@ -1,5 +1,6 @@
#!/usr/bin/perl
#
+# Copyright (c) 2008 Voltaire, Inc. All rights reserved.
# Copyright (c) 2006 The Regents of the University of California.
#
# Produced at Lawrence Livermore National Laboratory.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/scripts/ibswportwatch.pl new/infiniband-diags-1.4.1/scripts/ibswportwatch.pl
--- old/infiniband-diags-1.4.1/scripts/ibswportwatch.pl 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/scripts/ibswportwatch.pl 2008-10-19 14:04:35.000000000 +0200
@@ -1,5 +1,6 @@
#!/usr/bin/perl
#
+# Copyright (c) 2008 Voltaire, Inc. All rights reserved.
# Copyright (c) 2006 The Regents of the University of California.
#
# Produced at Lawrence Livermore National Laboratory.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/src/ibaddr.c new/infiniband-diags-1.4.1/src/ibaddr.c
--- old/infiniband-diags-1.4.1/src/ibaddr.c 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/src/ibaddr.c 2008-10-19 14:04:35.000000000 +0200
@@ -97,7 +97,7 @@
else
basename++;
- fprintf(stderr, "Usage: %s [-d(ebug) -D(irect) -G(uid) -l(id_show) -g(id_show) -C ca_name -P ca_port "
+ fprintf(stderr, "Usage: %s [-d(ebug) -D(irect) -G(uid) -l(id_show) -g(id_show) -s(m_port) sm_lid -C ca_name -P ca_port "
"-t(imeout) timeout_ms -V(ersion) -h(elp)] []\n",
basename);
fprintf(stderr, "\tExamples:\n");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/src/ibnetdiscover.c new/infiniband-diags-1.4.1/src/ibnetdiscover.c
--- old/infiniband-diags-1.4.1/src/ibnetdiscover.c 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/src/ibnetdiscover.c 2008-10-19 14:04:35.000000000 +0200
@@ -424,7 +424,7 @@
if (get_port(&port_buf, i, path) < 0) {
IBWARN("can't reach node %s port %d", portid2str(path), i);
- return 0;
+ continue;
}
port = find_port(node, &port_buf);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/src/ibping.c new/infiniband-diags-1.4.1/src/ibping.c
--- old/infiniband-diags-1.4.1/src/ibping.c 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/src/ibping.c 2008-10-19 14:04:35.000000000 +0200
@@ -174,7 +174,7 @@
printf("\n--- %s (%s) ibping statistics ---\n", last_host, portid2str(&portid));
printf("%" PRIu64 " packets transmitted, %" PRIu64 " received, %" PRIu64 "%% packet loss, time %" PRIu64 " ms\n",
ntrans, replied,
- (lost != 0) ? lost * 100ull / ntrans : 0ull, total_time / 1000ull);
+ (lost != 0) ? lost * 100 / ntrans : 0, total_time / 1000);
printf("rtt min/avg/max = %" PRIu64 ".%03" PRIu64 "/%" PRIu64 ".%03" PRIu64 "/%" PRIu64 ".%03" PRIu64 " ms\n",
minrtt == ~0ull ? 0 : minrtt/1000,
minrtt == ~0ull ? 0 : minrtt%1000,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/src/ibsysstat.c new/infiniband-diags-1.4.1/src/ibsysstat.c
--- old/infiniband-diags-1.4.1/src/ibsysstat.c 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/src/ibsysstat.c 2008-10-19 14:04:35.000000000 +0200
@@ -100,8 +100,10 @@
for (i = 0; i < host_ncpu && sz > 0; i++) {
n = snprintf(s, sz, "cpu %d: model %s MHZ %s\n",
i, cpus[i].model, cpus[i].mhz);
- if (n >= sz)
+ if (n >= sz) {
+ IBWARN("cpuinfo truncated");
break;
+ }
sz -= n;
s += n;
}
@@ -187,14 +189,16 @@
FILE *f;
int ncpu = 0;
- if (!(f = fopen("/proc/cpuinfo", "r")))
- return -1;
+ if (!(f = fopen("/proc/cpuinfo", "r"))) {
+ IBWARN("couldn't open /proc/cpuinfo");
+ return 0;
+ }
while (fgets(line, sizeof(line) - 1, f)) {
if (!strncmp(line, "processor\t", 10)) {
ncpu++;
if (ncpu > MAX_CPUS)
- return ncpu;
+ return MAX_CPUS;
continue;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/src/ibtracert.c new/infiniband-diags-1.4.1/src/ibtracert.c
--- old/infiniband-diags-1.4.1/src/ibtracert.c 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/src/ibtracert.c 2008-10-19 14:04:35.000000000 +0200
@@ -673,6 +673,20 @@
free(nodename);
}
+static int resolve_lid(ib_portid_t *portid, const void *srcport)
+{
+ uint8_t portinfo[64];
+ uint16_t lid;
+
+ if (!smp_query_via(portinfo, portid, IB_ATTR_PORT_INFO, 0, 0, srcport))
+ return -1;
+ mad_decode_field(portinfo, IB_PORT_LID_F, &lid);
+
+ ib_portid_set(portid, lid, 0, 0);
+
+ return 0;
+}
+
static void
usage(void)
{
@@ -806,6 +820,15 @@
if (ib_resolve_portid_str(&dest_portid, argv[1], dest_type, sm_id) < 0)
IBERROR("can't resolve destination port %s", argv[1]);
+ if (dest_type == IB_DEST_DRPATH) {
+ if (resolve_lid(&src_portid, NULL) < 0)
+ IBERROR("cannot resolve lid for port \'%s\'",
+ portid2str(&src_portid));
+ if (resolve_lid(&dest_portid, NULL) < 0)
+ IBERROR("cannot resolve lid for port \'%s\'",
+ portid2str(&dest_portid));
+ }
+
if (dest_portid.lid == 0 || src_portid.lid == 0) {
IBWARN("bad src/dest lid");
usage();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/src/perfquery.c new/infiniband-diags-1.4.1/src/perfquery.c
--- old/infiniband-diags-1.4.1/src/perfquery.c 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/src/perfquery.c 2008-10-19 14:04:35.000000000 +0200
@@ -49,10 +49,49 @@
#include "ibdiag_common.h"
+struct perf_count {
+ uint32_t portselect;
+ uint32_t counterselect;
+ uint32_t symbolerrors;
+ uint32_t linkrecovers;
+ uint32_t linkdowned;
+ uint32_t rcverrors;
+ uint32_t rcvremotephyerrors;
+ uint32_t rcvswrelayerrors;
+ uint32_t xmtdiscards;
+ uint32_t xmtconstrainterrors;
+ uint32_t rcvconstrainterrors;
+ uint32_t linkintegrityerrors;
+ uint32_t excbufoverrunerrors;
+ uint32_t vl15dropped;
+ uint32_t xmtdata;
+ uint32_t rcvdata;
+ uint32_t xmtpkts;
+ uint32_t rcvpkts;
+};
+
+struct perf_count_ext {
+ uint32_t portselect;
+ uint32_t counterselect;
+ uint64_t portxmitdata;
+ uint64_t portrcvdata;
+ uint64_t portxmitpkts;
+ uint64_t portrcvpkts;
+ uint64_t portunicastxmitpkts;
+ uint64_t portunicastrcvpkts;
+ uint64_t portmulticastxmitpkits;
+ uint64_t portmulticastrcvpkts;
+};
+
static uint8_t pc[1024];
+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};
+
char *argv0 = "perfquery";
+#define ALL_PORTS 0xFF
+
static void
usage(void)
{
@@ -63,7 +102,7 @@
else
basename++;
- fprintf(stderr, "Usage: %s [-d(ebug) -G(uid) -a(ll_ports) -r(eset_after_read) -C ca_name -P ca_port "
+ fprintf(stderr, "Usage: %s [-d(ebug) -G(uid) -a(ll_ports) -l(oop_ports) -r(eset_after_read) -C ca_name -P ca_port "
"-R(eset_only) -t(imeout) timeout_ms -V(ersion) -h(elp)] [ [[port] [reset_mask]]]\n",
basename);
fprintf(stderr, "\tExamples:\n");
@@ -81,6 +120,216 @@
exit(-1);
}
+/* Notes: IB semantics is to cap counters if count has exceeded limits.
+ * Therefore we must check for overflows and cap the counters if necessary.
+ *
+ * mad_decode_field and mad_encode_field assume 32 bit integers passed in
+ * for fields < 32 bits in length.
+ */
+
+static void aggregate_4bit(uint32_t *dest, uint32_t val)
+{
+ if ((((*dest) + val) < (*dest))
+ || ((*dest) + val) > 0xf)
+ (*dest) = 0xf;
+ else
+ (*dest) = (*dest) + val;
+}
+
+static void aggregate_8bit(uint32_t *dest, uint32_t val)
+{
+ if ((((*dest) + val) < (*dest))
+ || ((*dest) + val) > 0xff)
+ (*dest) = 0xff;
+ else
+ (*dest) = (*dest) + val;
+}
+
+static void aggregate_16bit(uint32_t *dest, uint32_t val)
+{
+ if ((((*dest) + val) < (*dest))
+ || ((*dest) + val) > 0xffff)
+ (*dest) = 0xffff;
+ else
+ (*dest) = (*dest) + val;
+}
+
+static void aggregate_32bit(uint32_t *dest, uint32_t val)
+{
+ if (((*dest) + val) < (*dest))
+ (*dest) = 0xffffffff;
+ else
+ (*dest) = (*dest) + val;
+}
+
+static void aggregate_64bit(uint64_t *dest, uint64_t val)
+{
+ if (((*dest) + val) < (*dest))
+ (*dest) = 0xffffffffffffffffULL;
+ else
+ (*dest) = (*dest) + val;
+}
+
+static void aggregate_perfcounters(void)
+{
+ uint32_t val;
+
+ mad_decode_field(pc, IB_PC_PORT_SELECT_F, &val);
+ perf_count.portselect = val;
+ mad_decode_field(pc, IB_PC_COUNTER_SELECT_F, &val);
+ perf_count.counterselect = val;
+ mad_decode_field(pc, IB_PC_ERR_SYM_F, &val);
+ aggregate_16bit(&perf_count.symbolerrors, val);
+ mad_decode_field(pc, IB_PC_LINK_RECOVERS_F, &val);
+ aggregate_8bit(&perf_count.linkrecovers, val);
+ mad_decode_field(pc, IB_PC_LINK_DOWNED_F, &val);
+ aggregate_8bit(&perf_count.linkdowned, val);
+ mad_decode_field(pc, IB_PC_ERR_RCV_F, &val);
+ aggregate_16bit(&perf_count.rcverrors, val);
+ mad_decode_field(pc, IB_PC_ERR_PHYSRCV_F, &val);
+ aggregate_16bit(&perf_count.rcvremotephyerrors, val);
+ mad_decode_field(pc, IB_PC_ERR_SWITCH_REL_F, &val);
+ aggregate_16bit(&perf_count.rcvswrelayerrors, val);
+ mad_decode_field(pc, IB_PC_XMT_DISCARDS_F, &val);
+ aggregate_16bit(&perf_count.xmtdiscards, val);
+ mad_decode_field(pc, IB_PC_ERR_XMTCONSTR_F, &val);
+ aggregate_8bit(&perf_count.xmtconstrainterrors, val);
+ mad_decode_field(pc, IB_PC_ERR_RCVCONSTR_F, &val);
+ aggregate_8bit(&perf_count.rcvconstrainterrors, val);
+ mad_decode_field(pc, IB_PC_ERR_LOCALINTEG_F, &val);
+ aggregate_4bit(&perf_count.linkintegrityerrors, val);
+ mad_decode_field(pc, IB_PC_ERR_EXCESS_OVR_F, &val);
+ aggregate_4bit(&perf_count.excbufoverrunerrors, val);
+ mad_decode_field(pc, IB_PC_VL15_DROPPED_F, &val);
+ aggregate_16bit(&perf_count.vl15dropped, val);
+ mad_decode_field(pc, IB_PC_XMT_BYTES_F, &val);
+ aggregate_32bit(&perf_count.xmtdata, val);
+ mad_decode_field(pc, IB_PC_RCV_BYTES_F, &val);
+ aggregate_32bit(&perf_count.rcvdata, val);
+ mad_decode_field(pc, IB_PC_XMT_PKTS_F, &val);
+ aggregate_32bit(&perf_count.xmtpkts, val);
+ mad_decode_field(pc, IB_PC_RCV_PKTS_F, &val);
+ aggregate_32bit(&perf_count.rcvpkts, val);
+}
+
+static void output_aggregate_perfcounters(ib_portid_t *portid)
+{
+ char buf[1024];
+ uint32_t val = ALL_PORTS;
+
+ /* set port_select to 255 to emulate AllPortSelect */
+ mad_encode_field(pc, IB_PC_PORT_SELECT_F, &val);
+ mad_encode_field(pc, IB_PC_COUNTER_SELECT_F, &perf_count.counterselect);
+ mad_encode_field(pc, IB_PC_ERR_SYM_F, &perf_count.symbolerrors);
+ mad_encode_field(pc, IB_PC_LINK_RECOVERS_F, &perf_count.linkrecovers);
+ mad_encode_field(pc, IB_PC_LINK_DOWNED_F, &perf_count.linkdowned);
+ mad_encode_field(pc, IB_PC_ERR_RCV_F, &perf_count.rcverrors);
+ mad_encode_field(pc, IB_PC_ERR_PHYSRCV_F, &perf_count.rcvremotephyerrors);
+ mad_encode_field(pc, IB_PC_ERR_SWITCH_REL_F, &perf_count.rcvswrelayerrors);
+ mad_encode_field(pc, IB_PC_XMT_DISCARDS_F, &perf_count.xmtdiscards);
+ mad_encode_field(pc, IB_PC_ERR_XMTCONSTR_F, &perf_count.xmtconstrainterrors);
+ mad_encode_field(pc, IB_PC_ERR_RCVCONSTR_F, &perf_count.rcvconstrainterrors);
+ mad_encode_field(pc, IB_PC_ERR_LOCALINTEG_F, &perf_count.linkintegrityerrors);
+ mad_encode_field(pc, IB_PC_ERR_EXCESS_OVR_F, &perf_count.excbufoverrunerrors);
+ mad_encode_field(pc, IB_PC_VL15_DROPPED_F, &perf_count.vl15dropped);
+ mad_encode_field(pc, IB_PC_XMT_BYTES_F, &perf_count.xmtdata);
+ mad_encode_field(pc, IB_PC_RCV_BYTES_F, &perf_count.rcvdata);
+ mad_encode_field(pc, IB_PC_XMT_PKTS_F, &perf_count.xmtpkts);
+ mad_encode_field(pc, IB_PC_RCV_PKTS_F, &perf_count.rcvpkts);
+
+ mad_dump_perfcounters(buf, sizeof buf, pc, sizeof pc);
+
+ printf("# Port counters: %s port %d\n%s", portid2str(portid), ALL_PORTS, buf);
+}
+
+static void aggregate_perfcounters_ext(void)
+{
+ uint32_t val;
+ uint64_t val64;
+
+ mad_decode_field(pc, IB_PC_EXT_PORT_SELECT_F, &val);
+ perf_count_ext.portselect = val;
+ mad_decode_field(pc, IB_PC_EXT_COUNTER_SELECT_F, &val);
+ perf_count_ext.counterselect = val;
+ mad_decode_field(pc, IB_PC_EXT_XMT_BYTES_F, &val64);
+ aggregate_64bit(&perf_count_ext.portxmitdata, val64);
+ mad_decode_field(pc, IB_PC_EXT_RCV_BYTES_F, &val64);
+ aggregate_64bit(&perf_count_ext.portrcvdata, val64);
+ mad_decode_field(pc, IB_PC_EXT_XMT_PKTS_F, &val64);
+ aggregate_64bit(&perf_count_ext.portxmitpkts, val64);
+ mad_decode_field(pc, IB_PC_EXT_RCV_PKTS_F, &val64);
+ aggregate_64bit(&perf_count_ext.portrcvpkts, val64);
+ mad_decode_field(pc, IB_PC_EXT_XMT_UPKTS_F, &val64);
+ aggregate_64bit(&perf_count_ext.portunicastxmitpkts, val64);
+ mad_decode_field(pc, IB_PC_EXT_RCV_UPKTS_F, &val64);
+ aggregate_64bit(&perf_count_ext.portunicastrcvpkts, val64);
+ mad_decode_field(pc, IB_PC_EXT_XMT_MPKTS_F, &val64);
+ aggregate_64bit(&perf_count_ext.portmulticastxmitpkits, val64);
+ mad_decode_field(pc, IB_PC_EXT_RCV_MPKTS_F, &val64);
+ aggregate_64bit(&perf_count_ext.portmulticastrcvpkts, val64);
+}
+
+static void output_aggregate_perfcounters_ext(ib_portid_t *portid)
+{
+ char buf[1024];
+ uint32_t val = ALL_PORTS;
+
+ /* set port_select to 255 to emulate AllPortSelect */
+ mad_encode_field(pc, IB_PC_EXT_PORT_SELECT_F, &val);
+ mad_encode_field(pc, IB_PC_EXT_COUNTER_SELECT_F, &perf_count_ext.counterselect);
+ mad_encode_field(pc, IB_PC_EXT_XMT_BYTES_F, &perf_count_ext.portxmitdata);
+ mad_encode_field(pc, IB_PC_EXT_RCV_BYTES_F, &perf_count_ext.portrcvdata);
+ mad_encode_field(pc, IB_PC_EXT_XMT_PKTS_F, &perf_count_ext.portxmitpkts);
+ mad_encode_field(pc, IB_PC_EXT_RCV_PKTS_F, &perf_count_ext.portrcvpkts);
+ mad_encode_field(pc, IB_PC_EXT_XMT_UPKTS_F, &perf_count_ext.portunicastxmitpkts);
+ mad_encode_field(pc, IB_PC_EXT_RCV_UPKTS_F, &perf_count_ext.portunicastrcvpkts);
+ mad_encode_field(pc, IB_PC_EXT_XMT_MPKTS_F, &perf_count_ext.portmulticastxmitpkits);
+ mad_encode_field(pc, IB_PC_EXT_RCV_MPKTS_F, &perf_count_ext.portmulticastrcvpkts);
+
+ mad_dump_perfcounters_ext(buf, sizeof buf, pc, sizeof pc);
+
+ printf("# Port counters: %s port %d\n%s", portid2str(portid), ALL_PORTS, buf);
+}
+
+static void dump_perfcounters(int extended, int timeout, uint16_t cap_mask, ib_portid_t *portid,
+ int port, int aggregate)
+{
+ char buf[1024];
+
+ if (extended != 1) {
+ if (!port_performance_query(pc, portid, port, timeout))
+ IBERROR("perfquery");
+ if (aggregate)
+ aggregate_perfcounters();
+ else
+ mad_dump_perfcounters(buf, sizeof buf, pc, sizeof pc);
+ } else {
+ if (!(cap_mask & 0x200)) /* 1.2 errata: bit 9 is extended counter support */
+ IBWARN("PerfMgt ClassPortInfo 0x%x extended counters not indicated\n", cap_mask);
+
+ if (!port_performance_ext_query(pc, portid, port, timeout))
+ IBERROR("perfextquery");
+ if (aggregate)
+ aggregate_perfcounters_ext();
+ else
+ mad_dump_perfcounters_ext(buf, sizeof buf, pc, sizeof pc);
+ }
+
+ if (!aggregate)
+ printf("# Port counters: %s port %d\n%s", portid2str(portid), port, buf);
+}
+
+static void reset_counters(int extended, int timeout, int mask, ib_portid_t *portid, int port)
+{
+ if (extended != 1) {
+ if (!port_performance_reset(pc, portid, port, mask, timeout))
+ IBERROR("perf reset");
+ } else {
+ if (!port_performance_ext_reset(pc, portid, port, mask, timeout))
+ IBERROR("perf ext reset");
+ }
+}
+
int
main(int argc, char **argv)
{
@@ -90,20 +339,23 @@
extern int ibdebug;
int dest_type = IB_DEST_LID;
int timeout = 0; /* use default */
- int mask = 0xffff, all = 0;
+ int mask = 0xffff, all_ports = 0;
int reset = 0, reset_only = 0;
int port = 0;
- char buf[1024];
int udebug = 0;
char *ca = 0;
int ca_port = 0;
int extended = 0;
uint16_t cap_mask;
- int allports = 0;
- int node_type, num_ports;
+ int all_ports_loop = 0;
+ 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:dGearRVhu";
+ static char const str_opts[] = "C:P:s:t:dGealrRVhu";
static const struct option long_opts[] = {
{ "C", 1, 0, 'C'},
{ "P", 1, 0, 'P'},
@@ -111,6 +363,7 @@
{ "Guid", 0, 0, 'G'},
{ "extended", 0, 0, 'e'},
{ "all_ports", 0, 0, 'a'},
+ { "loop_ports", 0, 0, 'l'},
{ "reset_after_read", 0, 0, 'r'},
{ "Reset_only", 0, 0, 'R'},
{ "sm_portid", 1, 0, 's'},
@@ -138,8 +391,11 @@
extended = 1;
break;
case 'a':
- all++;
- port = 0xff;
+ all_ports++;
+ port = ALL_PORTS;
+ break;
+ case 'l':
+ loop_ports++;
break;
case 'd':
ibdebug++;
@@ -197,70 +453,60 @@
/* ClassPortInfo should be supported as part of libibmad */
memcpy(&cap_mask, pc+2, sizeof(cap_mask)); /* CapabilityMask */
cap_mask = ntohs(cap_mask);
- if (!(cap_mask & 0x100)) /* bit 8 is AllPortSelect */
- if (port == 255) {
- allports = 1;
- IBWARN("AllPortSelect not supported");
- }
-
- if (allports == 1) {
-
- /*
- * Simulate all ports support in PMA
- * Determine node type, number of (physical) ports,
- * and, if switch, whether SP0 is enhanced
- * to determine first and last port to query
- */
+ if (!(cap_mask & 0x100)) { /* bit 8 is AllPortSelect */
+ if (!all_ports && port == ALL_PORTS)
+ IBERROR("AllPortSelect not supported");
+ if (all_ports)
+ all_ports_loop = 1;
+ }
- /* For now, support single port CAs */
+ 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");
node_type = mad_get_field(data, 0, IB_NODE_TYPE_F);
- if (node_type != IB_NODE_CA) /* NodeType other than CA ? */
- IBERROR("smp query nodeinfo: Node type not CA");
mad_decode_field(data, IB_NODE_NPORTS_F, &num_ports);
- if (num_ports != 1)
- IBERROR("smp query nodeinfo: %d ports; only 1 supported currently", num_ports);
- port = num_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 (all_ports_loop && !loop_ports)
+ IBWARN("Emulating AllPortSelect by iterating through all ports");
}
if (reset_only)
goto do_reset;
- if (extended != 1) {
- if (!port_performance_query(pc, &portid, port, timeout))
- IBERROR("perfquery");
-
- if (allports == 1)
- pc[1] = 255; /* fake PortSelect */
-
- mad_dump_perfcounters(buf, sizeof buf, pc, sizeof pc);
- } else {
- if (!(cap_mask & 0x200)) /* 1.2 errata: bit 9 is extended counter support */
- IBWARN("PerfMgt ClassPortInfo 0x%x extended counters not indicated\n", cap_mask);
-
- if (!port_performance_ext_query(pc, &portid, port, timeout))
- IBERROR("perfextquery");
-
- if (allports == 1)
- pc[1] = 255; /* fake PortSelect */
-
- mad_dump_perfcounters_ext(buf, sizeof buf, pc, sizeof pc);
+ if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) {
+ for (i = start_port; i <= num_ports; i++)
+ dump_perfcounters(extended, timeout, cap_mask, &portid, i,
+ (all_ports_loop && !loop_ports));
+ if (all_ports_loop && !loop_ports) {
+ if (extended != 1)
+ output_aggregate_perfcounters(&portid);
+ else
+ output_aggregate_perfcounters_ext(&portid);
+ }
}
-
- printf("# Port counters: %s port %d\n%s", portid2str(&portid), port, buf);
+ else
+ dump_perfcounters(extended, timeout, cap_mask, &portid, port, 0);
if (!reset)
exit(0);
do_reset:
- if (extended != 1) {
- if (!port_performance_reset(pc, &portid, port, mask, timeout))
- IBERROR("perf reset");
- } else {
- if (!port_performance_ext_reset(pc, &portid, port, mask, timeout))
- IBERROR("perf ext reset");
+
+ if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) {
+ for (i = start_port; i <= num_ports; i++)
+ reset_counters(extended, timeout, mask, &portid, i);
}
+ else
+ reset_counters(extended, timeout, mask, &portid, port);
exit(0);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/infiniband-diags-1.4.1/src/saquery.c new/infiniband-diags-1.4.1/src/saquery.c
--- old/infiniband-diags-1.4.1/src/saquery.c 2008-09-08 13:54:40.000000000 +0200
+++ new/infiniband-diags-1.4.1/src/saquery.c 2008-10-19 14:04:35.000000000 +0200
@@ -634,6 +634,21 @@
printf("\n");
}
+static void dump_one_lft_record(void *data)
+{
+ ib_lft_record_t *lftr = data;
+ unsigned block = cl_ntoh16(lftr->block_num);
+ int i;
+ printf("LFT Record dump:\n"
+ "\t\tLID........................%u\n"
+ "\t\tBlock......................%u\n"
+ "\t\tLFT:\n",
+ cl_ntoh16(lftr->lid), block);
+ for (i = 0; i < 64 ; i++)
+ printf("\t\t%u\t%u\n", block*64 + i, lftr->lft[i]);
+ printf("\n");
+}
+
static void dump_results(osmv_query_res_t *r, void (*dump_func)(void *))
{
int i;
@@ -1251,6 +1266,41 @@
return status;
}
+static int
+print_lft_records(const struct query_cmd *q, osm_bind_handle_t bind_handle,
+ int argc, char *argv[])
+{
+ ib_lft_record_t lftr;
+ ib_net64_t comp_mask = 0;
+ int lid = 0, block = -1;
+ ib_api_status_t status;
+
+ if (argc > 0)
+ parse_lid_and_ports(bind_handle, argv[0],
+ &lid, &block, NULL);
+
+ memset(&lftr, 0, sizeof(lftr));
+
+ if (lid > 0) {
+ lftr.lid = cl_hton16(lid);
+ comp_mask |= IB_LFTR_COMPMASK_LID;
+ }
+ if (block >= 0) {
+ lftr.block_num = cl_hton16(block);
+ comp_mask |= IB_LFTR_COMPMASK_BLOCK;
+ }
+
+ status = get_any_records(bind_handle, IB_MAD_ATTR_LFT_RECORD, 0,
+ comp_mask, &lftr,
+ ib_get_attr_offset(sizeof(lftr)), 0);
+ if (status != IB_SUCCESS)
+ return status;
+
+ dump_results(&result, dump_one_lft_record);
+ return_mad();
+ return status;
+}
+
static osm_bind_handle_t
get_bind_handle(void)
{
@@ -1344,6 +1394,8 @@
{ "ServiceRecord", "SR", IB_MAD_ATTR_SERVICE_RECORD, },
{ "PathRecord", "PR", IB_MAD_ATTR_PATH_RECORD, },
{ "MCMemberRecord", "MCMR", IB_MAD_ATTR_MCMEMBER_RECORD, },
+ { "LFTRecord", "LFTR", IB_MAD_ATTR_LFT_RECORD, "[[lid]/[block]]",
+ print_lft_records },
{ 0 }
};
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org