Skip to content

Commit

Permalink
selftests: mlxsw: tc_flower_scale: Add a traffic test
Browse files Browse the repository at this point in the history
Add a test that checks that the created filters do actually trigger on
matching traffic.

Exercising all the rules would be a very lengthy process. Instead, take a
log2 subset of rules. The logic behind picking log2 rules is that then
every bit of the instantiated item's number is exercised. This should catch
issues whether they happen at the high end, low end, or somewhere in
between.

Signed-off-by: Petr Machata <[email protected]>
Reviewed-by: Amit Cohen <[email protected]>
Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
pmachata authored and davem330 committed Jun 17, 2022
1 parent 35d5829 commit dd5d20e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tools/testing/selftests/drivers/net/mlxsw/tc_flower_scale.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ tc_flower_rules_create()
filter add dev $h2 ingress \
prot ipv6 \
pref 1000 \
handle 42$i \
flower $tcflags dst_ip $(tc_flower_addr $i) \
action drop
EOF
Expand Down Expand Up @@ -121,3 +122,19 @@ tc_flower_test()
tcflags="skip_sw"
__tc_flower_test $count $should_fail
}

tc_flower_traffic_test()
{
local count=$1; shift
local i;

for ((i = count - 1; i > 0; i /= 2)); do
$MZ -6 $h1 -c 1 -d 20msec -p 100 -a own -b $(mac_get $h2) \
-A $(tc_flower_addr 0) -B $(tc_flower_addr $i) \
-q -t udp sp=54321,dp=12345
done
for ((i = count - 1; i > 0; i /= 2)); do
tc_check_packets "dev $h2 ingress" 42$i 1
check_err $? "Traffic not seen at rule #$i"
done
}

0 comments on commit dd5d20e

Please sign in to comment.