Skip to content

Commit

Permalink
selftests: forwarding: introduce helper for standard ethtool counters
Browse files Browse the repository at this point in the history
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 <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Vladimir Oltean authored and Jakub Kicinski committed Apr 21, 2023
1 parent 8fcac79 commit b5bf712
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tools/testing/selftests/net/forwarding/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b5bf712

Please sign in to comment.