summaryrefslogtreecommitdiffstats
path: root/sys/dev/iwm/if_iwm.c
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2016-04-26 04:40:59 +0000
committeradrian <adrian@FreeBSD.org>2016-04-26 04:40:59 +0000
commitf32b4c2e155c56824cc13c295f7ac893160b965a (patch)
treea376f3122bb5f5fab8c74e403f667bb16f0d1c53 /sys/dev/iwm/if_iwm.c
parent3322e9c2c92e3f6594bfdd28f84cd7b07e923ce3 (diff)
downloadFreeBSD-src-f32b4c2e155c56824cc13c295f7ac893160b965a.zip
FreeBSD-src-f32b4c2e155c56824cc13c295f7ac893160b965a.tar.gz
[iwm] implement suspend/resume through ieee80211_{suspend,resume}_all
This allows wifi to associate correctly after a suspend/resume cycle. Yes, I'm using this now day to day. Tested: * Intel 7260AC, STA mode
Diffstat (limited to 'sys/dev/iwm/if_iwm.c')
-rw-r--r--sys/dev/iwm/if_iwm.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c
index 0fad29e..5b9ea20 100644
--- a/sys/dev/iwm/if_iwm.c
+++ b/sys/dev/iwm/if_iwm.c
@@ -4934,6 +4934,8 @@ iwm_init_task(void *arg1)
static int
iwm_resume(device_t dev)
{
+ struct iwm_softc *sc = device_get_softc(dev);
+ int do_reinit = 0;
uint16_t reg;
/* Clear device-specific "PCI retry timeout" register (41h). */
@@ -4941,17 +4943,33 @@ iwm_resume(device_t dev)
pci_write_config(dev, 0x40, reg & ~0xff00, sizeof(reg));
iwm_init_task(device_get_softc(dev));
+ IWM_LOCK(sc);
+ if (sc->sc_flags & IWM_FLAG_DORESUME) {
+ sc->sc_flags &= ~IWM_FLAG_DORESUME;
+ do_reinit = 1;
+ }
+ IWM_UNLOCK(sc);
+
+ if (do_reinit)
+ ieee80211_resume_all(&sc->sc_ic);
+
return 0;
}
static int
iwm_suspend(device_t dev)
{
+ int do_stop = 0;
struct iwm_softc *sc = device_get_softc(dev);
- if (sc->sc_ic.ic_nrunning > 0) {
+ do_stop = !! (sc->sc_ic.ic_nrunning > 0);
+
+ ieee80211_suspend_all(&sc->sc_ic);
+
+ if (do_stop) {
IWM_LOCK(sc);
iwm_stop(sc);
+ sc->sc_flags |= IWM_FLAG_DORESUME;
IWM_UNLOCK(sc);
}
OpenPOWER on IntegriCloud