mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-03 12:24:37 -04:00
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: Amit Cohen <amitc@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
28 lines
548 B
Bash
28 lines
548 B
Bash
#!/bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
CHECK_TC="yes"
|
|
|
|
tc_check_packets()
|
|
{
|
|
local id=$1
|
|
local handle=$2
|
|
local count=$3
|
|
|
|
cmd_jq "tc -j -s filter show $id" \
|
|
".[] | select(.options.handle == $handle) | \
|
|
select(.options.actions[0].stats.packets == $count)" \
|
|
&> /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
|
|
}
|