From patchwork Thu Sep 10 09:45:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keshetti Mahesh X-Patchwork-Id: 46577 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8A9lZEf025274 for ; Thu, 10 Sep 2009 09:47:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755345AbZIJJqP (ORCPT ); Thu, 10 Sep 2009 05:46:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755348AbZIJJqN (ORCPT ); Thu, 10 Sep 2009 05:46:13 -0400 Received: from mail-px0-f196.google.com ([209.85.216.196]:38672 "EHLO mail-px0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755345AbZIJJqJ (ORCPT ); Thu, 10 Sep 2009 05:46:09 -0400 Received: by pxi34 with SMTP id 34so1645284pxi.16 for ; Thu, 10 Sep 2009 02:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:cc:content-type; bh=ijG+iTfTSYW0xjQl2WYQ/AszRmF4fVcJRVektLCrSDI=; b=GCPoQ67pSnlGCIQQydwvDiRq3Vo1NfcvkCan0mPdYFhL/bHiRBOWRdEiot0uGr4CSy QhfwMAy9Se+qqocGztYStp/hJoEgWnGOH82hLfdtvGhwUn1ZQE/9E/uQPh9lFoqUGPkU hlLKabQWQU9PEK+Ni7JOaH5LZMd8yhmb34VHM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:cc:content-type; b=G4SjqI1Gpyxsn/rUK0ptvDnL/4rOjQ+gxM8na+StSaoPOwMllwIAA68WsPT7lhuBuS armrDp2CSnj+ATC1669aTpjqMk20yINJ6l9cbifXVABKT4svQFQdW4gCc4G2Tuamwj9y UclQcwtBHl65itKArMmi774yk28/ffDsE3SyQ= MIME-Version: 1.0 Received: by 10.140.203.15 with SMTP id a15mr451394rvg.183.1252575972099; Thu, 10 Sep 2009 02:46:12 -0700 (PDT) From: Keshetti Mahesh Date: Thu, 10 Sep 2009 15:15:52 +0530 Message-ID: <829ded920909100245r1dfabe03k57b2088843c0a136@mail.gmail.com> Subject: [PATCH] Added 'ibcheckspeed', Fix 'ibcheckportwidth' To: OFED mailing list Cc: OFED mailing list , Sasha Khapyorsky Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org - Added 'ibcheckspeed': Similar to 'ibcheckwidth' in operation and usage. Reports error/warning messages if the LinkSpeedActive is 2.5 Gbps when the LinkSpeedSupported is more than 2.5 Gbps. - Fix 'ibcheckportwidth': Exit if the maximum LinkWidthSupported is 1X instead of processing next line of output. Signed-off-by: Keshetti Mahesh --- infiniband-diags/scripts/ibcheckportspeed.in | 146 ++++++++++++++++++++++++++ infiniband-diags/scripts/ibcheckportwidth.in | 2 +- infiniband-diags/scripts/ibcheckspeed.in | 135 ++++++++++++++++++++++++ 3 files changed, 282 insertions(+), 1 deletions(-) create mode 100644 infiniband-diags/scripts/ibcheckportspeed.in create mode 100644 infiniband-diags/scripts/ibcheckspeed.in nnodes, ne + printf "## %d ports checked, %d ports with 2.5 Gbps speed in error found\n", nports, pe +} +' +exit $rv diff --git a/infiniband-diags/scripts/ibcheckportspeed.in b/infiniband-diags/scripts/ibcheckportspeed.in new file mode 100644 index 0000000..538a7a7 --- /dev/null +++ b/infiniband-diags/scripts/ibcheckportspeed.in @@ -0,0 +1,146 @@ +#!/bin/sh + +IBPATH=${IBPATH:-@IBSCRIPTPATH@} + +function usage() { + echo Usage: `basename $0` "[-h] [-v] [-N | -nocolor] [-G]" \ + "[-C ca_name] [-P ca_port] [-t(imeout) timeout_ms] " + exit -1 +} + +function green() { + if [ "$bw" = "yes" ]; then + if [ "$verbose" = "yes" ]; then + echo $1 + fi + return + fi + if [ "$verbose" = "yes" ]; then + echo -e "\\033[1;032m" $1 "\\033[0;39m" + fi +} + +function red() { + if [ "$bw" = "yes" ]; then + echo $1 + return + fi + echo -e "\\033[1;031m" $1 "\\033[0;39m" +} + +function blue() +{ + if [ "$bw" = "yes" ]; then + echo $1 + return + fi + echo -e "\033[1;034m" $1 "\033[0;39m" +} + +guid_addr="" +bw="" +verbose="" +ca_info="" + +while [ "$1" ]; do + case $1 in + -G) + guid_addr=yes + ;; + -nocolor|-N) + bw=yes + ;; + -v) + verbose=yes + ;; + -P | -C | -t | -timeout) + case $2 in + -*) + usage + ;; + esac + if [ x$2 = x ] ; then + usage + fi + ca_info="$ca_info $1 $2" + shift + ;; + -*) + usage + ;; + *) + break + ;; + esac + shift +done + +if [ $# -lt 2 ] +then + usage +fi + +portnum=$2 + +if [ "$guid_addr" ] +then + if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'` + then + echo -n "guid $1 address resolution: " + red "FAILED" + exit -1 + fi + guid=$1 +else + lid=$1 + if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $3}'` + then + echo -n "lid $1 address resolution: " + red "FAILED" + exit -1 + fi +fi + +text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`" +rv=$? +if echo "$text" | sed 's/[0-9]/#&/;s/ Gbps//g' | awk -v mono=$bw -F '#' ' +function blue(s) +{ + if (mono) + printf s + else if (!quiet) { + printf "\033[1;034m" s + printf "\033[0;39m" + } +} + +# Only check LinkSpeedActive if LinkSpeedSupported is not 2.5 Gbps +/^LinkSpeedSupported/{ if ($2 == "2.5") { exit } } +/^LinkSpeedActive/{ if ($2 == "2.5") warn = warn "#warn: Link configured as 2.5 Gbps lid '$lid' port '$portnum'\n"} + +/^ib/ {print $0; next} +/ibpanic:/ {print $0} +/ibwarn:/ {print $0} +/iberror:/ {print $0} + +END { + if (err != "") { + blue(err) + exit -1 + } + if (warn != "") { + blue(warn) + exit -1 + } + exit 0 +}' 2>&1 && test $rv -eq 0 ; then + if [ "$verbose" = "yes" ]; then + echo -n "Port check lid $lid port $portnum: " + green "OK" + fi + exit 0 +else + echo -n "Port check lid $lid port $portnum: " + red "FAILED" + exit -1 +fi diff --git a/infiniband-diags/scripts/ibcheckportwidth.in b/infiniband-diags/scripts/ibcheckportwidth.in index 32c5c5e..60a0892 100644 --- a/infiniband-diags/scripts/ibcheckportwidth.in +++ b/infiniband-diags/scripts/ibcheckportwidth.in @@ -103,7 +103,7 @@ function blue(s) } # Only check LinkWidthActive if LinkWidthSupported is not 1X -/^LinkWidthSupported/{ if ($2 != "1X") { next } } +/^LinkWidthSupported/{ if ($2 == "1X") { exit } } /^LinkWidthActive/{ if ($2 == "1X") warn = warn "#warn: Link configured as 1X lid '$lid' port '$portnum'\n"} /^ib/ {print $0; next} diff --git a/infiniband-diags/scripts/ibcheckspeed.in b/infiniband-diags/scripts/ibcheckspeed.in new file mode 100644 index 0000000..25c2201 --- /dev/null +++ b/infiniband-diags/scripts/ibcheckspeed.in @@ -0,0 +1,135 @@ +#!/bin/sh + +IBPATH=${IBPATH:-@IBSCRIPTPATH@} + +function usage() { + echo Usage: `basename $0` "[-h] [-v] [-N | -nocolor]" \ + "[ \| -C ca_name -P ca_port -t(imeout) timeout_ms]" + exit -1 +} + +function user_abort() { + echo "Aborted" + exit 1 +} + +trap user_abort SIGINT + +gflags="" +verbose="" +v=0 +ntype="" +nodeguid="" +oldlid="" +topofile="" +ca_info="" + +while [ "$1" ]; do + case $1 in + -h) + usage + ;; + -N|-nocolor) + gflags=-N + ;; + -v) + verbose="-v" + v=1 + ;; + -P | -C | -t | -timeout) + case $2 in + -*) + usage + ;; + esac + if [ x$2 = x ] ; then + usage + fi + ca_info="$ca_info $1 $2" + shift + ;; + -*) + usage + ;; + *) + if [ "$topofile" ]; then + usage + fi + topofile="$1" + ;; + esac + shift +done + +if [ "$topofile" ]; then + netcmd="cat $topofile" +else + netcmd="$IBPATH/ibnetdiscover $ca_info" +fi + +text="`eval $netcmd`" +rv=$? +echo "$text" | awk ' +BEGIN { + ne=0 + pe=0 +} +function check_node(lid) +{ + nodechecked=1 + if (system("'$IBPATH'/ibchecknode'"$ca_info"' '$gflags' '$verbose' " lid)) { + ne++ + badnode=1 + return + } +} + +/^Ca/ || /^Switch/ || /^Rt/ { + nnodes++ + ntype=$1; nodeguid=substr($3, 4, 16); ports=$2 + if ('$v') + print "\n# Checking " ntype ": nodeguid 0x" nodeguid + + nodechecked=0 + badnode=0 + if (ntype != "Switch") + next + + lid = substr($0, index($0, "port 0 lid ") + 11) + lid = substr(lid, 1, index(lid, " ") - 1) + check_node(lid) + } +/^\[/ { + 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 (system("'$IBPATH'/ibcheckportspeed'"$ca_info"' '$gflags' '$verbose' " lid " " port)) { + if (!'$v' && oldlid != lid) { + print "# Checked " ntype ": nodeguid 0x" nodeguid " with failure" + oldlid = lid + } + pe++; + } +} + +/^ib/ {print $0; next} +/ibpanic:/ {print $0} +/ibwarn:/ {print $0} +/iberror:/ {print $0} + +END { + printf "\n## Summary: %d nodes checked, %d bad nodes found\n",