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

testing: selftests: tc_common: Add tc_check_at_least_x_packets()

Add function that checks that at least X packets hit the tc rule.
There are cases that it is not possible to catch only the interesting
packets, so then, it is possible to send many packets and verify that at
least this amount of packets hit the rule.

This function will be used in the next patch for general tc rule that
can be used to test both software and hardware.
Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 45d45e53
...@@ -16,6 +16,16 @@ tc_check_packets() ...@@ -16,6 +16,16 @@ tc_check_packets()
tc_rule_handle_stats_get "$id" "$handle" > /dev/null tc_rule_handle_stats_get "$id" "$handle" > /dev/null
} }
tc_check_at_least_x_packets()
{
local id=$1
local handle=$2
local count=$3
busywait "$TC_HIT_TIMEOUT" until_counter_is ">= $count" \
tc_rule_handle_stats_get "$id" "$handle" > /dev/null
}
tc_check_packets_hitting() tc_check_packets_hitting()
{ {
local id=$1 local id=$1
......
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