3 # Usage ibstatus [devname[:port]]
5 infiniband_base="/sys/class/infiniband"
10 echo "Usage: " $prog " [-h] [devname[:portnum]]"
11 echo " -h: this help screen"
13 echo " $prog mthca1 # shows status of all ports of 'mthca1'"
14 echo " $prog mthca0:2 # shows status port number 2 of 'mthca0'"
15 echo " $prog # default: shows status of all '$def_ibdev' ports"
20 echo "Fatal error: " $*
26 port_dir="$infiniband_base/$1/ports/$2"
27 echo "Infiniband device '$1' port $2 status:"
28 echo " default gid: " `[ -r $port_dir/gids/0 ] && cat $port_dir/gids/0 || echo unknown`
29 echo " base lid: " `[ -r $port_dir/lid ] && cat $port_dir/lid || echo unknown`
30 echo " sm lid: " `[ -r $port_dir/sm_lid ] && cat $port_dir/sm_lid || echo unknown`
31 echo " state: " `[ -r $port_dir/state ] && cat $port_dir/state || echo unknown`
32 echo " phys state: " `[ -r $port_dir/phys_state ] && cat $port_dir/phys_state || echo unknown`
33 echo " rate: " `[ -r $port_dir/rate ] && cat $port_dir/rate || echo unknown`
38 ports_dir="$infiniband_base/$1/ports"
40 if ! [ -d "$ports_dir" ]; then
41 fatal "device '$1': sys files not found ($ports_dir)"
44 if [ "$2" = "+" ]; then
45 ports=`(cd "$infiniband_base/$1/ports" 2>/dev/null || fatal No devices; echo *)`
55 if [ "$1" = "-h" ]; then
60 cd $infiniband_base 2>/dev/null || fatal No devices
68 dev=`echo $1 | sed 's/:.*$//'`
69 port=`echo $1 | sed 's/^.*://'`
71 if [ "$port" = "$dev" ]; then