Commit 4bdd1e97 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

ath9k: move the PCU lock to the sc structure

The PCU lock should be used to contend TX DMA as well,
this will be done next.

This is part of a series of patches which fix stopping
TX DMA completley when requested on the driver.
For more details about this issue refer to this thread:

http://marc.info/?l=linux-wireless&m=128629803703756&w=2Tested-by: default avatarBen Greear <greearb@candelatech.com>
Cc: Kyungwan Nam <kyungwan.nam@atheros.com>
Cc: stable@kernel.org
Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 9d94674a
...@@ -309,7 +309,6 @@ struct ath_rx { ...@@ -309,7 +309,6 @@ struct ath_rx {
u8 rxotherant; u8 rxotherant;
u32 *rxlink; u32 *rxlink;
unsigned int rxfilter; unsigned int rxfilter;
spinlock_t pcu_lock;
spinlock_t rxbuflock; spinlock_t rxbuflock;
struct list_head rxbuf; struct list_head rxbuf;
struct ath_descdma rxdma; struct ath_descdma rxdma;
...@@ -601,6 +600,7 @@ struct ath_softc { ...@@ -601,6 +600,7 @@ struct ath_softc {
int irq; int irq;
spinlock_t sc_serial_rw; spinlock_t sc_serial_rw;
spinlock_t sc_pm_lock; spinlock_t sc_pm_lock;
spinlock_t sc_pcu_lock;
struct mutex mutex; struct mutex mutex;
struct work_struct paprd_work; struct work_struct paprd_work;
struct work_struct hw_check_work; struct work_struct hw_check_work;
......
...@@ -242,7 +242,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, ...@@ -242,7 +242,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
ath9k_hw_disable_interrupts(ah); ath9k_hw_disable_interrupts(ah);
ath_drain_all_txq(sc, false); ath_drain_all_txq(sc, false);
spin_lock_bh(&sc->rx.pcu_lock); spin_lock_bh(&sc->sc_pcu_lock);
stopped = ath_stoprecv(sc); stopped = ath_stoprecv(sc);
...@@ -268,7 +268,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, ...@@ -268,7 +268,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
"Unable to reset channel (%u MHz), " "Unable to reset channel (%u MHz), "
"reset status %d\n", "reset status %d\n",
channel->center_freq, r); channel->center_freq, r);
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
goto ps_restore; goto ps_restore;
} }
...@@ -276,11 +276,11 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, ...@@ -276,11 +276,11 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Unable to restart recv logic\n"); "Unable to restart recv logic\n");
r = -EIO; r = -EIO;
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
goto ps_restore; goto ps_restore;
} }
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
ath_update_txpow(sc); ath_update_txpow(sc);
ath9k_hw_set_interrupts(ah, ah->imask); ath9k_hw_set_interrupts(ah, ah->imask);
...@@ -615,7 +615,7 @@ void ath9k_tasklet(unsigned long data) ...@@ -615,7 +615,7 @@ void ath9k_tasklet(unsigned long data)
rxmask = (ATH9K_INT_RX | ATH9K_INT_RXEOL | ATH9K_INT_RXORN); rxmask = (ATH9K_INT_RX | ATH9K_INT_RXEOL | ATH9K_INT_RXORN);
if (status & rxmask) { if (status & rxmask) {
spin_lock_bh(&sc->rx.pcu_lock); spin_lock_bh(&sc->sc_pcu_lock);
/* Check for high priority Rx first */ /* Check for high priority Rx first */
if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) &&
...@@ -623,7 +623,7 @@ void ath9k_tasklet(unsigned long data) ...@@ -623,7 +623,7 @@ void ath9k_tasklet(unsigned long data)
ath_rx_tasklet(sc, 0, true); ath_rx_tasklet(sc, 0, true);
ath_rx_tasklet(sc, 0, false); ath_rx_tasklet(sc, 0, false);
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
} }
if (status & ATH9K_INT_TX) { if (status & ATH9K_INT_TX) {
...@@ -881,7 +881,7 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) ...@@ -881,7 +881,7 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw)
if (!ah->curchan) if (!ah->curchan)
ah->curchan = ath_get_curchannel(sc, sc->hw); ah->curchan = ath_get_curchannel(sc, sc->hw);
spin_lock_bh(&sc->rx.pcu_lock); spin_lock_bh(&sc->sc_pcu_lock);
r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
if (r) { if (r) {
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
...@@ -894,10 +894,10 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) ...@@ -894,10 +894,10 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw)
if (ath_startrecv(sc) != 0) { if (ath_startrecv(sc) != 0) {
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Unable to restart recv logic\n"); "Unable to restart recv logic\n");
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
return; return;
} }
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
if (sc->sc_flags & SC_OP_BEACONS) if (sc->sc_flags & SC_OP_BEACONS)
ath_beacon_config(sc, NULL); /* restart beacons */ ath_beacon_config(sc, NULL); /* restart beacons */
...@@ -937,7 +937,7 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw) ...@@ -937,7 +937,7 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw)
ath_drain_all_txq(sc, false); /* clear pending tx frames */ ath_drain_all_txq(sc, false); /* clear pending tx frames */
spin_lock_bh(&sc->rx.pcu_lock); spin_lock_bh(&sc->sc_pcu_lock);
ath_stoprecv(sc); /* turn off frame recv */ ath_stoprecv(sc); /* turn off frame recv */
ath_flushrecv(sc); /* flush recv queue */ ath_flushrecv(sc); /* flush recv queue */
...@@ -955,7 +955,7 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw) ...@@ -955,7 +955,7 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw)
ath9k_hw_phy_disable(ah); ath9k_hw_phy_disable(ah);
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
ath9k_hw_configpcipowersave(ah, 1, 1); ath9k_hw_configpcipowersave(ah, 1, 1);
ath9k_ps_restore(sc); ath9k_ps_restore(sc);
...@@ -977,7 +977,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) ...@@ -977,7 +977,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
ath9k_hw_disable_interrupts(ah); ath9k_hw_disable_interrupts(ah);
ath_drain_all_txq(sc, retry_tx); ath_drain_all_txq(sc, retry_tx);
spin_lock_bh(&sc->rx.pcu_lock); spin_lock_bh(&sc->sc_pcu_lock);
ath_stoprecv(sc); ath_stoprecv(sc);
ath_flushrecv(sc); ath_flushrecv(sc);
...@@ -991,7 +991,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) ...@@ -991,7 +991,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Unable to start recv logic\n"); "Unable to start recv logic\n");
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
/* /*
* We may be doing a reset in response to a request * We may be doing a reset in response to a request
...@@ -1155,14 +1155,14 @@ static int ath9k_start(struct ieee80211_hw *hw) ...@@ -1155,14 +1155,14 @@ static int ath9k_start(struct ieee80211_hw *hw)
* be followed by initialization of the appropriate bits * be followed by initialization of the appropriate bits
* and then setup of the interrupt mask. * and then setup of the interrupt mask.
*/ */
spin_lock_bh(&sc->rx.pcu_lock); spin_lock_bh(&sc->sc_pcu_lock);
r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); r = ath9k_hw_reset(ah, init_channel, ah->caldata, false);
if (r) { if (r) {
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Unable to reset hardware; reset status %d " "Unable to reset hardware; reset status %d "
"(freq %u MHz)\n", r, "(freq %u MHz)\n", r,
curchan->center_freq); curchan->center_freq);
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
goto mutex_unlock; goto mutex_unlock;
} }
...@@ -1183,10 +1183,10 @@ static int ath9k_start(struct ieee80211_hw *hw) ...@@ -1183,10 +1183,10 @@ static int ath9k_start(struct ieee80211_hw *hw)
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Unable to start recv logic\n"); "Unable to start recv logic\n");
r = -EIO; r = -EIO;
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
goto mutex_unlock; goto mutex_unlock;
} }
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
/* Setup our intr mask. */ /* Setup our intr mask. */
ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL | ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL |
...@@ -1387,14 +1387,14 @@ static void ath9k_stop(struct ieee80211_hw *hw) ...@@ -1387,14 +1387,14 @@ static void ath9k_stop(struct ieee80211_hw *hw)
if (!(sc->sc_flags & SC_OP_INVALID)) { if (!(sc->sc_flags & SC_OP_INVALID)) {
ath_drain_all_txq(sc, false); ath_drain_all_txq(sc, false);
spin_lock_bh(&sc->rx.pcu_lock); spin_lock_bh(&sc->sc_pcu_lock);
ath_stoprecv(sc); ath_stoprecv(sc);
ath9k_hw_phy_disable(ah); ath9k_hw_phy_disable(ah);
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
} else { } else {
spin_lock_bh(&sc->rx.pcu_lock); spin_lock_bh(&sc->sc_pcu_lock);
sc->rx.rxlink = NULL; sc->rx.rxlink = NULL;
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
} }
/* disable HAL and put h/w to sleep */ /* disable HAL and put h/w to sleep */
......
...@@ -317,7 +317,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) ...@@ -317,7 +317,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
struct ath_buf *bf; struct ath_buf *bf;
int error = 0; int error = 0;
spin_lock_init(&sc->rx.pcu_lock); spin_lock_init(&sc->sc_pcu_lock);
sc->sc_flags &= ~SC_OP_RXFLUSH; sc->sc_flags &= ~SC_OP_RXFLUSH;
spin_lock_init(&sc->rx.rxbuflock); spin_lock_init(&sc->rx.rxbuflock);
......
...@@ -1148,13 +1148,13 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) ...@@ -1148,13 +1148,13 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx)
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Failed to stop TX DMA. Resetting hardware!\n"); "Failed to stop TX DMA. Resetting hardware!\n");
spin_lock_bh(&sc->rx.pcu_lock); spin_lock_bh(&sc->sc_pcu_lock);
r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false);
if (r) if (r)
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Unable to reset hardware; reset status %d\n", "Unable to reset hardware; reset status %d\n",
r); r);
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
} }
for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
......
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