Commit b5bf7126 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski
Browse files

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: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8fcac792
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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