mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 17:24:17 +08:00
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: Petr Machata <petrm@nvidia.com> Reviewed-by: Amit Cohen <amcohen@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
35d5829e86
commit
dd5d20e17c
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user