| 1 | |
| 2 | |
| 3 |
|
| 4 | source ethtool-common.sh
|
| 5 |
|
| 6 | |
| 7 | if ! ethtool -h | grep include-stat 2>&1 >/dev/null; then
|
| 8 | echo "SKIP: No --include-statistics support in ethtool"
|
| 9 | exit 4
|
| 10 | fi
|
| 11 |
|
| 12 | NSIM_NETDEV=$(make_netdev)
|
| 13 |
|
| 14 | set -o pipefail
|
| 15 |
|
| 16 | echo n > $NSIM_DEV_DFS/ethtool/pause/report_stats_tx
|
| 17 | echo n > $NSIM_DEV_DFS/ethtool/pause/report_stats_rx
|
| 18 |
|
| 19 | s=$(ethtool --json -a $NSIM_NETDEV | jq '.[].statistics')
|
| 20 | check $? "$s" "null"
|
| 21 |
|
| 22 | s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics')
|
| 23 | check $? "$s" "{}"
|
| 24 |
|
| 25 | echo y > $NSIM_DEV_DFS/ethtool/pause/report_stats_tx
|
| 26 |
|
| 27 | s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics | length')
|
| 28 | check $? "$s" "1"
|
| 29 |
|
| 30 | s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics.tx_pause_frames')
|
| 31 | check $? "$s" "2"
|
| 32 |
|
| 33 | echo y > $NSIM_DEV_DFS/ethtool/pause/report_stats_rx
|
| 34 |
|
| 35 | s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics | length')
|
| 36 | check $? "$s" "2"
|
| 37 |
|
| 38 | s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics.rx_pause_frames')
|
| 39 | check $? "$s" "1"
|
| 40 | s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics.tx_pause_frames')
|
| 41 | check $? "$s" "2"
|
| 42 |
|
| 43 | if [ $num_errors -eq 0 ]; then
|
| 44 | echo "PASSED all $((num_passes)) checks"
|
| 45 | exit 0
|
| 46 | else
|
| 47 | echo "FAILED $num_errors/$((num_errors+num_passes)) checks"
|
| 48 | exit 1
|
| 49 | fi
|