--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -1955,7 +1955,7 @@ static void ath_tx_complete(struct ath_s
+@@ -179,6 +179,11 @@ static void ath_tx_flush_tid(struct ath_
+ spin_lock_bh(&txq->axq_lock);
+ }
+
++ if (tid->baw_head == tid->baw_tail) {
++ tid->state &= ~AGGR_ADDBA_COMPLETE;
++ tid->state &= ~AGGR_CLEANUP;
++ }
++
+ spin_unlock_bh(&txq->axq_lock);
+ }
+
+@@ -556,15 +561,9 @@ static void ath_tx_complete_aggr(struct
+ spin_unlock_bh(&txq->axq_lock);
+ }
+
+- if (tid->state & AGGR_CLEANUP) {
++ if (tid->state & AGGR_CLEANUP)
+ ath_tx_flush_tid(sc, tid);
+
+- if (tid->baw_head == tid->baw_tail) {
+- tid->state &= ~AGGR_ADDBA_COMPLETE;
+- tid->state &= ~AGGR_CLEANUP;
+- }
+- }
+-
+ rcu_read_unlock();
+
+ if (needreset) {
+@@ -1955,7 +1954,7 @@ static void ath_tx_complete(struct ath_s
skb_pull(skb, padsize);
}
debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy, sc,
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -350,6 +350,14 @@ static void ath_tx_count_frames(struct a
+@@ -355,6 +355,14 @@ static void ath_tx_count_frames(struct a
}
}
static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
struct ath_buf *bf, struct list_head *bf_q,
-@@ -438,6 +446,8 @@ static void ath_tx_complete_aggr(struct
+@@ -443,6 +451,8 @@ static void ath_tx_complete_aggr(struct
__skb_queue_head_init(&bf_pending);
ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad);
while (bf) {
u16 seqno = bf->bf_state.seqno;
-@@ -824,6 +834,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_
+@@ -823,6 +833,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_
ath_tx_addto_baw(sc, tid, seqno);
bf->bf_state.ndelim = ndelim;
__skb_unlink(skb, &tid->buf_q);
list_add_tail(&bf->list, bf_q);
if (bf_prev)
-@@ -1683,6 +1694,8 @@ static void ath_tx_send_ampdu(struct ath
+@@ -1682,6 +1693,8 @@ static void ath_tx_send_ampdu(struct ath
/* Add sub-frame to BAW */
ath_tx_addto_baw(sc, tid, bf->bf_state.seqno);
/* Queue to h/w without aggregation */
TX_STAT_INC(txctl->txq->axq_qnum, a_queued_hw);
bf->bf_lastbf = bf;
-@@ -1811,23 +1824,13 @@ error:
+@@ -1810,23 +1823,13 @@ error:
/* FIXME: tx power */
static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb,
if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && tid) {
/*
-@@ -1862,6 +1865,7 @@ int ath_tx_start(struct ieee80211_hw *hw
+@@ -1861,6 +1864,7 @@ int ath_tx_start(struct ieee80211_hw *hw
struct ieee80211_vif *vif = info->control.vif;
struct ath_softc *sc = hw->priv;
struct ath_txq *txq = txctl->txq;
int padpos, padsize;
int frmlen = skb->len + FCS_LEN;
int q;
-@@ -1904,6 +1908,24 @@ int ath_tx_start(struct ieee80211_hw *hw
+@@ -1903,6 +1907,24 @@ int ath_tx_start(struct ieee80211_hw *hw
setup_frame_info(hw, skb, frmlen);
/*
* At this point, the vif, hw_key and sta pointers in the tx control
* info are no longer valid (overwritten by the ath_frame_info data.
-@@ -1918,7 +1940,7 @@ int ath_tx_start(struct ieee80211_hw *hw
+@@ -1917,7 +1939,7 @@ int ath_tx_start(struct ieee80211_hw *hw
}
spin_unlock_bh(&txq->axq_lock);
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -259,14 +259,17 @@ static void ath_tid_drain(struct ath_sof
+@@ -264,14 +264,17 @@ static void ath_tid_drain(struct ath_sof
}
static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq,
return;
hdr = (struct ieee80211_hdr *)skb->data;
-@@ -382,6 +385,7 @@ static void ath_tx_complete_aggr(struct
+@@ -387,6 +390,7 @@ static void ath_tx_complete_aggr(struct
int nframes;
u8 tidno;
bool flush = !!(ts->ts_status & ATH9K_TX_FLUSH);
skb = bf->bf_mpdu;
hdr = (struct ieee80211_hdr *)skb->data;
-@@ -390,6 +394,10 @@ static void ath_tx_complete_aggr(struct
+@@ -395,6 +399,10 @@ static void ath_tx_complete_aggr(struct
memcpy(rates, tx_info->control.rates, sizeof(rates));
rcu_read_lock();
sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
-@@ -476,7 +484,8 @@ static void ath_tx_complete_aggr(struct
+@@ -481,7 +489,8 @@ static void ath_tx_complete_aggr(struct
txpending = 1;
} else if (fi->retries < ATH_MAX_SW_RETRIES) {
if (txok || !an->sleeping)