selftests: forwarding: tc_rule_stats_get: Parameterize direction
authorPetr Machata <petrm@mellanox.com>
Tue, 26 Jun 2018 00:07:45 +0000 (02:07 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 27 Jun 2018 01:42:12 +0000 (10:42 +0900)
The GRE multipath tests need stats on an egress counter. Change
tc_rule_stats_get() to take direction as an optional argument, with
default of ingress.

Take the opportunity to change line continuation character from | to \.
Move the | to the next line, which indent.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/forwarding/lib.sh

index 911d753c4ff03ddea75ad104cc404e7ecf1ba413..f94ea4bafa133f310549c34b46ca2eae430196b3 100644 (file)
@@ -383,9 +383,10 @@ tc_rule_stats_get()
 {
        local dev=$1; shift
        local pref=$1; shift
+       local dir=$1; shift
 
-       tc -j -s filter show dev $dev ingress pref $pref |
-       jq '.[1].options.actions[].stats.packets'
+       tc -j -s filter show dev $dev ${dir:-ingress} pref $pref \
+           | jq '.[1].options.actions[].stats.packets'
 }
 
 mac_get()