ath9k: disable PA predistortion on AR93xx for now until it is properly fixed
[openwrt.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  
91 --- a/drivers/net/wireless/ath/ath9k/hw.c
92 +++ b/drivers/net/wireless/ath/ath9k/hw.c
93 @@ -369,6 +369,9 @@ static void ath9k_hw_init_config(struct 
94         else
95                 ah->config.ht_enable = 0;
96  
97 +       /* PAPRD needs some more work to be enabled */
98 +       ah->config.paprd_disable = 1;
99 +
100         ah->config.rx_intr_mitigation = true;
101         ah->config.pcieSerDesWrite = true;
102  
103 @@ -1949,7 +1952,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw
104                 pCap->rx_status_len = sizeof(struct ar9003_rxs);
105                 pCap->tx_desc_len = sizeof(struct ar9003_txc);
106                 pCap->txs_len = sizeof(struct ar9003_txs);
107 -               if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD))
108 +               if (!ah->config.paprd_disable &&
109 +                   ah->eep_ops->get_eeprom(ah, EEP_PAPRD))
110                         pCap->hw_caps |= ATH9K_HW_CAP_PAPRD;
111         } else {
112                 pCap->tx_desc_len = sizeof(struct ath_desc);
113 --- a/drivers/net/wireless/ath/ath9k/hw.h
114 +++ b/drivers/net/wireless/ath/ath9k/hw.h
115 @@ -228,6 +228,7 @@ struct ath9k_ops_config {
116         u32 pcie_waen;
117         u8 analog_shiftreg;
118         u8 ht_enable;
119 +       u8 paprd_disable;
120         u32 ofdm_trig_low;
121         u32 ofdm_trig_high;
122         u32 cck_trig_high;