forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/net/wireless/ath/ath9k/xmit.c
....@@ -113,43 +113,13 @@
113113 ath_tx_status(hw, skb);
114114 }
115115
116
-void __ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
117
-{
118
- struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv;
119
- struct ath_chanctx *ctx = avp->chanctx;
120
- struct ath_acq *acq;
121
- struct list_head *tid_list;
122
- u8 acno = TID_TO_WME_AC(tid->tidno);
123
-
124
- if (!ctx || !list_empty(&tid->list))
125
- return;
126
-
127
-
128
- acq = &ctx->acq[acno];
129
- if ((sc->airtime_flags & AIRTIME_USE_NEW_QUEUES) &&
130
- tid->an->airtime_deficit[acno] > 0)
131
- tid_list = &acq->acq_new;
132
- else
133
- tid_list = &acq->acq_old;
134
-
135
- list_add_tail(&tid->list, tid_list);
136
-}
137
-
138116 void ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
139117 {
140
- struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv;
141
- struct ath_chanctx *ctx = avp->chanctx;
142
- struct ath_acq *acq;
118
+ struct ieee80211_txq *queue =
119
+ container_of((void *)tid, struct ieee80211_txq, drv_priv);
143120
144
- if (!ctx || !list_empty(&tid->list))
145
- return;
146
-
147
- acq = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
148
- spin_lock_bh(&acq->lock);
149
- __ath_tx_queue_tid(sc, tid);
150
- spin_unlock_bh(&acq->lock);
121
+ ieee80211_schedule_txq(sc->hw, queue);
151122 }
152
-
153123
154124 void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue)
155125 {
....@@ -163,11 +133,7 @@
163133 tid->tidno);
164134
165135 ath_txq_lock(sc, txq);
166
-
167
- tid->has_queued = true;
168
- ath_tx_queue_tid(sc, tid);
169136 ath_txq_schedule(sc, txq);
170
-
171137 ath_txq_unlock(sc, txq);
172138 }
173139
....@@ -175,8 +141,8 @@
175141 {
176142 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
177143 BUILD_BUG_ON(sizeof(struct ath_frame_info) >
178
- sizeof(tx_info->rate_driver_data));
179
- return (struct ath_frame_info *) &tx_info->rate_driver_data[0];
144
+ sizeof(tx_info->status.status_driver_data));
145
+ return (struct ath_frame_info *) &tx_info->status.status_driver_data[0];
180146 }
181147
182148 static void ath_send_bar(struct ath_atx_tid *tid, u16 seqno)
....@@ -217,8 +183,8 @@
217183 return ATH_AN_2_TID(an, tidno);
218184 }
219185
220
-static struct sk_buff *
221
-ath_tid_pull(struct ath_atx_tid *tid)
186
+static int
187
+ath_tid_pull(struct ath_atx_tid *tid, struct sk_buff **skbuf)
222188 {
223189 struct ieee80211_txq *txq = container_of((void*)tid, struct ieee80211_txq, drv_priv);
224190 struct ath_softc *sc = tid->an->sc;
....@@ -229,20 +195,16 @@
229195 };
230196 struct sk_buff *skb;
231197 struct ath_frame_info *fi;
232
- int q;
233
-
234
- if (!tid->has_queued)
235
- return NULL;
198
+ int q, ret;
236199
237200 skb = ieee80211_tx_dequeue(hw, txq);
238
- if (!skb) {
239
- tid->has_queued = false;
240
- return NULL;
241
- }
201
+ if (!skb)
202
+ return -ENOENT;
242203
243
- if (ath_tx_prepare(hw, skb, &txctl)) {
204
+ ret = ath_tx_prepare(hw, skb, &txctl);
205
+ if (ret) {
244206 ieee80211_free_txskb(hw, skb);
245
- return NULL;
207
+ return ret;
246208 }
247209
248210 q = skb_get_queue_mapping(skb);
....@@ -252,24 +214,19 @@
252214 ++tid->txq->pending_frames;
253215 }
254216
255
- return skb;
217
+ *skbuf = skb;
218
+ return 0;
256219 }
257220
258
-
259
-static bool ath_tid_has_buffered(struct ath_atx_tid *tid)
221
+static int ath_tid_dequeue(struct ath_atx_tid *tid,
222
+ struct sk_buff **skb)
260223 {
261
- return !skb_queue_empty(&tid->retry_q) || tid->has_queued;
262
-}
224
+ int ret = 0;
225
+ *skb = __skb_dequeue(&tid->retry_q);
226
+ if (!*skb)
227
+ ret = ath_tid_pull(tid, skb);
263228
264
-static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid)
265
-{
266
- struct sk_buff *skb;
267
-
268
- skb = __skb_dequeue(&tid->retry_q);
269
- if (!skb)
270
- skb = ath_tid_pull(tid);
271
-
272
- return skb;
229
+ return ret;
273230 }
274231
275232 static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
....@@ -365,11 +322,12 @@
365322 struct list_head bf_head;
366323 struct ath_tx_status ts;
367324 struct ath_frame_info *fi;
325
+ int ret;
368326
369327 memset(&ts, 0, sizeof(ts));
370328 INIT_LIST_HEAD(&bf_head);
371329
372
- while ((skb = ath_tid_dequeue(tid))) {
330
+ while ((ret = ath_tid_dequeue(tid, &skb)) == 0) {
373331 fi = get_frame_info(skb);
374332 bf = fi->bf;
375333
....@@ -391,7 +349,7 @@
391349 struct ieee80211_hdr *hdr;
392350 int prev = fi->retries;
393351
394
- TX_STAT_INC(txq->axq_qnum, a_retries);
352
+ TX_STAT_INC(sc, txq->axq_qnum, a_retries);
395353 fi->retries += count;
396354
397355 if (prev > 0)
....@@ -452,7 +410,6 @@
452410 struct ath_tx_status *ts, int txok,
453411 int *nframes, int *nbad)
454412 {
455
- struct ath_frame_info *fi;
456413 u16 seq_st = 0;
457414 u32 ba[WME_BA_BMP_SIZE >> 5];
458415 int ba_index;
....@@ -464,11 +421,10 @@
464421 isaggr = bf_isaggr(bf);
465422 if (isaggr) {
466423 seq_st = ts->ts_seqnum;
467
- memcpy(ba, &ts->ba_low, WME_BA_BMP_SIZE >> 3);
424
+ memcpy(ba, &ts->ba, WME_BA_BMP_SIZE >> 3);
468425 }
469426
470427 while (bf) {
471
- fi = get_frame_info(bf->bf_mpdu);
472428 ba_index = ATH_BA_INDEX(seq_st, bf->bf_state.seqno);
473429
474430 (*nframes)++;
....@@ -488,7 +444,6 @@
488444 {
489445 struct ath_node *an = NULL;
490446 struct sk_buff *skb;
491
- struct ieee80211_hdr *hdr;
492447 struct ieee80211_tx_info *tx_info;
493448 struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
494449 struct list_head bf_head;
....@@ -505,8 +460,6 @@
505460 int bar_index = -1;
506461
507462 skb = bf->bf_mpdu;
508
- hdr = (struct ieee80211_hdr *)skb->data;
509
-
510463 tx_info = IEEE80211_SKB_CB(skb);
511464
512465 memcpy(rates, bf->rates, sizeof(rates));
....@@ -551,7 +504,7 @@
551504 if (isaggr && txok) {
552505 if (ts->ts_flags & ATH9K_TX_BA) {
553506 seq_st = ts->ts_seqnum;
554
- memcpy(ba, &ts->ba_low, WME_BA_BMP_SIZE >> 3);
507
+ memcpy(ba, &ts->ba, WME_BA_BMP_SIZE >> 3);
555508 } else {
556509 /*
557510 * AR5416 can become deaf/mute when BA
....@@ -681,7 +634,6 @@
681634 skb_queue_splice_tail(&bf_pending, &tid->retry_q);
682635 if (!an->sleeping) {
683636 ath_tx_queue_tid(sc, tid);
684
-
685637 if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
686638 tid->clear_ps_filter = true;
687639 }
....@@ -708,11 +660,12 @@
708660 return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
709661 }
710662
711
-static void ath_tx_count_airtime(struct ath_softc *sc, struct ath_node *an,
712
- struct ath_atx_tid *tid, struct ath_buf *bf,
713
- struct ath_tx_status *ts)
663
+static void ath_tx_count_airtime(struct ath_softc *sc,
664
+ struct ieee80211_sta *sta,
665
+ struct ath_buf *bf,
666
+ struct ath_tx_status *ts,
667
+ u8 tid)
714668 {
715
- struct ath_txq *txq = tid->txq;
716669 u32 airtime = 0;
717670 int i;
718671
....@@ -722,17 +675,7 @@
722675 airtime += rate_dur * bf->rates[i].count;
723676 }
724677
725
- if (sc->airtime_flags & AIRTIME_USE_TX) {
726
- int q = txq->mac80211_qnum;
727
- struct ath_acq *acq = &sc->cur_chan->acq[q];
728
-
729
- spin_lock_bh(&acq->lock);
730
- an->airtime_deficit[q] -= airtime;
731
- if (an->airtime_deficit[q] <= 0)
732
- __ath_tx_queue_tid(sc, tid);
733
- spin_unlock_bh(&acq->lock);
734
- }
735
- ath_debug_airtime(sc, an, 0, airtime);
678
+ ieee80211_sta_register_airtime(sta, tid, airtime, 0);
736679 }
737680
738681 static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
....@@ -762,7 +705,7 @@
762705 if (sta) {
763706 struct ath_node *an = (struct ath_node *)sta->drv_priv;
764707 tid = ath_get_skb_tid(sc, an, bf->bf_mpdu);
765
- ath_tx_count_airtime(sc, an, tid, bf, ts);
708
+ ath_tx_count_airtime(sc, sta, bf, ts, tid->tidno);
766709 if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
767710 tid->clear_ps_filter = true;
768711 }
....@@ -947,20 +890,21 @@
947890 return ndelim;
948891 }
949892
950
-static struct ath_buf *
893
+static int
951894 ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
952
- struct ath_atx_tid *tid)
895
+ struct ath_atx_tid *tid, struct ath_buf **buf)
953896 {
954897 struct ieee80211_tx_info *tx_info;
955898 struct ath_frame_info *fi;
956
- struct sk_buff *skb, *first_skb = NULL;
957899 struct ath_buf *bf;
900
+ struct sk_buff *skb, *first_skb = NULL;
958901 u16 seqno;
902
+ int ret;
959903
960904 while (1) {
961
- skb = ath_tid_dequeue(tid);
962
- if (!skb)
963
- break;
905
+ ret = ath_tid_dequeue(tid, &skb);
906
+ if (ret < 0)
907
+ return ret;
964908
965909 fi = get_frame_info(skb);
966910 bf = fi->bf;
....@@ -992,7 +936,7 @@
992936
993937 if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) {
994938 bf->bf_state.bf_type = 0;
995
- return bf;
939
+ break;
996940 }
997941
998942 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
....@@ -1011,7 +955,7 @@
1011955 first_skb = skb;
1012956 continue;
1013957 }
1014
- break;
958
+ return -EINPROGRESS;
1015959 }
1016960
1017961 if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) {
....@@ -1028,10 +972,11 @@
1028972 if (bf_isampdu(bf))
1029973 ath_tx_addto_baw(sc, tid, bf);
1030974
1031
- return bf;
975
+ break;
1032976 }
1033977
1034
- return NULL;
978
+ *buf = bf;
979
+ return 0;
1035980 }
1036981
1037982 static int
....@@ -1041,7 +986,7 @@
1041986 {
1042987 #define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
1043988 struct ath_buf *bf = bf_first, *bf_prev = NULL;
1044
- int nframes = 0, ndelim;
989
+ int nframes = 0, ndelim, ret;
1045990 u16 aggr_limit = 0, al = 0, bpad = 0,
1046991 al_delta, h_baw = tid->baw_size / 2;
1047992 struct ieee80211_tx_info *tx_info;
....@@ -1093,7 +1038,9 @@
10931038
10941039 bf_prev = bf;
10951040
1096
- bf = ath_tx_get_tid_subframe(sc, txq, tid);
1041
+ ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1042
+ if (ret < 0)
1043
+ break;
10971044 }
10981045 goto finish;
10991046 stop:
....@@ -1106,7 +1053,7 @@
11061053 al = get_frame_info(bf->bf_mpdu)->framelen;
11071054 bf->bf_state.bf_type = BUF_AMPDU;
11081055 } else {
1109
- TX_STAT_INC(txq->axq_qnum, a_aggr);
1056
+ TX_STAT_INC(sc, txq->axq_qnum, a_aggr);
11101057 }
11111058
11121059 return al;
....@@ -1495,7 +1442,7 @@
14951442 struct ath_buf *bf_first)
14961443 {
14971444 struct ath_buf *bf = bf_first, *bf_prev = NULL;
1498
- int nframes = 0;
1445
+ int nframes = 0, ret;
14991446
15001447 do {
15011448 struct ieee80211_tx_info *tx_info;
....@@ -1509,8 +1456,8 @@
15091456 if (nframes >= 2)
15101457 break;
15111458
1512
- bf = ath_tx_get_tid_subframe(sc, txq, tid);
1513
- if (!bf)
1459
+ ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1460
+ if (ret < 0)
15141461 break;
15151462
15161463 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
....@@ -1523,30 +1470,27 @@
15231470 } while (1);
15241471 }
15251472
1526
-static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
1527
- struct ath_atx_tid *tid)
1473
+static int ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
1474
+ struct ath_atx_tid *tid)
15281475 {
1529
- struct ath_buf *bf;
1476
+ struct ath_buf *bf = NULL;
15301477 struct ieee80211_tx_info *tx_info;
15311478 struct list_head bf_q;
1532
- int aggr_len = 0;
1479
+ int aggr_len = 0, ret;
15331480 bool aggr;
1534
-
1535
- if (!ath_tid_has_buffered(tid))
1536
- return false;
15371481
15381482 INIT_LIST_HEAD(&bf_q);
15391483
1540
- bf = ath_tx_get_tid_subframe(sc, txq, tid);
1541
- if (!bf)
1542
- return false;
1484
+ ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1485
+ if (ret < 0)
1486
+ return ret;
15431487
15441488 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
15451489 aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
15461490 if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) ||
15471491 (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
15481492 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
1549
- return false;
1493
+ return -EBUSY;
15501494 }
15511495
15521496 ath_set_rates(tid->an->vif, tid->an->sta, bf);
....@@ -1556,7 +1500,7 @@
15561500 ath_tx_form_burst(sc, txq, tid, &bf_q, bf);
15571501
15581502 if (list_empty(&bf_q))
1559
- return false;
1503
+ return -EAGAIN;
15601504
15611505 if (tid->clear_ps_filter || tid->an->no_ps_filter) {
15621506 tid->clear_ps_filter = false;
....@@ -1565,7 +1509,7 @@
15651509
15661510 ath_tx_fill_desc(sc, bf, txq, aggr_len);
15671511 ath_tx_txqaddbuf(sc, txq, &bf_q, false);
1568
- return true;
1512
+ return 0;
15691513 }
15701514
15711515 int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
....@@ -1628,28 +1572,16 @@
16281572 {
16291573 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
16301574 struct ath_atx_tid *tid;
1631
- struct ath_txq *txq;
16321575 int tidno;
16331576
16341577 ath_dbg(common, XMIT, "%s called\n", __func__);
16351578
16361579 for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
16371580 tid = ath_node_to_tid(an, tidno);
1638
- txq = tid->txq;
1639
-
1640
- ath_txq_lock(sc, txq);
1641
-
1642
- if (list_empty(&tid->list)) {
1643
- ath_txq_unlock(sc, txq);
1644
- continue;
1645
- }
16461581
16471582 if (!skb_queue_empty(&tid->retry_q))
16481583 ieee80211_sta_set_buffered(sta, tid->tidno, true);
16491584
1650
- list_del_init(&tid->list);
1651
-
1652
- ath_txq_unlock(sc, txq);
16531585 }
16541586 }
16551587
....@@ -1668,11 +1600,12 @@
16681600
16691601 ath_txq_lock(sc, txq);
16701602 tid->clear_ps_filter = true;
1671
- if (ath_tid_has_buffered(tid)) {
1603
+ if (!skb_queue_empty(&tid->retry_q)) {
16721604 ath_tx_queue_tid(sc, tid);
16731605 ath_txq_schedule(sc, txq);
16741606 }
16751607 ath_txq_unlock_complete(sc, txq);
1608
+
16761609 }
16771610 }
16781611
....@@ -1703,9 +1636,9 @@
17031636 struct ath_txq *txq = sc->tx.uapsdq;
17041637 struct ieee80211_tx_info *info;
17051638 struct list_head bf_q;
1706
- struct ath_buf *bf_tail = NULL, *bf;
1639
+ struct ath_buf *bf_tail = NULL, *bf = NULL;
17071640 int sent = 0;
1708
- int i;
1641
+ int i, ret;
17091642
17101643 INIT_LIST_HEAD(&bf_q);
17111644 for (i = 0; tids && nframes; i++, tids >>= 1) {
....@@ -1718,8 +1651,9 @@
17181651
17191652 ath_txq_lock(sc, tid->txq);
17201653 while (nframes > 0) {
1721
- bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid);
1722
- if (!bf)
1654
+ ret = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq,
1655
+ tid, &bf);
1656
+ if (ret < 0)
17231657 break;
17241658
17251659 ath9k_set_moredata(sc, bf, true);
....@@ -1733,7 +1667,7 @@
17331667 bf_tail = bf;
17341668 nframes--;
17351669 sent++;
1736
- TX_STAT_INC(txq->axq_qnum, a_queued_hw);
1670
+ TX_STAT_INC(sc, txq->axq_qnum, a_queued_hw);
17371671
17381672 if (an->sta && skb_queue_empty(&tid->retry_q))
17391673 ieee80211_sta_set_buffered(an->sta, i, false);
....@@ -1985,11 +1919,11 @@
19851919 */
19861920 void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
19871921 {
1922
+ struct ieee80211_hw *hw = sc->hw;
19881923 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1924
+ struct ieee80211_txq *queue;
19891925 struct ath_atx_tid *tid;
1990
- struct list_head *tid_list;
1991
- struct ath_acq *acq;
1992
- bool active = AIRTIME_ACTIVE(sc->airtime_flags);
1926
+ int ret;
19931927
19941928 if (txq->mac80211_qnum < 0)
19951929 return;
....@@ -1997,58 +1931,29 @@
19971931 if (test_bit(ATH_OP_HW_RESET, &common->op_flags))
19981932 return;
19991933
1934
+ ieee80211_txq_schedule_start(hw, txq->mac80211_qnum);
20001935 spin_lock_bh(&sc->chan_lock);
20011936 rcu_read_lock();
2002
- acq = &sc->cur_chan->acq[txq->mac80211_qnum];
20031937
20041938 if (sc->cur_chan->stopped)
20051939 goto out;
20061940
2007
-begin:
2008
- tid_list = &acq->acq_new;
2009
- if (list_empty(tid_list)) {
2010
- tid_list = &acq->acq_old;
2011
- if (list_empty(tid_list))
2012
- goto out;
2013
- }
2014
- tid = list_first_entry(tid_list, struct ath_atx_tid, list);
1941
+ while ((queue = ieee80211_next_txq(hw, txq->mac80211_qnum))) {
1942
+ bool force;
20151943
2016
- if (active && tid->an->airtime_deficit[txq->mac80211_qnum] <= 0) {
2017
- spin_lock_bh(&acq->lock);
2018
- tid->an->airtime_deficit[txq->mac80211_qnum] += ATH_AIRTIME_QUANTUM;
2019
- list_move_tail(&tid->list, &acq->acq_old);
2020
- spin_unlock_bh(&acq->lock);
2021
- goto begin;
2022
- }
1944
+ tid = (struct ath_atx_tid *)queue->drv_priv;
20231945
2024
- if (!ath_tid_has_buffered(tid)) {
2025
- spin_lock_bh(&acq->lock);
2026
- if ((tid_list == &acq->acq_new) && !list_empty(&acq->acq_old))
2027
- list_move_tail(&tid->list, &acq->acq_old);
2028
- else {
2029
- list_del_init(&tid->list);
2030
- }
2031
- spin_unlock_bh(&acq->lock);
2032
- goto begin;
2033
- }
1946
+ ret = ath_tx_sched_aggr(sc, txq, tid);
1947
+ ath_dbg(common, QUEUE, "ath_tx_sched_aggr returned %d\n", ret);
20341948
2035
-
2036
- /*
2037
- * If we succeed in scheduling something, immediately restart to make
2038
- * sure we keep the HW busy.
2039
- */
2040
- if(ath_tx_sched_aggr(sc, txq, tid)) {
2041
- if (!active) {
2042
- spin_lock_bh(&acq->lock);
2043
- list_move_tail(&tid->list, &acq->acq_old);
2044
- spin_unlock_bh(&acq->lock);
2045
- }
2046
- goto begin;
1949
+ force = !skb_queue_empty(&tid->retry_q);
1950
+ ieee80211_return_txq(hw, queue, force);
20471951 }
20481952
20491953 out:
20501954 rcu_read_unlock();
20511955 spin_unlock_bh(&sc->chan_lock);
1956
+ ieee80211_txq_schedule_end(hw, txq->mac80211_qnum);
20521957 }
20531958
20541959 void ath_txq_schedule_all(struct ath_softc *sc)
....@@ -2116,14 +2021,14 @@
21162021 }
21172022
21182023 if (puttxbuf) {
2119
- TX_STAT_INC(txq->axq_qnum, puttxbuf);
2024
+ TX_STAT_INC(sc, txq->axq_qnum, puttxbuf);
21202025 ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
21212026 ath_dbg(common, XMIT, "TXDP[%u] = %llx (%p)\n",
21222027 txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
21232028 }
21242029
21252030 if (!edma || sc->tx99_state) {
2126
- TX_STAT_INC(txq->axq_qnum, txstart);
2031
+ TX_STAT_INC(sc, txq->axq_qnum, txstart);
21272032 ath9k_hw_txstart(ah, txq->axq_qnum);
21282033 }
21292034
....@@ -2160,7 +2065,7 @@
21602065 bf->bf_lastbf = bf;
21612066 ath_tx_fill_desc(sc, bf, txq, fi->framelen);
21622067 ath_tx_txqaddbuf(sc, txq, &bf_head, false);
2163
- TX_STAT_INC(txq->axq_qnum, queued);
2068
+ TX_STAT_INC(sc, txq->axq_qnum, queued);
21642069 }
21652070
21662071 static void setup_frame_info(struct ieee80211_hw *hw,
....@@ -2195,10 +2100,13 @@
21952100
21962101 if (tx_info->control.vif) {
21972102 struct ieee80211_vif *vif = tx_info->control.vif;
2198
-
2103
+ if (vif->bss_conf.txpower == INT_MIN)
2104
+ goto nonvifpower;
21992105 txpower = 2 * vif->bss_conf.txpower;
22002106 } else {
2201
- struct ath_softc *sc = hw->priv;
2107
+ struct ath_softc *sc;
2108
+ nonvifpower:
2109
+ sc = hw->priv;
22022110
22032111 txpower = sc->cur_chan->cur_txpower;
22042112 }
....@@ -2366,12 +2274,10 @@
23662274 int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
23672275 struct ath_tx_control *txctl)
23682276 {
2369
- struct ieee80211_hdr *hdr;
23702277 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
23712278 struct ieee80211_sta *sta = txctl->sta;
23722279 struct ieee80211_vif *vif = info->control.vif;
23732280 struct ath_frame_info *fi = get_frame_info(skb);
2374
- struct ath_vif *avp = NULL;
23752281 struct ath_softc *sc = hw->priv;
23762282 struct ath_txq *txq = txctl->txq;
23772283 struct ath_atx_tid *tid = NULL;
....@@ -2380,16 +2286,12 @@
23802286 bool ps_resp;
23812287 int q, ret;
23822288
2383
- if (vif)
2384
- avp = (void *)vif->drv_priv;
2385
-
23862289 ps_resp = !!(info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE);
23872290
23882291 ret = ath_tx_prepare(hw, skb, txctl);
23892292 if (ret)
23902293 return ret;
23912294
2392
- hdr = (struct ieee80211_hdr *) skb->data;
23932295 /*
23942296 * At this point, the vif, hw_key and sta pointers in the tx control
23952297 * info are no longer valid (overwritten by the ath_frame_info data.
....@@ -2493,7 +2395,7 @@
24932395 ath_txq_lock(sc, txctl.txq);
24942396 ath_tx_fill_desc(sc, bf, txctl.txq, 0);
24952397 ath_tx_txqaddbuf(sc, txctl.txq, &bf_q, false);
2496
- TX_STAT_INC(txctl.txq->axq_qnum, queued);
2398
+ TX_STAT_INC(sc, txctl.txq->axq_qnum, queued);
24972399 ath_txq_unlock(sc, txctl.txq);
24982400 }
24992401
....@@ -2599,6 +2501,16 @@
25992501 spin_unlock_irqrestore(&sc->tx.txbuflock, flags);
26002502 }
26012503
2504
+static void ath_clear_tx_status(struct ieee80211_tx_info *tx_info)
2505
+{
2506
+ void *ptr = &tx_info->status;
2507
+
2508
+ memset(ptr + sizeof(tx_info->status.rates), 0,
2509
+ sizeof(tx_info->status) -
2510
+ sizeof(tx_info->status.rates) -
2511
+ sizeof(tx_info->status.status_driver_data));
2512
+}
2513
+
26022514 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
26032515 struct ath_tx_status *ts, int nframes, int nbad,
26042516 int txok)
....@@ -2609,6 +2521,8 @@
26092521 struct ieee80211_hw *hw = sc->hw;
26102522 struct ath_hw *ah = sc->sc_ah;
26112523 u8 i, tx_rateindex;
2524
+
2525
+ ath_clear_tx_status(tx_info);
26122526
26132527 if (txok)
26142528 tx_info->status.ack_signal = ts->ts_rssi;
....@@ -2623,6 +2537,13 @@
26232537 }
26242538 tx_info->status.ampdu_len = nframes;
26252539 tx_info->status.ampdu_ack_len = nframes - nbad;
2540
+
2541
+ tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1;
2542
+
2543
+ for (i = tx_rateindex + 1; i < hw->max_rates; i++) {
2544
+ tx_info->status.rates[i].count = 0;
2545
+ tx_info->status.rates[i].idx = -1;
2546
+ }
26262547
26272548 if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 &&
26282549 (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) == 0) {
....@@ -2645,13 +2566,6 @@
26452566 tx_info->status.rates[tx_rateindex].count =
26462567 hw->max_rate_tries;
26472568 }
2648
-
2649
- for (i = tx_rateindex + 1; i < hw->max_rates; i++) {
2650
- tx_info->status.rates[i].count = 0;
2651
- tx_info->status.rates[i].idx = -1;
2652
- }
2653
-
2654
- tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1;
26552569 }
26562570
26572571 static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
....@@ -2706,7 +2620,7 @@
27062620 if (status == -EINPROGRESS)
27072621 break;
27082622
2709
- TX_STAT_INC(txq->axq_qnum, txprocdesc);
2623
+ TX_STAT_INC(sc, txq->axq_qnum, txprocdesc);
27102624
27112625 /*
27122626 * Remove ath_buf's of the same transmit unit from txq,
....@@ -2785,7 +2699,7 @@
27852699
27862700 ath_txq_lock(sc, txq);
27872701
2788
- TX_STAT_INC(txq->axq_qnum, txprocdesc);
2702
+ TX_STAT_INC(sc, txq->axq_qnum, txprocdesc);
27892703
27902704 fifo_list = &txq->txq_fifo[txq->txq_tailidx];
27912705 if (list_empty(fifo_list)) {
....@@ -2893,9 +2807,6 @@
28932807 struct ath_atx_tid *tid;
28942808 int tidno, acno;
28952809
2896
- for (acno = 0; acno < IEEE80211_NUM_ACS; acno++)
2897
- an->airtime_deficit[acno] = ATH_AIRTIME_QUANTUM;
2898
-
28992810 for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
29002811 tid = ath_node_to_tid(an, tidno);
29012812 tid->an = an;
....@@ -2905,7 +2816,6 @@
29052816 tid->baw_head = tid->baw_tail = 0;
29062817 tid->active = false;
29072818 tid->clear_ps_filter = true;
2908
- tid->has_queued = false;
29092819 __skb_queue_head_init(&tid->retry_q);
29102820 INIT_LIST_HEAD(&tid->list);
29112821 acno = TID_TO_WME_AC(tidno);