ath9k: merge fixes from r24627, r24628
[openwrt-10.03/.git] / package / mac80211 / patches / 530-ath9k_aggr_depth_fix.patch
1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -838,7 +838,7 @@ static void ath_tx_sched_aggr(struct ath
4                 ath_tx_txqaddbuf(sc, txq, &bf_q);
5                 TX_STAT_INC(txq->axq_qnum, a_aggr);
6  
7 -       } while (txq->axq_depth < ATH_AGGR_MIN_QDEPTH &&
8 +       } while (txq->axq_ampdu_depth < ATH_AGGR_MIN_QDEPTH &&
9                  status != ATH_AGGR_BAW_CLOSED);
10  }
11  
12 @@ -999,6 +999,7 @@ struct ath_txq *ath_txq_setup(struct ath
13                 INIT_LIST_HEAD(&txq->axq_acq);
14                 spin_lock_init(&txq->axq_lock);
15                 txq->axq_depth = 0;
16 +               txq->axq_ampdu_depth = 0;
17                 txq->axq_tx_inprogress = false;
18                 sc->tx.txqsetup |= 1<<qnum;
19  
20 @@ -1068,6 +1069,12 @@ int ath_cabq_update(struct ath_softc *sc
21         return 0;
22  }
23  
24 +static bool bf_is_ampdu_not_probing(struct ath_buf *bf)
25 +{
26 +    struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
27 +    return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
28 +}
29 +
30  /*
31   * Drain a given TX queue (could be Beacon or Data)
32   *
33 @@ -1126,7 +1133,8 @@ void ath_draintxq(struct ath_softc *sc, 
34                 }
35  
36                 txq->axq_depth--;
37 -
38 +               if (bf_is_ampdu_not_probing(bf))
39 +                       txq->axq_ampdu_depth--;
40                 spin_unlock_bh(&txq->axq_lock);
41  
42                 if (bf_isampdu(bf))
43 @@ -1316,6 +1324,8 @@ static void ath_tx_txqaddbuf(struct ath_
44                 ath9k_hw_txstart(ah, txq->axq_qnum);
45         }
46         txq->axq_depth++;
47 +       if (bf_is_ampdu_not_probing(bf))
48 +               txq->axq_ampdu_depth++;
49  }
50  
51  static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
52 @@ -1336,7 +1346,7 @@ static void ath_tx_send_ampdu(struct ath
53          */
54         if (!list_empty(&tid->buf_q) || tid->paused ||
55             !BAW_WITHIN(tid->seq_start, tid->baw_size, fi->seqno) ||
56 -           txctl->txq->axq_depth >= ATH_AGGR_MIN_QDEPTH) {
57 +           txctl->txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) {
58                 /*
59                  * Add this frame to software queue for scheduling later
60                  * for aggregation.
61 @@ -2040,6 +2050,9 @@ static void ath_tx_processq(struct ath_s
62                 txq->axq_tx_inprogress = false;
63                 if (bf_held)
64                         list_del(&bf_held->list);
65 +
66 +               if (bf_is_ampdu_not_probing(bf))
67 +                       txq->axq_ampdu_depth--;
68                 spin_unlock_bh(&txq->axq_lock);
69  
70                 if (bf_held)
71 @@ -2168,6 +2181,8 @@ void ath_tx_edma_tasklet(struct ath_soft
72                 INCR(txq->txq_tailidx, ATH_TXFIFO_DEPTH);
73                 txq->axq_depth--;
74                 txq->axq_tx_inprogress = false;
75 +               if (bf_is_ampdu_not_probing(bf))
76 +                       txq->axq_ampdu_depth--;
77                 spin_unlock_bh(&txq->axq_lock);
78  
79                 txok = !(txs.ts_status & ATH9K_TXERR_MASK);
80 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
81 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
82 @@ -187,6 +187,7 @@ struct ath_txq {
83         struct list_head axq_q;
84         spinlock_t axq_lock;
85         u32 axq_depth;
86 +       u32 axq_ampdu_depth;
87         bool stopped;
88         bool axq_tx_inprogress;
89         struct list_head axq_acq;