summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2017-09-04 09:12:35 +0000
committerstsp <stsp@openbsd.org>2017-09-04 09:12:35 +0000
commita39ec7e8254578b620d4bf8fdbeff003f59df58b (patch)
treeeb70d4e8c4dd30448f2e2f19f6b6c63a8b09ef8f
parentIf a beacon is received in RUN state, reset the management timer. (diff)
downloadwireguard-openbsd-a39ec7e8254578b620d4bf8fdbeff003f59df58b.tar.xz
wireguard-openbsd-a39ec7e8254578b620d4bf8fdbeff003f59df58b.zip
Make sure iwn(4) firmware gets to see a beacon before we send an auth request.
Otherwise, the Tx attempt can fail due to the firmware's built-in regulatory domain enforcement. Because this code runs in interrrupt context we use a DELAY(). It's currently set to 3 times the beacon interval. This is a bit long as far as DELAYs go, but since this driver runs state transitions in interrupt context there is no better way for now. Lower delays weren't reliable enough in my testing. Makes association work reliably for me on 5GHz. My original plan was to only add this hack for 5GHz but Holger Mikolon reported that it also helps on 2GHz channels with regulatory restrictions (e.g. 13), so do it always. ok mpi@
-rw-r--r--sys/dev/pci/if_iwn.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c
index 3db2dab5b7a..9d182d81e03 100644
--- a/sys/dev/pci/if_iwn.c
+++ b/sys/dev/pci/if_iwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwn.c,v 1.191 2017/08/13 15:04:47 tb Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.192 2017/09/04 09:12:35 stsp Exp $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -4930,6 +4930,14 @@ iwn_auth(struct iwn_softc *sc)
sc->sc_dev.dv_xname);
return error;
}
+
+ /*
+ * Make sure the firmware gets to see a beacon before we send
+ * the auth request. Otherwise the Tx attempt can fail due to
+ * the firmware's built-in regulatory domain enforcement.
+ */
+ DELAY(ni->ni_intval * 3 * IEEE80211_DUR_TU);
+
return 0;
}