[PATCH] hwsim tests: sleep a bit before connectivity checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Johannes Berg <johannes.berg@xxxxxxxxx>

There's a window of time, that probably never really happens
in real life, where we can TX before the kernel has run the
linkwatch_event(), which sets up the qdisc in dev_activate().
If we happen to attempt to do connectivity checks before the
event has been processed, all frames are dropped in the noop
qdisc, causing this to fail.

Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
---
 tests/hwsim/hwsim_utils.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index dccdefc71c56..5070b3a6ff8e 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -15,6 +15,18 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
                           ifname1=None, ifname2=None, config=True, timeout=5,
                           multicast_to_unicast=False, broadcast=True,
                           send_len=None):
+    # If running on a single-CPU system, and in particular on UML with
+    # purely virtual time (where there's no real preemption), we might
+    # be *really* fast to get to this point after starting things up,
+    # and that means that after the call to the linkwatch_fire_event()
+    # function in the kernel we still continue processing immediately
+    # in userspace (i.e. here) and manage to try to test the transmit
+    # before we have a real qdisc assigned to the netdev queues...
+    # Sleep a tiny little bit here to let the kernel actually run the
+    # scheduled work function (linkwatch_event()) after having queued
+    # it from the carrier on event.
+    time.sleep(0.01)
+
     addr1 = dev1.own_addr()
     if not dev1group and isinstance(dev1, WpaSupplicant):
         addr = dev1.get_driver_status_field('addr')
-- 
2.17.2


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux