From: stsp Date: Thu, 7 Dec 2017 14:13:05 +0000 (+0000) Subject: In iwm(4), keep scanning if net80211 asks for a SCAN->SCAN transition X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=deb6acad8ee19757af012937c30a690afb401a51;p=openbsd In iwm(4), keep scanning if net80211 asks for a SCAN->SCAN transition and the firmware is no longer busy scanning. Fixes 'ifconfig iwm0 scan' returning no results after resume far away from the currently configured AP. ok phessler@ --- diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index 036ecf46eef..ce5b40ad808 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.218 2017/12/07 14:12:39 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.219 2017/12/07 14:13:05 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -5986,17 +5986,27 @@ iwm_newstate_task(void *psc) ieee80211_state_name[ostate], ieee80211_state_name[nstate])); - if (nstate == ostate || (sc->sc_flags & IWM_FLAG_SHUTDOWN)) { - /* No-op state change or iwm_stop() is waiting for us. */ + if (sc->sc_flags & IWM_FLAG_SHUTDOWN) { + /* iwm_stop() is waiting for us. */ refcnt_rele_wake(&sc->task_refs); splx(s); return; } - if (ostate == IEEE80211_S_SCAN) - iwm_led_blink_stop(sc); + if (ostate == IEEE80211_S_SCAN) { + if (nstate == ostate) { + if (sc->sc_flags & IWM_FLAG_SCANNING) { + refcnt_rele_wake(&sc->task_refs); + splx(s); + return; + } + /* Firmware is no longer scanning. Do another scan. */ + goto next_scan; + } else + iwm_led_blink_stop(sc); + } - if (nstate < ostate) { + if (nstate <= ostate) { switch (ostate) { case IEEE80211_S_RUN: err = iwm_run_stop(sc); @@ -6035,6 +6045,7 @@ iwm_newstate_task(void *psc) break; case IEEE80211_S_SCAN: +next_scan: err = iwm_scan(sc); if (err) break;