[ofa-general] [PATCH] Fix bug which prevented some GUIDs from being found due to formating issues.
Ira Weiny
weiny2 at llnl.gov
Fri Feb 29 11:25:09 PST 2008
Correct (hopefully ;-) version of patch. I also found a couple more tools
which were affected so they are included in this patch.
Ira
>From c98dc28daf141781ed0cd15f09c95f9f0eda8eae Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Thu, 28 Feb 2008 15:03:23 -0800
Subject: [PATCH] Fix bug which prevented some GUIDs from being found due to formating issues.
Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
infiniband-diags/scripts/IBswcountlimits.pm | 16 +++++++++++++++-
infiniband-diags/scripts/ibfindnodesusing.pl | 2 +-
infiniband-diags/scripts/iblinkinfo.pl | 8 +++++---
infiniband-diags/scripts/ibprintca.pl | 2 +-
infiniband-diags/scripts/ibprintrt.pl | 2 +-
infiniband-diags/scripts/ibprintswitch.pl | 2 +-
infiniband-diags/scripts/ibqueryerrors.pl | 4 +++-
7 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/infiniband-diags/scripts/IBswcountlimits.pm b/infiniband-diags/scripts/IBswcountlimits.pm
index bddc421..b88867e 100755
--- a/infiniband-diags/scripts/IBswcountlimits.pm
+++ b/infiniband-diags/scripts/IBswcountlimits.pm
@@ -431,6 +431,20 @@ sub get_num_ports
}
# =========================================================================
+# format_guid(guid)
+# The diags store the guids as strings. This converts the guid supplied
+# to the correct string format.
+# eg: 0x0008f10400411f56 == 0x8f10400411f56
+#
+sub format_guid
+{
+ my $guid = hex $_[0];
+ my $guid_str = "";
+ $guid_str = sprintf("0x%016x", $guid);
+ return ($guid_str);
+}
+
+# =========================================================================
# convert_dr_to_guid(direct_route)
#
sub convert_dr_to_guid
@@ -442,7 +456,7 @@ sub convert_dr_to_guid
foreach my $line (@lines) {
if ($line =~ /^PortGuid:\.+(.*)/) { $guid = $1; }
}
- return $guid;
+ return format_guid($guid);
}
# =========================================================================
diff --git a/infiniband-diags/scripts/ibfindnodesusing.pl b/infiniband-diags/scripts/ibfindnodesusing.pl
index 2521255..1bf0987 100755
--- a/infiniband-diags/scripts/ibfindnodesusing.pl
+++ b/infiniband-diags/scripts/ibfindnodesusing.pl
@@ -92,7 +92,7 @@ if (defined $Getopt::Std::opt_R) { $regenerate_map = $Getopt::Std::opt_R; }
if (defined $Getopt::Std::opt_C) { $ca_name = $Getopt::Std::opt_C; }
if (defined $Getopt::Std::opt_P) { $ca_port = $Getopt::Std::opt_P; }
-my $target_switch = $ARGV[0];
+my $target_switch = format_guid($ARGV[0]);
my $target_port = $ARGV[1];
get_link_ends($regenerate_map, $ca_name, $ca_port);
diff --git a/infiniband-diags/scripts/iblinkinfo.pl b/infiniband-diags/scripts/iblinkinfo.pl
index 195c8cf..b2c90a1 100755
--- a/infiniband-diags/scripts/iblinkinfo.pl
+++ b/infiniband-diags/scripts/iblinkinfo.pl
@@ -80,9 +80,11 @@ chomp $argv0;
if (!getopts("hcpldRS:D:C:P:g")) { usage_and_exit $argv0; }
if (defined $Getopt::Std::opt_h) { usage_and_exit $argv0; }
-if (defined $Getopt::Std::opt_D) { $direct_route = $Getopt::Std::opt_D; }
-if (defined $Getopt::Std::opt_R) { $regenerate_map = $Getopt::Std::opt_R; }
-if (defined $Getopt::Std::opt_S) { $single_switch = $Getopt::Std::opt_S; }
+if (defined $Getopt::Std::opt_D) { $direct_route = $Getopt::Std::opt_D; }
+if (defined $Getopt::Std::opt_R) { $regenerate_map = $Getopt::Std::opt_R; }
+if (defined $Getopt::Std::opt_S) {
+ $single_switch = format_guid($Getopt::Std::opt_S);
+}
if (defined $Getopt::Std::opt_d) { $only_down_links = $Getopt::Std::opt_d; }
if (defined $Getopt::Std::opt_l) { $line_mode = $Getopt::Std::opt_l; }
if (defined $Getopt::Std::opt_p) { $print_add_switch = $Getopt::Std::opt_p; }
diff --git a/infiniband-diags/scripts/ibprintca.pl b/infiniband-diags/scripts/ibprintca.pl
index 0c6ca0e..38b4330 100755
--- a/infiniband-diags/scripts/ibprintca.pl
+++ b/infiniband-diags/scripts/ibprintca.pl
@@ -67,7 +67,7 @@ if (defined $Getopt::Std::opt_l) { $list_hcas = $Getopt::Std::opt_l; }
if (defined $Getopt::Std::opt_C) { $ca_name = $Getopt::Std::opt_C; }
if (defined $Getopt::Std::opt_P) { $ca_port = $Getopt::Std::opt_P; }
-my $target_hca = $ARGV[0];
+my $target_hca = format_guid($ARGV[0]);
my $cache_file = get_cache_file($ca_name, $ca_port);
diff --git a/infiniband-diags/scripts/ibprintrt.pl b/infiniband-diags/scripts/ibprintrt.pl
index 2918dc6..86dcb64 100755
--- a/infiniband-diags/scripts/ibprintrt.pl
+++ b/infiniband-diags/scripts/ibprintrt.pl
@@ -67,7 +67,7 @@ if (defined $Getopt::Std::opt_l) { $list_rts = $Getopt::Std::opt_l; }
if (defined $Getopt::Std::opt_C) { $ca_name = $Getopt::Std::opt_C; }
if (defined $Getopt::Std::opt_P) { $ca_port = $Getopt::Std::opt_P; }
-my $target_rt = $ARGV[0];
+my $target_rt = format_guid($ARGV[0]);
my $cache_file = get_cache_file($ca_name, $ca_port);
diff --git a/infiniband-diags/scripts/ibprintswitch.pl b/infiniband-diags/scripts/ibprintswitch.pl
index 9548619..2dc0040 100755
--- a/infiniband-diags/scripts/ibprintswitch.pl
+++ b/infiniband-diags/scripts/ibprintswitch.pl
@@ -66,7 +66,7 @@ if (defined $Getopt::Std::opt_l) { $list_switches = $Getopt::Std::opt_l; }
if (defined $Getopt::Std::opt_C) { $ca_name = $Getopt::Std::opt_C; }
if (defined $Getopt::Std::opt_P) { $ca_port = $Getopt::Std::opt_P; }
-my $target_switch = $ARGV[0];
+my $target_switch = format_guid($ARGV[0]);
my $cache_file = get_cache_file($ca_name, $ca_port);
diff --git a/infiniband-diags/scripts/ibqueryerrors.pl b/infiniband-diags/scripts/ibqueryerrors.pl
index ef61e9b..200a40c 100755
--- a/infiniband-diags/scripts/ibqueryerrors.pl
+++ b/infiniband-diags/scripts/ibqueryerrors.pl
@@ -171,7 +171,9 @@ if (defined $Getopt::Std::opt_c) {
if (defined $Getopt::Std::opt_r) { $report_port_info = $Getopt::Std::opt_r; }
if (defined $Getopt::Std::opt_R) { $regenerate_map = $Getopt::Std::opt_R; }
if (defined $Getopt::Std::opt_D) { $direct_route = $Getopt::Std::opt_D; }
-if (defined $Getopt::Std::opt_S) { $single_switch = $Getopt::Std::opt_S; }
+if (defined $Getopt::Std::opt_S) {
+ $single_switch = format_guid($Getopt::Std::opt_S);
+}
if (defined $Getopt::Std::opt_d) {
$include_data_counters = $Getopt::Std::opt_d;
}
--
1.5.1
More information about the general
mailing list