]> git.baikalelectronics.ru Git - kernel.git/commitdiff
selftests: forwarding: lib: Allow reading TC rule byte counters
authorPetr Machata <petrm@mellanox.com>
Fri, 24 Jan 2020 13:23:17 +0000 (15:23 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Jan 2020 09:56:31 +0000 (10:56 +0100)
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>
tools/testing/selftests/net/forwarding/lib.sh

index 096340f064dbc1bf58fcfa9d3d73d9da793202fe..2f5da414aaa7f0fa551c728ddeb375fa8a03c9f3 100644 (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()