Commit f10caf02 authored by Amit Cohen's avatar Amit Cohen Committed by David S. Miller

selftests: forwarding: tc_common: Add hitting check

Add an option to check that packets hit the tc filter without providing
the exact number of packets that should hit it.

It is useful while sending many packets in background and checking that
at least one of them hit the tc filter.
Signed-off-by: default avatarAmit Cohen <amitc@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7ce4e760
...@@ -14,3 +14,14 @@ tc_check_packets() ...@@ -14,3 +14,14 @@ tc_check_packets()
select(.options.actions[0].stats.packets == $count)" \ select(.options.actions[0].stats.packets == $count)" \
&> /dev/null &> /dev/null
} }
tc_check_packets_hitting()
{
local id=$1
local handle=$2
cmd_jq "tc -j -s filter show $id" \
".[] | select(.options.handle == $handle) | \
select(.options.actions[0].stats.packets > 0)" \
&> /dev/null
}
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