mac80211: add a few tx related fixes
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 310-ath9k_pending_work.patch
1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -1221,49 +1221,59 @@ void ath_tx_cleanupq(struct ath_softc *s
4 sc->tx.txqsetup &= ~(1<<txq->axq_qnum);
5 }
6
7 +/* For each axq_acq entry, for each tid, try to schedule packets
8 + * for transmit until ampdu_depth has reached min Q depth.
9 + */
10 void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
11 {
12 - struct ath_atx_ac *ac;
13 - struct ath_atx_tid *tid, *last;
14 + struct ath_atx_ac *ac, *ac_tmp, *last_ac;
15 + struct ath_atx_tid *tid, *last_tid;
16
17 if (list_empty(&txq->axq_acq) ||
18 txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
19 return;
20
21 ac = list_first_entry(&txq->axq_acq, struct ath_atx_ac, list);
22 - last = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
23 - list_del(&ac->list);
24 - ac->sched = false;
25 + last_ac = list_entry(txq->axq_acq.prev, struct ath_atx_ac, list);
26
27 - do {
28 - if (list_empty(&ac->tid_q))
29 - return;
30 -
31 - tid = list_first_entry(&ac->tid_q, struct ath_atx_tid, list);
32 - list_del(&tid->list);
33 - tid->sched = false;
34 + list_for_each_entry_safe(ac, ac_tmp, &txq->axq_acq, list) {
35 + last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
36 + list_del(&ac->list);
37 + ac->sched = false;
38 +
39 + while (!list_empty(&ac->tid_q)) {
40 + tid = list_first_entry(&ac->tid_q, struct ath_atx_tid,
41 + list);
42 + list_del(&tid->list);
43 + tid->sched = false;
44
45 - if (tid->paused)
46 - continue;
47 + if (tid->paused)
48 + continue;
49
50 - ath_tx_sched_aggr(sc, txq, tid);
51 + ath_tx_sched_aggr(sc, txq, tid);
52
53 - /*
54 - * add tid to round-robin queue if more frames
55 - * are pending for the tid
56 - */
57 - if (!list_empty(&tid->buf_q))
58 - ath_tx_queue_tid(txq, tid);
59 + /*
60 + * add tid to round-robin queue if more frames
61 + * are pending for the tid
62 + */
63 + if (!list_empty(&tid->buf_q))
64 + ath_tx_queue_tid(txq, tid);
65
66 - if (tid == last || txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
67 - break;
68 - } while (!list_empty(&ac->tid_q));
69 + if (tid == last_tid ||
70 + txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
71 + break;
72 + }
73
74 - if (!list_empty(&ac->tid_q)) {
75 - if (!ac->sched) {
76 - ac->sched = true;
77 - list_add_tail(&ac->list, &txq->axq_acq);
78 + if (!list_empty(&ac->tid_q)) {
79 + if (!ac->sched) {
80 + ac->sched = true;
81 + list_add_tail(&ac->list, &txq->axq_acq);
82 + }
83 }
84 +
85 + if (ac == last_ac ||
86 + txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
87 + return;
88 }
89 }
90