summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPetr Machata <petrm@mellanox.com>2020-03-02 19:56:02 +0200
committerDavid S. Miller <davem@davemloft.net>2020-03-03 17:03:52 -0800
commit84ea1f8541721c1852bc95f4d50a603c661eabc6 (patch)
tree1c47a1bbf2c49e7a478b71e820840faddd5a1fc6 /tools
parenta29b56c45114bedfd4d016495b93b35c3468bd72 (diff)
downloadlinux-84ea1f8541721c1852bc95f4d50a603c661eabc6.tar.gz
linux-84ea1f8541721c1852bc95f4d50a603c661eabc6.tar.bz2
linux-84ea1f8541721c1852bc95f4d50a603c661eabc6.zip
selftests: forwarding: lib: Add tc_rule_handle_stats_get()
The function tc_rule_stats_get() fetches a given statistic of a TC rule given the rule preference. Another common way to reference a rule is using its handle. Introduce a dual to the aforementioned function that gets a statistic given rule handle. Signed-off-by: Petr Machata <petrm@mellanox.com> Reviewed-by: Amit Cohen <amitc@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/net/forwarding/lib.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 83fd15e3e545..de57e8887a7c 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -626,6 +626,17 @@ tc_rule_stats_get()
| jq ".[1].options.actions[].stats$selector"
}
+tc_rule_handle_stats_get()
+{
+ local id=$1; shift
+ local handle=$1; shift
+ local selector=${1:-.packets}; shift
+
+ tc -j -s filter show $id \
+ | jq ".[] | select(.options.handle == $handle) | \
+ .options.actions[0].stats$selector"
+}
+
ethtool_stats_get()
{
local dev=$1; shift