ec0a26197e0fbfb6c15524e1a1b28c2a3273f754
[openwrt.git] / package / mac80211 / patches / 310-ath9k_pending_work.patch
1 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
2 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
3 @@ -961,18 +961,6 @@ static void ar5008_hw_rfbus_done(struct 
4         REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
5  }
6  
7 -static void ar5008_hw_enable_rfkill(struct ath_hw *ah)
8 -{
9 -       REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
10 -                   AR_GPIO_INPUT_EN_VAL_RFSILENT_BB);
11 -
12 -       REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2,
13 -                   AR_GPIO_INPUT_MUX2_RFSILENT);
14 -
15 -       ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
16 -       REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
17 -}
18 -
19  static void ar5008_restore_chainmask(struct ath_hw *ah)
20  {
21         int rx_chainmask = ah->rxchainmask;
22 @@ -1629,7 +1617,6 @@ void ar5008_hw_attach_phy_ops(struct ath
23         priv_ops->set_delta_slope = ar5008_hw_set_delta_slope;
24         priv_ops->rfbus_req = ar5008_hw_rfbus_req;
25         priv_ops->rfbus_done = ar5008_hw_rfbus_done;
26 -       priv_ops->enable_rfkill = ar5008_hw_enable_rfkill;
27         priv_ops->restore_chainmask = ar5008_restore_chainmask;
28         priv_ops->set_diversity = ar5008_set_diversity;
29         priv_ops->do_getnf = ar5008_hw_do_getnf;
30 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
31 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
32 @@ -745,28 +745,6 @@ static void ar9003_hw_rfbus_done(struct 
33         REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
34  }
35  
36 -/*
37 - * Set the interrupt and GPIO values so the ISR can disable RF
38 - * on a switch signal.  Assumes GPIO port and interrupt polarity
39 - * are set prior to call.
40 - */
41 -static void ar9003_hw_enable_rfkill(struct ath_hw *ah)
42 -{
43 -       /* Connect rfsilent_bb_l to baseband */
44 -       REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
45 -                   AR_GPIO_INPUT_EN_VAL_RFSILENT_BB);
46 -       /* Set input mux for rfsilent_bb_l to GPIO #0 */
47 -       REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2,
48 -                   AR_GPIO_INPUT_MUX2_RFSILENT);
49 -
50 -       /*
51 -        * Configure the desired GPIO port for input and
52 -        * enable baseband rf silence.
53 -        */
54 -       ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
55 -       REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
56 -}
57 -
58  static void ar9003_hw_set_diversity(struct ath_hw *ah, bool value)
59  {
60         u32 v = REG_READ(ah, AR_PHY_CCK_DETECT);
61 @@ -1203,7 +1181,6 @@ void ar9003_hw_attach_phy_ops(struct ath
62         priv_ops->set_delta_slope = ar9003_hw_set_delta_slope;
63         priv_ops->rfbus_req = ar9003_hw_rfbus_req;
64         priv_ops->rfbus_done = ar9003_hw_rfbus_done;
65 -       priv_ops->enable_rfkill = ar9003_hw_enable_rfkill;
66         priv_ops->set_diversity = ar9003_hw_set_diversity;
67         priv_ops->ani_control = ar9003_hw_ani_control;
68         priv_ops->do_getnf = ar9003_hw_do_getnf;
69 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
70 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
71 @@ -189,6 +189,7 @@ struct ath_txq {
72         struct list_head axq_q;
73         spinlock_t axq_lock;
74         u32 axq_depth;
75 +       u32 axq_ampdu_depth;
76         bool stopped;
77         bool axq_tx_inprogress;
78         struct list_head axq_acq;
79 --- a/drivers/net/wireless/ath/ath9k/hw-ops.h
80 +++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
81 @@ -223,11 +223,6 @@ static inline void ath9k_hw_rfbus_done(s
82         return ath9k_hw_private_ops(ah)->rfbus_done(ah);
83  }
84  
85 -static inline void ath9k_enable_rfkill(struct ath_hw *ah)
86 -{
87 -       return ath9k_hw_private_ops(ah)->enable_rfkill(ah);
88 -}
89 -
90  static inline void ath9k_hw_restore_chainmask(struct ath_hw *ah)
91  {
92         if (!ath9k_hw_private_ops(ah)->restore_chainmask)
93 --- a/drivers/net/wireless/ath/ath9k/hw.c
94 +++ b/drivers/net/wireless/ath/ath9k/hw.c
95 @@ -1399,7 +1399,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
96         ath9k_hw_init_qos(ah);
97  
98         if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
99 -               ath9k_enable_rfkill(ah);
100 +               ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
101  
102         ath9k_hw_init_global_settings(ah);
103  
104 --- a/drivers/net/wireless/ath/ath9k/hw.h
105 +++ b/drivers/net/wireless/ath/ath9k/hw.h
106 @@ -576,7 +576,6 @@ struct ath_hw_private_ops {
107         void (*set_delta_slope)(struct ath_hw *ah, struct ath9k_channel *chan);
108         bool (*rfbus_req)(struct ath_hw *ah);
109         void (*rfbus_done)(struct ath_hw *ah);
110 -       void (*enable_rfkill)(struct ath_hw *ah);
111         void (*restore_chainmask)(struct ath_hw *ah);
112         void (*set_diversity)(struct ath_hw *ah, bool value);
113         u32 (*compute_pll_control)(struct ath_hw *ah,
114 --- a/drivers/net/wireless/ath/ath9k/xmit.c
115 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
116 @@ -838,7 +838,7 @@ static void ath_tx_sched_aggr(struct ath
117                 ath_tx_txqaddbuf(sc, txq, &bf_q);
118                 TX_STAT_INC(txq->axq_qnum, a_aggr);
119  
120 -       } while (txq->axq_depth < ATH_AGGR_MIN_QDEPTH &&
121 +       } while (txq->axq_ampdu_depth < ATH_AGGR_MIN_QDEPTH &&
122                  status != ATH_AGGR_BAW_CLOSED);
123  }
124  
125 @@ -999,6 +999,7 @@ struct ath_txq *ath_txq_setup(struct ath
126                 INIT_LIST_HEAD(&txq->axq_acq);
127                 spin_lock_init(&txq->axq_lock);
128                 txq->axq_depth = 0;
129 +               txq->axq_ampdu_depth = 0;
130                 txq->axq_tx_inprogress = false;
131                 sc->tx.txqsetup |= 1<<qnum;
132  
133 @@ -1068,6 +1069,12 @@ int ath_cabq_update(struct ath_softc *sc
134         return 0;
135  }
136  
137 +static bool bf_is_ampdu_not_probing(struct ath_buf *bf)
138 +{
139 +    struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
140 +    return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
141 +}
142 +
143  /*
144   * Drain a given TX queue (could be Beacon or Data)
145   *
146 @@ -1126,7 +1133,8 @@ void ath_draintxq(struct ath_softc *sc, 
147                 }
148  
149                 txq->axq_depth--;
150 -
151 +               if (bf_is_ampdu_not_probing(bf))
152 +                       txq->axq_ampdu_depth--;
153                 spin_unlock_bh(&txq->axq_lock);
154  
155                 if (bf_isampdu(bf))
156 @@ -1316,6 +1324,8 @@ static void ath_tx_txqaddbuf(struct ath_
157                 ath9k_hw_txstart(ah, txq->axq_qnum);
158         }
159         txq->axq_depth++;
160 +       if (bf_is_ampdu_not_probing(bf))
161 +               txq->axq_ampdu_depth++;
162  }
163  
164  static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
165 @@ -1336,7 +1346,7 @@ static void ath_tx_send_ampdu(struct ath
166          */
167         if (!list_empty(&tid->buf_q) || tid->paused ||
168             !BAW_WITHIN(tid->seq_start, tid->baw_size, fi->seqno) ||
169 -           txctl->txq->axq_depth >= ATH_AGGR_MIN_QDEPTH) {
170 +           txctl->txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) {
171                 /*
172                  * Add this frame to software queue for scheduling later
173                  * for aggregation.
174 @@ -2040,6 +2050,9 @@ static void ath_tx_processq(struct ath_s
175                 txq->axq_tx_inprogress = false;
176                 if (bf_held)
177                         list_del(&bf_held->list);
178 +
179 +               if (bf_is_ampdu_not_probing(bf))
180 +                       txq->axq_ampdu_depth--;
181                 spin_unlock_bh(&txq->axq_lock);
182  
183                 if (bf_held)
184 @@ -2168,6 +2181,8 @@ void ath_tx_edma_tasklet(struct ath_soft
185                 INCR(txq->txq_tailidx, ATH_TXFIFO_DEPTH);
186                 txq->axq_depth--;
187                 txq->axq_tx_inprogress = false;
188 +               if (bf_is_ampdu_not_probing(bf))
189 +                       txq->axq_ampdu_depth--;
190                 spin_unlock_bh(&txq->axq_lock);
191  
192                 txok = !(txs.ts_status & ATH9K_TXERR_MASK);