Skip to content

Commit dd5d20e

Browse files
pmachatadavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Amit Cohen <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 35d5829 commit dd5d20e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tools/testing/selftests/drivers/net/mlxsw/tc_flower_scale.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ tc_flower_rules_create()
7777
filter add dev $h2 ingress \
7878
prot ipv6 \
7979
pref 1000 \
80+
handle 42$i \
8081
flower $tcflags dst_ip $(tc_flower_addr $i) \
8182
action drop
8283
EOF
@@ -121,3 +122,19 @@ tc_flower_test()
121122
tcflags="skip_sw"
122123
__tc_flower_test $count $should_fail
123124
}
125+
126+
tc_flower_traffic_test()
127+
{
128+
local count=$1; shift
129+
local i;
130+
131+
for ((i = count - 1; i > 0; i /= 2)); do
132+
$MZ -6 $h1 -c 1 -d 20msec -p 100 -a own -b $(mac_get $h2) \
133+
-A $(tc_flower_addr 0) -B $(tc_flower_addr $i) \
134+
-q -t udp sp=54321,dp=12345
135+
done
136+
for ((i = count - 1; i > 0; i /= 2)); do
137+
tc_check_packets "dev $h2 ingress" 42$i 1
138+
check_err $? "Traffic not seen at rule #$i"
139+
done
140+
}

0 commit comments

Comments
 (0)