ath9k patches
cover ath9k patches
From: Sujith Manoharan <[email protected]>
Fixes related to reset.
Sujith Manoharan (3):
ath9k: Unify reset API
ath9k: Set ATH_OP_HW_RESET before HW reset
ath9k: Disable beacon tasklet during reset
drivers/net/wireless/ath/ath9k/ath9k.h | 3 +-- drivers/net/wireless/ath/ath9k/channel.c | 2 +- drivers/net/wireless/ath/ath9k/main.c | 26 +++++++++++++++++++++----- drivers/net/wireless/ath/ath9k/tx99.c | 4 ++-- 4 files changed, 25 insertions(+), 10 deletions(-)
Signature · 1 line
2.1.2
PATCH 1/3 ath9k: Unify reset API
From: Sujith Manoharan <[email protected]>
Instead of having ath_reset_internal() and ath_reset() as two separate calls to perform a HW reset, have one function. This makes sure that the behavior will be the same at all callsites.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 3 +-- drivers/net/wireless/ath/ath9k/channel.c | 2 +- drivers/net/wireless/ath/ath9k/main.c | 12 +++++++----- drivers/net/wireless/ath/ath9k/tx99.c | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -2
@@ -540,7 +540,6 @@ static inline void ath_chanctx_check_active(struct ath_softc *sc,#endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */ -int ath_reset_internal (struct ath_softc *sc,struct ath9k_channel *hchan);void ath_startrecv (struct ath_softc *sc);bool ath_stoprecv (struct ath_softc *sc);u32 ath_calcrxfilter (struct ath_softc *sc);
@@ -1069,7 +1068,7 @@ void ath9k_tasklet(unsigned long data);int ath_cabq_update (struct ath_softc *);u8 ath9k_parse_mpdudensity (u8 mpdudensity);irqreturn_t ath_isr (int irq,void *dev); -int ath_reset (struct ath_softc *sc); +int ath_reset (struct ath_softc *sc,struct ath9k_channel *hchan);void ath_cancel_work (struct ath_softc *sc);void ath_restart_work (struct ath_softc *sc); int ath9k_init_device(u16 devid, struct ath_softc *sc,
drivers/net/wireless/ath/ath9k/channel.c +1 -1
@@ -66,7 +66,7 @@ static int ath_set_channel(struct ath_softc *sc) } hchan = &sc->sc_ah->channels[pos]; - r =ath_reset_internal (sc, hchan); + r =ath_reset (sc, hchan);if (r)return r;
drivers/net/wireless/ath/ath9k/main.c +7 -5
@@ -270,7 +270,7 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)return true; } -int ath_reset_internal (struct ath_softc *sc,struct ath9k_channel *hchan) +static int ath_reset_internal (struct ath_softc *sc,struct ath9k_channel *hchan) {struct ath_hw *ah = sc->sc_ah;struct ath_common *common =ath9k_hw_common (ah);
@@ -598,12 +598,12 @@ chip_reset:#undef SCHED_INTR } -int ath_reset (struct ath_softc *sc) +int ath_reset (struct ath_softc *sc,struct ath9k_channel *hchan) {int r;ath9k_ps_wakeup (sc); - r =ath_reset_internal (sc,NULL ); + r =ath_reset_internal (sc, hchan);ath9k_ps_restore (sc);return r;
@@ -623,7 +623,9 @@ void ath_reset_work(struct work_struct *work) { struct ath_softc *sc = container_of(work, struct ath_softc, hw_reset_work); -ath_reset (sc); +ath9k_ps_wakeup (sc); +ath_reset_internal (sc,NULL ); +ath9k_ps_restore (sc); }/**********************/
@@ -2044,7 +2046,7 @@ void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)spin_unlock_bh (&sc->sc_pcu_lock);if (!drain_txq) -ath_reset (sc); +ath_reset (sc,NULL );ath9k_ps_restore (sc); }
drivers/net/wireless/ath/ath9k/tx99.c +2 -2
@@ -99,7 +99,7 @@ static struct sk_buff *ath9k_build_tx99_skb(struct ath_softc *sc)static void ath9k_tx99_deinit (struct ath_softc *sc) { -ath_reset (sc); +ath_reset (sc,NULL );ath9k_ps_wakeup (sc);ath9k_tx99_stop (sc);
@@ -127,7 +127,7 @@ static int ath9k_tx99_init(struct ath_softc *sc)memset (&txctl,0 ,sizeof (txctl)); txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO ]; -ath_reset (sc); +ath_reset (sc,NULL );ath9k_ps_wakeup (sc);
Signature · 1 line
2.1.2
PATCH 2/3 ath9k: Set ATH_OP_HW_RESET before HW reset
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
When a HW reset is done, the interrupt tasklet is disabled before ISRs are disabled in the HW. This allows a small window where the HW can still generate interrupts. Since the tasklet is disabled and not killed, it is not scheduled but deferred for execution at a later time.
This happens because ATH_OP_HW_RESET is not set when ath_reset() is called. When the hw_reset_work workqueue is used, this problem doesn't arise because ATH_OP_HW_RESET is set and the ISR bails out.
Set ATH_OP_HW_RESET properly in ath_reset() to avoid this race - all the ath_reset_internal() callers have been converted to use ath_reset() in the previous patch.
--- drivers/net/wireless/ath/ath9k/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/wireless/ath/ath9k/main.c +12 -0
@@ -598,10 +598,17 @@ chip_reset:#undef SCHED_INTR } +/* +* This function is called when a HW reset cannot be deferred +* and has to be immediate. +*/ int ath_reset (struct ath_softc *sc,struct ath9k_channel *hchan) { +struct ath_common *common =ath9k_hw_common (sc->sc_ah);int r; +set_bit (ATH_OP_HW_RESET , &common->op_flags); +ath9k_ps_wakeup (sc); r =ath_reset_internal (sc, hchan);ath9k_ps_restore (sc);
@@ -609,6 +616,11 @@ int ath_reset(struct ath_softc *sc, struct ath9k_channel *hchan)return r; } +/* +* When a HW reset can be deferred, it is added to the +* hw_reset_work workqueue, but we set ATH_OP_HW_RESET before +* queueing. +*/ void ath9k_queue_reset (struct ath_softc *sc,enum ath_reset_type type) {struct ath_common *common =ath9k_hw_common (sc->sc_ah);
Signature · 1 line
2.1.2
PATCH 3/3 ath9k: Disable beacon tasklet during reset
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
When a chip reset is done, all running timers,
tasklets etc. are stopped but the beacon tasklet
is left running. Fix this.
--- drivers/net/wireless/ath/ath9k/main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath9k/main.c +2 -0
@@ -281,6 +281,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan)__ath_cancel_work (sc);tasklet_disable (&sc->intr_tq); +tasklet_disable (&sc->bcon_tasklet);spin_lock_bh (&sc->sc_pcu_lock);if (!sc->cur_chan->offchannel) {
@@ -326,6 +327,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan) out:spin_unlock_bh (&sc->sc_pcu_lock); +tasklet_enable (&sc->bcon_tasklet);tasklet_enable (&sc->intr_tq);return r;
Signature · 1 line
2.1.2