If net80211 is not in SCAN state anymore at the point in time where
the device tells us it is done scanning, do nothing instead of
proceeding to select an AP anyway and eventually sending some
commands that will just confuse the firmware.
This might silence some error messages people have seen with iwm(4).
Briefly tested on an 8260 device.
Index: if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.182
diff -u -p -r1.182 if_iwm.c
--- if_iwm.c 26 May 2017 18:40:05 -0000 1.182
+++ if_iwm.c 28 May 2017 10:03:13 -0000
@@ -5684,6 +5684,10 @@ iwm_endscan_cb(void *arg)
struct iwm_softc *sc = arg;
struct ieee80211com *ic = &sc->sc_ic;
+ /* Check if device was reset while scanning. */
+ if (ic->ic_state != IEEE80211_S_SCAN)
+ return;
+
sc->sc_flags &= ~IWM_FLAG_SCANNING;
ieee80211_end_scan(&ic->ic_if);
}
@@ -6161,6 +6163,7 @@ iwm_stop(struct ifnet *ifp, int disable)
task_del(systq, &sc->ba_task);
task_del(systq, &sc->htprot_task);
+ sc->sc_flags &= ~IWM_FLAG_SCANNING;
sc->sc_newstate(ic, IEEE80211_S_INIT, -1);
timeout_del(&sc->sc_calib_to);