From owner-svn-src-head@FreeBSD.ORG Fri May 8 17:40:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42454106564A; Fri, 8 May 2009 17:40:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 132338FC0A; Fri, 8 May 2009 17:40:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id A829D46B09; Fri, 8 May 2009 13:40:58 -0400 (EDT) Received: from John-Baldwins-Macbook-Pro.local (localhost [127.0.0.1]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 392CA8A022; Fri, 8 May 2009 13:40:57 -0400 (EDT) Message-ID: <4A046EB0.9060009@FreeBSD.org> Date: Fri, 08 May 2009 13:41:04 -0400 From: John Baldwin User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: Andrew Thompson References: <200905081344.n48DiYJI092605@svn.freebsd.org> In-Reply-To: <200905081344.n48DiYJI092605@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 08 May 2009 13:40:57 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191912 - in head/sys/dev: ipw iwi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 May 2009 17:40:59 -0000 Andrew Thompson wrote: > Author: thompsa > Date: Fri May 8 13:44:33 2009 > New Revision: 191912 > URL: http://svn.freebsd.org/changeset/base/191912 > > Log: > Drain the tasks before the interface stop call in case a restart was queued. Actually, you have to drain it after if_detach() so you can safely destroy the lock. The proper order should be something like this: bpfdetach(ifp); ieee80211_ifdetach(ic); ipw_stop(sc); callout_drain(); ieee80211_draintask(); ipw_release(sc); This is the order other NIC drivers use where they do something like: ether_ifdetach(ifp); FOO_LOCK(sc); foo_stop(sc); // calls callout_stop() FOO_UNLOCK(sc); callout_drain(); taskqueue_drain(); // only if it uses tasks if_free(); mtx_destroy(); > > Modified: > head/sys/dev/ipw/if_ipw.c > head/sys/dev/iwi/if_iwi.c > > Modified: head/sys/dev/ipw/if_ipw.c > ============================================================================== > --- head/sys/dev/ipw/if_ipw.c Fri May 8 03:19:57 2009 (r191911) > +++ head/sys/dev/ipw/if_ipw.c Fri May 8 13:44:33 2009 (r191912) > @@ -404,13 +404,13 @@ ipw_detach(device_t dev) > struct ifnet *ifp = sc->sc_ifp; > struct ieee80211com *ic = ifp->if_l2com; > > + ieee80211_draintask(ic, &sc->sc_init_task); > ipw_stop(sc); > > bpfdetach(ifp); > ieee80211_ifdetach(ic); > > callout_drain(&sc->sc_wdtimer); > - ieee80211_draintask(ic, &sc->sc_init_task); > > ipw_release(sc); > > > Modified: head/sys/dev/iwi/if_iwi.c > ============================================================================== > --- head/sys/dev/iwi/if_iwi.c Fri May 8 03:19:57 2009 (r191911) > +++ head/sys/dev/iwi/if_iwi.c Fri May 8 13:44:33 2009 (r191912) > @@ -459,17 +459,17 @@ iwi_detach(device_t dev) > struct ifnet *ifp = sc->sc_ifp; > struct ieee80211com *ic = ifp->if_l2com; > > - iwi_stop(sc); > - > - bpfdetach(ifp); > - ieee80211_ifdetach(ic); > - > /* NB: do early to drain any pending tasks */ > ieee80211_draintask(ic, &sc->sc_radiontask); > ieee80211_draintask(ic, &sc->sc_radiofftask); > ieee80211_draintask(ic, &sc->sc_restarttask); > ieee80211_draintask(ic, &sc->sc_disassoctask); > > + iwi_stop(sc); > + > + bpfdetach(ifp); > + ieee80211_ifdetach(ic); > + > iwi_put_firmware(sc); > iwi_release_fw_dma(sc); > -- John Baldwin