From: Petr Machata Date: Fri, 24 Jan 2020 13:23:17 +0000 (+0200) Subject: selftests: forwarding: lib: Allow reading TC rule byte counters X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c143139b7fd36cb66afb4423ac14a1efd8a45609;p=linux.git 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 Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller --- diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 096340f064dbc..2f5da414aaa7f 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -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()