diff options
-rw-r--r-- | sys/dev/ath/if_ath.c | 50 | ||||
-rw-r--r-- | sys/dev/ath/if_athvar.h | 1 |
2 files changed, 35 insertions, 16 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index bf0e3b3..c6556cb 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -159,6 +159,7 @@ static void ath_beacon_proc(void *, int); static struct ath_buf *ath_beacon_generate(struct ath_softc *, struct ieee80211vap *); static void ath_bstuck_proc(void *, int); +static void ath_reset_proc(void *, int); static void ath_beacon_return(struct ath_softc *, struct ath_buf *); static void ath_beacon_free(struct ath_softc *); static void ath_beacon_config(struct ath_softc *, struct ieee80211vap *); @@ -392,6 +393,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) TASK_INIT(&sc->sc_rxtask, 0, ath_rx_tasklet, sc); TASK_INIT(&sc->sc_bmisstask, 0, ath_bmiss_proc, sc); TASK_INIT(&sc->sc_bstucktask,0, ath_bstuck_proc, sc); + TASK_INIT(&sc->sc_resettask,0, ath_reset_proc, sc); /* * Allocate hardware transmit queues: one queue for @@ -1910,9 +1912,6 @@ ath_txrx_stop_locked(struct ath_softc *sc) ATH_UNLOCK_ASSERT(sc); ATH_PCU_LOCK_ASSERT(sc); - /* Stop any new TX/RX from occuring */ - taskqueue_block(sc->sc_tq); - /* * Sleep until all the pending operations have completed. * @@ -2050,6 +2049,9 @@ ath_reset(struct ifnet *ifp, ATH_RESET_TYPE reset_type) ATH_PCU_UNLOCK_ASSERT(sc); ATH_UNLOCK_ASSERT(sc); + /* Try to (stop any further TX/RX from occuring */ + taskqueue_block(sc->sc_tq); + ATH_PCU_LOCK(sc); ath_hal_intrset(ah, 0); /* disable interrupts */ ath_txrx_stop_locked(sc); /* Ensure TX/RX is stopped */ @@ -3163,6 +3165,23 @@ ath_beacon_start_adhoc(struct ath_softc *sc, struct ieee80211vap *vap) } /* + * Reset the hardware, with no loss. + * + * This can't be used for a general case reset. + */ +static void +ath_reset_proc(void *arg, int pending) +{ + struct ath_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + +#if 0 + if_printf(ifp, "%s: resetting\n", __func__); +#endif + ath_reset(ifp, ATH_RESET_NOLOSS); +} + +/* * Reset the hardware after detecting beacons have stopped. */ static void @@ -5387,6 +5406,12 @@ ath_chan_set(struct ath_softc *sc, struct ieee80211_channel *chan) int ret = 0; /* Treat this as an interface reset */ + ATH_PCU_UNLOCK_ASSERT(sc); + ATH_UNLOCK_ASSERT(sc); + + /* (Try to) stop TX/RX from occuring */ + taskqueue_block(sc->sc_tq); + ATH_PCU_LOCK(sc); ath_hal_intrset(ah, 0); /* Stop new RX/TX completion */ ath_txrx_stop_locked(sc); /* Stop pending RX/TX completion */ @@ -5526,18 +5551,10 @@ ath_calibrate(void *arg) DPRINTF(sc, ATH_DEBUG_CALIBRATE, "%s: rfgain change\n", __func__); sc->sc_stats.ast_per_rfgain++; - /* - * Drop lock - we can't hold it across the - * ath_reset() call. Instead, we'll drop - * out here, do a reset, then reschedule - * the callout. - */ - callout_reset(&sc->sc_cal_ch, 1, ath_calibrate, sc); sc->sc_resetcal = 0; sc->sc_doresetcal = AH_TRUE; - ATH_UNLOCK(sc); - ath_reset(ifp, ATH_RESET_NOLOSS); - ATH_LOCK(sc); + taskqueue_enqueue(sc->sc_tq, &sc->sc_resettask); + callout_reset(&sc->sc_cal_ch, 1, ath_calibrate, sc); return; } /* @@ -6187,11 +6204,12 @@ ath_watchdog(void *arg) /* * We can't hold the lock across the ath_reset() call. + * + * And since this routine can't hold a lock and sleep, + * do the reset deferred. */ if (do_reset) { - ATH_UNLOCK(sc); - ath_reset(sc->sc_ifp, ATH_RESET_NOLOSS); - ATH_LOCK(sc); + taskqueue_enqueue(sc->sc_tq, &sc->sc_resettask); } callout_schedule(&sc->sc_wd_ch, hz); diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h index 919ecec..1b6542b 100644 --- a/sys/dev/ath/if_athvar.h +++ b/sys/dev/ath/if_athvar.h @@ -501,6 +501,7 @@ struct ath_softc { struct ath_txq *sc_cabq; /* tx q for cab frames */ struct task sc_bmisstask; /* bmiss int processing */ struct task sc_bstucktask; /* stuck beacon processing */ + struct task sc_resettask; /* interface reset task */ enum { OK, /* no change needed */ UPDATE, /* update pending */ |