From owner-freebsd-wireless@FreeBSD.ORG Sun Mar 18 17:25:14 2012 Return-Path: Delivered-To: freebsd-wireless@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36024106566B for ; Sun, 18 Mar 2012 17:25:14 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by mx1.freebsd.org (Postfix) with ESMTP id A8E328FC15 for ; Sun, 18 Mar 2012 17:25:13 +0000 (UTC) Received: by wibhj6 with SMTP id hj6so2265721wib.13 for ; Sun, 18 Mar 2012 10:25:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:message-id:x-gm-message-state; bh=U8F/vB4KXmsE77kiVGny37GiukHAF3S4w7tA7/8NK/0=; b=IV89nIo75AO3l+IIqPvOPJ/+erZpU/nT9lvSIboA30QEfaYAmYlFMIUhDF/Fa/pMo6 I2u162TlUFFICupctaW4JOaQH5dF8CAWU2M7yYNALp2poZ/OvqYiAQ8TCI9CEiEfEgvk 0xH62hI/ZlufuCCkLz1eWV1gHpeZXxKKtSfCatGrxJVhGpU4ubGxnz8zWl03gZwYwUGU FeWVj086h3cMTdnZP89nLBqdJXYdnPzXgPl2h/NZZvgzZXG8tt0hONCsrHYafj62TKO5 3ABc4KS7fFefdufx677t/0VnY3RJLDV8W7ZzXHg3o98W0SBf/xOSLSP9MtfGpKjaNbmf A5hw== Received: by 10.180.95.74 with SMTP id di10mr22795270wib.1.1332091512498; Sun, 18 Mar 2012 10:25:12 -0700 (PDT) Received: from amy.lab.techwires.net (dslb-178-002-172-042.pools.arcor-ip.net. [178.2.172.42]) by mx.google.com with ESMTPS id n8sm29500720wix.10.2012.03.18.10.25.09 (version=SSLv3 cipher=OTHER); Sun, 18 Mar 2012 10:25:11 -0700 (PDT) Sender: Bernhard Schmidt From: Bernhard Schmidt To: Mitsuru IWASAKI Date: Sun, 18 Mar 2012 18:25:25 +0100 User-Agent: KMail/1.13.7 (FreeBSD/9.0-STABLE; KDE/4.7.4; amd64; ; ) References: <201203171232.42515.bschmidt@freebsd.org> <20120319.010352.124006046.iwasaki@jp.FreeBSD.org> In-Reply-To: <20120319.010352.124006046.iwasaki@jp.FreeBSD.org> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_FqhZPFMxtAg2aQz" Message-Id: <201203181825.25124.bschmidt@freebsd.org> X-Gm-Message-State: ALoCoQmnVt00er5e9w1e6PMxkFf0ZVcz/Wd5XI9Yw5db+TwOfgtOnL3Lu8ha9PcqJRq1hTqfknLV Cc: freebsd-wireless@freebsd.org Subject: Re: [patch] iwi(4) suspend/resume broken X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 17:25:14 -0000 --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--