Skip to content

Commit bd0c907

Browse files
committed
Merge branch 'selftests-mlxsw-add-few-fixes-for-sharedbuffer-test'
Petr Machata says: ==================== selftests: mlxsw: Add few fixes for sharedbuffer test Danielle Ratson writes: Currently, the sharedbuffer test fails sometimes because it is reading a maximum occupancy that is larger than expected on some different cases. This is happening because the test assumes that the packet it is sending is the only packet being passed to the device. In addition, some duplications on one hand, and redundant test cases on the other hand, were found in the test. Add egress filters on h1 and h2 that will guarantee that the packets in the buffer are sent in the test, and remove the redundant test cases. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 11776cf + 5f2c7ab commit bd0c907

File tree

1 file changed

+40
-15
lines changed

1 file changed

+40
-15
lines changed

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

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,34 @@ SB_ITC=0
2222
h1_create()
2323
{
2424
simple_if_init $h1 192.0.1.1/24
25+
tc qdisc add dev $h1 clsact
26+
27+
# Add egress filter on $h1 that will guarantee that the packet sent,
28+
# will be the only packet being passed to the device.
29+
tc filter add dev $h1 egress pref 2 handle 102 matchall action drop
2530
}
2631

2732
h1_destroy()
2833
{
34+
tc filter del dev $h1 egress pref 2 handle 102 matchall action drop
35+
tc qdisc del dev $h1 clsact
2936
simple_if_fini $h1 192.0.1.1/24
3037
}
3138

3239
h2_create()
3340
{
3441
simple_if_init $h2 192.0.1.2/24
42+
tc qdisc add dev $h2 clsact
43+
44+
# Add egress filter on $h2 that will guarantee that the packet sent,
45+
# will be the only packet being passed to the device.
46+
tc filter add dev $h2 egress pref 1 handle 101 matchall action drop
3547
}
3648

3749
h2_destroy()
3850
{
51+
tc filter del dev $h2 egress pref 1 handle 101 matchall action drop
52+
tc qdisc del dev $h2 clsact
3953
simple_if_fini $h2 192.0.1.2/24
4054
}
4155

@@ -101,18 +115,18 @@ port_pool_test()
101115
local exp_max_occ=$(devlink_cell_size_get)
102116
local max_occ
103117

118+
tc filter add dev $h1 egress protocol ip pref 1 handle 101 flower \
119+
src_mac $h1mac dst_mac $h2mac \
120+
src_ip 192.0.1.1 dst_ip 192.0.1.2 \
121+
action pass
122+
104123
devlink sb occupancy clearmax $DEVLINK_DEV
105124

106125
$MZ $h1 -c 1 -p 10 -a $h1mac -b $h2mac -A 192.0.1.1 -B 192.0.1.2 \
107126
-t ip -q
108127

109128
devlink sb occupancy snapshot $DEVLINK_DEV
110129

111-
RET=0
112-
max_occ=$(sb_occ_pool_check $dl_port1 $SB_POOL_ING $exp_max_occ)
113-
check_err $? "Expected iPool($SB_POOL_ING) max occupancy to be $exp_max_occ, but got $max_occ"
114-
log_test "physical port's($h1) ingress pool"
115-
116130
RET=0
117131
max_occ=$(sb_occ_pool_check $dl_port2 $SB_POOL_ING $exp_max_occ)
118132
check_err $? "Expected iPool($SB_POOL_ING) max occupancy to be $exp_max_occ, but got $max_occ"
@@ -122,25 +136,30 @@ port_pool_test()
122136
max_occ=$(sb_occ_pool_check $cpu_dl_port $SB_POOL_EGR_CPU $exp_max_occ)
123137
check_err $? "Expected ePool($SB_POOL_EGR_CPU) max occupancy to be $exp_max_occ, but got $max_occ"
124138
log_test "CPU port's egress pool"
139+
140+
tc filter del dev $h1 egress protocol ip pref 1 handle 101 flower \
141+
src_mac $h1mac dst_mac $h2mac \
142+
src_ip 192.0.1.1 dst_ip 192.0.1.2 \
143+
action pass
125144
}
126145

127146
port_tc_ip_test()
128147
{
129148
local exp_max_occ=$(devlink_cell_size_get)
130149
local max_occ
131150

151+
tc filter add dev $h1 egress protocol ip pref 1 handle 101 flower \
152+
src_mac $h1mac dst_mac $h2mac \
153+
src_ip 192.0.1.1 dst_ip 192.0.1.2 \
154+
action pass
155+
132156
devlink sb occupancy clearmax $DEVLINK_DEV
133157

134158
$MZ $h1 -c 1 -p 10 -a $h1mac -b $h2mac -A 192.0.1.1 -B 192.0.1.2 \
135159
-t ip -q
136160

137161
devlink sb occupancy snapshot $DEVLINK_DEV
138162

139-
RET=0
140-
max_occ=$(sb_occ_itc_check $dl_port2 $SB_ITC $exp_max_occ)
141-
check_err $? "Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ"
142-
log_test "physical port's($h1) ingress TC - IP packet"
143-
144163
RET=0
145164
max_occ=$(sb_occ_itc_check $dl_port2 $SB_ITC $exp_max_occ)
146165
check_err $? "Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ"
@@ -150,24 +169,27 @@ port_tc_ip_test()
150169
max_occ=$(sb_occ_etc_check $cpu_dl_port $SB_ITC_CPU_IP $exp_max_occ)
151170
check_err $? "Expected egress TC($SB_ITC_CPU_IP) max occupancy to be $exp_max_occ, but got $max_occ"
152171
log_test "CPU port's egress TC - IP packet"
172+
173+
tc filter del dev $h1 egress protocol ip pref 1 handle 101 flower \
174+
src_mac $h1mac dst_mac $h2mac \
175+
src_ip 192.0.1.1 dst_ip 192.0.1.2 \
176+
action pass
153177
}
154178

155179
port_tc_arp_test()
156180
{
157181
local exp_max_occ=$(devlink_cell_size_get)
158182
local max_occ
159183

184+
tc filter add dev $h1 egress protocol arp pref 1 handle 101 flower \
185+
src_mac $h1mac action pass
186+
160187
devlink sb occupancy clearmax $DEVLINK_DEV
161188

162189
$MZ $h1 -c 1 -p 10 -a $h1mac -A 192.0.1.1 -t arp -q
163190

164191
devlink sb occupancy snapshot $DEVLINK_DEV
165192

166-
RET=0
167-
max_occ=$(sb_occ_itc_check $dl_port2 $SB_ITC $exp_max_occ)
168-
check_err $? "Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ"
169-
log_test "physical port's($h1) ingress TC - ARP packet"
170-
171193
RET=0
172194
max_occ=$(sb_occ_itc_check $dl_port2 $SB_ITC $exp_max_occ)
173195
check_err $? "Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ"
@@ -177,6 +199,9 @@ port_tc_arp_test()
177199
max_occ=$(sb_occ_etc_check $cpu_dl_port $SB_ITC_CPU_ARP $exp_max_occ)
178200
check_err $? "Expected egress TC($SB_ITC_IP2ME) max occupancy to be $exp_max_occ, but got $max_occ"
179201
log_test "CPU port's egress TC - ARP packet"
202+
203+
tc filter del dev $h1 egress protocol arp pref 1 handle 101 flower \
204+
src_mac $h1mac action pass
180205
}
181206

182207
setup_prepare()

0 commit comments

Comments
 (0)