0001
0002
0003
0004 source ethtool-common.sh
0005
0006
0007 if ! ethtool -h | grep include-stat 2>&1 >/dev/null; then
0008 echo "SKIP: No --include-statistics support in ethtool"
0009 exit 4
0010 fi
0011
0012 NSIM_NETDEV=$(make_netdev)
0013
0014 set -o pipefail
0015
0016 echo n > $NSIM_DEV_DFS/ethtool/pause/report_stats_tx
0017 echo n > $NSIM_DEV_DFS/ethtool/pause/report_stats_rx
0018
0019 s=$(ethtool --json -a $NSIM_NETDEV | jq '.[].statistics')
0020 check $? "$s" "null"
0021
0022 s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics')
0023 check $? "$s" "{}"
0024
0025 echo y > $NSIM_DEV_DFS/ethtool/pause/report_stats_tx
0026
0027 s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics | length')
0028 check $? "$s" "1"
0029
0030 s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics.tx_pause_frames')
0031 check $? "$s" "2"
0032
0033 echo y > $NSIM_DEV_DFS/ethtool/pause/report_stats_rx
0034
0035 s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics | length')
0036 check $? "$s" "2"
0037
0038 s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics.rx_pause_frames')
0039 check $? "$s" "1"
0040 s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics.tx_pause_frames')
0041 check $? "$s" "2"
0042
0043 if [ $num_errors -eq 0 ]; then
0044 echo "PASSED all $((num_passes)) checks"
0045 exit 0
0046 else
0047 echo "FAILED $num_errors/$((num_errors+num_passes)) checks"
0048 exit 1
0049 fi