From owner-p4-projects@FreeBSD.ORG Tue May 27 19:34:47 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3CA5B1065683; Tue, 27 May 2008 19:34:47 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F10961065678 for ; Tue, 27 May 2008 19:34:46 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E2B518FC0C for ; Tue, 27 May 2008 19:34:46 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m4RJYk89026263 for ; Tue, 27 May 2008 19:34:46 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m4RJYksW026261 for perforce@freebsd.org; Tue, 27 May 2008 19:34:46 GMT (envelope-from sam@freebsd.org) Date: Tue, 27 May 2008 19:34:46 GMT Message-Id: <200805271934.m4RJYksW026261@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 142401 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 May 2008 19:34:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=142401 Change 142401 by sam@sam_ebb on 2008/05/27 19:34:28 close a race on detach by reordering bpfdetach and taskqueue_free; add some comments to explain Affected files ... .. //depot/projects/vap/sys/dev/ath/if_ath.c#81 edit Differences ... ==== //depot/projects/vap/sys/dev/ath/if_ath.c#81 (text+ko) ==== @@ -678,13 +678,15 @@ DPRINTF(sc, ATH_DEBUG_ANY, "%s: if_flags %x\n", __func__, ifp->if_flags); - ath_stop(ifp); - bpfdetach(ifp); /* * NB: the order of these is important: + * o stop the chip so no more interrupts will fire * o call the 802.11 layer before detaching the hal to * insure callbacks into the driver to delete global * key cache entries can be handled + * o free the taskqueue which drains any pending tasks + * o reclaim the bpf tap now that we know nothing will use + * it (e.g. rx processing from the task q thread) * o reclaim the tx queue data structures after calling * the 802.11 layer as we'll get called back to reclaim * node state and potentially want to use them @@ -692,12 +694,14 @@ * it last * Other than that, it's straightforward... */ + ath_stop(ifp); ieee80211_ifdetach(ifp->if_l2com); + taskqueue_free(sc->sc_tq); + bpfdetach(ifp); #ifdef ATH_TX99_DIAG if (sc->sc_tx99 != NULL) sc->sc_tx99->detach(sc->sc_tx99); #endif - taskqueue_free(sc->sc_tq); ath_rate_detach(sc->sc_rc); ath_desc_free(sc); ath_tx_cleanup(sc);