304-ath9k-remove-struct-ath_atx_ac.patch 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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
  4. struct ath_atx_ac contains a list of active TIDs belonging to one WMM AC.
  5. This patch changes the code to track active station TIDs in the txq directly.
  6. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7. ---
  8. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  9. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  10. @@ -173,14 +173,6 @@ struct ath_txq {
  11. struct sk_buff_head complete_q;
  12. };
  13. -struct ath_atx_ac {
  14. - struct ath_txq *txq;
  15. - struct list_head list;
  16. - struct list_head tid_q;
  17. - bool clear_ps_filter;
  18. - bool sched;
  19. -};
  20. -
  21. struct ath_frame_info {
  22. struct ath_buf *bf;
  23. u16 framelen;
  24. @@ -243,7 +235,7 @@ struct ath_atx_tid {
  25. struct sk_buff_head buf_q;
  26. struct sk_buff_head retry_q;
  27. struct ath_node *an;
  28. - struct ath_atx_ac *ac;
  29. + struct ath_txq *txq;
  30. unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
  31. u16 seq_start;
  32. u16 seq_next;
  33. @@ -255,6 +247,7 @@ struct ath_atx_tid {
  34. s8 bar_index;
  35. bool sched;
  36. bool active;
  37. + bool clear_ps_filter;
  38. };
  39. struct ath_node {
  40. @@ -262,7 +255,6 @@ struct ath_node {
  41. struct ieee80211_sta *sta; /* station struct we're part of */
  42. struct ieee80211_vif *vif; /* interface with which we're associated */
  43. struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
  44. - struct ath_atx_ac ac[IEEE80211_NUM_ACS];
  45. u16 maxampdu;
  46. u8 mpdudensity;
  47. --- a/drivers/net/wireless/ath/ath9k/xmit.c
  48. +++ b/drivers/net/wireless/ath/ath9k/xmit.c
  49. @@ -106,7 +106,6 @@ void ath_txq_unlock_complete(struct ath_
  50. static void ath_tx_queue_tid(struct ath_softc *sc, struct ath_txq *txq,
  51. struct ath_atx_tid *tid)
  52. {
  53. - struct ath_atx_ac *ac = tid->ac;
  54. struct list_head *list;
  55. struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv;
  56. struct ath_chanctx *ctx = avp->chanctx;
  57. @@ -118,15 +117,8 @@ static void ath_tx_queue_tid(struct ath_
  58. return;
  59. tid->sched = true;
  60. - list_add_tail(&tid->list, &ac->tid_q);
  61. -
  62. - if (ac->sched)
  63. - return;
  64. -
  65. - ac->sched = true;
  66. -
  67. list = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
  68. - list_add_tail(&ac->list, list);
  69. + list_add_tail(&tid->list, list);
  70. }
  71. static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  72. @@ -223,7 +215,7 @@ static struct sk_buff *ath_tid_dequeue(s
  73. static void
  74. ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid)
  75. {
  76. - struct ath_txq *txq = tid->ac->txq;
  77. + struct ath_txq *txq = tid->txq;
  78. struct ieee80211_tx_info *tx_info;
  79. struct sk_buff *skb, *tskb;
  80. struct ath_buf *bf;
  81. @@ -252,7 +244,7 @@ ath_tx_tid_change_state(struct ath_softc
  82. static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
  83. {
  84. - struct ath_txq *txq = tid->ac->txq;
  85. + struct ath_txq *txq = tid->txq;
  86. struct sk_buff *skb;
  87. struct ath_buf *bf;
  88. struct list_head bf_head;
  89. @@ -659,7 +651,7 @@ static void ath_tx_complete_aggr(struct
  90. ath_tx_queue_tid(sc, txq, tid);
  91. if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
  92. - tid->ac->clear_ps_filter = true;
  93. + tid->clear_ps_filter = true;
  94. }
  95. }
  96. @@ -749,7 +741,7 @@ static u32 ath_lookup_rate(struct ath_so
  97. struct ieee80211_tx_rate *rates;
  98. u32 max_4ms_framelen, frmlen;
  99. u16 aggr_limit, bt_aggr_limit, legacy = 0;
  100. - int q = tid->ac->txq->mac80211_qnum;
  101. + int q = tid->txq->mac80211_qnum;
  102. int i;
  103. skb = bf->bf_mpdu;
  104. @@ -1486,8 +1478,8 @@ static bool ath_tx_sched_aggr(struct ath
  105. if (list_empty(&bf_q))
  106. return false;
  107. - if (tid->ac->clear_ps_filter || tid->an->no_ps_filter) {
  108. - tid->ac->clear_ps_filter = false;
  109. + if (tid->clear_ps_filter || tid->an->no_ps_filter) {
  110. + tid->clear_ps_filter = false;
  111. tx_info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
  112. }
  113. @@ -1506,7 +1498,7 @@ int ath_tx_aggr_start(struct ath_softc *
  114. an = (struct ath_node *)sta->drv_priv;
  115. txtid = ATH_AN_2_TID(an, tid);
  116. - txq = txtid->ac->txq;
  117. + txq = txtid->txq;
  118. ath_txq_lock(sc, txq);
  119. @@ -1540,7 +1532,7 @@ void ath_tx_aggr_stop(struct ath_softc *
  120. {
  121. struct ath_node *an = (struct ath_node *)sta->drv_priv;
  122. struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
  123. - struct ath_txq *txq = txtid->ac->txq;
  124. + struct ath_txq *txq = txtid->txq;
  125. ath_txq_lock(sc, txq);
  126. txtid->active = false;
  127. @@ -1553,7 +1545,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
  128. struct ath_node *an)
  129. {
  130. struct ath_atx_tid *tid;
  131. - struct ath_atx_ac *ac;
  132. struct ath_txq *txq;
  133. bool buffered;
  134. int tidno;
  135. @@ -1561,8 +1552,7 @@ void ath_tx_aggr_sleep(struct ieee80211_
  136. for (tidno = 0, tid = &an->tid[tidno];
  137. tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  138. - ac = tid->ac;
  139. - txq = ac->txq;
  140. + txq = tid->txq;
  141. ath_txq_lock(sc, txq);
  142. @@ -1576,11 +1566,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
  143. tid->sched = false;
  144. list_del(&tid->list);
  145. - if (ac->sched) {
  146. - ac->sched = false;
  147. - list_del(&ac->list);
  148. - }
  149. -
  150. ath_txq_unlock(sc, txq);
  151. ieee80211_sta_set_buffered(sta, tidno, buffered);
  152. @@ -1590,18 +1575,16 @@ void ath_tx_aggr_sleep(struct ieee80211_
  153. void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
  154. {
  155. struct ath_atx_tid *tid;
  156. - struct ath_atx_ac *ac;
  157. struct ath_txq *txq;
  158. int tidno;
  159. for (tidno = 0, tid = &an->tid[tidno];
  160. tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  161. - ac = tid->ac;
  162. - txq = ac->txq;
  163. + txq = tid->txq;
  164. ath_txq_lock(sc, txq);
  165. - ac->clear_ps_filter = true;
  166. + tid->clear_ps_filter = true;
  167. if (ath_tid_has_buffered(tid)) {
  168. ath_tx_queue_tid(sc, txq, tid);
  169. @@ -1621,7 +1604,7 @@ void ath_tx_aggr_resume(struct ath_softc
  170. an = (struct ath_node *)sta->drv_priv;
  171. tid = ATH_AN_2_TID(an, tidno);
  172. - txq = tid->ac->txq;
  173. + txq = tid->txq;
  174. ath_txq_lock(sc, txq);
  175. @@ -1660,7 +1643,7 @@ void ath9k_release_buffered_frames(struc
  176. tid = ATH_AN_2_TID(an, i);
  177. - ath_txq_lock(sc, tid->ac->txq);
  178. + ath_txq_lock(sc, tid->txq);
  179. while (nframes > 0) {
  180. bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
  181. if (!bf)
  182. @@ -1684,7 +1667,7 @@ void ath9k_release_buffered_frames(struc
  183. if (an->sta && !ath_tid_has_buffered(tid))
  184. ieee80211_sta_set_buffered(an->sta, i, false);
  185. }
  186. - ath_txq_unlock_complete(sc, tid->ac->txq);
  187. + ath_txq_unlock_complete(sc, tid->txq);
  188. }
  189. if (list_empty(&bf_q))
  190. @@ -1933,9 +1916,8 @@ void ath_tx_cleanupq(struct ath_softc *s
  191. void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
  192. {
  193. struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  194. - struct ath_atx_ac *ac, *last_ac;
  195. struct ath_atx_tid *tid, *last_tid;
  196. - struct list_head *ac_list;
  197. + struct list_head *tid_list;
  198. bool sent = false;
  199. if (txq->mac80211_qnum < 0)
  200. @@ -1945,63 +1927,46 @@ void ath_txq_schedule(struct ath_softc *
  201. return;
  202. spin_lock_bh(&sc->chan_lock);
  203. - ac_list = &sc->cur_chan->acq[txq->mac80211_qnum];
  204. + tid_list = &sc->cur_chan->acq[txq->mac80211_qnum];
  205. - if (list_empty(ac_list)) {
  206. + if (list_empty(tid_list)) {
  207. spin_unlock_bh(&sc->chan_lock);
  208. return;
  209. }
  210. rcu_read_lock();
  211. - last_ac = list_entry(ac_list->prev, struct ath_atx_ac, list);
  212. - while (!list_empty(ac_list)) {
  213. + last_tid = list_entry(tid_list->prev, struct ath_atx_tid, list);
  214. + while (!list_empty(tid_list)) {
  215. bool stop = false;
  216. if (sc->cur_chan->stopped)
  217. break;
  218. - ac = list_first_entry(ac_list, struct ath_atx_ac, list);
  219. - last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
  220. - list_del(&ac->list);
  221. - ac->sched = false;
  222. -
  223. - while (!list_empty(&ac->tid_q)) {
  224. -
  225. - tid = list_first_entry(&ac->tid_q, struct ath_atx_tid,
  226. - list);
  227. - list_del(&tid->list);
  228. - tid->sched = false;
  229. -
  230. - if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  231. - sent = true;
  232. -
  233. - /*
  234. - * add tid to round-robin queue if more frames
  235. - * are pending for the tid
  236. - */
  237. - if (ath_tid_has_buffered(tid))
  238. - ath_tx_queue_tid(sc, txq, tid);
  239. + tid = list_first_entry(tid_list, struct ath_atx_tid, list);
  240. + list_del(&tid->list);
  241. + tid->sched = false;
  242. - if (stop || tid == last_tid)
  243. - break;
  244. - }
  245. + if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  246. + sent = true;
  247. - if (!list_empty(&ac->tid_q) && !ac->sched) {
  248. - ac->sched = true;
  249. - list_add_tail(&ac->list, ac_list);
  250. - }
  251. + /*
  252. + * add tid to round-robin queue if more frames
  253. + * are pending for the tid
  254. + */
  255. + if (ath_tid_has_buffered(tid))
  256. + ath_tx_queue_tid(sc, txq, tid);
  257. if (stop)
  258. break;
  259. - if (ac == last_ac) {
  260. + if (tid == last_tid) {
  261. if (!sent)
  262. break;
  263. sent = false;
  264. - last_ac = list_entry(ac_list->prev,
  265. - struct ath_atx_ac, list);
  266. + last_tid = list_entry(tid_list->prev,
  267. + struct ath_atx_tid, list);
  268. }
  269. }
  270. @@ -2391,10 +2356,10 @@ int ath_tx_start(struct ieee80211_hw *hw
  271. txq = sc->tx.uapsdq;
  272. ath_txq_lock(sc, txq);
  273. } else if (txctl->an && queue) {
  274. - WARN_ON(tid->ac->txq != txctl->txq);
  275. + WARN_ON(tid->txq != txctl->txq);
  276. if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
  277. - tid->ac->clear_ps_filter = true;
  278. + tid->clear_ps_filter = true;
  279. /*
  280. * Add this frame to software queue for scheduling later
  281. @@ -2888,7 +2853,6 @@ int ath_tx_init(struct ath_softc *sc, in
  282. void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
  283. {
  284. struct ath_atx_tid *tid;
  285. - struct ath_atx_ac *ac;
  286. int tidno, acno;
  287. for (tidno = 0, tid = &an->tid[tidno];
  288. @@ -2901,24 +2865,16 @@ void ath_tx_node_init(struct ath_softc *
  289. tid->baw_head = tid->baw_tail = 0;
  290. tid->sched = false;
  291. tid->active = false;
  292. + tid->clear_ps_filter = true;
  293. __skb_queue_head_init(&tid->buf_q);
  294. __skb_queue_head_init(&tid->retry_q);
  295. acno = TID_TO_WME_AC(tidno);
  296. - tid->ac = &an->ac[acno];
  297. - }
  298. -
  299. - for (acno = 0, ac = &an->ac[acno];
  300. - acno < IEEE80211_NUM_ACS; acno++, ac++) {
  301. - ac->sched = false;
  302. - ac->clear_ps_filter = true;
  303. - ac->txq = sc->tx.txq_map[acno];
  304. - INIT_LIST_HEAD(&ac->tid_q);
  305. + tid->txq = sc->tx.txq_map[acno];
  306. }
  307. }
  308. void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
  309. {
  310. - struct ath_atx_ac *ac;
  311. struct ath_atx_tid *tid;
  312. struct ath_txq *txq;
  313. int tidno;
  314. @@ -2926,8 +2882,7 @@ void ath_tx_node_cleanup(struct ath_soft
  315. for (tidno = 0, tid = &an->tid[tidno];
  316. tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  317. - ac = tid->ac;
  318. - txq = ac->txq;
  319. + txq = tid->txq;
  320. ath_txq_lock(sc, txq);
  321. @@ -2936,11 +2891,6 @@ void ath_tx_node_cleanup(struct ath_soft
  322. tid->sched = false;
  323. }
  324. - if (ac->sched) {
  325. - list_del(&ac->list);
  326. - tid->ac->sched = false;
  327. - }
  328. -
  329. ath_tid_drain(sc, txq, tid);
  330. tid->active = false;