ath9k: fix enabling interrupts after a hardware error interrupt
PATCH 1/3 ath9k: fix enabling interrupts after a hardware error interrupt
The interrupt handler increases the interrupt disable refcount, so the tasklet needs to always call ath9k_hw_enable_interrupts.
--- drivers/net/wireless/ath/ath9k/main.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +5 -4
@@ -669,15 +669,15 @@ void ath9k_tasklet(unsigned long data)u32 status = sc->intrstatus;u32 rxmask; +ath9k_ps_wakeup (sc); +spin_lock (&sc->sc_pcu_lock); +if ((status &ATH9K_INT_FATAL ) || (status &ATH9K_INT_BB_WATCHDOG )) {ieee80211_queue_work (sc->hw, &sc->hw_reset_work); -return ; + goto out; } -ath9k_ps_wakeup (sc); -spin_lock (&sc->sc_pcu_lock); -/* * Only run the baseband hang check if beacons stop working in AP or * IBSS mode, because it has a high false positive rate. For station
@@ -725,6 +725,7 @@ void ath9k_tasklet(unsigned long data)if (status &ATH9K_INT_GENTIMER )ath_gen_timer_isr (sc->sc_ah); +out:/* re-enable hardware interrupt */ ath9k_hw_enable_interrupts (ah);
Signature · 1 line
1.7.3.2
PATCH 2/3 ath9k: make beacon timer initialization more reliable
When starting the AP beacon timer, it assumes that the TSF has recently been cleared. Set the SC_OP_TSF_RESET flag to ensure that this is always the case.
--- drivers/net/wireless/ath/ath9k/beacon.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/beacon.c +1 -0
@@ -517,6 +517,7 @@ static void ath_beacon_config_ap(struct ath_softc *sc,/* Set the computed AP beacon timers */ ath9k_hw_disable_interrupts (ah); + sc->sc_flags |=SC_OP_TSF_RESET ;ath9k_beacon_init (sc, nexttbtt, intval); sc->beacon.bmisscnt =0 ;ath9k_hw_set_interrupts (ah, ah->imask);
Signature · 1 line
1.7.3.2
PATCH 3/3 ath9k: ensure that rx is not enabled during a reset
During a reset, rx buffers are flushed after rx has been disabled. To avoid race conditions, rx needs to stay disabled during the reset, so avoid any calls to ath9k_hw_rxena in that case.
--- drivers/net/wireless/ath/ath9k/main.c | 4 ++-- drivers/net/wireless/ath/ath9k/recv.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +2 -2
@@ -247,8 +247,8 @@ static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush)if (!flush) {if (ah->caps.hw_caps &ATH9K_HW_CAP_EDMA ) -ath_rx_tasklet (sc,0 , true); -ath_rx_tasklet (sc,0 , false); +ath_rx_tasklet (sc,1 , true); +ath_rx_tasklet (sc,1 , false); }else {ath_flushrecv (sc); }
drivers/net/wireless/ath/ath9k/recv.c +3 -2
@@ -1839,7 +1839,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)* If we're asked to flush receive queue, directly * chain it back at the queue without processing it. */ -if (flush) +if (sc->sc_flags &SC_OP_RXFLUSH ) goto requeue_drop_frag; retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs,
@@ -1967,7 +1967,8 @@ requeue: }else {list_move_tail (&bf->list, &sc->rx.rxbuf);ath_rx_buf_link (sc, bf); -ath9k_hw_rxena (ah); +if (!flush) +ath9k_hw_rxena (ah); } }while (1 );
Signature · 1 line
1.7.3.2
Hi Felix,
Quoted 13 lines · Felix Fietkau
The interrupt handler increases the interrupt disable refcount, so the tasklet needs to always call
ath9k_hw_enable_interrupts.Signed-off-by Felix Fietkau <[email protected]>---
drivers/net/wireless/ath/ath9k/main.c | 9 +++++----1 files changed, 5 insertions(+), 4 deletions(-)drivers/net/wireless/ath/ath9k/main.c +0
-0
drivers/net/wireless/ath/ath9k/main.c void ath9k_tasklet(unsigned long data) · line 672
Quoted 4 lines
drivers/net/wireless/ath/ath9k/main.c +1
-0@@ -669,15 +669,15 @@ void ath9k_tasklet(unsigned long data) u32 status = sc->intrstatus; u32 rxmask; + ath9k_ps_wakeup(sc);
this is done in ath_reset, is there any corner cases that I had missed ?
drivers/net/wireless/ath/ath9k/main.c void ath9k_tasklet(unsigned long data) · line 673
Quoted 1 line
drivers/net/wireless/ath/ath9k/main.c +1
-0+ spin_lock(&sc->sc_pcu_lock);
spin_lock_bh(&sc->sc_pcu_lock) in ath_reset_internal, won't be a problem know, or should we need to move this lock
Quoted 15 lines
drivers/net/wireless/ath/ath9k/main.c +1
-0+if ((status &
ATH9K_INT_FATAL) ||
(status &ATH9K_INT_BB_WATCHDOG)) {ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
- return;
+ goto out;
}-
ath9k_ps_wakeup(sc);
-spin_lock(&sc->sc_pcu_lock);
-
/*
* Only run the baseband hang check if beacons stop working in AP or
* IBSS mode, because it has a high false positive rate. For station
drivers/net/wireless/ath/ath9k/main.c void ath9k_tasklet(unsigned long data) · line 730
Quoted 6 lines
drivers/net/wireless/ath/ath9k/main.c +1
-0@@ -725,6 +725,7 @@ void ath9k_tasklet(unsigned long data) if (status & ATH9K_INT_GENTIMER) ath_gen_timer_isr(sc->sc_ah); +out: /* re-enable hardware interrupt */ ath9k_hw_enable_interrupts(ah);
this is done in ath_complete_reset, should we enable interrupts if some times ath9k_hw_reset fails?
please correct me if I had understood wrongly. thanks!
Quoted 9 lines
drivers/net/wireless/ath/ath9k/main.c +0
-1--1.7.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
shafi
Quoted 46 lines · Mohammed Shafi
Hi Felix,
Quoted 13 lines · Felix Fietkau
The interrupt handler increases the interrupt disable refcount, so the tasklet needs to always call
ath9k_hw_enable_interrupts.Signed-off-by Felix Fietkau<[email protected]>---
drivers/net/wireless/ath/ath9k/main.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)diff --git
a/drivers/net/wireless/ath/ath9k/main.cb/drivers/net/wireless/ath/ath9k/main.cindex 8a17cff5..a3c3316 100644
---a/drivers/net/wireless/ath/ath9k/main.c
+++b/drivers/net/wireless/ath/ath9k/main.c
@@ -669,15 +669,15 @@ voidath9k_tasklet(unsigned long data)Quoted 4 lines
u32 status = sc->intrstatus; u32 rxmask;+
ath9k_ps_wakeup(sc);this is done in
ath_reset, is there any corner cases that I had missed ?Quoted 1 line
+
spin_lock(&sc->sc_pcu_lock);
spin_lock_bh(&sc->sc_pcu_lock)inath_reset_internal, won't be a problem know, or should we need to move this lockQuoted 18 lines
+
if ((status& ATH9K_INT_FATAL) || (status& ATH9K_INT_BB_WATCHDOG)) { ieee80211_queue_work(sc->hw,&sc->hw_reset_work); - return; + goto out; }-
ath9k_ps_wakeup(sc);
-spin_lock(&sc->sc_pcu_lock);
-
/*
* Only run the baseband hang check if beacons stop working in AP or
* IBSS mode, because it has a high false positive rate. For station
@@ -725,6 +725,7 @@ voidath9k_tasklet(unsigned long data)
if (status&ATH9K_INT_GENTIMER)
ath_gen_timer_isr(sc->sc_ah);
Quoted 8 lines
Quoted 3 lines
+out:
/* re-enable hardware interrupt */ ath9k_hw_enable_interrupts(ah);this is done in
ath_complete_reset, should we enable interrupts if some timesath9k_hw_resetfails?
please correct me if I had understood wrongly. thanks!
ath9k_hw_enable_interrupts was changed to use refcounting to keep interrupts blocked. The interrupt handler increses the refcount, so the tasklet needs to decrease it. When a reset is issued, it starts by disabling interrupts, then re-enables them after completing the reset. Disabling interrupts in the ISR, but not enabling them in the tasklet causes an imbalance which leaves interrupts disabled after the reset is done.
- Felix
Quoted 61 lines · Felix Fietkau
Quoted 51 lines · Mohammed Shafi
Hi Felix,
Quoted 18 lines · Felix Fietkau
The interrupt handler increases the interrupt disable refcount, so the tasklet needs to always call
ath9k_hw_enable_interrupts.Signed-off-by Felix Fietkau<[email protected]>---
drivers/net/wireless/ath/ath9k/main.c| 9 +++++----1 files changed, 5 insertions(+), 4 deletions(-)diff --git
a/drivers/net/wireless/ath/ath9k/main.cb/drivers/net/wireless/ath/ath9k/main.c
index 8a17cff5..a3c3316 100644
---a/drivers/net/wireless/ath/ath9k/main.c
+++b/drivers/net/wireless/ath/ath9k/main.c
@@ -669,15 +669,15 @@ voidath9k_tasklet(unsigned long data)u32 status =sc->intrstatus;
u32 rxmask;Quoted 1 line
+
ath9k_ps_wakeup(sc);this is done in
ath_reset, is there any corner cases that I had missed ?Quoted 1 line
+
spin_lock(&sc->sc_pcu_lock);
spin_lock_bh(&sc->sc_pcu_lock)inath_reset_internal, won't be a problem know, or should we need to move this lockQuoted 20 lines
+
if ((status& ATH9K_INT_FATAL) ||
(status& ATH9K_INT_BB_WATCHDOG)) {ieee80211_queue_work(sc->hw,&sc->hw_reset_work);
- return;
+ goto out;
}-
ath9k_ps_wakeup(sc);
-spin_lock(&sc->sc_pcu_lock);
-
/*
* Only run the baseband hang check if beacons stop working in AP or
* IBSS mode, because it has a high false positive rate. For station
@@ -725,6 +725,7 @@ voidath9k_tasklet(unsigned long data)if (status& ATH9K_INT_GENTIMER)ath_gen_timer_isr(sc->sc_ah);Quoted 8 lines
Quoted 3 lines
+out:
/* re-enable hardware interrupt */
ath9k_hw_enable_interrupts(ah);this is done in
ath_complete_reset, should we enable interrupts if some timesath9k_hw_resetfails?
please correct me if I had understood wrongly. thanks!
Quoted 6 lines
ath9k_hw_enable_interruptswas changed to use refcounting to keep interrupts blocked. The interrupt handler increses the refcount, so the tasklet needs to decrease it. When a reset is issued, it starts by disabling interrupts, then re-enables them after completing the reset.
Disabling interrupts in the ISR, but not enabling them in the tasklet causes an imbalance which leaves interrupts disabled after the reset is done.
Felix, thanks for your explanation. i understood it somewhat :). i will take a look at this more carefully, especially intr_ref_cnt.
Quoted 3 lines
- Felix
Signature · 1 line
shafi