strict_strtoul is obsolete, use kstrtoul instead
[openwrt/svn-archive/archive.git] / package / kernel / mac80211 / patches / 568-ath9k_tid_fairness.patch
1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -1282,8 +1282,8 @@ ath_tx_form_burst(struct ath_softc *sc,
4 } while (1);
5 }
6
7 -static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
8 - struct ath_atx_tid *tid)
9 +static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
10 + struct ath_atx_tid *tid, bool *stop)
11 {
12 struct ath_buf *bf;
13 struct ieee80211_tx_info *tx_info;
14 @@ -1292,37 +1292,36 @@ static void ath_tx_sched_aggr(struct ath
15 int aggr_len = 0;
16 bool aggr, last = true;
17
18 - do {
19 - if (!ath_tid_has_buffered(tid))
20 - return;
21 -
22 - INIT_LIST_HEAD(&bf_q);
23 + if (!ath_tid_has_buffered(tid))
24 + return false;
25
26 - bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
27 - if (!bf)
28 - break;
29 -
30 - tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
31 - aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
32 - if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) ||
33 - (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH))
34 - break;
35 + INIT_LIST_HEAD(&bf_q);
36
37 - ath_set_rates(tid->an->vif, tid->an->sta, bf);
38 - if (aggr)
39 - last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
40 - tid_q, &aggr_len);
41 - else
42 - ath_tx_form_burst(sc, txq, tid, &bf_q, bf, tid_q);
43 + bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
44 + if (!bf)
45 + return false;
46 +
47 + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
48 + aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
49 + if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) ||
50 + (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH))
51 + return false;
52 +
53 + ath_set_rates(tid->an->vif, tid->an->sta, bf);
54 + if (aggr)
55 + last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
56 + tid_q, &aggr_len);
57 + else
58 + ath_tx_form_burst(sc, txq, tid, &bf_q, bf, tid_q);
59
60 - if (tid->ac->clear_ps_filter) {
61 - tid->ac->clear_ps_filter = false;
62 - tx_info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
63 - }
64 + if (tid->ac->clear_ps_filter) {
65 + tid->ac->clear_ps_filter = false;
66 + tx_info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
67 + }
68
69 - ath_tx_fill_desc(sc, bf, txq, aggr_len);
70 - ath_tx_txqaddbuf(sc, txq, &bf_q, false);
71 - } while (!last);
72 + ath_tx_fill_desc(sc, bf, txq, aggr_len);
73 + ath_tx_txqaddbuf(sc, txq, &bf_q, false);
74 + return true;
75 }
76
77 int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
78 @@ -1754,8 +1753,9 @@ void ath_tx_cleanupq(struct ath_softc *s
79 */
80 void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
81 {
82 - struct ath_atx_ac *ac, *ac_tmp, *last_ac;
83 + struct ath_atx_ac *ac, *last_ac;
84 struct ath_atx_tid *tid, *last_tid;
85 + bool sent = false;
86
87 if (test_bit(SC_OP_HW_RESET, &sc->sc_flags) ||
88 list_empty(&txq->axq_acq) ||
89 @@ -1764,15 +1764,17 @@ void ath_txq_schedule(struct ath_softc *
90
91 rcu_read_lock();
92
93 - ac = list_first_entry(&txq->axq_acq, struct ath_atx_ac, list);
94 last_ac = list_entry(txq->axq_acq.prev, struct ath_atx_ac, list);
95 + while (!list_empty(&txq->axq_acq)) {
96 + bool stop = false;
97
98 - list_for_each_entry_safe(ac, ac_tmp, &txq->axq_acq, list) {
99 + ac = list_first_entry(&txq->axq_acq, struct ath_atx_ac, list);
100 last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
101 list_del(&ac->list);
102 ac->sched = false;
103
104 while (!list_empty(&ac->tid_q)) {
105 +
106 tid = list_first_entry(&ac->tid_q, struct ath_atx_tid,
107 list);
108 list_del(&tid->list);
109 @@ -1781,7 +1783,8 @@ void ath_txq_schedule(struct ath_softc *
110 if (tid->paused)
111 continue;
112
113 - ath_tx_sched_aggr(sc, txq, tid);
114 + if (ath_tx_sched_aggr(sc, txq, tid, &stop))
115 + sent = true;
116
117 /*
118 * add tid to round-robin queue if more frames
119 @@ -1790,8 +1793,7 @@ void ath_txq_schedule(struct ath_softc *
120 if (ath_tid_has_buffered(tid))
121 ath_tx_queue_tid(txq, tid);
122
123 - if (tid == last_tid ||
124 - txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
125 + if (stop || tid == last_tid)
126 break;
127 }
128
129 @@ -1800,9 +1802,17 @@ void ath_txq_schedule(struct ath_softc *
130 list_add_tail(&ac->list, &txq->axq_acq);
131 }
132
133 - if (ac == last_ac ||
134 - txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
135 + if (stop)
136 break;
137 +
138 + if (ac == last_ac) {
139 + if (!sent)
140 + break;
141 +
142 + sent = false;
143 + last_ac = list_entry(txq->axq_acq.prev,
144 + struct ath_atx_ac, list);
145 + }
146 }
147
148 rcu_read_unlock();