aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-11-14 09:20:07 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-11-17 16:19:18 -0500
commitb572d0335fcb26e526f6ae087a9a09371b22e739 (patch)
tree5103370d976df09c266e40bdbae4021b1d5d0571
parent269c44bc8415ad78fb4dc3de25e6de3420332e9f (diff)
ath9k: remove bfs_nframes from struct ath_buf_state
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c97
2 files changed, 47 insertions, 52 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index b70ac3a6db21..b1c45b8e49c8 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -101,7 +101,6 @@ enum buffer_type {
101 BUF_XRETRY = BIT(5), 101 BUF_XRETRY = BIT(5),
102}; 102};
103 103
104#define bf_nframes bf_state.bfs_nframes
105#define bf_frmlen bf_state.bfs_frmlen 104#define bf_frmlen bf_state.bfs_frmlen
106#define bf_retries bf_state.bfs_retries 105#define bf_retries bf_state.bfs_retries
107#define bf_isht(bf) (bf->bf_state.bf_type & BUF_HT) 106#define bf_isht(bf) (bf->bf_state.bf_type & BUF_HT)
@@ -213,7 +212,6 @@ struct ath_atx_ac {
213}; 212};
214 213
215struct ath_buf_state { 214struct ath_buf_state {
216 int bfs_nframes;
217 int bfs_retries; 215 int bfs_retries;
218 u8 bf_type; 216 u8 bf_type;
219 u8 bfs_paprd; 217 u8 bfs_paprd;
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 88efcc1671b1..87b79ef9dbef 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -57,10 +57,8 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
57static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, 57static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
58 struct list_head *head); 58 struct list_head *head);
59static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len); 59static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len);
60static int ath_tx_num_badfrms(struct ath_softc *sc, struct ath_buf *bf,
61 struct ath_tx_status *ts, int txok);
62static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts, 60static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,
63 int nbad, int txok, bool update_rc); 61 int nframes, int nbad, int txok, bool update_rc);
64static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, 62static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
65 int seqno); 63 int seqno);
66 64
@@ -303,6 +301,39 @@ static struct ath_buf* ath_clone_txbuf(struct ath_softc *sc, struct ath_buf *bf)
303 return tbf; 301 return tbf;
304} 302}
305 303
304static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf,
305 struct ath_tx_status *ts, int txok,
306 int *nframes, int *nbad)
307{
308 u16 seq_st = 0;
309 u32 ba[WME_BA_BMP_SIZE >> 5];
310 int ba_index;
311 int isaggr = 0;
312
313 *nbad = 0;
314 *nframes = 0;
315
316 if (bf->bf_lastbf->bf_tx_aborted)
317 return;
318
319 isaggr = bf_isaggr(bf);
320 if (isaggr) {
321 seq_st = ts->ts_seqnum;
322 memcpy(ba, &ts->ba_low, WME_BA_BMP_SIZE >> 3);
323 }
324
325 while (bf) {
326 ba_index = ATH_BA_INDEX(seq_st, ath_frame_seqno(bf->bf_mpdu));
327
328 (*nframes)++;
329 if (!txok || (isaggr && !ATH_BA_ISSET(ba, ba_index)))
330 (*nbad)++;
331
332 bf = bf->bf_next;
333 }
334}
335
336
306static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, 337static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
307 struct ath_buf *bf, struct list_head *bf_q, 338 struct ath_buf *bf, struct list_head *bf_q,
308 struct ath_tx_status *ts, int txok) 339 struct ath_tx_status *ts, int txok)
@@ -332,7 +363,6 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
332 hw = bf->aphy->hw; 363 hw = bf->aphy->hw;
333 364
334 memcpy(rates, tx_info->control.rates, sizeof(rates)); 365 memcpy(rates, tx_info->control.rates, sizeof(rates));
335 nframes = bf->bf_nframes;
336 366
337 rcu_read_lock(); 367 rcu_read_lock();
338 368
@@ -349,7 +379,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
349 !bf->bf_stale || bf_next != NULL) 379 !bf->bf_stale || bf_next != NULL)
350 list_move_tail(&bf->list, &bf_head); 380 list_move_tail(&bf->list, &bf_head);
351 381
352 ath_tx_rc_status(bf, ts, 1, 0, false); 382 ath_tx_rc_status(bf, ts, 1, 1, 0, false);
353 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 383 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
354 0, 0); 384 0, 0);
355 385
@@ -393,7 +423,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
393 INIT_LIST_HEAD(&bf_pending); 423 INIT_LIST_HEAD(&bf_pending);
394 INIT_LIST_HEAD(&bf_head); 424 INIT_LIST_HEAD(&bf_head);
395 425
396 nbad = ath_tx_num_badfrms(sc, bf, ts, txok); 426 ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad);
397 while (bf) { 427 while (bf) {
398 txfail = txpending = 0; 428 txfail = txpending = 0;
399 bf_next = bf->bf_next; 429 bf_next = bf->bf_next;
@@ -456,11 +486,10 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
456 486
457 if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { 487 if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
458 memcpy(tx_info->control.rates, rates, sizeof(rates)); 488 memcpy(tx_info->control.rates, rates, sizeof(rates));
459 bf->bf_nframes = nframes; 489 ath_tx_rc_status(bf, ts, nframes, nbad, txok, true);
460 ath_tx_rc_status(bf, ts, nbad, txok, true);
461 rc_update = false; 490 rc_update = false;
462 } else { 491 } else {
463 ath_tx_rc_status(bf, ts, nbad, txok, false); 492 ath_tx_rc_status(bf, ts, nframes, nbad, txok, false);
464 } 493 }
465 494
466 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 495 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
@@ -485,8 +514,8 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
485 514
486 bf->bf_state.bf_type |= 515 bf->bf_state.bf_type |=
487 BUF_XRETRY; 516 BUF_XRETRY;
488 ath_tx_rc_status(bf, ts, nbad, 517 ath_tx_rc_status(bf, ts, nframes,
489 0, false); 518 nbad, 0, false);
490 ath_tx_complete_buf(sc, bf, txq, 519 ath_tx_complete_buf(sc, bf, txq,
491 &bf_head, 520 &bf_head,
492 ts, 0, 0); 521 ts, 0, 0);
@@ -752,7 +781,6 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
752 } while (!list_empty(&tid->buf_q)); 781 } while (!list_empty(&tid->buf_q));
753 782
754 *aggr_len = al; 783 *aggr_len = al;
755 bf_first->bf_nframes = nframes;
756 784
757 return status; 785 return status;
758#undef PADBYTES 786#undef PADBYTES
@@ -785,7 +813,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
785 bf->bf_lastbf = list_entry(bf_q.prev, struct ath_buf, list); 813 bf->bf_lastbf = list_entry(bf_q.prev, struct ath_buf, list);
786 814
787 /* if only one frame, send as non-aggregate */ 815 /* if only one frame, send as non-aggregate */
788 if (bf->bf_nframes == 1) { 816 if (bf == bf->bf_lastbf) {
789 bf->bf_state.bf_type &= ~BUF_AGGR; 817 bf->bf_state.bf_type &= ~BUF_AGGR;
790 ath9k_hw_clr11n_aggr(sc->sc_ah, bf->bf_desc); 818 ath9k_hw_clr11n_aggr(sc->sc_ah, bf->bf_desc);
791 ath_buf_set_rate(sc, bf, bf->bf_frmlen); 819 ath_buf_set_rate(sc, bf, bf->bf_frmlen);
@@ -1333,7 +1361,6 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
1333 ath_tx_addto_baw(sc, tid, bf_seqno); 1361 ath_tx_addto_baw(sc, tid, bf_seqno);
1334 1362
1335 /* Queue to h/w without aggregation */ 1363 /* Queue to h/w without aggregation */
1336 bf->bf_nframes = 1;
1337 bf->bf_lastbf = bf; 1364 bf->bf_lastbf = bf;
1338 ath_buf_set_rate(sc, bf, bf->bf_frmlen); 1365 ath_buf_set_rate(sc, bf, bf->bf_frmlen);
1339 ath_tx_txqaddbuf(sc, txctl->txq, bf_head); 1366 ath_tx_txqaddbuf(sc, txctl->txq, bf_head);
@@ -1352,7 +1379,6 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
1352 if (tid) 1379 if (tid)
1353 INCR(tid->seq_start, IEEE80211_SEQ_MAX); 1380 INCR(tid->seq_start, IEEE80211_SEQ_MAX);
1354 1381
1355 bf->bf_nframes = 1;
1356 bf->bf_lastbf = bf; 1382 bf->bf_lastbf = bf;
1357 ath_buf_set_rate(sc, bf, bf->bf_frmlen); 1383 ath_buf_set_rate(sc, bf, bf->bf_frmlen);
1358 ath_tx_txqaddbuf(sc, txq, bf_head); 1384 ath_tx_txqaddbuf(sc, txq, bf_head);
@@ -1895,37 +1921,8 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
1895 spin_unlock_irqrestore(&sc->tx.txbuflock, flags); 1921 spin_unlock_irqrestore(&sc->tx.txbuflock, flags);
1896} 1922}
1897 1923
1898static int ath_tx_num_badfrms(struct ath_softc *sc, struct ath_buf *bf,
1899 struct ath_tx_status *ts, int txok)
1900{
1901 u16 seq_st = 0;
1902 u32 ba[WME_BA_BMP_SIZE >> 5];
1903 int ba_index;
1904 int nbad = 0;
1905 int isaggr = 0;
1906
1907 if (bf->bf_lastbf->bf_tx_aborted)
1908 return 0;
1909
1910 isaggr = bf_isaggr(bf);
1911 if (isaggr) {
1912 seq_st = ts->ts_seqnum;
1913 memcpy(ba, &ts->ba_low, WME_BA_BMP_SIZE >> 3);
1914 }
1915
1916 while (bf) {
1917 ba_index = ATH_BA_INDEX(seq_st, ath_frame_seqno(bf->bf_mpdu));
1918 if (!txok || (isaggr && !ATH_BA_ISSET(ba, ba_index)))
1919 nbad++;
1920
1921 bf = bf->bf_next;
1922 }
1923
1924 return nbad;
1925}
1926
1927static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts, 1924static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,
1928 int nbad, int txok, bool update_rc) 1925 int nframes, int nbad, int txok, bool update_rc)
1929{ 1926{
1930 struct sk_buff *skb = bf->bf_mpdu; 1927 struct sk_buff *skb = bf->bf_mpdu;
1931 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1928 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
@@ -1946,10 +1943,10 @@ static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,
1946 if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && update_rc) { 1943 if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && update_rc) {
1947 tx_info->flags |= IEEE80211_TX_STAT_AMPDU; 1944 tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
1948 1945
1949 BUG_ON(nbad > bf->bf_nframes); 1946 BUG_ON(nbad > nframes);
1950 1947
1951 tx_info->status.ampdu_len = bf->bf_nframes; 1948 tx_info->status.ampdu_len = nframes;
1952 tx_info->status.ampdu_ack_len = bf->bf_nframes - nbad; 1949 tx_info->status.ampdu_ack_len = nframes - nbad;
1953 } 1950 }
1954 1951
1955 if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 && 1952 if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 &&
@@ -2078,7 +2075,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
2078 */ 2075 */
2079 if (ts.ts_status & ATH9K_TXERR_XRETRY) 2076 if (ts.ts_status & ATH9K_TXERR_XRETRY)
2080 bf->bf_state.bf_type |= BUF_XRETRY; 2077 bf->bf_state.bf_type |= BUF_XRETRY;
2081 ath_tx_rc_status(bf, &ts, txok ? 0 : 1, txok, true); 2078 ath_tx_rc_status(bf, &ts, 1, txok ? 0 : 1, txok, true);
2082 } 2079 }
2083 2080
2084 qnum = skb_get_queue_mapping(bf->bf_mpdu); 2081 qnum = skb_get_queue_mapping(bf->bf_mpdu);
@@ -2200,7 +2197,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
2200 if (!bf_isampdu(bf)) { 2197 if (!bf_isampdu(bf)) {
2201 if (txs.ts_status & ATH9K_TXERR_XRETRY) 2198 if (txs.ts_status & ATH9K_TXERR_XRETRY)
2202 bf->bf_state.bf_type |= BUF_XRETRY; 2199 bf->bf_state.bf_type |= BUF_XRETRY;
2203 ath_tx_rc_status(bf, &txs, txok ? 0 : 1, txok, true); 2200 ath_tx_rc_status(bf, &txs, 1, txok ? 0 : 1, txok, true);
2204 } 2201 }
2205 2202
2206 qnum = skb_get_queue_mapping(bf->bf_mpdu); 2203 qnum = skb_get_queue_mapping(bf->bf_mpdu);