Commit e3f31175 authored by Felix Fietkau's avatar Felix Fietkau Committed by Kalle Valo

ath9k: fix race condition in irq processing during hardware reset

To fix invalid hardware accesses, the commit 872b5d81 ("ath9k: do not
access hardware on IRQs during reset") made the irq handler ignore interrupts
emitted after queueing a hardware reset (which disables the IRQ). This left a
small time window for the IRQ to get re-enabled by the tasklet, which caused
IRQ storms.  Instead of returning IRQ_NONE when ATH_OP_HW_RESET is set, disable
the IRQ entirely for the duration of the reset.
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 7b055201
...@@ -285,6 +285,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan) ...@@ -285,6 +285,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan)
__ath_cancel_work(sc); __ath_cancel_work(sc);
disable_irq(sc->irq);
tasklet_disable(&sc->intr_tq); tasklet_disable(&sc->intr_tq);
tasklet_disable(&sc->bcon_tasklet); tasklet_disable(&sc->bcon_tasklet);
spin_lock_bh(&sc->sc_pcu_lock); spin_lock_bh(&sc->sc_pcu_lock);
...@@ -331,6 +332,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan) ...@@ -331,6 +332,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan)
r = -EIO; r = -EIO;
out: out:
enable_irq(sc->irq);
spin_unlock_bh(&sc->sc_pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
tasklet_enable(&sc->bcon_tasklet); tasklet_enable(&sc->bcon_tasklet);
tasklet_enable(&sc->intr_tq); tasklet_enable(&sc->intr_tq);
...@@ -512,9 +514,6 @@ irqreturn_t ath_isr(int irq, void *dev) ...@@ -512,9 +514,6 @@ irqreturn_t ath_isr(int irq, void *dev)
if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags)) if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags))
return IRQ_NONE; return IRQ_NONE;
if (!AR_SREV_9100(ah) && test_bit(ATH_OP_HW_RESET, &common->op_flags))
return IRQ_NONE;
/* shared irq, not for us */ /* shared irq, not for us */
if (!ath9k_hw_intrpend(ah)) if (!ath9k_hw_intrpend(ah))
return IRQ_NONE; return IRQ_NONE;
...@@ -529,7 +528,7 @@ irqreturn_t ath_isr(int irq, void *dev) ...@@ -529,7 +528,7 @@ irqreturn_t ath_isr(int irq, void *dev)
ath9k_debug_sync_cause(sc, sync_cause); ath9k_debug_sync_cause(sc, sync_cause);
status &= ah->imask; /* discard unasked-for bits */ status &= ah->imask; /* discard unasked-for bits */
if (AR_SREV_9100(ah) && test_bit(ATH_OP_HW_RESET, &common->op_flags)) if (test_bit(ATH_OP_HW_RESET, &common->op_flags))
return IRQ_HANDLED; return IRQ_HANDLED;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment