selftests: forwarding: lib: Allow reading TC rule byte counters

The function tc_rule_stats_get() fetches a packet counter of a given TC
rule. Extend it to support byte counters as well by adding an optional
argument with selector.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Petr Machata 2020-01-24 15:23:17 +02:00 committed by David S. Miller
parent 4121d9479b
commit c143139b7f
1 changed files with 2 additions and 1 deletions

View File

@ -593,9 +593,10 @@ tc_rule_stats_get()
local dev=$1; shift
local pref=$1; shift
local dir=$1; shift
local selector=${1:-.packets}; shift
tc -j -s filter show dev $dev ${dir:-ingress} pref $pref \
| jq '.[1].options.actions[].stats.packets'
| jq ".[1].options.actions[].stats$selector"
}
ethtool_stats_get()