forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/tools/testing/selftests/net/forwarding/tc_shblocks.sh
....@@ -1,7 +1,7 @@
11 #!/bin/bash
22 # SPDX-License-Identifier: GPL-2.0
33
4
-ALL_TESTS="shared_block_test"
4
+ALL_TESTS="shared_block_test match_indev_test"
55 NUM_NETIFS=4
66 source tc_common.sh
77 source lib.sh
....@@ -70,6 +70,33 @@
7070 log_test "shared block ($tcflags)"
7171 }
7272
73
+match_indev_test()
74
+{
75
+ RET=0
76
+
77
+ tc filter add block 22 protocol ip pref 1 handle 101 flower \
78
+ $tcflags indev $swp1 dst_mac $swmac action drop
79
+ tc filter add block 22 protocol ip pref 2 handle 102 flower \
80
+ $tcflags indev $swp2 dst_mac $swmac action drop
81
+
82
+ $MZ $h1 -c 1 -p 64 -a $h1mac -b $swmac -A 192.0.2.1 -B 192.0.2.2 \
83
+ -t ip -q
84
+
85
+ tc_check_packets "block 22" 101 1
86
+ check_err $? "Did not match first incoming packet on a block"
87
+
88
+ $MZ $h2 -c 1 -p 64 -a $h2mac -b $swmac -A 192.0.2.1 -B 192.0.2.2 \
89
+ -t ip -q
90
+
91
+ tc_check_packets "block 22" 102 1
92
+ check_err $? "Did not match second incoming packet on a block"
93
+
94
+ tc filter del block 22 protocol ip pref 1 handle 101 flower
95
+ tc filter del block 22 protocol ip pref 2 handle 102 flower
96
+
97
+ log_test "indev match ($tcflags)"
98
+}
99
+
73100 setup_prepare()
74101 {
75102 h1=${NETIFS[p1]}