Skip to content

Commit 5d06a76

Browse files
nirdotandavem330
authored andcommitted
selftests: mlxsw: Add Bloom delta test
The eRP table is active when there is more than a single rule pattern. It may be that the patterns are close enough and use delta mechanism. Bloom filter index computation is based on the values of {rule & mask, mask ID, region ID} where the rule delta bits must be cleared. Add a test that exercises Bloom filter with delta mechanism. Configure rules within delta range and pass a packet which is supposed to hit the correct rule. Signed-off-by: Nir Dotan <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5118ca4 commit 5d06a76

File tree

1 file changed

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

1 file changed

+36
-1
lines changed

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

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

1010
ALL_TESTS="single_mask_test identical_filters_test two_masks_test \
1111
multiple_masks_test ctcam_edge_cases_test delta_simple_test \
12-
bloom_simple_test bloom_complex_test"
12+
bloom_simple_test bloom_complex_test bloom_delta_test"
1313
NUM_NETIFS=2
1414
source $lib_dir/tc_common.sh
1515
source $lib_dir/lib.sh
@@ -542,6 +542,41 @@ bloom_complex_test()
542542
log_test "bloom complex test ($tcflags)"
543543
}
544544

545+
546+
bloom_delta_test()
547+
{
548+
# When multiple masks are used, the eRP table is activated. When
549+
# masks are close enough (delta) the masks reside on the same
550+
# eRP table. This test verifies that the eRP table is correctly
551+
# allocated and used in delta condition and that Bloom filter is
552+
# still functional with delta.
553+
554+
RET=0
555+
556+
tc filter add dev $h2 ingress protocol ip pref 3 handle 103 flower \
557+
$tcflags dst_ip 192.1.0.0/16 action drop
558+
559+
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.1.2.1 -B 192.1.2.2 \
560+
-t ip -q
561+
562+
tc_check_packets "dev $h2 ingress" 103 1
563+
check_err $? "Single filter - did not match"
564+
565+
tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \
566+
$tcflags dst_ip 192.2.1.0/24 action drop
567+
568+
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.2.1.1 -B 192.2.1.2 \
569+
-t ip -q
570+
571+
tc_check_packets "dev $h2 ingress" 102 1
572+
check_err $? "Delta filters - did not match second filter"
573+
574+
tc filter del dev $h2 ingress protocol ip pref 3 handle 103 flower
575+
tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
576+
577+
log_test "bloom delta test ($tcflags)"
578+
}
579+
545580
setup_prepare()
546581
{
547582
h1=${NETIFS[p1]}

0 commit comments

Comments
 (0)