Date: Sun, 18 Mar 2012 18:25:25 +0100 From: Bernhard Schmidt <bschmidt@freebsd.org> To: Mitsuru IWASAKI <iwasaki@jp.freebsd.org> Cc: freebsd-wireless@freebsd.org Subject: Re: [patch] iwi(4) suspend/resume broken Message-ID: <201203181825.25124.bschmidt@freebsd.org> In-Reply-To: <20120319.010352.124006046.iwasaki@jp.FreeBSD.org> References: <CAAgh0_YaqjXH=yA5Aq7kTcZSik4YE8JTKSSnFRtRsBtMXnPoSQ@mail.gmail.com> <201203171232.42515.bschmidt@freebsd.org> <20120319.010352.124006046.iwasaki@jp.FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_FqhZPFMxtAg2aQz Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit On Sunday 18 March 2012 17:03:52 Mitsuru IWASAKI wrote: > Hi, > > > I'd really prefer calling ieee80211_stop/init() in the suspend/resume > > functions, while the driver is not holding the lock (net80211 might > > call into the driver again). > > > > I roughly checked a few things and I even think that calling > > ieee80211_stop_all() might be enough. Still playing around though. > > OK, then I wouldn't commit my patches, I would wait for your patches to > test here. > Or may I try to hack ieee80211 layer to fix suspend/resume problem? > > Thanks! Well, I came up with attached diff. It works fine on iwn and wpi too basically, wpi has a bit of an issue with the scan after resume, I see probe resquest/response on air but the device doesn't pick em up sometimes.. still debugging. Anyways, I'm pretty sure that if you are doing the same for ipw/iwi it will just work fine. The ieee80211_resume_all/suspend_all calls will ensure that the appropriate stop/init driver functions are called. -- Bernhard --Boundary-00=_FqhZPFMxtAg2aQz Content-Type: text/x-patch; charset="ISO-8859-1"; name="suspend.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="suspend.diff" Index: sys/dev/iwn/if_iwn.c =================================================================== --- sys/dev/iwn/if_iwn.c (revision 233092) +++ sys/dev/iwn/if_iwn.c (working copy) @@ -945,13 +945,9 @@ static int iwn_suspend(device_t dev) { struct iwn_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->sc_ifp; - struct ieee80211com *ic = ifp->if_l2com; - struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + struct ieee80211com *ic = sc->sc_ifp->if_l2com; - iwn_stop(sc); - if (vap != NULL) - ieee80211_stop(vap); + ieee80211_suspend_all(ic); return 0; } @@ -959,20 +955,12 @@ static int iwn_resume(device_t dev) { struct iwn_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->sc_ifp; - struct ieee80211com *ic = ifp->if_l2com; - struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + struct ieee80211com *ic = sc->sc_ifp->if_l2com; /* Clear device-specific "PCI retry timeout" register (41h). */ pci_write_config(dev, 0x41, 0, 1); - if (ifp->if_flags & IFF_UP) { - iwn_init(sc); - if (vap != NULL) - ieee80211_init(vap); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - iwn_start(ifp); - } + ieee80211_resume_all(ic); return 0; } Index: sys/dev/wpi/if_wpi.c =================================================================== --- sys/dev/wpi/if_wpi.c (revision 233092) +++ sys/dev/wpi/if_wpi.c (working copy) @@ -1218,8 +1218,9 @@ static int wpi_suspend(device_t dev) { struct wpi_softc *sc = device_get_softc(dev); + struct ieee80211com *ic = sc->sc_ifp->if_l2com; - wpi_stop(sc); + ieee80211_suspend_all(ic); return 0; } @@ -1227,15 +1228,11 @@ static int wpi_resume(device_t dev) { struct wpi_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = sc->sc_ifp->if_l2com; pci_write_config(dev, 0x41, 0, 1); - if (ifp->if_flags & IFF_UP) { - wpi_init(ifp->if_softc); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - wpi_start(ifp); - } + ieee80211_resume_all(ic); return 0; } --Boundary-00=_FqhZPFMxtAg2aQz--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203181825.25124.bschmidt>