Commit dd5d20e1 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

selftests: mlxsw: tc_flower_scale: Add a traffic test

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: default avatarPetr Machata <petrm@nvidia.com>
Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 35d5829e
......@@ -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
......@@ -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
}
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