I find this approach easier to follow and it doesn't mess with
ic->ic_scan_lock which is supposed to be managed by the net80211 layer.
Seems to work just as well as the old code.
OK?
Index: if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.52
diff -u -p -r1.52 if_iwm.c
--- if_iwm.c 5 Oct 2015 13:05:08 -0000 1.52
+++ if_iwm.c 5 Oct 2015 20:36:46 -0000
@@ -4611,7 +4611,6 @@ iwm_mvm_scan_request(struct iwm_softc *s
* to allocate the time events. Warn on it, but maybe we
* should try to send the command again with different params.
*/
- sc->sc_scanband = 0;
ret = EIO;
}
return ret;
@@ -5316,6 +5315,8 @@ iwm_newstate_task(void *psc)
ic->ic_des_esslen != 0,
ic->ic_des_essid, ic->ic_des_esslen)) != 0) {
printf("%s: could not initiate scan\n", DEVNAME(sc));
+ sc->sc_scanband = 0;
+ sc->sc_newstate(ic, IEEE80211_S_INIT, arg);
return;
}
ic->ic_state = nstate;
@@ -5408,11 +5409,7 @@ iwm_endscan_cb(void *arg)
}
if (done) {
- if (!sc->sc_scanband) {
- ic->ic_scan_lock = IEEE80211_SCAN_UNLOCKED;
- } else {
- ieee80211_end_scan(&ic->ic_if);
- }
+ ieee80211_end_scan(&ic->ic_if);
sc->sc_scanband = 0;
}
}
@@ -5639,9 +5636,10 @@ iwm_stop(struct ifnet *ifp, int disable)
sc->sc_flags &= ~IWM_FLAG_HW_INITED;
sc->sc_flags |= IWM_FLAG_STOPPED;
sc->sc_generation++;
+ if (sc->sc_scanband)
+ ieee80211_end_scan(&ic->ic_if);
sc->sc_scanband = 0;
sc->sc_auth_prot = 0;
- ic->ic_scan_lock = IEEE80211_SCAN_UNLOCKED;
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
task_del(systq, &sc->init_task);