ath5k: Use new dma_stop function on base.c

* Since we stop rx/tx dma and pcu durring reset there is no need to
 call ath5k_hw_stop_rx/tx_dma before, also there is no need to call
 them durring stop_locked since we can use ath5k_hw_dma_stop for
 both.

 Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Nick Kossifidis 2010-11-23 20:45:38 +02:00 committed by John W. Linville
parent e088f23be1
commit 80dac9eecb
1 changed files with 41 additions and 58 deletions

View File

@ -1063,62 +1063,44 @@ ath5k_beaconq_config(struct ath5k_softc *sc)
return ret; return ret;
} }
static void /**
ath5k_txq_drainq(struct ath5k_softc *sc, struct ath5k_txq *txq) * ath5k_drain_tx_buffs - Empty tx buffers
{ *
struct ath5k_buf *bf, *bf0; * @sc The &struct ath5k_softc
*
/* * Empty tx buffers from all queues in preparation
* NB: this assumes output has been stopped and * of a reset or during shutdown.
* we do not need to block ath5k_tx_tasklet *
*/ * NB: this assumes output has been stopped and
spin_lock_bh(&txq->lock); * we do not need to block ath5k_tx_tasklet
list_for_each_entry_safe(bf, bf0, &txq->q, list) {
ath5k_debug_printtxbuf(sc, bf);
ath5k_txbuf_free_skb(sc, bf);
spin_lock_bh(&sc->txbuflock);
list_move_tail(&bf->list, &sc->txbuf);
sc->txbuf_len++;
txq->txq_len--;
spin_unlock_bh(&sc->txbuflock);
}
txq->link = NULL;
txq->txq_poll_mark = false;
spin_unlock_bh(&txq->lock);
}
/*
* Drain the transmit queues and reclaim resources.
*/ */
static void static void
ath5k_txq_cleanup(struct ath5k_softc *sc) ath5k_drain_tx_buffs(struct ath5k_softc *sc)
{ {
struct ath5k_hw *ah = sc->ah; struct ath5k_txq *txq;
unsigned int i; struct ath5k_buf *bf, *bf0;
int i;
/* XXX return value */ for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
if (likely(!test_bit(ATH_STAT_INVALID, sc->status))) { if (sc->txqs[i].setup) {
/* don't touch the hardware if marked invalid */ txq = &sc->txqs[i];
ath5k_hw_stop_tx_dma(ah, sc->bhalq); spin_lock_bh(&txq->lock);
ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "beacon queue %x\n", list_for_each_entry_safe(bf, bf0, &txq->q, list) {
ath5k_hw_get_txdp(ah, sc->bhalq)); ath5k_debug_printtxbuf(sc, bf);
for (i = 0; i < ARRAY_SIZE(sc->txqs); i++)
if (sc->txqs[i].setup) { ath5k_txbuf_free_skb(sc, bf);
ath5k_hw_stop_tx_dma(ah, sc->txqs[i].qnum);
ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "txq [%u] %x, " spin_lock_bh(&sc->txbuflock);
"link %p\n", list_move_tail(&bf->list, &sc->txbuf);
sc->txqs[i].qnum, sc->txbuf_len++;
ath5k_hw_get_txdp(ah, txq->txq_len--;
sc->txqs[i].qnum), spin_unlock_bh(&sc->txbuflock);
sc->txqs[i].link);
} }
txq->link = NULL;
txq->txq_poll_mark = false;
spin_unlock_bh(&txq->lock);
}
} }
for (i = 0; i < ARRAY_SIZE(sc->txqs); i++)
if (sc->txqs[i].setup)
ath5k_txq_drainq(sc, &sc->txqs[i]);
} }
static void static void
@ -1178,16 +1160,19 @@ ath5k_rx_start(struct ath5k_softc *sc)
} }
/* /*
* Disable the receive h/w in preparation for a reset. * Disable the receive logic on PCU (DRU)
* In preparation for a shutdown.
*
* Note: Doesn't stop rx DMA, ath5k_hw_dma_stop
* does.
*/ */
static void static void
ath5k_rx_stop(struct ath5k_softc *sc) ath5k_rx_stop(struct ath5k_softc *sc)
{ {
struct ath5k_hw *ah = sc->ah; struct ath5k_hw *ah = sc->ah;
ath5k_hw_stop_rx_pcu(ah); /* disable PCU */
ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */ ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */
ath5k_hw_stop_rx_dma(ah); /* disable DMA engine */ ath5k_hw_stop_rx_pcu(ah); /* disable PCU */
ath5k_debug_printrxbuffs(sc, ah); ath5k_debug_printrxbuffs(sc, ah);
} }
@ -2383,10 +2368,9 @@ ath5k_stop_locked(struct ath5k_softc *sc)
ath5k_led_off(sc); ath5k_led_off(sc);
ath5k_hw_set_imr(ah, 0); ath5k_hw_set_imr(ah, 0);
synchronize_irq(sc->pdev->irq); synchronize_irq(sc->pdev->irq);
}
ath5k_txq_cleanup(sc);
if (!test_bit(ATH_STAT_INVALID, sc->status)) {
ath5k_rx_stop(sc); ath5k_rx_stop(sc);
ath5k_hw_dma_stop(ah);
ath5k_drain_tx_buffs(sc);
ath5k_hw_phy_disable(ah); ath5k_hw_phy_disable(ah);
} }
@ -2532,8 +2516,7 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan)
stop_tasklets(sc); stop_tasklets(sc);
if (chan) { if (chan) {
ath5k_txq_cleanup(sc); ath5k_drain_tx_buffs(sc);
ath5k_rx_stop(sc);
sc->curchan = chan; sc->curchan = chan;
sc->curband = &sc->sbands[chan->band]; sc->curband = &sc->sbands[chan->band];