summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2017-07-16 21:35:20 +0000
committerstsp <stsp@openbsd.org>2017-07-16 21:35:20 +0000
commit708fbc090293538ee1b948f059b14ac3e3a2f3e7 (patch)
treed8e12788cf45737f1f6e5283ecbd20b2372e2905
parentMatch /clocks node on Allwinner H5. (diff)
downloadwireguard-openbsd-708fbc090293538ee1b948f059b14ac3e3a2f3e7.tar.xz
wireguard-openbsd-708fbc090293538ee1b948f059b14ac3e3a2f3e7.zip
Some net80211 state changes are triggered by incoming frames, and it is
possible for such frames to move iwm(4) to the same state, e.g. AUTH->AUTH. Do not bother the firmware with such no-op state changes because that runs a high risk of hitting firmware errors. Problem reported by Gregor Best.
-rw-r--r--sys/dev/pci/if_iwm.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index dbf3708e012..49494a71405 100644
--- a/sys/dev/pci/if_iwm.c
+++ b/sys/dev/pci/if_iwm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwm.c,v 1.199 2017/07/15 15:48:08 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.200 2017/07/16 21:35:20 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -5841,17 +5841,18 @@ iwm_newstate_task(void *psc)
ieee80211_state_name[ostate],
ieee80211_state_name[nstate]));
- if (ostate == IEEE80211_S_SCAN && nstate != ostate)
+ if (nstate == ostate)
+ return;
+
+ if (ostate == IEEE80211_S_SCAN)
iwm_led_blink_stop(sc);
- if (nstate <= ostate) {
+ if (nstate < ostate) {
switch (ostate) {
case IEEE80211_S_RUN:
- if (nstate <= IEEE80211_S_RUN) {
- err = iwm_run_stop(sc);
- if (err)
- goto out;
- }
+ err = iwm_run_stop(sc);
+ if (err)
+ goto out;
/* FALLTHROUGH */
case IEEE80211_S_ASSOC:
if (nstate <= IEEE80211_S_ASSOC) {