0d9511f09576e429190771844971ff7dbf3f5565
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 530-ath9k_cleanup_queue_wake.patch
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");
5
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))
10 + continue;
11 +
12 + /*
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.
16 + */
17 + txq = &sc->tx.txq[i];
18 + txq->stopped = false;
19 + ath_draintxq(sc, txq, retry_tx);
20 }
21
22 return !npend;
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;
27 +
28 + if (txq->stopped && txq->pending_frames < ATH_MAX_QDEPTH) {
29 + if (ath_mac80211_start_queue(sc, q))
30 + txq->stopped = 0;
31 + }
32 spin_unlock_bh(&txq->axq_lock);
33 }
34
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;
37 }
38
39 -static void ath_wake_mac80211_queue(struct ath_softc *sc, int qnum)
40 -{
41 - struct ath_txq *txq;
42 -
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))
47 - txq->stopped = 0;
48 - }
49 - spin_unlock_bh(&txq->axq_lock);
50 -}
51 -
52 static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
53 {
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;
57 int txok;
58 int status;
59 - int qnum;
60
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);
65 }
66
67 - qnum = skb_get_queue_mapping(bf->bf_mpdu);
68 -
69 if (bf_isampdu(bf))
70 ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, txok,
71 true);
72 else
73 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, txok, 0);
74
75 - if (txq == sc->tx.txq_map[qnum])
76 - ath_wake_mac80211_queue(sc, qnum);
77 -
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;
83 int status;
84 int txok;
85 - int qnum;
86
87 for (;;) {
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);
91 }
92
93 - qnum = skb_get_queue_mapping(bf->bf_mpdu);
94 -
95 if (bf_isampdu(bf))
96 ath_tx_complete_aggr(sc, txq, bf, &bf_head, &txs,
97 txok, true);
98 @@ -2218,9 +2210,6 @@ void ath_tx_edma_tasklet(struct ath_soft
99 ath_tx_complete_buf(sc, bf, txq, &bf_head,
100 &txs, txok, 0);
101
102 - if (txq == sc->tx.txq_map[qnum])
103 - ath_wake_mac80211_queue(sc, qnum);
104 -
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
111 }
112
113 ps_restore:
114 + ieee80211_wake_queues(hw);
115 +
116 spin_unlock_bh(&sc->sc_pcu_lock);
117
118 ath9k_ps_restore(sc);