It similar to ibcheckerrors fix - don't use 'all port' option for CA
ports querying and reset.

Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]>
---
 infiniband-diags/scripts/ibchecknet.in      |   46 ++++++++++-----------------
 infiniband-diags/scripts/ibclearcounters.in |    6 +---
 infiniband-diags/scripts/ibclearerrors.in   |    4 +--
 infiniband-diags/scripts/ibdatacounters.in  |   41 +++++++----------------
 4 files changed, 32 insertions(+), 65 deletions(-)

diff --git a/infiniband-diags/scripts/ibchecknet.in 
b/infiniband-diags/scripts/ibchecknet.in
index b6e0945..ebcf22d 100644
--- a/infiniband-diags/scripts/ibchecknet.in
+++ b/infiniband-diags/scripts/ibchecknet.in
@@ -72,16 +72,16 @@ BEGIN {
        ne=0
        pe=0
 }
-function check_node(lid)
+function check_node(lid, port)
 {
-       nodechecked=1
-       if (system("'$IBPATH'/ibchecknode'"$ca_info"' '$gflags' '$verbose' " 
lid)) {
+       if (system("'$IBPATH'/ibchecknode '"$ca_info"' '$gflags' '$verbose' " 
lid)) {
                ne++
-               badnode=1
-               return
+               print "\n# " ntype ": nodeguid 0x" nodeguid " failed"
+               return 1;
        }
-       if (system("'$IBPATH'/ibcheckerrs'"$ca_info"' '$gflags' '$verbose' " 
lid " 255"))
-               nodeerr=1;
+       if (system("'$IBPATH'/ibcheckerrs '"$ca_info"' '$gflags' '$verbose' 
'$brief' " lid " " port))
+               return  2;
+       return 0;
 }
 
 /^Ca/ || /^Switch/ || /^Rt/ {
@@ -90,30 +90,27 @@ function check_node(lid)
                        if ('$v' || ntype != "Switch") 
                                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)
+                       err = check_node(lid, 255)
                }
 /^\[/  {
                nports++
                port = $1
-               if (!nodechecked) {
-                       lid = substr($0, index($0, " lid ") + 5)
-                       lid = substr(lid, 1, index(lid, " ") - 1)
-                       check_node(lid)
-               }
-               if (badnode) {
-                       print "\n# " ntype ": nodeguid 0x" nodeguid " failed"
-                       next
-               }
                sub("\\(.*\\)", "", port)
                gsub("[\\[\\]]", "", port)
+               if (ntype != "Switch") {
+                       lid = substr($0, index($0, " lid ") + 5)
+                       lid = substr(lid, 1, index(lid, " ") - 1)
+                       if (check_node(lid, port) == 2)
+                               pcnterr++;
+               } else if (err &&
+                          system("'$IBPATH'/ibcheckerrs '"$ca_info"' '$gflags' 
'$verbose' '$brief' " lid " " port))
+                       pcnterr++;
                if (system("'$IBPATH'/ibcheckport'"$ca_info"' '$gflags' 
'$verbose' " lid " " port)) {
                        if (!'$v' && oldlid != lid) {
                                print "# Checked " ntype ": nodeguid 0x" 
nodeguid " with failure"
@@ -121,15 +118,6 @@ function check_node(lid)
                        }
                        pe++;
                }
-
-               if (nodeerr)
-                       if (system("'$IBPATH'/ibcheckerrs'"$ca_info"' '$gflags' 
'$verbose' " lid " " port)) {
-                               if (!'$v' && oldlid != lid) {
-                                       print "# Checked " ntype ": nodeguid 
0x" nodeguid " with failure"
-                                       oldlid = lid
-                               }
-                               pcnterr++;
-                       }
 }
 
 /^ib/  {print $0; next}
diff --git a/infiniband-diags/scripts/ibclearcounters.in 
b/infiniband-diags/scripts/ibclearcounters.in
index 0413d86..5b4e60c 100644
--- a/infiniband-diags/scripts/ibclearcounters.in
+++ b/infiniband-diags/scripts/ibclearcounters.in
@@ -18,7 +18,6 @@ trap user_abort SIGINT
 gflags=""
 verbose=""
 v=0
-oldlid=""
 topofile=""
 ca_info=""
 
@@ -67,14 +66,12 @@ echo "$text" | awk '
 
 function clear_counters(lid)
 {
-       nodecleared=1
        if (system("'$IBPATH'/perfquery'"$ca_info"' '$gflags' -R -a " lid))
                nodeerr++
 }
 
 function clear_port_counters(lid, port)
 {
-       nodecleared=1
        if (system("'$IBPATH'/perfquery'"$ca_info"' '$gflags' -R " lid " " 
port))
                nodeerr++
 }
@@ -82,7 +79,6 @@ function clear_port_counters(lid, port)
 /^Ca/ || /^Switch/ || /^Rt/ {
                        nnodes++
                        ntype=$1; nodeguid=substr($3, 4, 16); ports=$2
-                       nodecleared=0
                        if (ntype != "Switch")
                                next
 
@@ -95,7 +91,7 @@ function clear_port_counters(lid, port)
                        port = $1
                        sub("\\(.*\\)", "", port)
                        gsub("[\\[\\]]", "", port)
-                       if (!nodecleared) {
+                       if (ntype != "Switch") {
                                lid = substr($0, index($0, " lid ") + 5)
                                lid = substr(lid, 1, index(lid, " ") - 1)
                                clear_port_counters(lid, port)
diff --git a/infiniband-diags/scripts/ibclearerrors.in 
b/infiniband-diags/scripts/ibclearerrors.in
index 930efa6..edf93f5 100644
--- a/infiniband-diags/scripts/ibclearerrors.in
+++ b/infiniband-diags/scripts/ibclearerrors.in
@@ -67,7 +67,6 @@ echo "$text" | awk '
 
 function clear_errors(lid, port)
 {
-       nodecleared=1
        if (system("'$IBPATH'/perfquery'"$ca_info"' '$gflags' -R " lid " " port 
" 0x0fff"))
                nodeerr++
 }
@@ -75,7 +74,6 @@ function clear_errors(lid, port)
 /^Ca/ || /^Switch/ || /^Rt/ {
                        nnodes++
                        ntype=$1; nodeguid=substr($3, 4, 16); ports=$2
-                       nodecleared=0
                        if (ntype != "Switch")
                                next
 
@@ -88,7 +86,7 @@ function clear_errors(lid, port)
                        port = $1
                        sub("\\(.*\\)", "", port)
                        gsub("[\\[\\]]", "", port)
-                       if (!nodecleared) {
+                       if (ntype != "Switch") {
                                lid = substr($0, index($0, " lid ") + 5)
                                lid = substr(lid, 1, index(lid, " ") - 1)
                                clear_errors(lid, port)
diff --git a/infiniband-diags/scripts/ibdatacounters.in 
b/infiniband-diags/scripts/ibdatacounters.in
index 7f0df1c..fa2455b 100644
--- a/infiniband-diags/scripts/ibdatacounters.in
+++ b/infiniband-diags/scripts/ibdatacounters.in
@@ -21,7 +21,6 @@ brief=""
 v=0
 ntype=""
 nodeguid=""
-oldlid=""
 topofile=""
 ca_info=""
 
@@ -79,16 +78,14 @@ echo "$text" | awk '
 BEGIN {
        ne=0
 }
-function check_node(lid)
+function check_node(lid, port)
 {
-       nodechecked=1
-       if (system("'$IBPATH'/ibchecknode'"$ca_info"' '$gflags' '$verbose' " 
lid)) {
+       if (system("'$IBPATH'/ibchecknode '"$ca_info"' '$gflags' '$verbose' " 
lid)) {
                ne++
-               badnode=1
-               return
+               print "\n# " ntype ": nodeguid 0x" nodeguid " failed"
+               return 1;
        }
-       if (system("'$IBPATH'/ibdatacounts'"$ca_info"' '$gflags' '$verbose' 
'$brief' " lid " 255"))
-               nodeerr=1;
+       return system("'$IBPATH'/ibcheckerrs '"$ca_info"' '$gflags' '$verbose' 
'$brief' " lid " " port);
 }
 
 /^Ca/ || /^Switch/ || /^Rt/ {
@@ -97,37 +94,25 @@ function check_node(lid)
                        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)
+                       err = check_node(lid, 255)
                }
 /^\[/  {
                nports++
                port = $1
-               if (!nodechecked) {
-                       lid = substr($0, index($0, " lid ") + 5)
-                       lid = substr(lid, 1, index(lid, " ") - 1)
-                       check_node(lid)
-               }
-               if (badnode) {
-                       print "\n# " ntype ": nodeguid 0x" nodeguid " failed"
-                       next
-               }
                sub("\\(.*\\)", "", port)
                gsub("[\\[\\]]", "", port)
-               if (nodeerr)
-                       if (system("'$IBPATH'/ibdatacounts'"$ca_info"' 
'$gflags' '$verbose' '$brief' " lid " " port)) {
-                               if (!'$v' && oldlid != lid) {
-                                       print "# Checked " ntype ": nodeguid 
0x" nodeguid " with failure"
-                                       oldlid = lid
-                               }
-                       }
+               if (ntype != "Switch") {
+                       lid = substr($0, index($0, " lid ") + 5)
+                       lid = substr(lid, 1, index(lid, " ") - 1)
+                       check_node(lid, port)
+               } else if (err) 
+                       system("'$IBPATH'/ibdatacounts '"$ca_info"' '$gflags' 
'$verbose' '$brief' " lid " " port);
 }
 
 /^ib/  {print $0; next}
-- 
1.5.3.4.206.g58ba4

_______________________________________________
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