1 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
3 @@ -159,6 +159,9 @@ void ath_descdma_cleanup(struct ath_soft
4 /* return block-ack bitmap index given sequence and starting sequence */
5 #define ATH_BA_INDEX(_st, _seq) (((_seq) - (_st)) & (IEEE80211_SEQ_MAX - 1))
7 +/* return the seqno for _start + _offset */
8 +#define ATH_BA_INDEX2SEQ(_seq, _offset) (((_seq) + (_offset)) & (IEEE80211_SEQ_MAX - 1))
10 /* returns delimiter padding required given the packet length */
11 #define ATH_AGGR_GET_NDELIM(_len) \
12 (((_len) >= ATH_AGGR_MINPLEN) ? 0 : \
13 @@ -253,9 +256,9 @@ struct ath_atx_tid {
15 #ifdef CONFIG_ATH9K_DEBUGFS
16 struct list_head list; /* for sc->nodes */
18 struct ieee80211_sta *sta; /* station struct we're part of */
19 struct ieee80211_vif *vif; /* interface with which we're associated */
21 struct ath_atx_tid tid[WME_NUM_TID];
22 struct ath_atx_ac ac[WME_NUM_AC];
24 @@ -277,7 +280,6 @@ struct ath_tx_control {
27 #define ATH_TX_ERROR 0x01
28 -#define ATH_TX_BAR 0x02
31 * @txq_map: Index is mac80211 queue number. This is
32 --- a/drivers/net/wireless/ath/ath9k/main.c
33 +++ b/drivers/net/wireless/ath/ath9k/main.c
34 @@ -644,9 +644,9 @@ static void ath_node_attach(struct ath_s
35 spin_lock(&sc->nodes_lock);
36 list_add(&an->list, &sc->nodes);
37 spin_unlock(&sc->nodes_lock);
42 if (sc->sc_flags & SC_OP_TXAGGR) {
43 ath_tx_node_init(sc, an);
44 an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
45 --- a/drivers/net/wireless/ath/ath9k/xmit.c
46 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
47 @@ -53,7 +53,7 @@ static void ath_tx_complete(struct ath_s
48 int tx_flags, struct ath_txq *txq);
49 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
50 struct ath_txq *txq, struct list_head *bf_q,
51 - struct ath_tx_status *ts, int txok, int sendbar);
52 + struct ath_tx_status *ts, int txok);
53 static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
54 struct list_head *head, bool internal);
55 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
56 @@ -150,6 +150,12 @@ static struct ath_frame_info *get_frame_
57 return (struct ath_frame_info *) &tx_info->rate_driver_data[0];
60 +static void ath_send_bar(struct ath_atx_tid *tid, u16 seqno)
62 + ieee80211_send_bar(tid->an->vif, tid->an->sta->addr, tid->tidno,
63 + seqno << IEEE80211_SEQ_SEQ_SHIFT);
66 static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
68 struct ath_txq *txq = tid->ac->txq;
69 @@ -158,6 +164,7 @@ static void ath_tx_flush_tid(struct ath_
70 struct list_head bf_head;
71 struct ath_tx_status ts;
72 struct ath_frame_info *fi;
73 + bool sendbar = false;
75 INIT_LIST_HEAD(&bf_head);
77 @@ -172,7 +179,8 @@ static void ath_tx_flush_tid(struct ath_
78 if (bf && fi->retries) {
79 list_add_tail(&bf->list, &bf_head);
80 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
81 - ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 1);
82 + ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
85 ath_tx_send_normal(sc, txq, NULL, skb);
87 @@ -185,6 +193,9 @@ static void ath_tx_flush_tid(struct ath_
90 spin_unlock_bh(&txq->axq_lock);
93 + ath_send_bar(tid, tid->seq_start);
96 static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
97 @@ -255,7 +266,7 @@ static void ath_tid_drain(struct ath_sof
98 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
100 spin_unlock(&txq->axq_lock);
101 - ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
102 + ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
103 spin_lock(&txq->axq_lock);
106 @@ -381,7 +392,7 @@ static void ath_tx_complete_aggr(struct
107 struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
108 struct list_head bf_head;
109 struct sk_buff_head bf_pending;
110 - u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0;
111 + u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first;
112 u32 ba[WME_BA_BMP_SIZE >> 5];
113 int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
114 bool rc_update = true;
115 @@ -391,6 +402,7 @@ static void ath_tx_complete_aggr(struct
117 bool flush = !!(ts->ts_status & ATH9K_TX_FLUSH);
119 + int bar_index = -1;
122 hdr = (struct ieee80211_hdr *)skb->data;
123 @@ -416,8 +428,7 @@ static void ath_tx_complete_aggr(struct
124 if (!bf->bf_stale || bf_next != NULL)
125 list_move_tail(&bf->list, &bf_head);
127 - ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
129 + ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 0);
133 @@ -427,6 +438,7 @@ static void ath_tx_complete_aggr(struct
134 an = (struct ath_node *)sta->drv_priv;
135 tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK;
136 tid = ATH_AN_2_TID(an, tidno);
137 + seq_first = tid->seq_start;
140 * The hardware occasionally sends a tx status for the wrong TID.
141 @@ -495,8 +507,9 @@ static void ath_tx_complete_aggr(struct
147 + bar_index = max_t(int, bar_index,
148 + ATH_BA_INDEX(seq_first, seqno));
152 @@ -525,7 +538,7 @@ static void ath_tx_complete_aggr(struct
155 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
159 /* retry the un-acked ones */
160 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)) {
161 @@ -545,8 +558,10 @@ static void ath_tx_complete_aggr(struct
163 ath_tx_complete_buf(sc, bf, txq,
168 + bar_index = max_t(int, bar_index,
169 + ATH_BA_INDEX(seq_first,
174 @@ -564,6 +579,9 @@ static void ath_tx_complete_aggr(struct
178 + if (bar_index >= 0)
179 + ath_send_bar(tid, ATH_BA_INDEX2SEQ(seq_first, bar_index + 1));
181 /* prepend un-acked frames to the beginning of the pending frame queue */
182 if (!skb_queue_empty(&bf_pending)) {
184 @@ -1452,7 +1470,7 @@ static void ath_drain_txq_list(struct at
185 ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, 0,
188 - ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
189 + ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
190 spin_lock_bh(&txq->axq_lock);
193 @@ -1967,9 +1985,6 @@ static void ath_tx_complete(struct ath_s
195 ath_dbg(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb);
197 - if (tx_flags & ATH_TX_BAR)
198 - tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
200 if (!(tx_flags & ATH_TX_ERROR))
201 /* Frame was ACKed */
202 tx_info->flags |= IEEE80211_TX_STAT_ACK;
203 @@ -2013,16 +2028,13 @@ static void ath_tx_complete(struct ath_s
205 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
206 struct ath_txq *txq, struct list_head *bf_q,
207 - struct ath_tx_status *ts, int txok, int sendbar)
208 + struct ath_tx_status *ts, int txok)
210 struct sk_buff *skb = bf->bf_mpdu;
211 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
216 - tx_flags = ATH_TX_BAR;
219 tx_flags |= ATH_TX_ERROR;
221 @@ -2129,7 +2141,7 @@ static void ath_tx_process_buffer(struct
223 if (!bf_isampdu(bf)) {
224 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
225 - ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok, 0);
226 + ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok);
228 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok, true);
230 --- a/drivers/net/wireless/ath/ath9k/debug.c
231 +++ b/drivers/net/wireless/ath/ath9k/debug.c
232 @@ -856,7 +856,7 @@ void ath_debug_stat_tx(struct ath_softc
233 sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len;
235 if (bf_isampdu(bf)) {
236 - if (flags & ATH_TX_BAR)
237 + if (flags & ATH_TX_ERROR)
238 TX_STAT_INC(qnum, a_xretries);
240 TX_STAT_INC(qnum, a_completed);