Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 May 2008 19:34:46 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 142401 for review
Message-ID:  <200805271934.m4RJYksW026261@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805271934.m4RJYksW026261>