1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Sat, 4 Apr 2015 18:39:06 +0200
3 Subject: [PATCH] ath9k: remove struct ath_atx_ac
5 struct ath_atx_ac contains a list of active TIDs belonging to one WMM AC.
6 This patch changes the code to track active station TIDs in the txq directly.
8 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
12 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
13 @@ -173,14 +173,6 @@ struct ath_txq {
14 struct sk_buff_head complete_q;
18 - struct ath_txq *txq;
19 - struct list_head list;
20 - struct list_head tid_q;
21 - bool clear_ps_filter;
25 struct ath_frame_info {
28 @@ -243,7 +235,7 @@ struct ath_atx_tid {
29 struct sk_buff_head buf_q;
30 struct sk_buff_head retry_q;
32 - struct ath_atx_ac *ac;
33 + struct ath_txq *txq;
34 unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
37 @@ -255,6 +247,7 @@ struct ath_atx_tid {
41 + bool clear_ps_filter;
45 @@ -262,7 +255,6 @@ struct ath_node {
46 struct ieee80211_sta *sta; /* station struct we're part of */
47 struct ieee80211_vif *vif; /* interface with which we're associated */
48 struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
49 - struct ath_atx_ac ac[IEEE80211_NUM_ACS];
53 --- a/drivers/net/wireless/ath/ath9k/xmit.c
54 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
55 @@ -106,7 +106,6 @@ void ath_txq_unlock_complete(struct ath_
56 static void ath_tx_queue_tid(struct ath_softc *sc, struct ath_txq *txq,
57 struct ath_atx_tid *tid)
59 - struct ath_atx_ac *ac = tid->ac;
60 struct list_head *list;
61 struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv;
62 struct ath_chanctx *ctx = avp->chanctx;
63 @@ -118,15 +117,8 @@ static void ath_tx_queue_tid(struct ath_
67 - list_add_tail(&tid->list, &ac->tid_q);
74 list = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
75 - list_add_tail(&ac->list, list);
76 + list_add_tail(&tid->list, list);
79 static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
80 @@ -223,7 +215,7 @@ static struct sk_buff *ath_tid_dequeue(s
82 ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid)
84 - struct ath_txq *txq = tid->ac->txq;
85 + struct ath_txq *txq = tid->txq;
86 struct ieee80211_tx_info *tx_info;
87 struct sk_buff *skb, *tskb;
89 @@ -252,7 +244,7 @@ ath_tx_tid_change_state(struct ath_softc
91 static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
93 - struct ath_txq *txq = tid->ac->txq;
94 + struct ath_txq *txq = tid->txq;
97 struct list_head bf_head;
98 @@ -659,7 +651,7 @@ static void ath_tx_complete_aggr(struct
99 ath_tx_queue_tid(sc, txq, tid);
101 if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
102 - tid->ac->clear_ps_filter = true;
103 + tid->clear_ps_filter = true;
107 @@ -749,7 +741,7 @@ static u32 ath_lookup_rate(struct ath_so
108 struct ieee80211_tx_rate *rates;
109 u32 max_4ms_framelen, frmlen;
110 u16 aggr_limit, bt_aggr_limit, legacy = 0;
111 - int q = tid->ac->txq->mac80211_qnum;
112 + int q = tid->txq->mac80211_qnum;
116 @@ -1486,8 +1478,8 @@ static bool ath_tx_sched_aggr(struct ath
117 if (list_empty(&bf_q))
120 - if (tid->ac->clear_ps_filter || tid->an->no_ps_filter) {
121 - tid->ac->clear_ps_filter = false;
122 + if (tid->clear_ps_filter || tid->an->no_ps_filter) {
123 + tid->clear_ps_filter = false;
124 tx_info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
127 @@ -1506,7 +1498,7 @@ int ath_tx_aggr_start(struct ath_softc *
129 an = (struct ath_node *)sta->drv_priv;
130 txtid = ATH_AN_2_TID(an, tid);
131 - txq = txtid->ac->txq;
134 ath_txq_lock(sc, txq);
136 @@ -1540,7 +1532,7 @@ void ath_tx_aggr_stop(struct ath_softc *
138 struct ath_node *an = (struct ath_node *)sta->drv_priv;
139 struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
140 - struct ath_txq *txq = txtid->ac->txq;
141 + struct ath_txq *txq = txtid->txq;
143 ath_txq_lock(sc, txq);
144 txtid->active = false;
145 @@ -1553,7 +1545,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
148 struct ath_atx_tid *tid;
149 - struct ath_atx_ac *ac;
153 @@ -1561,8 +1552,7 @@ void ath_tx_aggr_sleep(struct ieee80211_
154 for (tidno = 0, tid = &an->tid[tidno];
155 tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
161 ath_txq_lock(sc, txq);
163 @@ -1576,11 +1566,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
165 list_del(&tid->list);
169 - list_del(&ac->list);
172 ath_txq_unlock(sc, txq);
174 ieee80211_sta_set_buffered(sta, tidno, buffered);
175 @@ -1590,18 +1575,16 @@ void ath_tx_aggr_sleep(struct ieee80211_
176 void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
178 struct ath_atx_tid *tid;
179 - struct ath_atx_ac *ac;
183 for (tidno = 0, tid = &an->tid[tidno];
184 tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
190 ath_txq_lock(sc, txq);
191 - ac->clear_ps_filter = true;
192 + tid->clear_ps_filter = true;
194 if (ath_tid_has_buffered(tid)) {
195 ath_tx_queue_tid(sc, txq, tid);
196 @@ -1621,7 +1604,7 @@ void ath_tx_aggr_resume(struct ath_softc
198 an = (struct ath_node *)sta->drv_priv;
199 tid = ATH_AN_2_TID(an, tidno);
200 - txq = tid->ac->txq;
203 ath_txq_lock(sc, txq);
205 @@ -1660,7 +1643,7 @@ void ath9k_release_buffered_frames(struc
207 tid = ATH_AN_2_TID(an, i);
209 - ath_txq_lock(sc, tid->ac->txq);
210 + ath_txq_lock(sc, tid->txq);
211 while (nframes > 0) {
212 bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
214 @@ -1684,7 +1667,7 @@ void ath9k_release_buffered_frames(struc
215 if (an->sta && !ath_tid_has_buffered(tid))
216 ieee80211_sta_set_buffered(an->sta, i, false);
218 - ath_txq_unlock_complete(sc, tid->ac->txq);
219 + ath_txq_unlock_complete(sc, tid->txq);
222 if (list_empty(&bf_q))
223 @@ -1933,9 +1916,8 @@ void ath_tx_cleanupq(struct ath_softc *s
224 void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
226 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
227 - struct ath_atx_ac *ac, *last_ac;
228 struct ath_atx_tid *tid, *last_tid;
229 - struct list_head *ac_list;
230 + struct list_head *tid_list;
233 if (txq->mac80211_qnum < 0)
234 @@ -1945,63 +1927,46 @@ void ath_txq_schedule(struct ath_softc *
237 spin_lock_bh(&sc->chan_lock);
238 - ac_list = &sc->cur_chan->acq[txq->mac80211_qnum];
239 + tid_list = &sc->cur_chan->acq[txq->mac80211_qnum];
241 - if (list_empty(ac_list)) {
242 + if (list_empty(tid_list)) {
243 spin_unlock_bh(&sc->chan_lock);
249 - last_ac = list_entry(ac_list->prev, struct ath_atx_ac, list);
250 - while (!list_empty(ac_list)) {
251 + last_tid = list_entry(tid_list->prev, struct ath_atx_tid, list);
252 + while (!list_empty(tid_list)) {
255 if (sc->cur_chan->stopped)
258 - ac = list_first_entry(ac_list, struct ath_atx_ac, list);
259 - last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
260 - list_del(&ac->list);
263 - while (!list_empty(&ac->tid_q)) {
265 - tid = list_first_entry(&ac->tid_q, struct ath_atx_tid,
267 - list_del(&tid->list);
268 - tid->sched = false;
270 - if (ath_tx_sched_aggr(sc, txq, tid, &stop))
274 - * add tid to round-robin queue if more frames
275 - * are pending for the tid
277 - if (ath_tid_has_buffered(tid))
278 - ath_tx_queue_tid(sc, txq, tid);
279 + tid = list_first_entry(tid_list, struct ath_atx_tid, list);
280 + list_del(&tid->list);
281 + tid->sched = false;
283 - if (stop || tid == last_tid)
286 + if (ath_tx_sched_aggr(sc, txq, tid, &stop))
289 - if (!list_empty(&ac->tid_q) && !ac->sched) {
291 - list_add_tail(&ac->list, ac_list);
294 + * add tid to round-robin queue if more frames
295 + * are pending for the tid
297 + if (ath_tid_has_buffered(tid))
298 + ath_tx_queue_tid(sc, txq, tid);
303 - if (ac == last_ac) {
304 + if (tid == last_tid) {
309 - last_ac = list_entry(ac_list->prev,
310 - struct ath_atx_ac, list);
311 + last_tid = list_entry(tid_list->prev,
312 + struct ath_atx_tid, list);
316 @@ -2391,10 +2356,10 @@ int ath_tx_start(struct ieee80211_hw *hw
318 ath_txq_lock(sc, txq);
319 } else if (txctl->an && queue) {
320 - WARN_ON(tid->ac->txq != txctl->txq);
321 + WARN_ON(tid->txq != txctl->txq);
323 if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
324 - tid->ac->clear_ps_filter = true;
325 + tid->clear_ps_filter = true;
328 * Add this frame to software queue for scheduling later
329 @@ -2888,7 +2853,6 @@ int ath_tx_init(struct ath_softc *sc, in
330 void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
332 struct ath_atx_tid *tid;
333 - struct ath_atx_ac *ac;
336 for (tidno = 0, tid = &an->tid[tidno];
337 @@ -2901,24 +2865,16 @@ void ath_tx_node_init(struct ath_softc *
338 tid->baw_head = tid->baw_tail = 0;
341 + tid->clear_ps_filter = true;
342 __skb_queue_head_init(&tid->buf_q);
343 __skb_queue_head_init(&tid->retry_q);
344 acno = TID_TO_WME_AC(tidno);
345 - tid->ac = &an->ac[acno];
348 - for (acno = 0, ac = &an->ac[acno];
349 - acno < IEEE80211_NUM_ACS; acno++, ac++) {
351 - ac->clear_ps_filter = true;
352 - ac->txq = sc->tx.txq_map[acno];
353 - INIT_LIST_HEAD(&ac->tid_q);
354 + tid->txq = sc->tx.txq_map[acno];
358 void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
360 - struct ath_atx_ac *ac;
361 struct ath_atx_tid *tid;
364 @@ -2926,8 +2882,7 @@ void ath_tx_node_cleanup(struct ath_soft
365 for (tidno = 0, tid = &an->tid[tidno];
366 tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
372 ath_txq_lock(sc, txq);
374 @@ -2936,11 +2891,6 @@ void ath_tx_node_cleanup(struct ath_soft
379 - list_del(&ac->list);
380 - tid->ac->sched = false;
383 ath_tid_drain(sc, txq, tid);