Skip to content

Commit 26281e2

Browse files
committed
Merge branch 'selftests-Various-fixes'
Petr Machata says: ==================== selftests: Various fixes This patch set contains various fixes whose common denominator is improving quality of forwarding and mlxsw selftests. Most of the fixes are improvements in determinism (such that timing and latency don't impact the test performance). These were prompted by regular runs of the test suite on a hardware emulator, the performance of which is necessarily lower than that of the real device. Patches #1 (from Ido), #2 and #3 make changes to ping limits. Patches #4 and #5 add more sleep in places where things need more time to finish. Patches torvalds#6 and torvalds#7 fix two tests in the suite of mirror-to-gretap tests where underlay involves a VLAN device over an 802.1q bridge. Patches torvalds#8, torvalds#9 and torvalds#10 fix bugs in mirror-to-gretap test where underlay involves a LAG device. Patch torvalds#11 fixes a missed RET initialization in mirror-to-gretap flower test. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 3fc46fc + 084fafe commit 26281e2

File tree

10 files changed

+107
-21
lines changed

10 files changed

+107
-21
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,10 @@ dscp_ping_test()
148148
eval "t0s=($(dscp_fetch_stats $dev_10 10)
149149
$(dscp_fetch_stats $dev_20 20))"
150150

151+
local ping_timeout=$((PING_TIMEOUT * 5))
151152
ip vrf exec $vrf_name \
152153
${PING} -Q $dscp_10 ${sip:+-I $sip} $dip \
153-
-c 10 -i 0.1 -w 2 &> /dev/null
154+
-c 10 -i 0.5 -w $ping_timeout &> /dev/null
154155

155156
local -A t1s
156157
eval "t1s=($(dscp_fetch_stats $dev_10 10)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,10 @@ dscp_ping_test()
169169
eval "local -A dev1_t0s=($(dscp_fetch_stats $dev1 0))"
170170
eval "local -A dev2_t0s=($(dscp_fetch_stats $dev2 0))"
171171

172+
local ping_timeout=$((PING_TIMEOUT * 5))
172173
ip vrf exec $vrf_name \
173174
${PING} -Q $dscp ${sip:+-I $sip} $dip \
174-
-c 10 -i 0.1 -w 2 &> /dev/null
175+
-c 10 -i 0.5 -w $ping_timeout &> /dev/null
175176

176177
eval "local -A dev1_t1s=($(dscp_fetch_stats $dev1 0))"
177178
eval "local -A dev2_t1s=($(dscp_fetch_stats $dev2 0))"

tools/testing/selftests/net/forwarding/forwarding.config.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ PAUSE_ON_CLEANUP=no
3333
NETIF_TYPE=veth
3434
# Whether to create virtual interfaces (veth) or not
3535
NETIF_CREATE=yes
36+
# Timeout (in seconds) before ping exits regardless of how many packets have
37+
# been sent or received
38+
PING_TIMEOUT=5

tools/testing/selftests/net/forwarding/lib.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ NETIF_TYPE=${NETIF_TYPE:=veth}
1717
NETIF_CREATE=${NETIF_CREATE:=yes}
1818
MCD=${MCD:=smcrouted}
1919
MC_CLI=${MC_CLI:=smcroutectl}
20+
PING_TIMEOUT=${PING_TIMEOUT:=5}
2021

2122
relative_path="${BASH_SOURCE%/*}"
2223
if [[ "$relative_path" == "${BASH_SOURCE}" ]]; then
@@ -820,7 +821,8 @@ ping_do()
820821
local vrf_name
821822

822823
vrf_name=$(master_name_get $if_name)
823-
ip vrf exec $vrf_name $PING $args $dip -c 10 -i 0.1 -w 2 &> /dev/null
824+
ip vrf exec $vrf_name \
825+
$PING $args $dip -c 10 -i 0.1 -w $PING_TIMEOUT &> /dev/null
824826
}
825827

826828
ping_test()
@@ -840,7 +842,8 @@ ping6_do()
840842
local vrf_name
841843

842844
vrf_name=$(master_name_get $if_name)
843-
ip vrf exec $vrf_name $PING6 $args $dip -c 10 -i 0.1 -w 2 &> /dev/null
845+
ip vrf exec $vrf_name \
846+
$PING6 $args $dip -c 10 -i 0.1 -w $PING_TIMEOUT &> /dev/null
844847
}
845848

846849
ping6_test()

tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ setup_prepare()
190190
h4_create
191191
switch_create
192192

193+
forwarding_enable
194+
193195
trap_install $h3 ingress
194196
trap_install $h4 ingress
195197
}
@@ -201,6 +203,8 @@ cleanup()
201203
trap_uninstall $h4 ingress
202204
trap_uninstall $h3 ingress
203205

