hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/tools/testing/selftests/drivers/net/mlxsw/tc_flower_scale.sh
....@@ -2,9 +2,9 @@
22 # SPDX-License-Identifier: GPL-2.0
33
44 # 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
88 # script that calls the testing routine with a given number of rules.
99
1010 TC_FLOWER_NUM_NETIFS=2
....@@ -94,22 +94,11 @@
9494
9595 tc_flower_rules_create $count $should_fail
9696
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)))"
113102 }
114103
115104 tc_flower_test()