Skip to content

Commit dbe27d2

Browse files
ccpalexNipaLocal
authored andcommitted
selftests: net: local_termination: Wait for interfaces to come up
It seems that most of the tests prepare the interfaces once before the test run (setup_prepare()), rely on setup_wait() to wait for link and only then run the test(s). local_termination brings the physical interfaces down and up during test run but never wait for them to come up. If the auto-negotiation takes some seconds, first test packets are being lost, which leads to false-negative test results. Use setup_wait_dev() after corresponding simple_if_init() on physical interfaces to make sure auto-negotiation has been completed and test packets will not be lost because of the race against link establishment. The wait has to be done in each individual test because the interfaces have to be brough up first and only then we can wait for link (not individually, because they are expected to be looped in pairs). Fixes: 90b9566 ("selftests: forwarding: add a test for local_termination.sh") Signed-off-by: Alexander Sverdlin <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 6e5157c commit dbe27d2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ standalone()
430430
h1_create
431431
h2_create
432432
macvlan_create $h2
433+
setup_wait_dev $h1
434+
setup_wait_dev $h2
433435

434436
run_test $h1 $h2 $skip_ptp $no_unicast_flt "$h2"
435437

@@ -448,6 +450,8 @@ test_bridge()
448450
bridge_create $vlan_filtering
449451
simple_if_init br0 $H2_IPV4/24 $H2_IPV6/64
450452
macvlan_create br0
453+
setup_wait_dev $h1
454+
setup_wait_dev $h2
451455

452456
run_test $h1 br0 $skip_ptp $no_unicast_flt \
453457
"vlan_filtering=$vlan_filtering bridge"
@@ -480,6 +484,8 @@ test_vlan()
480484
h1_vlan_create
481485
h2_vlan_create
482486
macvlan_create $h2.100
487+
setup_wait_dev $h1
488+
setup_wait_dev $h2
483489

484490
run_test $h1.100 $h2.100 $skip_ptp $no_unicast_flt "VLAN upper"
485491

@@ -505,6 +511,8 @@ vlan_over_bridged_port()
505511
h2_vlan_create
506512
bridge_create $vlan_filtering
507513
macvlan_create $h2.100
514+
setup_wait_dev $h1
515+
setup_wait_dev $h2
508516

509517
run_test $h1.100 $h2.100 $skip_ptp $no_unicast_flt \
510518
"VLAN over vlan_filtering=$vlan_filtering bridged port"
@@ -536,6 +544,8 @@ vlan_over_bridge()
536544
simple_if_init br0
537545
vlan_create br0 100 vbr0 $H2_IPV4/24 $H2_IPV6/64
538546
macvlan_create br0.100
547+
setup_wait_dev $h1
548+
setup_wait_dev $h2
539549

540550
if [ $vlan_filtering = 1 ]; then
541551
bridge vlan add dev $h2 vid 100 master

0 commit comments

Comments
 (0)