206+
forwarding_restore
207+
204208
switch_destroy
205209
h4_destroy
206210
h3_destroy
@@ -220,11 +224,15 @@ test_lag_slave()
220224

221225
RET=0
222226

227+
tc filter add dev $swp1 ingress pref 999 \
228+
proto 802.1q flower vlan_ethtype arp $tcflags \
229+
action pass
223230
mirror_install $swp1 ingress gt4 \
224-
"proto 802.1q flower vlan_id 333 $tcflags"
231+
"proto 802.1q flower vlan_id 333 $tcflags"
225232

226233
# Test connectivity through $up_dev when $down_dev is set down.
227234
ip link set dev $down_dev down
235+
ip neigh flush dev br1
228236
setup_wait_dev $up_dev
229237
setup_wait_dev $host_dev
230238
$ARPING -I br1 192.0.2.130 -qfc 1
@@ -240,6 +248,7 @@ test_lag_slave()
240248
ip link set dev $up_dev up
241249
ip link set dev $down_dev up
242250
mirror_uninstall $swp1 ingress
251+
tc filter del dev $swp1 ingress pref 999
243252

244253
log_test "$what ($tcflags)"
245254
}

tools/testing/selftests/net/forwarding/mirror_gre_changes.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ test_span_gre_ttl()
7979
mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 0
8080

8181
ip link set dev $tundev type $type ttl 50
82+
sleep 2
8283
mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 10
8384

8485
ip link set dev $tundev type $type ttl 100

tools/testing/selftests/net/forwarding/mirror_gre_flower.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ full_test_span_gre_dir_acl()
8181
local match_dip=$1; shift
8282
local what=$1; shift
8383

84+
RET=0
85+
8486
mirror_install $swp1 $direction $tundev \
8587
"protocol ip flower $tcflags dst_ip $match_dip"
8688
fail_test_span_gre_dir $tundev $direction
@@ -108,8 +110,6 @@ test_ip6gretap()
108110

