.. | .. |
---|
2 | 2 | # SPDX-License-Identifier: GPL-2.0 |
---|
3 | 3 | |
---|
4 | 4 | # Test for resource limit of offloaded flower rules. The test adds a given |
---|
5 | | -# number of flower matches for different IPv6 addresses, then generates traffic, |
---|
6 | | -# and ensures each was hit exactly once. This file contains functions to set up |
---|
7 | | -# a testing topology and run the test, and is meant to be sourced from a test |
---|
| 5 | +# number of flower matches for different IPv6 addresses, then check the offload |
---|
| 6 | +# indication for all of the tc flower rules. This file contains functions to set |
---|
| 7 | +# up a testing topology and run the test, and is meant to be sourced from a test |
---|
8 | 8 | # script that calls the testing routine with a given number of rules. |
---|
9 | 9 | |
---|
10 | 10 | TC_FLOWER_NUM_NETIFS=2 |
---|
.. | .. |
---|
94 | 94 | |
---|
95 | 95 | tc_flower_rules_create $count $should_fail |
---|
96 | 96 | |
---|
97 | | - for ((i = 0; i < count; ++i)); do |
---|
98 | | - $MZ $h1 -q -c 1 -t ip -p 20 -b bc -6 \ |
---|
99 | | - -A 2001:db8:2::1 \ |
---|
100 | | - -B $(tc_flower_addr $i) |
---|
101 | | - done |
---|
102 | | - |
---|
103 | | - MISMATCHES=$( |
---|
104 | | - tc -j -s filter show dev $h2 ingress | |
---|
105 | | - jq -r '[ .[] | select(.kind == "flower") | .options | |
---|
106 | | - values as $rule | .actions[].stats.packets | |
---|
107 | | - select(. != 1) | "\(.) on \($rule.keys.dst_ip)" ] | |
---|
108 | | - join(", ")' |
---|
109 | | - ) |
---|
110 | | - |
---|
111 | | - test -z "$MISMATCHES" |
---|
112 | | - check_err $? "Expected to capture 1 packet for each IP, but got $MISMATCHES" |
---|
| 97 | + offload_count=$(tc -j -s filter show dev $h2 ingress | |
---|
| 98 | + jq -r '[ .[] | select(.kind == "flower") | |
---|
| 99 | + .options | .in_hw ]' | jq .[] | wc -l) |
---|
| 100 | + [[ $((offload_count - 1)) -eq $count ]] |
---|
| 101 | + check_err_fail $should_fail $? "Attempt to offload $count rules (actual result $((offload_count - 1)))" |
---|
113 | 102 | } |
---|
114 | 103 | |
---|
115 | 104 | tc_flower_test() |
---|