infiniband-diags: Add dump2psl and dump2slvl perl scripts
PATCH 1/1 infiniband-diags: Add dump2psl and dump2slvl perl scripts
to aid in torus-2QoS credit checking
--- configure.in | 2 + scripts/dump2psl.pl | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/dump2slvl.pl | 24 +++++++++++++++++++++++ 3 files changed, 77 insertions(+), 0 deletions(-) create mode 100755 scripts/dump2psl.pl create mode 100755 scripts/dump2slvl.pl
configure.in +2 -0
@@ -169,6 +169,8 @@ AC_CONFIG_FILES([\ scripts/ibrouters \ scripts/iblinkinfo.pl \ scripts/ibqueryerrors.pl \ + scripts/dump2psl.pl \ + scripts/dump2slvl.pl \ libibnetdisc/Makefile ]) AC_OUTPUT
scripts/dump2psl.pl new file +17 -0
@@ -0,0 +1,51 @@ +#! /usr/bin/perl -w + +# usage: cat file.lst opensm-path-records.dump | dump2psl.pl + +my $h = "([a-fA-F0-9]+)"; +my $H = "([xXa-fA-F0-9]+)"; +my $D = "([0-9]+)"; + +my $n; +my $p; +my %port2node; + +my $ca_port = 0x0; + +while (<>) { + + # parse .lst file, look for node GUID <-> port GUID relationship,
hash it
+
+ if (/[^C]*\{\s*CA Ports[^N]*NodeGUID:$h\s*PortGUID:$h/) {
+
+
+ $n = "0x" . $1;
+ $p = "0x" . $2;
+
+ if (defined $port2node{$p}) {
+ if ($port2node{$p} ne $n) {
+ printf STDERR "Cowardly refusing to reassign port GUID $p\n";
+ printf STDERR "from node GUID $port2node{$p} ";
+ printf STDERR "to node GUID $n\n";
+ next;
+ }
+ next;
+ }
+ $port2node{$p} = $n;
+ # printf STDERR "Assigned port GUID $p to node GUID $n\n";
+ }
+
+ # parse opensm-path-records.dump, reformat for ibdmchk .psl format
+
+ if (/^Channel\s+Adapter\s+$H/) {
+ $ca_port = $1;
+ }
+
+ if (/^\s*$H\s+:\s+$D\s+:\s+$D\s+:\s+$D\s+/) {
+
+ if (!defined($port2node{$ca_port})) {
+ next;
+ }
+ printf "%s %d %d\n", $port2node{$ca_port}, oct($1), $2;
+ }
+}
scripts/dump2slvl.pl new file +24 -0
@@ -0,0 +1,24 @@ +#! /usr/bin/perl -w + +my $switch = 0x0; + +my $H = "([xXa-fA-F0-9]+)"; +my $D = "([0-9]+)"; +my $DD = "\\s+([0-9]+)\\s+([0-9]+)"; + +while (<>) { + + if (/^Switch\s+$H/) { + $switch = $1; + } + + if (/^\s*$D\s+$D\s+:$DD$DD$DD$DD$DD$DD$DD$DD/) { + + printf "%s %d %d", $switch, $1, $2; + printf " 0x%x%x 0x%x%x", $3, $4, $5, $6; + printf " 0x%x%x 0x%x%x", $7, $8, $9, $10; + printf " 0x%x%x 0x%x%x", $11, $12, $13, $14; + printf " 0x%x%x 0x%x%x", $15, $16, $17, $18; + printf "\n"; + } +}
Signature · 6 lines
1.5.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html