[ofa-general] [PATCH] infiniband-diags/scripts/iblinkinfo.pl: Fix switch to switch output with new ibnetdiscover output.
Ira Weiny
weiny2 at llnl.gov
Thu Jan 24 19:02:27 PST 2008
I am not sure when the "port guid output" format change to ibnetdiscover
happened, but I just realized that switch to switch links were not being parsed
correctly by IBswcountlimits.pm. This caused issues with some of the perl
diags. I have fixed this. Furthermore, Erez mentioned that he would like port
guid output so I threw that option in as well. (Since I have to parse that
info out of ibnetdiscover now.)
One might wonder why I did not catch this before? If you mainly test on a 1
switch system you don't get to see what switch to switch links look like in
diag output... :-( I have learned my lesson, sorry.
Sasha, this needs to be in 1.3 as well.
Sorry, :-(
Ira
>From 89887aff392b0f40acf4035c19e06359271dfe6a Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Thu, 24 Jan 2008 18:50:38 -0800
Subject: [PATCH] infiniband-diags/scripts/iblinkinfo.pl: Fix switch to switch output with new
ibnetdiscover output.
ibnetdiscover now prints port guids. This format change cause the regex to
break when parsing switch to switch links. Fix this by parsing for the
remote port guid. And while we are at it add an option to print the port
guids parsed.
Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
infiniband-diags/scripts/IBswcountlimits.pm | 41 ++++++++++++++++----------
infiniband-diags/scripts/iblinkinfo.pl | 9 ++++-
2 files changed, 32 insertions(+), 18 deletions(-)
diff --git a/infiniband-diags/scripts/IBswcountlimits.pm b/infiniband-diags/scripts/IBswcountlimits.pm
index 6985750..c698ed1 100755
--- a/infiniband-diags/scripts/IBswcountlimits.pm
+++ b/infiniband-diags/scripts/IBswcountlimits.pm
@@ -288,62 +288,71 @@ sub get_link_ends
if ( $in_switch eq "yes" )
{
my $rec = undef;
- if ($line =~ /^\[(\d+)\]\s+\"[HSR]-(.+)\"\[(\d+)\]\(.+\)\s+#.*\"(.*)\"\.* lid (\d+).*/)
+ if ($line =~ /^\[(\d+)\]\s+\"[HSR]-(.+)\"\[(\d+)\](\(.+\))?\s+#.*\"(.*)\"\.* lid (\d+).*/)
{
$loc_port = $1;
my $rem_guid = $2;
my $rem_port = $3;
- my $rem_desc = $4;
- my $rem_lid = $5;
+ my $rem_port_guid = $4;
+ my $rem_desc = $5;
+ my $rem_lid = $6;
$rec = { loc_guid => "0x$guid", loc_port => $loc_port, loc_ext_port => "",
loc_desc => $desc, loc_sw_lid => $loc_sw_lid,
rem_guid => "0x$rem_guid", rem_lid => $rem_lid,
- rem_port => $rem_port, rem_ext_port => "", rem_desc => $rem_desc };
+ rem_port => $rem_port, rem_ext_port => "", rem_desc => $rem_desc,
+ rem_port_guid => $rem_port_guid };
}
- if ($line =~ /^\[(\d+)\]\[ext (\d+)\]\s+\"[HSR]-(.+)\"\[(\d+)\]\(.+\)\s+#.*\"(.*)\"\.* lid (\d+).*/)
+ if ($line =~ /^\[(\d+)\]\[ext (\d+)\]\s+\"[HSR]-(.+)\"\[(\d+)\](\(.+\))?\s+#.*\"(.*)\"\.* lid (\d+).*/)
{
$loc_port = $1;
my $loc_ext_port = $2;
my $rem_guid = $3;
my $rem_port = $4;
- my $rem_desc = $5;
- my $rem_lid = $6;
+ my $rem_port_guid = $5;
+ my $rem_desc = $6;
+ my $rem_lid = $7;
$rec = { loc_guid => "0x$guid", loc_port => $loc_port, loc_ext_port => $loc_ext_port,
loc_desc => $desc, loc_sw_lid => $loc_sw_lid,
rem_guid => "0x$rem_guid", rem_lid => $rem_lid,
- rem_port => $rem_port, rem_ext_port => "", rem_desc => $rem_desc };
+ rem_port => $rem_port, rem_ext_port => "", rem_desc => $rem_desc,
+ rem_port_guid => $rem_port_guid };
}
- if ($line =~ /^\[(\d+)\]\s+\"[HSR]-(.+)\"\[(\d+)\]\[ext (\d+)\]\(.+\)\s+#.*\"(.*)\"\.* lid (\d+).*/)
+ if ($line =~ /^\[(\d+)\]\s+\"[HSR]-(.+)\"\[(\d+)\]\[ext (\d+)\](\(.+\))?\s+#.*\"(.*)\"\.* lid (\d+).*/)
{
$loc_port = $1;
my $rem_guid = $2;
my $rem_port = $3;
my $rem_ext_port = $4;
- my $rem_desc = $5;
- my $rem_lid = $6;
+ my $rem_port_guid = $5;
+ my $rem_desc = $6;
+ my $rem_lid = $7;
$rec = { loc_guid => "0x$guid", loc_port => $loc_port, loc_ext_port => "",
loc_desc => $desc, loc_sw_lid => $loc_sw_lid,
rem_guid => "0x$rem_guid", rem_lid => $rem_lid,
rem_port => $rem_port, rem_ext_port => $rem_ext_port,
- rem_desc => $rem_desc };
+ rem_desc => $rem_desc,
+ rem_port_guid => $rem_port_guid };
}
- if ($line =~ /^\[(\d+)\]\[ext (\d+)\]\s+\"[HSR]-(.+)\"\[(\d+)\]\[ext (\d+)\]\(.+\)\s+#.*\"(.*)\"\.* lid (\d+).*/)
+ if ($line =~ /^\[(\d+)\]\[ext (\d+)\]\s+\"[HSR]-(.+)\"\[(\d+)\]\[ext (\d+)\](\(.+\))?\s+#.*\"(.*)\"\.* lid (\d+).*/)
{
$loc_port = $1;
my $loc_ext_port = $2;
my $rem_guid = $3;
my $rem_port = $4;
my $rem_ext_port = $5;
- my $rem_desc = $6;
- my $rem_lid = $7;
+ my $rem_port_guid = $6;
+ my $rem_desc = $7;
+ my $rem_lid = $8;
$rec = { loc_guid => "0x$guid", loc_port => $loc_port, loc_ext_port => $loc_ext_port,
loc_desc => $desc, loc_sw_lid => $loc_sw_lid,
rem_guid => "0x$rem_guid", rem_lid => $rem_lid,
rem_port => $rem_port, rem_ext_port => $rem_ext_port,
- rem_desc => $rem_desc };
+ rem_desc => $rem_desc,
+ rem_port_guid => $rem_port_guid };
}
if ($rec)
{
+ $rec->{rem_port_guid} =~ s/\((.*)\)/$1/;
$IBswcountlimits::link_ends{"0x$guid"}{$loc_port} = $rec;
}
}
diff --git a/infiniband-diags/scripts/iblinkinfo.pl b/infiniband-diags/scripts/iblinkinfo.pl
index 6d02eac..764e92d 100755
--- a/infiniband-diags/scripts/iblinkinfo.pl
+++ b/infiniband-diags/scripts/iblinkinfo.pl
@@ -54,6 +54,7 @@ sub usage_and_exit
print " -c print port capabilities (enabled/supported values)\n";
print " -C <ca_name> use selected Channel Adaptor name for queries\n";
print " -P <ca_port> use selected channel adaptor port for queries\n";
+ print " -g print port guids instead of node guids\n";
exit 0;
}
@@ -66,9 +67,10 @@ my $print_extended_cap = undef;
my $only_down_links = undef;
my $ca_name = "";
my $ca_port = "";
+my $print_port_guids = undef;
chomp $argv0;
-if (!getopts("hcpldRS:C:P:")) { usage_and_exit $argv0; }
+if (!getopts("hcpldRS:C:P:g")) { usage_and_exit $argv0; }
if (defined $Getopt::Std::opt_h) { usage_and_exit $argv0; }
if (defined $Getopt::Std::opt_R) { $regenerate_map = $Getopt::Std::opt_R; }
if (defined $Getopt::Std::opt_S) { $single_switch = $Getopt::Std::opt_S; }
@@ -78,6 +80,7 @@ if (defined $Getopt::Std::opt_p) { $print_add_switch = $Getopt::Std::opt_p; }
if (defined $Getopt::Std::opt_c) { $print_extended_cap = $Getopt::Std::opt_c; }
if (defined $Getopt::Std::opt_C) { $ca_name = $Getopt::Std::opt_C; }
if (defined $Getopt::Std::opt_P) { $ca_port = $Getopt::Std::opt_P; }
+if (defined $Getopt::Std::opt_g) { $print_port_guids = $Getopt::Std::opt_g; }
my $extra_smpquery_params = get_ca_name_port_param_string($ca_name, $ca_port);
@@ -145,7 +148,6 @@ sub main
if ($line =~ /^VLStallCount:\.+(.*)/) { $vl_stall = $1; }
if ($line =~ /^PhysLinkState:\.+(.*)/) { $phy_link_state = $1; }
}
- my $rem_guid = $hr->{rem_guid};
my $rem_port = $hr->{rem_port};
my $rem_lid = $hr->{rem_lid};
my $rem_speed_sup = "";
@@ -216,6 +218,9 @@ sub main
{
my $line_begin = sprintf ("%18s \"%30s\"%s", $switch, $hr->{loc_desc}, $pkt_life_prompt);
my $ext_guid = sprintf ("%18s", $hr->{rem_guid});
+ if ($print_port_guids && $hr->{rem_port_guid} ne "") {
+ $ext_guid = sprintf ("0x%016s", $hr->{rem_port_guid});
+ }
push (@output_lines, sprintf ("%s %6s %4s[%2s] ==%s%s==> %18s %6s %4s[%2s] \"%s\" ( %s %s)\n",
$line_begin,
$hr->{loc_sw_lid}, $port, $hr->{loc_ext_port},
--
1.5.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-infiniband-diags-scripts-iblinkinfo.pl-Fix-switch-t.patch
Type: application/octet-stream
Size: 7196 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20080124/e5d96226/attachment.obj>
More information about the general
mailing list