[ofa-general] [PATCH] infiniband-diags/ibcheckerrors: fix port errors count

Sasha Khapyorsky sashak at voltaire.com
Wed Dec 12 15:46:17 PST 2007


This fixes port error counter (pcnterr) update. Also removes unsued
variables.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 infiniband-diags/scripts/ibcheckerrors.in |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/infiniband-diags/scripts/ibcheckerrors.in b/infiniband-diags/scripts/ibcheckerrors.in
index 5cfabc6..a45bd63 100644
--- a/infiniband-diags/scripts/ibcheckerrors.in
+++ b/infiniband-diags/scripts/ibcheckerrors.in
@@ -21,7 +21,6 @@ brief=""
 v=0
 ntype=""
 nodeguid=""
-oldlid=""
 topofile=""
 ca_info=""
 
@@ -81,14 +80,14 @@ BEGIN {
 }
 function check_node(lid, port)
 {
-	nodechecked=1
 	if (system("'$IBPATH'/ibchecknode '"$ca_info"' '$gflags' '$verbose' " lid)) {
 		ne++
 		print "\n# " ntype ": nodeguid 0x" nodeguid " failed"
-		return
+		return 1;
 	}
 	if (system("'$IBPATH'/ibcheckerrs '"$ca_info"' '$gflags' '$verbose' '$brief' " lid " " port))
-		nodeerr=1;
+		return 2;
+	return 0;
 }
 
 /^Ca/ || /^Switch/ || /^Rt/ {
@@ -97,15 +96,13 @@ function check_node(lid, port)
 			if ('$v')
 				print "\n# Checking " ntype ": nodeguid 0x" nodeguid
 
-			nodechecked=0
-			nodeerr=0
-			badnode=0
+			err = 0;
 			if (ntype != "Switch")
 				next
 
 			lid = substr($0, index($0, "port 0 lid ") + 11)
 			lid = substr(lid, 1, index(lid, " ") - 1)
-			check_node(lid, 255)
+			err = check_node(lid, 255)
 		}
 /^\[/	{
 		nports++
@@ -115,10 +112,9 @@ function check_node(lid, port)
 		if (ntype != "Switch") {
 			lid = substr($0, index($0, " lid ") + 5)
 			lid = substr(lid, 1, index(lid, " ") - 1)
-			check_node(lid, port)
-			if (nodeerr)
+			if (check_node(lid, port) == 2)
 				pcnterr++;
-		} else if (nodeerr &&
+		} else if (err &&
 			   system("'$IBPATH'/ibcheckerrs '"$ca_info"' '$gflags' '$verbose' '$brief' " lid " " port))
 			pcnterr++;
 }
-- 
1.5.3.4.206.g58ba4




More information about the general mailing list