1 # SPDX-License-Identifier: GPL-2.0
10 tc_police_h1_destroy()
15 tc_police_switch_create()
18 tc qdisc add dev $swp1 clsact
21 tc_police_switch_destroy()
23 tc qdisc del dev $swp1 clsact
27 tc_police_rules_create()
30 local should_fail=$1; shift
32 TC_POLICE_BATCH_FILE="$(mktemp)"
34 for ((i = 0; i < count; ++i)); do
35 cat >> $TC_POLICE_BATCH_FILE <<-EOF
36 filter add dev $swp1 ingress \
39 action police rate 10mbit burst 100k \
40 conform-exceed drop/ok
44 tc -b $TC_POLICE_BATCH_FILE
45 check_err_fail $should_fail $? "Rule insertion"
51 local should_fail=$1; shift
53 tc_police_rules_create $count $should_fail
55 offload_count=$(tc filter show dev $swp1 ingress | grep in_hw | wc -l)
56 ((offload_count == count))
57 check_err_fail $should_fail $? "tc police offload count"
63 local should_fail=$1; shift
65 if ! tc_offload_check $TC_POLICE_NUM_NETIFS; then
66 check_err 1 "Could not test offloaded functionality"
70 __tc_police_test $count $should_fail
73 tc_police_setup_prepare()
81 tc_police_switch_create
88 tc_police_switch_destroy