block-mount: Fixed mount deadlocks due to buggy use of locks in /lib/functions/block.sh
[openwrt.git] / package / mac80211 / patches / 510-ath9k_fix_ampdu_retry_count.patch
1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -328,6 +328,7 @@ static void ath_tx_complete_aggr(struct 
4         u32 ba[WME_BA_BMP_SIZE >> 5];
5         int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
6         bool rc_update = true;
7 +       struct ieee80211_tx_rate rates[4];
8  
9         skb = bf->bf_mpdu;
10         hdr = (struct ieee80211_hdr *)skb->data;
11 @@ -335,6 +336,8 @@ static void ath_tx_complete_aggr(struct 
12         tx_info = IEEE80211_SKB_CB(skb);
13         hw = bf->aphy->hw;
14  
15 +       memcpy(rates, tx_info->control.rates, sizeof(rates));
16 +
17         rcu_read_lock();
18  
19         /* XXX: use ieee80211_find_sta! */
20 @@ -375,6 +378,9 @@ static void ath_tx_complete_aggr(struct 
21                 txfail = txpending = 0;
22                 bf_next = bf->bf_next;
23  
24 +               skb = bf->bf_mpdu;
25 +               tx_info = IEEE80211_SKB_CB(skb);
26 +
27                 if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, bf->bf_seqno))) {
28                         /* transmit completion, subframe is
29                          * acked by block ack */
30 @@ -428,6 +434,7 @@ static void ath_tx_complete_aggr(struct 
31                         spin_unlock_bh(&txq->axq_lock);
32  
33                         if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
34 +                               memcpy(tx_info->control.rates, rates, sizeof(rates));
35                                 ath_tx_rc_status(bf, ts, nbad, txok, true);
36                                 rc_update = false;
37                         } else {
38 @@ -2014,7 +2021,7 @@ static void ath_tx_rc_status(struct ath_
39                 tx_info->status.rates[i].idx = -1;
40         }
41  
42 -       tx_info->status.rates[tx_rateindex].count = bf->bf_retries + 1;
43 +       tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1;
44  }
45  
46  static void ath_wake_mac80211_queue(struct ath_softc *sc, struct ath_txq *txq)
47 @@ -2125,7 +2132,6 @@ static void ath_tx_processq(struct ath_s
48                          * This frame is sent out as a single frame.
49                          * Use hardware retry status for this frame.
50                          */
51 -                       bf->bf_retries = ts.ts_longretry;
52                         if (ts.ts_status & ATH9K_TXERR_XRETRY)
53                                 bf->bf_state.bf_type |= BUF_XRETRY;
54                         ath_tx_rc_status(bf, &ts, 0, txok, true);
55 @@ -2255,7 +2261,6 @@ void ath_tx_edma_tasklet(struct ath_soft
56                 }
57  
58                 if (!bf_isampdu(bf)) {
59 -                       bf->bf_retries = txs.ts_longretry;
60                         if (txs.ts_status & ATH9K_TXERR_XRETRY)
61                                 bf->bf_state.bf_type |= BUF_XRETRY;
62                         ath_tx_rc_status(bf, &txs, 0, txok, true);