Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / testing / selftests / net / forwarding / tc_common.sh
blob2e3326edfa9a0129c75577ec5d87ec36bc9bfa07
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
4 CHECK_TC="yes"
6 # Can be overridden by the configuration file. See lib.sh
7 : "${TC_HIT_TIMEOUT:=1000}" # ms
9 tc_check_packets()
11 local id=$1
12 local handle=$2
13 local count=$3
15 busywait "$TC_HIT_TIMEOUT" until_counter_is "== $count" \
16 tc_rule_handle_stats_get "$id" "$handle" > /dev/null
19 tc_check_at_least_x_packets()
21 local id=$1
22 local handle=$2
23 local count=$3
25 busywait "$TC_HIT_TIMEOUT" until_counter_is ">= $count" \
26 tc_rule_handle_stats_get "$id" "$handle" > /dev/null
29 tc_check_packets_hitting()
31 local id=$1
32 local handle=$2
34 busywait "$TC_HIT_TIMEOUT" until_counter_is "> 0" \
35 tc_rule_handle_stats_get "$id" "$handle" > /dev/null