Commit abfce9e0 authored by Danielle Ratson's avatar Danielle Ratson Committed by David S. Miller

selftests: mlxsw: Reduce running time using offload indication

After adding a given number of flower rules for different IPv6
addresses, the test generates traffic and ensures that each packet is
received, which is time-consuming.

Instead, test the offload indication of the tc flower rules and reduce
the running time by half.
Signed-off-by: default avatarDanielle Ratson <danieller@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a865ad99
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Test for resource limit of offloaded flower rules. The test adds a given # Test for resource limit of offloaded flower rules. The test adds a given
# number of flower matches for different IPv6 addresses, then generates traffic, # number of flower matches for different IPv6 addresses, then check the offload
# and ensures each was hit exactly once. This file contains functions to set up # indication for all of the tc flower rules. This file contains functions to set
# a testing topology and run the test, and is meant to be sourced from a test # up a testing topology and run the test, and is meant to be sourced from a test
# script that calls the testing routine with a given number of rules. # script that calls the testing routine with a given number of rules.
TC_FLOWER_NUM_NETIFS=2 TC_FLOWER_NUM_NETIFS=2
...@@ -94,22 +94,15 @@ __tc_flower_test() ...@@ -94,22 +94,15 @@ __tc_flower_test()
tc_flower_rules_create $count $should_fail tc_flower_rules_create $count $should_fail
for ((i = 0; i < count; ++i)); do offload_count=$(tc -j -s filter show dev $h2 ingress |
$MZ $h1 -q -c 1 -t ip -p 20 -b bc -6 \ jq -r '[ .[] | select(.kind == "flower") |
-A 2001:db8:2::1 \ .options | .in_hw ]' | jq .[] | wc -l)
-B $(tc_flower_addr $i) [[ $((offload_count - 1)) -eq $count ]]
done if [[ $should_fail -eq 0 ]]; then
check_err $? "Offload mismatch"
MISMATCHES=$( else
tc -j -s filter show dev $h2 ingress | check_err_fail $should_fail $? "Offload more than expacted"
jq -r '[ .[] | select(.kind == "flower") | .options | fi
values as $rule | .actions[].stats.packets |
select(. != 1) | "\(.) on \($rule.keys.dst_ip)" ] |
join(", ")'
)
test -z "$MISMATCHES"
check_err $? "Expected to capture 1 packet for each IP, but got $MISMATCHES"
} }
tc_flower_test() tc_flower_test()
......
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