Skip to content

Commit 095c720

Browse files
nirdotandavem330
authored andcommitted
selftests: mlxsw: Add Bloom filter simple test
Add a test that exercises Bloom filter code. Activate eRP table in the region by adding multiple rule patterns which with very high probability use different entries in the Bloom filter. Then send packets in order to check lookup hits on all relevant rules. Signed-off-by: Nir Dotan <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 03ce5bd commit 095c720

File tree

1 file changed

+56
-1
lines changed
  • tools/testing/selftests/drivers/net/mlxsw/spectrum-2

1 file changed

+56
-1
lines changed

tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
lib_dir=$(dirname $0)/../../../../net/forwarding
99

1010
ALL_TESTS="single_mask_test identical_filters_test two_masks_test \
11-
multiple_masks_test ctcam_edge_cases_test delta_simple_test"
11+
multiple_masks_test ctcam_edge_cases_test delta_simple_test \
12+
bloom_simple_test"
1213
NUM_NETIFS=2
1314
source $lib_dir/tc_common.sh
1415
source $lib_dir/lib.sh
@@ -404,6 +405,60 @@ delta_simple_test()
404405
log_test "delta simple test ($tcflags)"
405406
}
406407

408+
bloom_simple_test()
409+
{
410+
# Bloom filter requires that the eRP table is used. This test
411+
# verifies that Bloom filter is not harming correctness of ACLs.
412+
# First, make sure that eRP table is used and then set rule patterns
413+
# which are distant enough and will result skipping a lookup after
414+
# consulting the Bloom filter. Although some eRP lookups are skipped,
415+
# the correct filter should be hit.
416+
417+
RET=0
418+
419+
tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
420+
$tcflags dst_ip 192.0.2.2 action drop
421+
tc filter add dev $h2 ingress protocol ip pref 5 handle 104 flower \
422+
$tcflags dst_ip 198.51.100.2 action drop
423+
tc filter add dev $h2 ingress protocol ip pref 3 handle 103 flower \
424+
$tcflags dst_ip 192.0.0.0/8 action drop
425+
426+
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
427+
-t ip -q
428+
429+
tc_check_packets "dev $h2 ingress" 101 1
430+
check_err $? "Two filters - did not match highest priority"
431+
432+
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 198.51.100.1 -B 198.51.100.2 \
433+
-t ip -q
434+
435+
tc_check_packets "dev $h2 ingress" 104 1
436+
check_err $? "Single filter - did not match"
437+
438+
tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
439+
440+
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
441+
-t ip -q
442+
443+
tc_check_packets "dev $h2 ingress" 103 1
444+
check_err $? "Low prio filter - did not match"
445+
446+
tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \
447+
$tcflags dst_ip 198.0.0.0/8 action drop
448+
449+
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 198.51.100.1 -B 198.51.100.2 \
450+
-t ip -q
451+
452+
tc_check_packets "dev $h2 ingress" 102 1
453+
check_err $? "Two filters - did not match highest priority after add"
454+
455+
tc filter del dev $h2 ingress protocol ip pref 3 handle 103 flower
456+
tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
457+
tc filter del dev $h2 ingress protocol ip pref 5 handle 104 flower
458+
459+
log_test "bloom simple test ($tcflags)"
460+
}
461+
407462
setup_prepare()
408463
{
409464
h1=${NETIFS[p1]}

0 commit comments

Comments
 (0)