Skip to content

Instantly share code, notes, and snippets.

@crazyboycjr
Last active September 10, 2019 19:24
Show Gist options
  • Save crazyboycjr/8954822efb0d41d7cacee1e350acbc1f to your computer and use it in GitHub Desktop.
Save crazyboycjr/8954822efb0d41d7cacee1e350acbc1f to your computer and use it in GitHub Desktop.
list-mlnx-counters.sh
#!/bin/bash
intf="rdma0"
if [ $# -gt 0 ]
then
intf=$1
fi
ibdev=`ibdev2netdev | grep $intf | awk '{print $1}'`
printf "Will config on interface: %s %s" $intf $ibdev
printf "Port Counters:\n"
COUNTERS_PATH=/sys/class/infiniband/$ibdev/ports/1/counters
for i in `ls $COUNTERS_PATH/`; do
printf "%s %s\n" $i `cat $COUNTERS_PATH/$i`;
done | column -c 2 -t
echo
printf "HW Counters (RDMA diagnostics):\n"
HW_COUNTERS_PATH=/sys/class/infiniband/$ibdev/ports/1/hw_counters
for i in `ls $HW_COUNTERS_PATH/`; do
printf "%s %s\n" $i `cat $HW_COUNTERS_PATH/$i`;
done | column -c 2 -t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment