ath9k: add initial tx queueing rework patches
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 560-ath9k_prepare_tid_queue_split.patch
1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -168,6 +168,16 @@ static void ath_txq_skb_done(struct ath_
4 }
5 }
6
7 +static bool ath_tid_has_buffered(struct ath_atx_tid *tid)
8 +{
9 + return !skb_queue_empty(&tid->buf_q);
10 +}
11 +
12 +static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid)
13 +{
14 + return __skb_dequeue(&tid->buf_q);
15 +}
16 +
17 static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
18 {
19 struct ath_txq *txq = tid->ac->txq;
20 @@ -182,7 +192,7 @@ static void ath_tx_flush_tid(struct ath_
21
22 memset(&ts, 0, sizeof(ts));
23
24 - while ((skb = __skb_dequeue(&tid->buf_q))) {
25 + while ((skb = ath_tid_dequeue(tid))) {
26 fi = get_frame_info(skb);
27 bf = fi->bf;
28
29 @@ -266,7 +276,7 @@ static void ath_tid_drain(struct ath_sof
30 memset(&ts, 0, sizeof(ts));
31 INIT_LIST_HEAD(&bf_head);
32
33 - while ((skb = __skb_dequeue(&tid->buf_q))) {
34 + while ((skb = ath_tid_dequeue(tid))) {
35 fi = get_frame_info(skb);
36 bf = fi->bf;
37
38 @@ -815,7 +825,7 @@ static int ath_compute_num_delims(struct
39
40 static struct ath_buf *
41 ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
42 - struct ath_atx_tid *tid)
43 + struct ath_atx_tid *tid, struct sk_buff_head **q)
44 {
45 struct ath_frame_info *fi;
46 struct sk_buff *skb;
47 @@ -823,7 +833,8 @@ ath_tx_get_tid_subframe(struct ath_softc
48 u16 seqno;
49
50 while (1) {
51 - skb = skb_peek(&tid->buf_q);
52 + *q = &tid->buf_q;
53 + skb = skb_peek(*q);
54 if (!skb)
55 break;
56
57 @@ -833,7 +844,7 @@ ath_tx_get_tid_subframe(struct ath_softc
58 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
59
60 if (!bf) {
61 - __skb_unlink(skb, &tid->buf_q);
62 + __skb_unlink(skb, *q);
63 ath_txq_skb_done(sc, txq, skb);
64 ieee80211_free_txskb(sc->hw, skb);
65 continue;
66 @@ -852,7 +863,7 @@ ath_tx_get_tid_subframe(struct ath_softc
67
68 INIT_LIST_HEAD(&bf_head);
69 list_add(&bf->list, &bf_head);
70 - __skb_unlink(skb, &tid->buf_q);
71 + __skb_unlink(skb, *q);
72 ath_tx_update_baw(sc, tid, seqno);
73 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
74 continue;
75 @@ -881,9 +892,10 @@ static enum ATH_AGGR_STATUS ath_tx_form_
76 struct ieee80211_tx_info *tx_info;
77 struct ath_frame_info *fi;
78 struct sk_buff *skb;
79 + struct sk_buff_head *tid_q;
80
81 do {
82 - bf = ath_tx_get_tid_subframe(sc, txq, tid);
83 + bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
84 if (!bf) {
85 status = ATH_AGGR_BAW_CLOSED;
86 break;
87 @@ -940,14 +952,14 @@ static enum ATH_AGGR_STATUS ath_tx_form_
88 ath_tx_addto_baw(sc, tid, bf->bf_state.seqno);
89 bf->bf_state.ndelim = ndelim;
90
91 - __skb_unlink(skb, &tid->buf_q);
92 + __skb_unlink(skb, tid_q);
93 list_add_tail(&bf->list, bf_q);
94 if (bf_prev)
95 bf_prev->bf_next = bf;
96
97 bf_prev = bf;
98
99 - } while (!skb_queue_empty(&tid->buf_q));
100 + } while (ath_tid_has_buffered(tid));
101
102 *aggr_len = al;
103
104 @@ -1222,7 +1234,7 @@ static void ath_tx_sched_aggr(struct ath
105 int aggr_len;
106
107 do {
108 - if (skb_queue_empty(&tid->buf_q))
109 + if (!ath_tid_has_buffered(tid))
110 return;
111
112 INIT_LIST_HEAD(&bf_q);
113 @@ -1326,7 +1338,7 @@ void ath_tx_aggr_sleep(struct ieee80211_
114
115 ath_txq_lock(sc, txq);
116
117 - buffered = !skb_queue_empty(&tid->buf_q);
118 + buffered = ath_tid_has_buffered(tid);
119
120 tid->sched = false;
121 list_del(&tid->list);
122 @@ -1358,7 +1370,7 @@ void ath_tx_aggr_wakeup(struct ath_softc
123 ath_txq_lock(sc, txq);
124 ac->clear_ps_filter = true;
125
126 - if (!skb_queue_empty(&tid->buf_q) && !tid->paused) {
127 + if (!tid->paused && ath_tid_has_buffered(tid)) {
128 ath_tx_queue_tid(txq, tid);
129 ath_txq_schedule(sc, txq);
130 }
131 @@ -1383,7 +1395,7 @@ void ath_tx_aggr_resume(struct ath_softc
132 tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
133 tid->paused = false;
134
135 - if (!skb_queue_empty(&tid->buf_q)) {
136 + if (ath_tid_has_buffered(tid)) {
137 ath_tx_queue_tid(txq, tid);
138 ath_txq_schedule(sc, txq);
139 }
140 @@ -1403,6 +1415,7 @@ void ath9k_release_buffered_frames(struc
141 struct ieee80211_tx_info *info;
142 struct list_head bf_q;
143 struct ath_buf *bf_tail = NULL, *bf;
144 + struct sk_buff_head *tid_q;
145 int sent = 0;
146 int i;
147
148 @@ -1418,12 +1431,12 @@ void ath9k_release_buffered_frames(struc
149 continue;
150
151 ath_txq_lock(sc, tid->ac->txq);
152 - while (!skb_queue_empty(&tid->buf_q) && nframes > 0) {
153 - bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid);
154 + while (nframes > 0) {
155 + bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
156 if (!bf)
157 break;
158
159 - __skb_unlink(bf->bf_mpdu, &tid->buf_q);
160 + __skb_unlink(bf->bf_mpdu, tid_q);
161 list_add_tail(&bf->list, &bf_q);
162 ath_set_rates(tid->an->vif, tid->an->sta, bf);
163 ath_tx_addto_baw(sc, tid, bf->bf_state.seqno);
164 @@ -1436,7 +1449,7 @@ void ath9k_release_buffered_frames(struc
165 sent++;
166 TX_STAT_INC(txq->axq_qnum, a_queued_hw);
167
168 - if (skb_queue_empty(&tid->buf_q))
169 + if (ath_tid_has_buffered(tid))
170 ieee80211_sta_set_buffered(an->sta, i, false);
171 }
172 ath_txq_unlock_complete(sc, tid->ac->txq);
173 @@ -1722,7 +1735,7 @@ void ath_txq_schedule(struct ath_softc *
174 * add tid to round-robin queue if more frames
175 * are pending for the tid
176 */
177 - if (!skb_queue_empty(&tid->buf_q))
178 + if (ath_tid_has_buffered(tid))
179 ath_tx_queue_tid(txq, tid);
180
181 if (tid == last_tid ||
182 @@ -1831,7 +1844,7 @@ static void ath_tx_send_ampdu(struct ath
183 * - seqno is not within block-ack window
184 * - h/w queue depth exceeds low water mark
185 */
186 - if ((!skb_queue_empty(&tid->buf_q) || tid->paused ||
187 + if ((ath_tid_has_buffered(tid) || tid->paused ||
188 !BAW_WITHIN(tid->seq_start, tid->baw_size, tid->seq_next) ||
189 txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) &&
190 txq != sc->tx.uapsdq) {