ath9k: fix some hw reset issues

SVN-Revision: 28151
This commit is contained in:
Felix Fietkau 2011-09-03 03:27:20 +00:00
parent 7fce085a97
commit f24b8561d4
4 changed files with 61 additions and 53 deletions

View File

@ -8,15 +8,7 @@
void ath_hw_check(struct work_struct *work);
void ath_hw_pll_work(struct work_struct *work);
void ath_paprd_calibrate(struct work_struct *work);
@@ -559,6 +560,7 @@ struct ath_ant_comb {
#define SC_OP_RXFLUSH BIT(7)
#define SC_OP_LED_ASSOCIATED BIT(8)
#define SC_OP_LED_ON BIT(9)
+#define SC_OP_HW_RESET BIT(10)
#define SC_OP_TSF_RESET BIT(11)
#define SC_OP_BT_PRIORITY_DETECTED BIT(12)
#define SC_OP_BT_SCAN BIT(13)
@@ -609,6 +611,7 @@ struct ath_softc {
@@ -609,6 +610,7 @@ struct ath_softc {
struct mutex mutex;
struct work_struct paprd_work;
struct work_struct hw_check_work;
@ -24,7 +16,7 @@
struct completion paprd_complete;
unsigned int hw_busy_count;
@@ -655,7 +658,6 @@ struct ath_softc {
@@ -655,7 +657,6 @@ struct ath_softc {
};
void ath9k_tasklet(unsigned long data);
@ -151,7 +143,7 @@
return;
}
@@ -968,13 +899,14 @@ void ath_radio_disable(struct ath_softc
@@ -968,7 +899,7 @@ void ath_radio_disable(struct ath_softc
ath9k_ps_restore(sc);
}
@ -160,14 +152,7 @@
{
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
struct ieee80211_hw *hw = sc->hw;
int r;
+ sc->sc_flags &= ~SC_OP_HW_RESET;
sc->hw_busy_count = 0;
/* Stop ANI */
@@ -1035,6 +967,84 @@ int ath_reset(struct ath_softc *sc, bool
@@ -1035,6 +966,84 @@ int ath_reset(struct ath_softc *sc, bool
return r;
}
@ -252,7 +237,7 @@
/**********************/
/* mac80211 callbacks */
/**********************/
@@ -1227,6 +1237,7 @@ static void ath9k_stop(struct ieee80211_
@@ -1227,6 +1236,7 @@ static void ath9k_stop(struct ieee80211_
cancel_delayed_work_sync(&sc->hw_pll_work);
cancel_work_sync(&sc->paprd_work);
cancel_work_sync(&sc->hw_check_work);
@ -262,39 +247,35 @@
ath_dbg(common, ATH_DBG_ANY, "Device not present\n");
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -603,8 +603,10 @@ static void ath_tx_complete_aggr(struct
@@ -604,7 +604,7 @@ static void ath_tx_complete_aggr(struct
rcu_read_unlock();
- if (needreset)
if (needreset)
- ath_reset(sc, false);
+ if (needreset) {
+ sc->sc_flags |= SC_OP_HW_RESET;
+ ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
+ }
}
static bool ath_lookup_legacy(struct ath_buf *bf)
@@ -1357,7 +1359,7 @@ void ath_txq_schedule(struct ath_softc *
@@ -1357,7 +1357,7 @@ void ath_txq_schedule(struct ath_softc *
struct ath_atx_ac *ac, *ac_tmp, *last_ac;
struct ath_atx_tid *tid, *last_tid;
- if (list_empty(&txq->axq_acq) ||
+ if ((sc->sc_flags & SC_OP_HW_RESET) || list_empty(&txq->axq_acq) ||
+ if (work_pending(&sc->hw_reset_work) || list_empty(&txq->axq_acq) ||
txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
return;
@@ -2184,6 +2186,9 @@ static void ath_tx_processq(struct ath_s
@@ -2184,6 +2184,9 @@ static void ath_tx_processq(struct ath_s
spin_lock_bh(&txq->axq_lock);
for (;;) {
+ if (sc->sc_flags & SC_OP_HW_RESET)
+ if (work_pending(&sc->hw_reset_work))
+ break;
+
if (list_empty(&txq->axq_q)) {
txq->axq_link = NULL;
if (sc->sc_flags & SC_OP_TXAGGR)
@@ -2271,9 +2276,7 @@ static void ath_tx_complete_poll_work(st
@@ -2271,9 +2274,7 @@ static void ath_tx_complete_poll_work(st
if (needreset) {
ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET,
"tx hung, resetting the chip\n");
@ -305,11 +286,11 @@
}
ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
@@ -2306,6 +2309,9 @@ void ath_tx_edma_tasklet(struct ath_soft
@@ -2306,6 +2307,9 @@ void ath_tx_edma_tasklet(struct ath_soft
int status;
for (;;) {
+ if (sc->sc_flags & SC_OP_HW_RESET)
+ if (work_pending(&sc->hw_reset_work))
+ break;
+
status = ath9k_hw_txprocdesc(ah, NULL, (void *)&ts);

View File

@ -118,7 +118,7 @@
}
ath9k_cmn_update_txpow(ah, sc->curtxpow,
@@ -297,21 +270,95 @@ static int ath_set_channel(struct ath_so
@@ -297,21 +270,93 @@ static int ath_set_channel(struct ath_so
ath9k_hw_set_interrupts(ah, ah->imask);
ath9k_hw_enable_interrupts(ah);
@ -153,8 +153,6 @@
+ __ath_cancel_work(sc);
+
+ spin_lock_bh(&sc->sc_pcu_lock);
+
+ sc->sc_flags &= ~SC_OP_HW_RESET;
+ if (!(sc->sc_flags & SC_OP_OFFCHANNEL)) {
+ fastcc = false;
@ -217,7 +215,7 @@
return r;
}
@@ -824,28 +871,13 @@ static void ath_radio_enable(struct ath_
@@ -824,28 +869,13 @@ static void ath_radio_enable(struct ath_
channel->center_freq, r);
}
@ -247,7 +245,7 @@
spin_unlock_bh(&sc->sc_pcu_lock);
ath9k_ps_restore(sc);
@@ -858,11 +890,10 @@ void ath_radio_disable(struct ath_softc
@@ -858,11 +888,10 @@ void ath_radio_disable(struct ath_softc
int r;
ath9k_ps_wakeup(sc);
@ -261,7 +259,7 @@
/*
* Keep the LED on when the radio is disabled
@@ -873,13 +904,7 @@ void ath_radio_disable(struct ath_softc
@@ -873,13 +902,7 @@ void ath_radio_disable(struct ath_softc
ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
}
@ -276,7 +274,7 @@
if (!ah->curchan)
ah->curchan = ath9k_cmn_get_curchannel(hw, ah);
@@ -901,49 +926,11 @@ void ath_radio_disable(struct ath_softc
@@ -901,48 +924,11 @@ void ath_radio_disable(struct ath_softc
static int ath_reset(struct ath_softc *sc, bool retry_tx)
{
@ -285,7 +283,6 @@
- struct ieee80211_hw *hw = sc->hw;
int r;
- sc->sc_flags &= ~SC_OP_HW_RESET;
- sc->hw_busy_count = 0;
-
- /* Stop ANI */
@ -327,7 +324,7 @@
if (retry_tx) {
int i;
@@ -956,12 +943,6 @@ static int ath_reset(struct ath_softc *s
@@ -955,12 +941,6 @@ static int ath_reset(struct ath_softc *s
}
}
@ -340,7 +337,7 @@
ath9k_ps_restore(sc);
return r;
@@ -971,9 +952,7 @@ void ath_reset_work(struct work_struct *
@@ -970,9 +950,7 @@ void ath_reset_work(struct work_struct *
{
struct ath_softc *sc = container_of(work, struct ath_softc, hw_reset_work);
@ -350,7 +347,7 @@
}
void ath_hw_check(struct work_struct *work)
@@ -994,11 +973,8 @@ void ath_hw_check(struct work_struct *wo
@@ -993,11 +971,8 @@ void ath_hw_check(struct work_struct *wo
ath_dbg(common, ATH_DBG_RESET, "Possible baseband hang, "
"busy=%d (try %d)\n", busy, sc->hw_busy_count + 1);
if (busy >= 99) {
@ -364,7 +361,7 @@
} else if (busy >= 0)
sc->hw_busy_count = 0;
@@ -1018,9 +994,7 @@ static void ath_hw_pll_rx_hang_check(str
@@ -1017,9 +992,7 @@ static void ath_hw_pll_rx_hang_check(str
/* Rx is hung for more than 500ms. Reset it */
ath_dbg(common, ATH_DBG_RESET,
"Possible RX hang, resetting");
@ -375,7 +372,7 @@
count = 0;
}
} else
@@ -1091,28 +1065,6 @@ static int ath9k_start(struct ieee80211_
@@ -1090,28 +1063,6 @@ static int ath9k_start(struct ieee80211_
goto mutex_unlock;
}
@ -404,7 +401,7 @@
/* Setup our intr mask. */
ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL |
ATH9K_INT_RXORN | ATH9K_INT_FATAL |
@@ -1135,12 +1087,14 @@ static int ath9k_start(struct ieee80211_
@@ -1134,12 +1085,14 @@ static int ath9k_start(struct ieee80211_
/* Disable BMISS interrupt when we're not associated */
ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
@ -423,7 +420,7 @@
if ((ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE) &&
!ah->btcoex_hw.enabled) {
@@ -1233,11 +1187,7 @@ static void ath9k_stop(struct ieee80211_
@@ -1232,11 +1185,7 @@ static void ath9k_stop(struct ieee80211_
mutex_lock(&sc->mutex);
@ -436,7 +433,7 @@
if (sc->sc_flags & SC_OP_INVALID) {
ath_dbg(common, ATH_DBG_ANY, "Device not present\n");
@@ -2354,9 +2304,11 @@ static void ath9k_flush(struct ieee80211
@@ -2353,9 +2302,11 @@ static void ath9k_flush(struct ieee80211
ath9k_ps_wakeup(sc);
spin_lock_bh(&sc->sc_pcu_lock);
drain_txq = ath_drain_all_txq(sc, false);

View File

@ -57,7 +57,7 @@
}
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -655,6 +655,7 @@ struct ath_softc {
@@ -654,6 +654,7 @@ struct ath_softc {
struct ath_descdma txsdma;
struct ath_ant_comb ant_comb;
@ -65,7 +65,7 @@
};
void ath9k_tasklet(unsigned long data);
@@ -675,6 +676,7 @@ int ath9k_init_device(u16 devid, struct
@@ -674,6 +675,7 @@ int ath9k_init_device(u16 devid, struct
const struct ath_bus_ops *bus_ops);
void ath9k_deinit_device(struct ath_softc *sc);
void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw);
@ -98,7 +98,7 @@
ieee80211_wake_queues(sc->hw);
return true;
@@ -2385,6 +2401,59 @@ static int ath9k_get_stats(struct ieee80
@@ -2383,6 +2399,59 @@ static int ath9k_get_stats(struct ieee80
return 0;
}
@ -158,7 +158,7 @@
struct ieee80211_ops ath9k_ops = {
.tx = ath9k_tx,
.start = ath9k_start,
@@ -2411,4 +2480,6 @@ struct ieee80211_ops ath9k_ops = {
@@ -2409,4 +2478,6 @@ struct ieee80211_ops ath9k_ops = {
.tx_frames_pending = ath9k_tx_frames_pending,
.tx_last_beacon = ath9k_tx_last_beacon,
.get_stats = ath9k_get_stats,

View File

@ -0,0 +1,30 @@
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -667,15 +667,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
@@ -723,6 +723,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);