1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Tue, 30 Aug 2016 12:44:08 +0200
3 Subject: [PATCH] ath9k: fix block-ack window tracking issues
5 Ensure that a buffer gets tracked as part of the block-ack window as
6 soon as it's dequeued from the tid for the first time. Ensure that
7 double calls to ath_tx_addto_baw (e.g. on retransmission) don't cause
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
13 --- a/drivers/net/wireless/ath/ath9k/xmit.c
14 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
15 @@ -62,7 +62,7 @@ static void ath_tx_rc_status(struct ath_
16 struct ath_tx_status *ts, int nframes, int nbad,
18 static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
20 + struct ath_buf *bf);
21 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
23 struct ath_atx_tid *tid,
24 @@ -311,7 +311,7 @@ static void ath_tx_flush_tid(struct ath_
27 if (fi->baw_tracked) {
28 - ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
29 + ath_tx_update_baw(sc, tid, bf);
33 @@ -327,10 +327,15 @@ static void ath_tx_flush_tid(struct ath_
36 static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
40 + struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
41 + u16 seqno = bf->bf_state.seqno;
44 + if (!fi->baw_tracked)
47 index = ATH_BA_INDEX(tid->seq_start, seqno);
48 cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
50 @@ -351,6 +356,9 @@ static void ath_tx_addto_baw(struct ath_
51 u16 seqno = bf->bf_state.seqno;
54 + if (fi->baw_tracked)
57 index = ATH_BA_INDEX(tid->seq_start, seqno);
58 cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
59 __set_bit(cindex, tid->tx_buf);
60 @@ -627,7 +635,7 @@ static void ath_tx_complete_aggr(struct
61 * complete the acked-ones/xretried ones; update
64 - ath_tx_update_baw(sc, tid, seqno);
65 + ath_tx_update_baw(sc, tid, bf);
67 if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
68 memcpy(tx_info->control.rates, rates, sizeof(rates));
69 @@ -657,7 +665,7 @@ static void ath_tx_complete_aggr(struct
73 - ath_tx_update_baw(sc, tid, seqno);
74 + ath_tx_update_baw(sc, tid, bf);
76 ath_tx_complete_buf(sc, bf, txq,
78 @@ -1026,11 +1034,14 @@ ath_tx_get_tid_subframe(struct ath_softc
80 INIT_LIST_HEAD(&bf_head);
81 list_add(&bf->list, &bf_head);
82 - ath_tx_update_baw(sc, tid, seqno);
83 + ath_tx_update_baw(sc, tid, bf);
84 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
89 + ath_tx_addto_baw(sc, tid, bf);
94 @@ -1088,8 +1099,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s
97 /* link buffers of this frame to the aggregate */
98 - if (!fi->baw_tracked)
99 - ath_tx_addto_baw(sc, tid, bf);
100 bf->bf_state.ndelim = ndelim;
102 list_add_tail(&bf->list, bf_q);
103 @@ -1725,10 +1734,8 @@ void ath9k_release_buffered_frames(struc
104 ath9k_set_moredata(sc, bf, true);
105 list_add_tail(&bf->list, &bf_q);
106 ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
107 - if (bf_isampdu(bf)) {
108 - ath_tx_addto_baw(sc, tid, bf);
109 + if (bf_isampdu(bf))
110 bf->bf_state.bf_type &= ~BUF_AGGR;
113 bf_tail->bf_next = bf;