From: Vladimir Oltean Date: Tue, 18 Apr 2023 11:14:58 +0000 (+0300) Subject: selftests: forwarding: introduce helper for standard ethtool counters X-Git-Tag: v6.6.7~2736^2~82^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5bf7126a6a0e706ef0e6c6cd22b2ebc23bf54a2;p=platform%2Fkernel%2Flinux-starfive.git selftests: forwarding: introduce helper for standard ethtool counters Counters for the MAC Merge layer and preemptible MAC have standardized so far on using structured ethtool stats as opposed to the driver specific names and meanings. Benefit from that rare opportunity and introduce a helper to lib.sh for querying standardized counters, in the hope that these will take off for other uses as well. Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski --- diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index efd48e1..36e47c9 100755 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -787,6 +787,17 @@ ethtool_stats_get() ethtool -S $dev | grep "^ *$stat:" | head -n 1 | cut -d: -f2 } +ethtool_std_stats_get() +{ + local dev=$1; shift + local grp=$1; shift + local name=$1; shift + local src=$1; shift + + ethtool --json -S $dev --groups $grp -- --src $src | \ + jq '.[]."'"$grp"'"."'$name'"' +} + qdisc_stats_get() { local dev=$1; shift