Commit 84ea1f85 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

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: default avatarPetr Machata <petrm@mellanox.com>
Reviewed-by: default avatarAmit Cohen <amitc@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a29b56c4
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment