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);
7 +/* For each axq_acq entry, for each tid, try to schedule packets
8 + * for transmit until ampdu_depth has reached min Q depth.
10 void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
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;
17 if (list_empty(&txq->axq_acq) ||
18 txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
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);
25 + last_ac = list_entry(txq->axq_acq.prev, struct ath_atx_ac, list);
28 - if (list_empty(&ac->tid_q))
31 - tid = list_first_entry(&ac->tid_q, struct ath_atx_tid, list);
32 - list_del(&tid->list);
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);
39 + while (!list_empty(&ac->tid_q)) {
40 + tid = list_first_entry(&ac->tid_q, struct ath_atx_tid,
42 + list_del(&tid->list);
50 - ath_tx_sched_aggr(sc, txq, tid);
51 + ath_tx_sched_aggr(sc, txq, tid);
54 - * add tid to round-robin queue if more frames
55 - * are pending for the tid
57 - if (!list_empty(&tid->buf_q))
58 - ath_tx_queue_tid(txq, tid);
60 + * add tid to round-robin queue if more frames
61 + * are pending for the tid
63 + if (!list_empty(&tid->buf_q))
64 + ath_tx_queue_tid(txq, tid);
66 - if (tid == last || txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
68 - } while (!list_empty(&ac->tid_q));
69 + if (tid == last_tid ||
70 + txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
74 - if (!list_empty(&ac->tid_q)) {
77 - list_add_tail(&ac->list, &txq->axq_acq);
78 + if (!list_empty(&ac->tid_q)) {
81 + list_add_tail(&ac->list, &txq->axq_acq);
85 + if (ac == last_ac ||
86 + txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)