Date: Tue, 26 Apr 2016 09:27:12 +0300 From: "Andriy Voskoboinyk" <avos@freebsd.org> To: "Adrian Chadd" <adrian@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r298612 - head/sys/dev/iwm Message-ID: <op.ygij7mo34dikkl@localhost> In-Reply-To: <201604260440.u3Q4exZD045896@repo.freebsd.org> References: <201604260440.u3Q4exZD045896@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Tue, 26 Apr 2016 07:40:59 +0300 =D0=B1=D1=83=D0=BB=D0=BE =D0=BD=D0=B0=D0= =BF=D0=B8=D1=81=D0=B0=D0=BD=D0=BE Adrian Chadd = <adrian@freebsd.org>: > Author: adrian > Date: Tue Apr 26 04:40:59 2016 > New Revision: 298612 > URL: https://svnweb.freebsd.org/changeset/base/298612 > > Log: > [iwm] implement suspend/resume through ieee80211_{suspend,resume}_al= l > 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 > > Modified: > head/sys/dev/iwm/if_iwm.c > head/sys/dev/iwm/if_iwmvar.h > > Modified: head/sys/dev/iwm/if_iwm.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- head/sys/dev/iwm/if_iwm.c Tue Apr 26 03:24:28 2016 (r298611) > +++ head/sys/dev/iwm/if_iwm.c Tue Apr 26 04:40:59 2016 (r298612) > @@ -4934,6 +4934,8 @@ iwm_init_task(void *arg1) > static int > iwm_resume(device_t dev) > { > + struct iwm_softc *sc =3D device_get_softc(dev); > + int do_reinit =3D 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 &=3D ~IWM_FLAG_DORESUME; > + do_reinit =3D 1; If no vap was running, then nothing will be started (because of IEEE80211_FEXT_RESUME flag). > + } > + IWM_UNLOCK(sc); > + > + if (do_reinit) > + ieee80211_resume_all(&sc->sc_ic); AFAIK, suspend_all() / resume_all() should work without any additional logic (except (?) device-specific PCI registers (41h) pre-setup on resume). > + > return 0; > } > static int > iwm_suspend(device_t dev) > { > + int do_stop =3D 0; > struct iwm_softc *sc =3D device_get_softc(dev); > - if (sc->sc_ic.ic_nrunning > 0) { > + do_stop =3D !! (sc->sc_ic.ic_nrunning > 0); > + > + ieee80211_suspend_all(&sc->sc_ic); > + > + if (do_stop) { > IWM_LOCK(sc); > iwm_stop(sc); Is it really needed? (iwm_stop() will be already executed when the last = vap will be stopped + suspend_resume() waits for ic_parent method). > + sc->sc_flags |=3D IWM_FLAG_DORESUME; > IWM_UNLOCK(sc); > } > > Modified: head/sys/dev/iwm/if_iwmvar.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- head/sys/dev/iwm/if_iwmvar.h Tue Apr 26 03:24:28 2016 (r298611) > +++ head/sys/dev/iwm/if_iwmvar.h Tue Apr 26 04:40:59 2016 (r298612) > @@ -405,6 +405,7 @@ struct iwm_softc { > #define IWM_FLAG_STOPPED (1 << 2) > #define IWM_FLAG_RFKILL (1 << 3) > #define IWM_FLAG_BUSY (1 << 4) > +#define IWM_FLAG_DORESUME (1 << 5) > struct intr_config_hook sc_preinit_hook; > struct callout sc_watchdog_to;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?op.ygij7mo34dikkl>