572-ath9k_xmit_queue_cleanup.patch 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  2. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  3. @@ -195,7 +195,6 @@ enum ATH_AGGR_STATUS {
  4. #define ATH_TXFIFO_DEPTH 8
  5. struct ath_txq {
  6. - int axq_class;
  7. u32 axq_qnum;
  8. u32 *axq_link;
  9. struct list_head axq_q;
  10. @@ -208,11 +207,12 @@ struct ath_txq {
  11. struct list_head txq_fifo_pending;
  12. u8 txq_headidx;
  13. u8 txq_tailidx;
  14. + int pending_frames;
  15. };
  16. struct ath_atx_ac {
  17. + struct ath_txq *txq;
  18. int sched;
  19. - int qnum;
  20. struct list_head list;
  21. struct list_head tid_q;
  22. };
  23. @@ -290,12 +290,11 @@ struct ath_tx_control {
  24. struct ath_tx {
  25. u16 seq_no;
  26. u32 txqsetup;
  27. - int hwq_map[WME_NUM_AC];
  28. spinlock_t txbuflock;
  29. struct list_head txbuf;
  30. struct ath_txq txq[ATH9K_NUM_TX_QUEUES];
  31. struct ath_descdma txdma;
  32. - int pending_frames[WME_NUM_AC];
  33. + struct ath_txq *txq_map[WME_NUM_AC];
  34. };
  35. struct ath_rx_edma {
  36. @@ -325,7 +324,6 @@ void ath_rx_cleanup(struct ath_softc *sc
  37. int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp);
  38. struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype);
  39. void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq);
  40. -int ath_tx_setup(struct ath_softc *sc, int haltype);
  41. void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx);
  42. void ath_draintxq(struct ath_softc *sc,
  43. struct ath_txq *txq, bool retry_tx);
  44. @@ -665,7 +663,6 @@ struct ath_wiphy {
  45. void ath9k_tasklet(unsigned long data);
  46. int ath_reset(struct ath_softc *sc, bool retry_tx);
  47. -int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc);
  48. int ath_cabq_update(struct ath_softc *);
  49. static inline void ath_read_cachesize(struct ath_common *common, int *csz)
  50. --- a/drivers/net/wireless/ath/ath9k/beacon.c
  51. +++ b/drivers/net/wireless/ath/ath9k/beacon.c
  52. @@ -28,7 +28,7 @@ int ath_beaconq_config(struct ath_softc
  53. struct ath_hw *ah = sc->sc_ah;
  54. struct ath_common *common = ath9k_hw_common(ah);
  55. struct ath9k_tx_queue_info qi, qi_be;
  56. - int qnum;
  57. + struct ath_txq *txq;
  58. ath9k_hw_get_txq_props(ah, sc->beacon.beaconq, &qi);
  59. if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  60. @@ -38,8 +38,8 @@ int ath_beaconq_config(struct ath_softc
  61. qi.tqi_cwmax = 0;
  62. } else {
  63. /* Adhoc mode; important thing is to use 2x cwmin. */
  64. - qnum = sc->tx.hwq_map[WME_AC_BE];
  65. - ath9k_hw_get_txq_props(ah, qnum, &qi_be);
  66. + txq = sc->tx.txq_map[WME_AC_BE];
  67. + ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be);
  68. qi.tqi_aifs = qi_be.tqi_aifs;
  69. qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  70. qi.tqi_cwmax = qi_be.tqi_cwmax;
  71. --- a/drivers/net/wireless/ath/ath9k/common.h
  72. +++ b/drivers/net/wireless/ath/ath9k/common.h
  73. @@ -31,10 +31,11 @@
  74. #define WME_MAX_BA WME_BA_BMP_SIZE
  75. #define ATH_TID_MAX_BUFS (2 * WME_MAX_BA)
  76. -#define WME_AC_BE 0
  77. -#define WME_AC_BK 1
  78. -#define WME_AC_VI 2
  79. -#define WME_AC_VO 3
  80. +/* These must match mac80211 skb queue mapping numbers */
  81. +#define WME_AC_VO 0
  82. +#define WME_AC_VI 1
  83. +#define WME_AC_BE 2
  84. +#define WME_AC_BK 3
  85. #define WME_NUM_AC 4
  86. #define ATH_RSSI_DUMMY_MARKER 0x127
  87. --- a/drivers/net/wireless/ath/ath9k/main.c
  88. +++ b/drivers/net/wireless/ath/ath9k/main.c
  89. @@ -331,7 +331,7 @@ void ath_paprd_calibrate(struct work_str
  90. struct ath_tx_control txctl;
  91. struct ath9k_hw_cal_data *caldata = ah->caldata;
  92. struct ath_common *common = ath9k_hw_common(ah);
  93. - int qnum, ftype;
  94. + int ftype;
  95. int chain_ok = 0;
  96. int chain;
  97. int len = 1800;
  98. @@ -358,8 +358,7 @@ void ath_paprd_calibrate(struct work_str
  99. memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN);
  100. memset(&txctl, 0, sizeof(txctl));
  101. - qnum = sc->tx.hwq_map[WME_AC_BE];
  102. - txctl.txq = &sc->tx.txq[qnum];
  103. + txctl.txq = sc->tx.txq_map[WME_AC_BE];
  104. ath9k_ps_wakeup(sc);
  105. ar9003_paprd_init_table(ah);
  106. @@ -1025,56 +1024,6 @@ int ath_reset(struct ath_softc *sc, bool
  107. return r;
  108. }
  109. -static int ath_get_hal_qnum(u16 queue, struct ath_softc *sc)
  110. -{
  111. - int qnum;
  112. -
  113. - switch (queue) {
  114. - case 0:
  115. - qnum = sc->tx.hwq_map[WME_AC_VO];
  116. - break;
  117. - case 1:
  118. - qnum = sc->tx.hwq_map[WME_AC_VI];
  119. - break;
  120. - case 2:
  121. - qnum = sc->tx.hwq_map[WME_AC_BE];
  122. - break;
  123. - case 3:
  124. - qnum = sc->tx.hwq_map[WME_AC_BK];
  125. - break;
  126. - default:
  127. - qnum = sc->tx.hwq_map[WME_AC_BE];
  128. - break;
  129. - }
  130. -
  131. - return qnum;
  132. -}
  133. -
  134. -int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc)
  135. -{
  136. - int qnum;
  137. -
  138. - switch (queue) {
  139. - case WME_AC_VO:
  140. - qnum = 0;
  141. - break;
  142. - case WME_AC_VI:
  143. - qnum = 1;
  144. - break;
  145. - case WME_AC_BE:
  146. - qnum = 2;
  147. - break;
  148. - case WME_AC_BK:
  149. - qnum = 3;
  150. - break;
  151. - default:
  152. - qnum = -1;
  153. - break;
  154. - }
  155. -
  156. - return qnum;
  157. -}
  158. -
  159. /* XXX: Remove me once we don't depend on ath9k_channel for all
  160. * this redundant data */
  161. void ath9k_update_ichannel(struct ath_softc *sc, struct ieee80211_hw *hw,
  162. @@ -1244,7 +1193,6 @@ static int ath9k_tx(struct ieee80211_hw
  163. struct ath_tx_control txctl;
  164. int padpos, padsize;
  165. struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  166. - int qnum;
  167. if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) {
  168. ath_print(common, ATH_DBG_XMIT,
  169. @@ -1317,8 +1265,7 @@ static int ath9k_tx(struct ieee80211_hw
  170. memmove(skb->data, skb->data + padsize, padpos);
  171. }
  172. - qnum = ath_get_hal_qnum(skb_get_queue_mapping(skb), sc);
  173. - txctl.txq = &sc->tx.txq[qnum];
  174. + txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)];
  175. ath_print(common, ATH_DBG_XMIT, "transmitting packet, skb: %p\n", skb);
  176. @@ -1802,12 +1749,15 @@ static int ath9k_conf_tx(struct ieee8021
  177. struct ath_wiphy *aphy = hw->priv;
  178. struct ath_softc *sc = aphy->sc;
  179. struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  180. + struct ath_txq *txq;
  181. struct ath9k_tx_queue_info qi;
  182. - int ret = 0, qnum;
  183. + int ret = 0;
  184. if (queue >= WME_NUM_AC)
  185. return 0;
  186. + txq = sc->tx.txq_map[queue];
  187. +
  188. mutex_lock(&sc->mutex);
  189. memset(&qi, 0, sizeof(struct ath9k_tx_queue_info));
  190. @@ -1816,20 +1766,19 @@ static int ath9k_conf_tx(struct ieee8021
  191. qi.tqi_cwmin = params->cw_min;
  192. qi.tqi_cwmax = params->cw_max;
  193. qi.tqi_burstTime = params->txop;
  194. - qnum = ath_get_hal_qnum(queue, sc);
  195. ath_print(common, ATH_DBG_CONFIG,
  196. "Configure tx [queue/halq] [%d/%d], "
  197. "aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n",
  198. - queue, qnum, params->aifs, params->cw_min,
  199. + queue, txq->axq_qnum, params->aifs, params->cw_min,
  200. params->cw_max, params->txop);
  201. - ret = ath_txq_update(sc, qnum, &qi);
  202. + ret = ath_txq_update(sc, txq->axq_qnum, &qi);
  203. if (ret)
  204. ath_print(common, ATH_DBG_FATAL, "TXQ Update failed\n");
  205. if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC)
  206. - if ((qnum == sc->tx.hwq_map[WME_AC_BE]) && !ret)
  207. + if (queue == WME_AC_BE && !ret)
  208. ath_beaconq_config(sc);
  209. mutex_unlock(&sc->mutex);
  210. --- a/drivers/net/wireless/ath/ath9k/xmit.c
  211. +++ b/drivers/net/wireless/ath/ath9k/xmit.c
  212. @@ -124,7 +124,7 @@ static void ath_tx_queue_tid(struct ath_
  213. static void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
  214. {
  215. - struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
  216. + struct ath_txq *txq = tid->ac->txq;
  217. WARN_ON(!tid->paused);
  218. @@ -142,7 +142,7 @@ unlock:
  219. static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
  220. {
  221. - struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
  222. + struct ath_txq *txq = tid->ac->txq;
  223. struct ath_buf *bf;
  224. struct list_head bf_head;
  225. struct ath_tx_status ts;
  226. @@ -817,7 +817,7 @@ void ath_tx_aggr_stop(struct ath_softc *
  227. {
  228. struct ath_node *an = (struct ath_node *)sta->drv_priv;
  229. struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
  230. - struct ath_txq *txq = &sc->tx.txq[txtid->ac->qnum];
  231. + struct ath_txq *txq = txtid->ac->txq;
  232. if (txtid->state & AGGR_CLEANUP)
  233. return;
  234. @@ -888,10 +888,16 @@ struct ath_txq *ath_txq_setup(struct ath
  235. struct ath_hw *ah = sc->sc_ah;
  236. struct ath_common *common = ath9k_hw_common(ah);
  237. struct ath9k_tx_queue_info qi;
  238. + static const int subtype_txq_to_hwq[] = {
  239. + [WME_AC_BE] = ATH_TXQ_AC_BE,
  240. + [WME_AC_BK] = ATH_TXQ_AC_BK,
  241. + [WME_AC_VI] = ATH_TXQ_AC_VI,
  242. + [WME_AC_VO] = ATH_TXQ_AC_VO,
  243. + };
  244. int qnum, i;
  245. memset(&qi, 0, sizeof(qi));
  246. - qi.tqi_subtype = subtype;
  247. + qi.tqi_subtype = subtype_txq_to_hwq[subtype];
  248. qi.tqi_aifs = ATH9K_TXQ_USEDEFAULT;
  249. qi.tqi_cwmin = ATH9K_TXQ_USEDEFAULT;
  250. qi.tqi_cwmax = ATH9K_TXQ_USEDEFAULT;
  251. @@ -940,7 +946,6 @@ struct ath_txq *ath_txq_setup(struct ath
  252. if (!ATH_TXQ_SETUP(sc, qnum)) {
  253. struct ath_txq *txq = &sc->tx.txq[qnum];
  254. - txq->axq_class = subtype;
  255. txq->axq_qnum = qnum;
  256. txq->axq_link = NULL;
  257. INIT_LIST_HEAD(&txq->axq_q);
  258. @@ -1210,24 +1215,6 @@ void ath_txq_schedule(struct ath_softc *
  259. }
  260. }
  261. -int ath_tx_setup(struct ath_softc *sc, int haltype)
  262. -{
  263. - struct ath_txq *txq;
  264. -
  265. - if (haltype >= ARRAY_SIZE(sc->tx.hwq_map)) {
  266. - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL,
  267. - "HAL AC %u out of range, max %zu!\n",
  268. - haltype, ARRAY_SIZE(sc->tx.hwq_map));
  269. - return 0;
  270. - }
  271. - txq = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, haltype);
  272. - if (txq != NULL) {
  273. - sc->tx.hwq_map[haltype] = txq->axq_qnum;
  274. - return 1;
  275. - } else
  276. - return 0;
  277. -}
  278. -
  279. /***********/
  280. /* TX, DMA */
  281. /***********/
  282. @@ -1708,6 +1695,7 @@ static void ath_tx_start_dma(struct ath_
  283. goto tx_done;
  284. }
  285. + WARN_ON(tid->ac->txq != txctl->txq);
  286. if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
  287. /*
  288. * Try aggregation if it's a unicast data frame
  289. @@ -1747,6 +1735,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  290. return -1;
  291. }
  292. + q = skb_get_queue_mapping(skb);
  293. r = ath_tx_setup_buffer(hw, bf, skb, txctl);
  294. if (unlikely(r)) {
  295. ath_print(common, ATH_DBG_FATAL, "TX mem alloc failure\n");
  296. @@ -1756,8 +1745,9 @@ int ath_tx_start(struct ieee80211_hw *hw
  297. * we will at least have to run TX completionon one buffer
  298. * on the queue */
  299. spin_lock_bh(&txq->axq_lock);
  300. - if (!txq->stopped && txq->axq_depth > 1) {
  301. - ath_mac80211_stop_queue(sc, skb_get_queue_mapping(skb));
  302. + if (txq == sc->tx.txq_map[q] && !txq->stopped &&
  303. + txq->axq_depth > 1) {
  304. + ath_mac80211_stop_queue(sc, q);
  305. txq->stopped = 1;
  306. }
  307. spin_unlock_bh(&txq->axq_lock);
  308. @@ -1767,13 +1757,10 @@ int ath_tx_start(struct ieee80211_hw *hw
  309. return r;
  310. }
  311. - q = skb_get_queue_mapping(skb);
  312. - if (q >= 4)
  313. - q = 0;
  314. -
  315. spin_lock_bh(&txq->axq_lock);
  316. - if (++sc->tx.pending_frames[q] > ATH_MAX_QDEPTH && !txq->stopped) {
  317. - ath_mac80211_stop_queue(sc, skb_get_queue_mapping(skb));
  318. + if (txq == sc->tx.txq_map[q] &&
  319. + ++txq->pending_frames > ATH_MAX_QDEPTH && !txq->stopped) {
  320. + ath_mac80211_stop_queue(sc, q);
  321. txq->stopped = 1;
  322. }
  323. spin_unlock_bh(&txq->axq_lock);
  324. @@ -1841,7 +1828,8 @@ exit:
  325. /*****************/
  326. static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
  327. - struct ath_wiphy *aphy, int tx_flags)
  328. + struct ath_wiphy *aphy, int tx_flags,
  329. + struct ath_txq *txq)
  330. {
  331. struct ieee80211_hw *hw = sc->hw;
  332. struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
  333. @@ -1888,11 +1876,12 @@ static void ath_tx_complete(struct ath_s
  334. ath9k_tx_status(hw, skb);
  335. else {
  336. q = skb_get_queue_mapping(skb);
  337. - if (q >= 4)
  338. - q = 0;
  339. -
  340. - if (--sc->tx.pending_frames[q] < 0)
  341. - sc->tx.pending_frames[q] = 0;
  342. + if (txq == sc->tx.txq_map[q]) {
  343. + spin_lock_bh(&txq->axq_lock);
  344. + if (WARN_ON(--txq->pending_frames < 0))
  345. + txq->pending_frames = 0;
  346. + spin_unlock_bh(&txq->axq_lock);
  347. + }
  348. ieee80211_tx_status(hw, skb);
  349. }
  350. @@ -1927,8 +1916,8 @@ static void ath_tx_complete_buf(struct a
  351. else
  352. complete(&sc->paprd_complete);
  353. } else {
  354. - ath_debug_stat_tx(sc, txq, bf, ts);
  355. - ath_tx_complete(sc, skb, bf->aphy, tx_flags);
  356. + ath_debug_stat_tx(sc, bf, ts);
  357. + ath_tx_complete(sc, skb, bf->aphy, tx_flags, txq);
  358. }
  359. /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
  360. * accidentally reference it later.
  361. @@ -2018,16 +2007,13 @@ static void ath_tx_rc_status(struct ath_
  362. tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1;
  363. }
  364. -static void ath_wake_mac80211_queue(struct ath_softc *sc, struct ath_txq *txq)
  365. +static void ath_wake_mac80211_queue(struct ath_softc *sc, int qnum)
  366. {
  367. - int qnum;
  368. -
  369. - qnum = ath_get_mac80211_qnum(txq->axq_class, sc);
  370. - if (qnum == -1)
  371. - return;
  372. + struct ath_txq *txq;
  373. + txq = sc->tx.txq_map[qnum];
  374. spin_lock_bh(&txq->axq_lock);
  375. - if (txq->stopped && sc->tx.pending_frames[qnum] < ATH_MAX_QDEPTH) {
  376. + if (txq->stopped && txq->pending_frames < ATH_MAX_QDEPTH) {
  377. if (ath_mac80211_start_queue(sc, qnum))
  378. txq->stopped = 0;
  379. }
  380. @@ -2044,6 +2030,7 @@ static void ath_tx_processq(struct ath_s
  381. struct ath_tx_status ts;
  382. int txok;
  383. int status;
  384. + int qnum;
  385. ath_print(common, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n",
  386. txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum),
  387. @@ -2119,12 +2106,15 @@ static void ath_tx_processq(struct ath_s
  388. ath_tx_rc_status(bf, &ts, txok ? 0 : 1, txok, true);
  389. }
  390. + qnum = skb_get_queue_mapping(bf->bf_mpdu);
  391. +
  392. if (bf_isampdu(bf))
  393. ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, txok);
  394. else
  395. ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, txok, 0);
  396. - ath_wake_mac80211_queue(sc, txq);
  397. + if (txq == sc->tx.txq_map[qnum])
  398. + ath_wake_mac80211_queue(sc, qnum);
  399. spin_lock_bh(&txq->axq_lock);
  400. if (sc->sc_flags & SC_OP_TXAGGR)
  401. @@ -2194,6 +2184,7 @@ void ath_tx_edma_tasklet(struct ath_soft
  402. struct list_head bf_head;
  403. int status;
  404. int txok;
  405. + int qnum;
  406. for (;;) {
  407. status = ath9k_hw_txprocdesc(ah, NULL, (void *)&txs);
  408. @@ -2237,13 +2228,16 @@ void ath_tx_edma_tasklet(struct ath_soft
  409. ath_tx_rc_status(bf, &txs, txok ? 0 : 1, txok, true);
  410. }
  411. + qnum = skb_get_queue_mapping(bf->bf_mpdu);
  412. +
  413. if (bf_isampdu(bf))
  414. ath_tx_complete_aggr(sc, txq, bf, &bf_head, &txs, txok);
  415. else
  416. ath_tx_complete_buf(sc, bf, txq, &bf_head,
  417. &txs, txok, 0);
  418. - ath_wake_mac80211_queue(sc, txq);
  419. + if (txq == sc->tx.txq_map[qnum])
  420. + ath_wake_mac80211_queue(sc, qnum);
  421. spin_lock_bh(&txq->axq_lock);
  422. if (!list_empty(&txq->txq_fifo_pending)) {
  423. @@ -2375,7 +2369,7 @@ void ath_tx_node_init(struct ath_softc *
  424. for (acno = 0, ac = &an->ac[acno];
  425. acno < WME_NUM_AC; acno++, ac++) {
  426. ac->sched = false;
  427. - ac->qnum = sc->tx.hwq_map[acno];
  428. + ac->txq = sc->tx.txq_map[acno];
  429. INIT_LIST_HEAD(&ac->tid_q);
  430. }
  431. }
  432. @@ -2385,17 +2379,13 @@ void ath_tx_node_cleanup(struct ath_soft
  433. struct ath_atx_ac *ac;
  434. struct ath_atx_tid *tid;
  435. struct ath_txq *txq;
  436. - int i, tidno;
  437. + int tidno;
  438. for (tidno = 0, tid = &an->tid[tidno];
  439. tidno < WME_NUM_TID; tidno++, tid++) {
  440. - i = tid->ac->qnum;
  441. -
  442. - if (!ATH_TXQ_SETUP(sc, i))
  443. - continue;
  444. - txq = &sc->tx.txq[i];
  445. ac = tid->ac;
  446. + txq = ac->txq;
  447. spin_lock_bh(&txq->axq_lock);
  448. --- a/drivers/net/wireless/ath/ath9k/hw.h
  449. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  450. @@ -157,6 +157,13 @@
  451. #define PAPRD_GAIN_TABLE_ENTRIES 32
  452. #define PAPRD_TABLE_SZ 24
  453. +enum ath_hw_txq_subtype {
  454. + ATH_TXQ_AC_BE = 0,
  455. + ATH_TXQ_AC_BK = 1,
  456. + ATH_TXQ_AC_VI = 2,
  457. + ATH_TXQ_AC_VO = 3,
  458. +};
  459. +
  460. enum ath_ini_subsys {
  461. ATH_INI_PRE = 0,
  462. ATH_INI_CORE,
  463. --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
  464. +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
  465. @@ -20,8 +20,15 @@
  466. /* TX */
  467. /******/
  468. +static const int subtype_txq_to_hwq[] = {
  469. + [WME_AC_BE] = ATH_TXQ_AC_BE,
  470. + [WME_AC_BK] = ATH_TXQ_AC_BK,
  471. + [WME_AC_VI] = ATH_TXQ_AC_VI,
  472. + [WME_AC_VO] = ATH_TXQ_AC_VO,
  473. +};
  474. +
  475. #define ATH9K_HTC_INIT_TXQ(subtype) do { \
  476. - qi.tqi_subtype = subtype; \
  477. + qi.tqi_subtype = subtype_txq_to_hwq[subtype]; \
  478. qi.tqi_aifs = ATH9K_TXQ_USEDEFAULT; \
  479. qi.tqi_cwmin = ATH9K_TXQ_USEDEFAULT; \
  480. qi.tqi_cwmax = ATH9K_TXQ_USEDEFAULT; \
  481. --- a/drivers/net/wireless/ath/ath9k/init.c
  482. +++ b/drivers/net/wireless/ath/ath9k/init.c
  483. @@ -396,7 +396,8 @@ static void ath9k_init_crypto(struct ath
  484. static int ath9k_init_btcoex(struct ath_softc *sc)
  485. {
  486. - int r, qnum;
  487. + struct ath_txq *txq;
  488. + int r;
  489. switch (sc->sc_ah->btcoex_hw.scheme) {
  490. case ATH_BTCOEX_CFG_NONE:
  491. @@ -409,8 +410,8 @@ static int ath9k_init_btcoex(struct ath_
  492. r = ath_init_btcoex_timer(sc);
  493. if (r)
  494. return -1;
  495. - qnum = sc->tx.hwq_map[WME_AC_BE];
  496. - ath9k_hw_init_btcoex_hw(sc->sc_ah, qnum);
  497. + txq = sc->tx.txq_map[WME_AC_BE];
  498. + ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum);
  499. sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW;
  500. break;
  501. default:
  502. @@ -423,59 +424,18 @@ static int ath9k_init_btcoex(struct ath_
  503. static int ath9k_init_queues(struct ath_softc *sc)
  504. {
  505. - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  506. int i = 0;
  507. - for (i = 0; i < ARRAY_SIZE(sc->tx.hwq_map); i++)
  508. - sc->tx.hwq_map[i] = -1;
  509. -
  510. sc->beacon.beaconq = ath9k_hw_beaconq_setup(sc->sc_ah);
  511. - if (sc->beacon.beaconq == -1) {
  512. - ath_print(common, ATH_DBG_FATAL,
  513. - "Unable to setup a beacon xmit queue\n");
  514. - goto err;
  515. - }
  516. -
  517. sc->beacon.cabq = ath_txq_setup(sc, ATH9K_TX_QUEUE_CAB, 0);
  518. - if (sc->beacon.cabq == NULL) {
  519. - ath_print(common, ATH_DBG_FATAL,
  520. - "Unable to setup CAB xmit queue\n");
  521. - goto err;
  522. - }
  523. sc->config.cabqReadytime = ATH_CABQ_READY_TIME;
  524. ath_cabq_update(sc);
  525. - if (!ath_tx_setup(sc, WME_AC_BK)) {
  526. - ath_print(common, ATH_DBG_FATAL,
  527. - "Unable to setup xmit queue for BK traffic\n");
  528. - goto err;
  529. - }
  530. -
  531. - if (!ath_tx_setup(sc, WME_AC_BE)) {
  532. - ath_print(common, ATH_DBG_FATAL,
  533. - "Unable to setup xmit queue for BE traffic\n");
  534. - goto err;
  535. - }
  536. - if (!ath_tx_setup(sc, WME_AC_VI)) {
  537. - ath_print(common, ATH_DBG_FATAL,
  538. - "Unable to setup xmit queue for VI traffic\n");
  539. - goto err;
  540. - }
  541. - if (!ath_tx_setup(sc, WME_AC_VO)) {
  542. - ath_print(common, ATH_DBG_FATAL,
  543. - "Unable to setup xmit queue for VO traffic\n");
  544. - goto err;
  545. - }
  546. + for (i = 0; i < WME_NUM_AC; i++)
  547. + sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i);
  548. return 0;
  549. -
  550. -err:
  551. - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
  552. - if (ATH_TXQ_SETUP(sc, i))
  553. - ath_tx_cleanupq(sc, &sc->tx.txq[i]);
  554. -
  555. - return -EIO;
  556. }
  557. static int ath9k_init_channels_rates(struct ath_softc *sc)
  558. --- a/drivers/net/wireless/ath/ath9k/virtual.c
  559. +++ b/drivers/net/wireless/ath/ath9k/virtual.c
  560. @@ -187,7 +187,7 @@ static int ath9k_send_nullfunc(struct at
  561. info->control.rates[1].idx = -1;
  562. memset(&txctl, 0, sizeof(struct ath_tx_control));
  563. - txctl.txq = &sc->tx.txq[sc->tx.hwq_map[WME_AC_VO]];
  564. + txctl.txq = sc->tx.txq_map[WME_AC_VO];
  565. txctl.frame_type = ps ? ATH9K_IFT_PAUSE : ATH9K_IFT_UNPAUSE;
  566. if (ath_tx_start(aphy->hw, skb, &txctl) != 0)
  567. --- a/drivers/net/wireless/ath/ath9k/debug.c
  568. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  569. @@ -579,10 +579,10 @@ static const struct file_operations fops
  570. do { \
  571. len += snprintf(buf + len, size - len, \
  572. "%s%13u%11u%10u%10u\n", str, \
  573. - sc->debug.stats.txstats[sc->tx.hwq_map[WME_AC_BE]].elem, \
  574. - sc->debug.stats.txstats[sc->tx.hwq_map[WME_AC_BK]].elem, \
  575. - sc->debug.stats.txstats[sc->tx.hwq_map[WME_AC_VI]].elem, \
  576. - sc->debug.stats.txstats[sc->tx.hwq_map[WME_AC_VO]].elem); \
  577. + sc->debug.stats.txstats[WME_AC_BE].elem, \
  578. + sc->debug.stats.txstats[WME_AC_BK].elem, \
  579. + sc->debug.stats.txstats[WME_AC_VI].elem, \
  580. + sc->debug.stats.txstats[WME_AC_VO].elem); \
  581. } while(0)
  582. static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
  583. @@ -624,33 +624,35 @@ static ssize_t read_file_xmit(struct fil
  584. return retval;
  585. }
  586. -void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq,
  587. - struct ath_buf *bf, struct ath_tx_status *ts)
  588. +void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
  589. + struct ath_tx_status *ts)
  590. {
  591. - TX_STAT_INC(txq->axq_qnum, tx_pkts_all);
  592. - sc->debug.stats.txstats[txq->axq_qnum].tx_bytes_all += bf->bf_mpdu->len;
  593. + int qnum = skb_get_queue_mapping(bf->bf_mpdu);
  594. +
  595. + TX_STAT_INC(qnum, tx_pkts_all);
  596. + sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len;
  597. if (bf_isampdu(bf)) {
  598. if (bf_isxretried(bf))
  599. - TX_STAT_INC(txq->axq_qnum, a_xretries);
  600. + TX_STAT_INC(qnum, a_xretries);
  601. else
  602. - TX_STAT_INC(txq->axq_qnum, a_completed);
  603. + TX_STAT_INC(qnum, a_completed);
  604. } else {
  605. - TX_STAT_INC(txq->axq_qnum, completed);
  606. + TX_STAT_INC(qnum, completed);
  607. }
  608. if (ts->ts_status & ATH9K_TXERR_FIFO)
  609. - TX_STAT_INC(txq->axq_qnum, fifo_underrun);
  610. + TX_STAT_INC(qnum, fifo_underrun);
  611. if (ts->ts_status & ATH9K_TXERR_XTXOP)
  612. - TX_STAT_INC(txq->axq_qnum, xtxop);
  613. + TX_STAT_INC(qnum, xtxop);
  614. if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED)
  615. - TX_STAT_INC(txq->axq_qnum, timer_exp);
  616. + TX_STAT_INC(qnum, timer_exp);
  617. if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR)
  618. - TX_STAT_INC(txq->axq_qnum, desc_cfg_err);
  619. + TX_STAT_INC(qnum, desc_cfg_err);
  620. if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN)
  621. - TX_STAT_INC(txq->axq_qnum, data_underrun);
  622. + TX_STAT_INC(qnum, data_underrun);
  623. if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
  624. - TX_STAT_INC(txq->axq_qnum, delim_underrun);
  625. + TX_STAT_INC(qnum, delim_underrun);
  626. }
  627. static const struct file_operations fops_xmit = {
  628. --- a/drivers/net/wireless/ath/ath9k/debug.h
  629. +++ b/drivers/net/wireless/ath/ath9k/debug.h
  630. @@ -169,8 +169,8 @@ void ath9k_exit_debug(struct ath_hw *ah)
  631. int ath9k_debug_create_root(void);
  632. void ath9k_debug_remove_root(void);
  633. void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
  634. -void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq,
  635. - struct ath_buf *bf, struct ath_tx_status *ts);
  636. +void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
  637. + struct ath_tx_status *ts);
  638. void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs);
  639. #else
  640. @@ -199,7 +199,6 @@ static inline void ath_debug_stat_interr
  641. }
  642. static inline void ath_debug_stat_tx(struct ath_softc *sc,
  643. - struct ath_txq *txq,
  644. struct ath_buf *bf,
  645. struct ath_tx_status *ts)
  646. {