109111
test_all()
110112
{
111-
RET=0
112-
113113
slow_path_trap_install $swp1 ingress
114114
slow_path_trap_install $swp1 egress
115115

tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh

Lines changed: 76 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,44 @@
11
#!/bin/bash
22
# SPDX-License-Identifier: GPL-2.0
33

4-
# This test uses standard topology for testing gretap. See
5-
# mirror_gre_topo_lib.sh for more details.
6-
#
74
# Test for "tc action mirred egress mirror" when the underlay route points at a
85
# vlan device on top of a bridge device with vlan filtering (802.1q).
6+
#
7+
# +---------------------+ +---------------------+
8+
# | H1 | | H2 |
9+
# | + $h1 | | $h2 + |
10+
# | | 192.0.2.1/28 | | 192.0.2.2/28 | |
11+
# +-----|---------------+ +---------------|-----+
12+
# | |
13+
# +-----|-------------------------------------------------------------|-----+
14+
# | SW o--> mirred egress mirror dev {gt4,gt6} | |
15+
# | | | |
16+
# | +---|-------------------------------------------------------------|---+ |
17+
# | | + $swp1 br1 $swp2 + | |
18+
# | | | |
19+
# | | + $swp3 | |
20+
# | +---|-----------------------------------------------------------------+ |
21+
# | | | |
22+
# | | + br1.555 |
23+
# | | 192.0.2.130/28 |
24+
# | | 2001:db8:2::2/64 |
25+
# | | |
26+
# | | + gt6 (ip6gretap) + gt4 (gretap) |
27+
# | | : loc=2001:db8:2::1 : loc=192.0.2.129 |
28+
# | | : rem=2001:db8:2::2 : rem=192.0.2.130 |
29+
# | | : ttl=100 : ttl=100 |
30+
# | | : tos=inherit : tos=inherit |
31+
# | | : : |
32+
# +-----|---------------------:----------------------:----------------------+
33+
# | : :
34+
# +-----|---------------------:----------------------:----------------------+
35+
# | H3 + $h3 + h3-gt6 (ip6gretap) + h3-gt4 (gretap) |
36+
# | | loc=2001:db8:2::2 loc=192.0.2.130 |
37+
# | + $h3.555 rem=2001:db8:2::1 rem=192.0.2.129 |
38+
# | 192.0.2.130/28 ttl=100 ttl=100 |
39+
# | 2001:db8:2::2/64 tos=inherit tos=inherit |
40+
# | |
41+
# +-------------------------------------------------------------------------+
942

1043
ALL_TESTS="
1144
test_gretap
@@ -30,6 +63,15 @@ source mirror_gre_topo_lib.sh
3063

3164
require_command $ARPING
3265

66+
h3_addr_add_del()
67+
{
68+
local add_del=$1; shift
69+
local dev=$1; shift
70+
71+
ip addr $add_del dev $dev 192.0.2.130/28
72+
ip addr $add_del dev $dev 2001:db8:2::2/64
73+
}
74+
3375
setup_prepare()
3476
{
3577
h1=${NETIFS[p1]}
@@ -55,7 +97,8 @@ setup_prepare()
5597
ip route rep 192.0.2.130/32 dev br1.555
5698
ip -6 route rep 2001:db8:2::2/128 dev br1.555
5799

58-
vlan_create $h3 555 v$h3 192.0.2.130/28 2001:db8:2::2/64
100+
vlan_create $h3 555 v$h3
101+
h3_addr_add_del add $h3.555
59102

60103
ip link set dev $swp3 master br1
61104
bridge vlan add dev $swp3 vid 555
@@ -68,6 +111,8 @@ cleanup()
68111

69112
ip link set dev $swp2 nomaster
70113
ip link set dev $swp3 nomaster
114+
115+
h3_addr_add_del del $h3.555
71116
vlan_destroy $h3 555
72117
vlan_destroy br1 555
73118

@@ -182,13 +227,19 @@ test_span_gre_untagged_egress()
182227
quick_test_span_gre_dir $tundev ingress
183228
quick_test_span_vlan_dir $h3 555 ingress
184229

230+
h3_addr_add_del del $h3.555
185231
bridge vlan add dev $swp3 vid 555 pvid untagged
186-
sleep 1
232+
h3_addr_add_del add $h3
233+
sleep 5
234+
187235
quick_test_span_gre_dir $tundev ingress
188236
fail_test_span_vlan_dir $h3 555 ingress
189237

238+
h3_addr_add_del del $h3
190239
bridge vlan add dev $swp3 vid 555
191-
sleep 1
240+
h3_addr_add_del add $h3.555
241+
sleep 5
242+
192243
quick_test_span_gre_dir $tundev ingress
193244
quick_test_span_vlan_dir $h3 555 ingress
194245

@@ -218,12 +269,25 @@ test_span_gre_fdb_roaming()
218269
mirror_install $swp1 ingress $tundev "matchall $tcflags"
219270
quick_test_span_gre_dir $tundev ingress
220271

221-
bridge fdb del dev $swp3 $h3mac vlan 555 master
222-
bridge fdb add dev $swp2 $h3mac vlan 555 master
223-
sleep 1
224-
fail_test_span_gre_dir $tundev ingress
225-
226-
bridge fdb del dev $swp2 $h3mac vlan 555 master
272+
while ((RET == 0)); do
273+
bridge fdb del dev $swp3 $h3mac vlan 555 master 2>/dev/null
274+
bridge fdb add dev $swp2 $h3mac vlan 555 master
275+
sleep 1
276+
fail_test_span_gre_dir $tundev ingress
277+
278+
if ! bridge fdb sh dev $swp2 vlan 555 master \
279+
| grep -q $h3mac; then
280+
printf "TEST: %-60s [RETRY]\n" \
281+
"$what: MAC roaming ($tcflags)"
282+
# ARP or ND probably reprimed the FDB while the test
283+
# was running. We would get a spurious failure.
284+
RET=0
285+
continue
286+
fi
287+
break
288+
done
289+
290+
bridge fdb del dev $swp2 $h3mac vlan 555 master 2>/dev/null
227291
# Re-prime FDB
228292
$ARPING -I br1.555 192.0.2.130 -fqc 1
229293
sleep 1

tools/testing/selftests/net/forwarding/mirror_lib.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ mirror_test()
2929
local pref=$1; shift
3030
local expect=$1; shift
3131

32+
local ping_timeout=$((PING_TIMEOUT * 5))
3233
local t0=$(tc_rule_stats_get $dev $pref)
3334
ip vrf exec $vrf_name \
34-
${PING} ${sip:+-I $sip} $dip -c 10 -i 0.1 -w 2 &> /dev/null
35+
${PING} ${sip:+-I $sip} $dip -c 10 -i 0.5 -w $ping_timeout \
36+
&> /dev/null
37+
sleep 0.5
3538
local t1=$(tc_rule_stats_get $dev $pref)
3639
local delta=$((t1 - t0))
3740
# Tolerate a couple stray extra packets.

tools/testing/selftests/net/forwarding/router_broadcast.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ ping_test_from()
170170

171171
log_info "ping $dip, expected reply from $from"
172172
ip vrf exec $(master_name_get $oif) \
173-
$PING -I $oif $dip -c 10 -i 0.1 -w 2 -b 2>&1 | grep $from &> /dev/null
173+
$PING -I $oif $dip -c 10 -i 0.1 -w $PING_TIMEOUT -b 2>&1 \
174+
| grep $from &> /dev/null
174175
check_err_fail $fail $?
175176
}
176177

0 commit comments

Comments
 (0)