3 IBPATH=${IBPATH:-@IBSCRIPTPATH@}
6 echo Usage: `basename $0` "[-h] [<topology-file>" \
7 "| -C ca_name -P ca_port -t(imeout) timeout_ms]"
11 function user_abort() {
16 trap user_abort SIGINT
29 -P | -C | -t | -timeout)
38 ca_info="$ca_info $1 $2"
45 if [ "$topofile" ]; then
54 if [ "$topofile" ]; then
55 netcmd="cat $topofile"
57 netcmd="$IBPATH/ibnetdiscover $ca_info"
64 function clear_counters(lid)
66 if (system("'$IBPATH'/perfquery'"$ca_info"' '$gflags' -R -a " lid))
70 function clear_port_counters(lid, port)
72 if (system("'$IBPATH'/perfquery'"$ca_info"' '$gflags' -R " lid " " port))
76 /^Ca/ || /^Switch/ || /^Rt/ {
78 ntype=$1; nodeguid=substr($3, 4, 16); ports=$2
79 if (ntype != "Switch")
82 lid = substr($0, index($0, "port 0 lid ") + 11)
83 lid = substr(lid, 1, index(lid, " ") - 1)
89 sub("\\(.*\\)", "", port)
90 gsub("[\\[\\]]", "", port)
91 if (ntype != "Switch") {
92 lid = substr($0, index($0, " lid ") + 5)
93 lid = substr(lid, 1, index(lid, " ") - 1)
94 clear_port_counters(lid, port)
98 /^ib/ {print $0; next}
101 /iberror:/ {print $0}
104 printf "\n## Summary: %d nodes cleared %d errors\n", nnodes, nodeerr