iblinkinfo.pl warns when the link speed (or width) is higher than
one of the supported values. For example, we're seeing:

168   11[  ]  ==( 4X 10.0 Gbps Active /   LinkUp)==>     169   \
        11[  ] "Infiniscale-IV Mellanox Technologies" (  Could be 5.0 Gbps)

It's complaining that 10Gbps was negotiated even though 5.0Gbps is
available, which I doubt is the intended behavior.

The following patch causes iblinkinfo to warn only when the link
speed (or width) is lower than the greatest common value supported
by both ports.

Signed-off-by: Arthur Kepner <[email protected]>
---

diff -rup a/scripts/iblinkinfo.pl b/scripts/iblinkinfo.pl
--- a/scripts/iblinkinfo.pl     2009-07-29 13:16:02.889073624 -0700
+++ b/scripts/iblinkinfo.pl     2009-07-29 13:17:24.902170284 -0700
@@ -168,9 +168,11 @@ sub main
                        }
                        my @lines          = split("\n", $data);
                        my $speed          = "";
+                       my $nspeed         = -1; # in Gbps
                        my $speed_sup      = "";
                        my $speed_enable   = "";
                        my $width          = "";
+                       my $nwidth         = -1;
                        my $width_sup      = "";
                        my $width_enable   = "";
                        my $state          = "";
@@ -179,12 +181,18 @@ sub main
                        my $phy_link_state = "";

                        foreach my $line (@lines) {
-                               if ($line =~ /^LinkSpeedActive:\.+(.*)/) { 
$speed = $1; }
+                               if ($line =~ 
/^LinkSpeedActive:\.+(\d+\.\d+)(.*)/) {
+                                       $nspeed = $1;
+                                       $speed = $1.$2;
+                               }
                                if ($line =~ /^LinkSpeedEnabled:\.+(.*)/) {
                                        $speed_enable = $1;
                                }
                                if ($line =~ /^LinkSpeedSupported:\.+(.*)/) { 
$speed_sup = $1; }
-                               if ($line =~ /^LinkWidthActive:\.+(.*)/)    { 
$width     = $1; }
+                               if ($line =~ /^LinkWidthActive:\.+(\d+)(.*)/) {
+                                       $nwidth     = $1;
+                                       $width = $1.$2;
+                               }
                                if ($line =~ /^LinkWidthEnabled:\.+(.*)/) {
                                        $width_enable = $1;
                                }
@@ -243,19 +251,19 @@ sub main
                                if ($rem_width_enable ne "" && $rem_width_sup 
ne "") {
                                        if (   $width_enable =~ /12X/
                                                && $rem_width_enable =~ /12X/
-                                               && $width !~ /12X/)
+                                               && $nwidth < 12)
                                        {
                                                $width_msg = "Could be 12X";
                                        } else {
                                                if (   $width_enable =~ /8X/
                                                        && $rem_width_enable =~ 
/8X/
-                                                       && $width !~ /8X/)
+                                                       && $nwidth < 8)
                                                {
                                                        $width_msg = "Could be 
8X";
                                                } else {
                                                        if (   $width_enable =~ 
/4X/
                                                                && 
$rem_width_enable =~ /4X/
-                                                               && $width !~ 
/4X/)
+                                                               && $nwidth < 4)
                                                        {
                                                                $width_msg = 
"Could be 4X";
                                                        }
@@ -265,13 +273,13 @@ sub main
                                if ($rem_speed_enable ne "" && $rem_speed_sup 
ne "") {
                                        if (   $speed_enable =~ /10\.0/
                                                && $rem_speed_enable =~ /10\.0/
-                                               && $speed !~ /10\.0/)
+                                               && $nspeed < 10.0)
                                        {
                                                $speed_msg = "Could be 10.0 
Gbps";
                                        } else {
                                                if (   $speed_enable =~ /5\.0/
                                                        && $rem_speed_enable =~ 
/5\.0/
-                                                       && $speed !~ /5\.0/)
+                                                       && $nspeed < 5.0)
                                                {
                                                        $speed_msg = "Could be 
5.0 Gbps";
                                                }

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to