PERFORCE change 139287 for review
Sam Leffler
sam at FreeBSD.org
Thu Apr 3 20:18:37 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=139287
Change 139287 by sam at sam_ebb on 2008/04/03 20:18:32
Use new taskqueue_block/unblock to fix/improve on longstanding issues:
o block rx processing during key changes (still a small race but
probably acceptable)
o bock task q processing on move to INIT state; still have a small
race but before we couldn't use taskqueue_drain because we are
called with mtx(s) held and that just barfs entirely
This still doesn't fix module unload while active on smp
machines which may be a different issue (hard to see since
the laptop doesn't have a serial port and it just locks up hard).
Affected files ...
.. //depot/projects/vap/sys/dev/ath/if_ath.c#58 edit
Differences ...
==== //depot/projects/vap/sys/dev/ath/if_ath.c#58 (text+ko) ====
@@ -2451,9 +2451,7 @@
struct ath_softc *sc = ifp->if_softc;
DPRINTF(sc, ATH_DEBUG_KEYCACHE, "%s:\n", __func__);
-#if 0
- tasklet_disable(&sc->sc_rxtq);
-#endif
+ taskqueue_block(sc->sc_tq);
IF_LOCK(&ifp->if_snd); /* NB: doesn't block mgmt frames */
}
@@ -2465,9 +2463,7 @@
DPRINTF(sc, ATH_DEBUG_KEYCACHE, "%s:\n", __func__);
IF_UNLOCK(&ifp->if_snd);
-#if 0
- tasklet_enable(&sc->sc_rxtq);
-#endif
+ taskqueue_unblock(sc->sc_tq);
}
/*
@@ -5524,10 +5520,12 @@
* Walk the vap list and check if there any vap's in RUN state.
*/
static int
-ath_isanyrunningvaps(const struct ieee80211vap *this)
+ath_isanyrunningvaps(struct ieee80211vap *this)
{
- const struct ieee80211com *ic = this->iv_ic;
- const struct ieee80211vap *vap;
+ struct ieee80211com *ic = this->iv_ic;
+ struct ieee80211vap *vap;
+
+ IEEE80211_LOCK_ASSERT(ic);
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
if (vap != this && vap->iv_state == IEEE80211_S_RUN)
@@ -5568,12 +5566,14 @@
/*
* Scanning: turn off beacon miss and don't beacon.
* Mark beacon state so when we reach RUN state we'll
- * [re]setup beacons.
+ * [re]setup beacons. Unblock the task q thread so
+ * deferred interrupt processing is done.
*/
ath_hal_intrset(ah,
sc->sc_imask &~ (HAL_INT_SWBA | HAL_INT_BMISS));
sc->sc_imask &= ~(HAL_INT_SWBA | HAL_INT_BMISS);
sc->sc_beacons = 0;
+ taskqueue_unblock(sc->sc_tq);
}
ni = vap->iv_bss;
@@ -5689,33 +5689,29 @@
sc->sc_halstats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER;
sc->sc_halstats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER;
/*
- * Finally, start any timers.
+ * Finally, start any timers and the task q thread
+ * (in case we didn't go through SCAN state).
*/
if (sc->sc_calinterval != 0) {
/* start periodic recalibration timer */
callout_reset(&sc->sc_cal_ch, sc->sc_calinterval * hz,
ath_calibrate, sc);
}
+ taskqueue_unblock(sc->sc_tq);
} else if (nstate == IEEE80211_S_INIT) {
/*
* If there are no vaps left in RUN state then
* shutdown host/driver operation:
- * o disable interrupts so we don't rx frames
- * o clean any pending items on the task q
- * o notify the rate control algorithm
+ * o disable interrupts
+ * o disable the task queue thread
+ * o mark beacon processing as stopped
*/
if (!ath_isanyrunningvaps(vap)) {
sc->sc_imask &= ~(HAL_INT_SWBA | HAL_INT_BMISS);
/* disable interrupts */
ath_hal_intrset(ah, sc->sc_imask &~ HAL_INT_GLOBAL);
+ taskqueue_block(sc->sc_tq);
sc->sc_beacons = 0;
-#if 0
- /* XXX can't use taskqueue_drain 'cuz we're holding sc_mtx */
- taskqueue_drain(sc->sc_tq, &sc->sc_rxtask);
- taskqueue_drain(sc->sc_tq, &sc->sc_rxorntask);
- taskqueue_drain(sc->sc_tq, &sc->sc_bmisstask);
- taskqueue_drain(sc->sc_tq, &sc->sc_bstucktask);
-#endif
}
}
bad:
More information about the p4-projects
mailing list