1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -1208,8 +1208,17 @@ bool ath_drain_all_txq(struct ath_softc
4 ath_err(common, "Failed to stop TX DMA!\n");
6 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
7 - if (ATH_TXQ_SETUP(sc, i))
8 - ath_draintxq(sc, &sc->tx.txq[i], retry_tx);
9 + if (!ATH_TXQ_SETUP(sc, i))
13 + * The caller will resume queues with ieee80211_wake_queues.
14 + * Mark the queue as not stopped to prevent ath_tx_complete
15 + * from waking the queue too early.
17 + txq = &sc->tx.txq[i];
18 + txq->stopped = false;
19 + ath_draintxq(sc, txq, retry_tx);
23 @@ -1873,6 +1882,11 @@ static void ath_tx_complete(struct ath_s
24 spin_lock_bh(&txq->axq_lock);
25 if (WARN_ON(--txq->pending_frames < 0))
26 txq->pending_frames = 0;
28 + if (txq->stopped && txq->pending_frames < ATH_MAX_QDEPTH) {
29 + if (ath_mac80211_start_queue(sc, q))
32 spin_unlock_bh(&txq->axq_lock);
35 @@ -1982,19 +1996,6 @@ static void ath_tx_rc_status(struct ath_
36 tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1;
39 -static void ath_wake_mac80211_queue(struct ath_softc *sc, int qnum)
41 - struct ath_txq *txq;
43 - txq = sc->tx.txq_map[qnum];
44 - spin_lock_bh(&txq->axq_lock);
45 - if (txq->stopped && txq->pending_frames < ATH_MAX_QDEPTH) {
46 - if (ath_mac80211_start_queue(sc, qnum))
49 - spin_unlock_bh(&txq->axq_lock);
52 static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
54 struct ath_hw *ah = sc->sc_ah;
55 @@ -2005,7 +2006,6 @@ static void ath_tx_processq(struct ath_s
56 struct ath_tx_status ts;
61 ath_dbg(common, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n",
62 txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum),
63 @@ -2084,17 +2084,12 @@ static void ath_tx_processq(struct ath_s
64 ath_tx_rc_status(bf, &ts, 1, txok ? 0 : 1, txok, true);
67 - qnum = skb_get_queue_mapping(bf->bf_mpdu);
70 ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, txok,
73 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, txok, 0);
75 - if (txq == sc->tx.txq_map[qnum])
76 - ath_wake_mac80211_queue(sc, qnum);
78 spin_lock_bh(&txq->axq_lock);
79 if (sc->sc_flags & SC_OP_TXAGGR)
80 ath_txq_schedule(sc, txq);
81 @@ -2163,7 +2158,6 @@ void ath_tx_edma_tasklet(struct ath_soft
82 struct list_head bf_head;
88 status = ath9k_hw_txprocdesc(ah, NULL, (void *)&txs);
89 @@ -2209,8 +2203,6 @@ void ath_tx_edma_tasklet(struct ath_soft
90 ath_tx_rc_status(bf, &txs, 1, txok ? 0 : 1, txok, true);
93 - qnum = skb_get_queue_mapping(bf->bf_mpdu);
96 ath_tx_complete_aggr(sc, txq, bf, &bf_head, &txs,
98 @@ -2218,9 +2210,6 @@ void ath_tx_edma_tasklet(struct ath_soft
99 ath_tx_complete_buf(sc, bf, txq, &bf_head,
102 - if (txq == sc->tx.txq_map[qnum])
103 - ath_wake_mac80211_queue(sc, qnum);
105 spin_lock_bh(&txq->axq_lock);
106 if (!list_empty(&txq->txq_fifo_pending)) {
107 INIT_LIST_HEAD(&bf_head);
108 --- a/drivers/net/wireless/ath/ath9k/main.c
109 +++ b/drivers/net/wireless/ath/ath9k/main.c
110 @@ -295,6 +295,8 @@ int ath_set_channel(struct ath_softc *sc
114 + ieee80211_wake_queues(hw);
116 spin_unlock_bh(&sc->sc_pcu_lock);
118 ath9k_ps_restore(sc);