mac80211: allow building for linux 3.1 again
[openwrt.git] / package / mac80211 / patches / 541-ath9k_aggr_queue_cleanup.patch
1 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
3 @@ -206,6 +206,7 @@ struct ath_atx_ac {
4 };
5
6 struct ath_frame_info {
7 + struct ath_buf *bf;
8 int framelen;
9 enum ath9k_key_type keytype;
10 u8 keyix;
11 @@ -235,7 +236,7 @@ struct ath_buf {
12
13 struct ath_atx_tid {
14 struct list_head list;
15 - struct list_head buf_q;
16 + struct sk_buff_head buf_q;
17 struct ath_node *an;
18 struct ath_atx_ac *ac;
19 unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
20 --- a/drivers/net/wireless/ath/ath9k/debug.c
21 +++ b/drivers/net/wireless/ath/ath9k/debug.c
22 @@ -711,7 +711,7 @@ static ssize_t read_file_stations(struct
23 " tid: %p %s %s %i %p %p\n",
24 tid, tid->sched ? "sched" : "idle",
25 tid->paused ? "paused" : "running",
26 - list_empty(&tid->buf_q),
27 + skb_queue_empty(&tid->buf_q),
28 tid->an, tid->ac);
29 if (len >= size)
30 goto done;
31 --- a/drivers/net/wireless/ath/ath9k/xmit.c
32 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
33 @@ -129,7 +129,7 @@ static void ath_tx_resume_tid(struct ath
34 spin_lock_bh(&txq->axq_lock);
35 tid->paused = false;
36
37 - if (list_empty(&tid->buf_q))
38 + if (skb_queue_empty(&tid->buf_q))
39 goto unlock;
40
41 ath_tx_queue_tid(txq, tid);
42 @@ -149,6 +149,7 @@ static struct ath_frame_info *get_frame_
43 static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
44 {
45 struct ath_txq *txq = tid->ac->txq;
46 + struct sk_buff *skb;
47 struct ath_buf *bf;
48 struct list_head bf_head;
49 struct ath_tx_status ts;
50 @@ -159,12 +160,13 @@ static void ath_tx_flush_tid(struct ath_
51 memset(&ts, 0, sizeof(ts));
52 spin_lock_bh(&txq->axq_lock);
53
54 - while (!list_empty(&tid->buf_q)) {
55 - bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
56 - list_move_tail(&bf->list, &bf_head);
57 + while ((skb = __skb_dequeue(&tid->buf_q))) {
58 + fi = get_frame_info(skb);
59 + bf = fi->bf;
60 +
61 + list_add_tail(&bf->list, &bf_head);
62
63 spin_unlock_bh(&txq->axq_lock);
64 - fi = get_frame_info(bf->bf_mpdu);
65 if (fi->retries) {
66 ath_tx_update_baw(sc, tid, fi->seqno);
67 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 1);
68 @@ -219,6 +221,7 @@ static void ath_tid_drain(struct ath_sof
69 struct ath_atx_tid *tid)
70
71 {
72 + struct sk_buff *skb;
73 struct ath_buf *bf;
74 struct list_head bf_head;
75 struct ath_tx_status ts;
76 @@ -227,14 +230,12 @@ static void ath_tid_drain(struct ath_sof
77 memset(&ts, 0, sizeof(ts));
78 INIT_LIST_HEAD(&bf_head);
79
80 - for (;;) {
81 - if (list_empty(&tid->buf_q))
82 - break;
83 + while ((skb = __skb_dequeue(&tid->buf_q))) {
84 + fi = get_frame_info(skb);
85 + bf = fi->bf;
86
87 - bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
88 - list_move_tail(&bf->list, &bf_head);
89 + list_add_tail(&bf->list, &bf_head);
90
91 - fi = get_frame_info(bf->bf_mpdu);
92 if (fi->retries)
93 ath_tx_update_baw(sc, tid, fi->seqno);
94
95 @@ -349,7 +350,8 @@ static void ath_tx_complete_aggr(struct
96 struct ieee80211_tx_info *tx_info;
97 struct ath_atx_tid *tid = NULL;
98 struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
99 - struct list_head bf_head, bf_pending;
100 + struct list_head bf_head;
101 + struct sk_buff_head bf_pending;
102 u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0;
103 u32 ba[WME_BA_BMP_SIZE >> 5];
104 int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
105 @@ -422,8 +424,7 @@ static void ath_tx_complete_aggr(struct
106 }
107 }
108
109 - INIT_LIST_HEAD(&bf_pending);
110 - INIT_LIST_HEAD(&bf_head);
111 + __skb_queue_head_init(&bf_pending);
112
113 ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad);
114 while (bf) {
115 @@ -467,10 +468,10 @@ static void ath_tx_complete_aggr(struct
116 * Make sure the last desc is reclaimed if it
117 * not a holding desc.
118 */
119 - if (!bf_last->bf_stale || bf_next != NULL)
120 + INIT_LIST_HEAD(&bf_head);
121 + if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) ||
122 + bf_next != NULL || !bf_last->bf_stale)
123 list_move_tail(&bf->list, &bf_head);
124 - else
125 - INIT_LIST_HEAD(&bf_head);
126
127 if (!txpending || (tid->state & AGGR_CLEANUP)) {
128 /*
129 @@ -521,7 +522,7 @@ static void ath_tx_complete_aggr(struct
130
131 ath9k_hw_cleartxdesc(sc->sc_ah,
132 tbf->bf_desc);
133 - list_add_tail(&tbf->list, &bf_head);
134 + fi->bf = tbf;
135 } else {
136 /*
137 * Clear descriptor status words for
138 @@ -536,21 +537,21 @@ static void ath_tx_complete_aggr(struct
139 * Put this buffer to the temporary pending
140 * queue to retain ordering
141 */
142 - list_splice_tail_init(&bf_head, &bf_pending);
143 + __skb_queue_tail(&bf_pending, skb);
144 }
145
146 bf = bf_next;
147 }
148
149 /* prepend un-acked frames to the beginning of the pending frame queue */
150 - if (!list_empty(&bf_pending)) {
151 + if (!skb_queue_empty(&bf_pending)) {
152 if (an->sleeping)
153 ieee80211_sta_set_tim(sta);
154
155 spin_lock_bh(&txq->axq_lock);
156 if (clear_filter)
157 tid->ac->clear_ps_filter = true;
158 - list_splice(&bf_pending, &tid->buf_q);
159 + skb_queue_splice(&bf_pending, &tid->buf_q);
160 if (!an->sleeping)
161 ath_tx_queue_tid(txq, tid);
162 spin_unlock_bh(&txq->axq_lock);
163 @@ -743,19 +744,22 @@ static enum ATH_AGGR_STATUS ath_tx_form_
164 int *aggr_len)
165 {
166 #define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
167 - struct ath_buf *bf, *bf_first, *bf_prev = NULL;
168 + struct ath_buf *bf, *bf_first = NULL, *bf_prev = NULL;
169 int rl = 0, nframes = 0, ndelim, prev_al = 0;
170 u16 aggr_limit = 0, al = 0, bpad = 0,
171 al_delta, h_baw = tid->baw_size / 2;
172 enum ATH_AGGR_STATUS status = ATH_AGGR_DONE;
173 struct ieee80211_tx_info *tx_info;
174 struct ath_frame_info *fi;
175 -
176 - bf_first = list_first_entry(&tid->buf_q, struct ath_buf, list);
177 + struct sk_buff *skb;
178
179 do {
180 - bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
181 - fi = get_frame_info(bf->bf_mpdu);
182 + skb = skb_peek(&tid->buf_q);
183 + fi = get_frame_info(skb);
184 + bf = fi->bf;
185 +
186 + if (!bf_first)
187 + bf_first = bf;
188
189 /* do not step over block-ack window */
190 if (!BAW_WITHIN(tid->seq_start, tid->baw_size, fi->seqno)) {
191 @@ -808,7 +812,9 @@ static enum ATH_AGGR_STATUS ath_tx_form_
192 if (!fi->retries)
193 ath_tx_addto_baw(sc, tid, fi->seqno);
194 ath9k_hw_set11n_aggr_middle(sc->sc_ah, bf->bf_desc, ndelim);
195 - list_move_tail(&bf->list, bf_q);
196 +
197 + __skb_unlink(skb, &tid->buf_q);
198 + list_add_tail(&bf->list, bf_q);
199 if (bf_prev) {
200 bf_prev->bf_next = bf;
201 ath9k_hw_set_desc_link(sc->sc_ah, bf_prev->bf_desc,
202 @@ -816,7 +822,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_
203 }
204 bf_prev = bf;
205
206 - } while (!list_empty(&tid->buf_q));
207 + } while (!skb_queue_empty(&tid->buf_q));
208
209 *aggr_len = al;
210
211 @@ -834,7 +840,7 @@ static void ath_tx_sched_aggr(struct ath
212 int aggr_len;
213
214 do {
215 - if (list_empty(&tid->buf_q))
216 + if (skb_queue_empty(&tid->buf_q))
217 return;
218
219 INIT_LIST_HEAD(&bf_q);
220 @@ -955,7 +961,7 @@ bool ath_tx_aggr_sleep(struct ath_softc
221
222 spin_lock_bh(&txq->axq_lock);
223
224 - if (!list_empty(&tid->buf_q))
225 + if (!skb_queue_empty(&tid->buf_q))
226 buffered = true;
227
228 tid->sched = false;
229 @@ -988,7 +994,7 @@ void ath_tx_aggr_wakeup(struct ath_softc
230 spin_lock_bh(&txq->axq_lock);
231 ac->clear_ps_filter = true;
232
233 - if (!list_empty(&tid->buf_q) && !tid->paused) {
234 + if (!skb_queue_empty(&tid->buf_q) && !tid->paused) {
235 ath_tx_queue_tid(txq, tid);
236 ath_txq_schedule(sc, txq);
237 }
238 @@ -1332,7 +1338,7 @@ void ath_txq_schedule(struct ath_softc *
239 * add tid to round-robin queue if more frames
240 * are pending for the tid
241 */
242 - if (!list_empty(&tid->buf_q))
243 + if (!skb_queue_empty(&tid->buf_q))
244 ath_tx_queue_tid(txq, tid);
245
246 if (tid == last_tid ||
247 @@ -1438,7 +1444,7 @@ static void ath_tx_send_ampdu(struct ath
248 * - seqno is not within block-ack window
249 * - h/w queue depth exceeds low water mark
250 */
251 - if (!list_empty(&tid->buf_q) || tid->paused ||
252 + if (!skb_queue_empty(&tid->buf_q) || tid->paused ||
253 !BAW_WITHIN(tid->seq_start, tid->baw_size, fi->seqno) ||
254 txctl->txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) {
255 /*
256 @@ -1446,7 +1452,7 @@ static void ath_tx_send_ampdu(struct ath
257 * for aggregation.
258 */
259 TX_STAT_INC(txctl->txq->axq_qnum, a_queued_sw);
260 - list_add_tail(&bf->list, &tid->buf_q);
261 + __skb_queue_tail(&tid->buf_q, bf->bf_mpdu);
262 if (!txctl->an || !txctl->an->sleeping)
263 ath_tx_queue_tid(txctl->txq, tid);
264 return;
265 @@ -1777,6 +1783,7 @@ static struct ath_buf *ath_tx_setup_buff
266 bf->bf_buf_addr,
267 txq->axq_qnum);
268
269 + fi->bf = bf;
270
271 return bf;
272 }
273 @@ -2394,7 +2401,7 @@ void ath_tx_node_init(struct ath_softc *
274 tid->sched = false;
275 tid->paused = false;
276 tid->state &= ~AGGR_CLEANUP;
277 - INIT_LIST_HEAD(&tid->buf_q);
278 + __skb_queue_head_init(&tid->buf_q);
279 acno = TID_TO_WME_AC(tidno);
280 tid->ac = &an->ac[acno];
281 tid->state &= ~AGGR_ADDBA_COMPLETE;
This page took 0.050825 seconds and 5 git commands to generate.