mac80211: re-enable beacon channel hints
[openwrt.git] / package / mac80211 / patches / 300-pending_work.patch
1 --- a/drivers/net/wireless/ath/ath9k/main.c
2 +++ b/drivers/net/wireless/ath/ath9k/main.c
3 @@ -324,7 +324,6 @@ static void ath_paprd_activate(struct at
4 if (!caldata || !caldata->paprd_done)
5 return;
6
7 - ath9k_ps_wakeup(sc);
8 ar9003_paprd_enable(ah, false);
9 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
10 if (!(common->tx_chainmask & BIT(chain)))
11 @@ -334,7 +333,6 @@ static void ath_paprd_activate(struct at
12 }
13
14 ar9003_paprd_enable(ah, true);
15 - ath9k_ps_restore(sc);
16 }
17
18 static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int chain)
19 @@ -554,8 +552,11 @@ set_timer:
20 if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->caldata) {
21 if (!ah->caldata->paprd_done)
22 ieee80211_queue_work(sc->hw, &sc->paprd_work);
23 - else if (!ah->paprd_table_write_done)
24 + else if (!ah->paprd_table_write_done) {
25 + ath9k_ps_wakeup(sc);
26 ath_paprd_activate(sc);
27 + ath9k_ps_restore(sc);
28 + }
29 }
30 }
31
32 @@ -1376,7 +1377,6 @@ static void ath9k_calculate_summary_stat
33
34 ath9k_calculate_iter_data(hw, vif, &iter_data);
35
36 - ath9k_ps_wakeup(sc);
37 /* Set BSSID mask. */
38 memcpy(common->bssidmask, iter_data.mask, ETH_ALEN);
39 ath_hw_setbssidmask(common);
40 @@ -1411,7 +1411,6 @@ static void ath9k_calculate_summary_stat
41 }
42
43 ath9k_hw_set_interrupts(ah, ah->imask);
44 - ath9k_ps_restore(sc);
45
46 /* Set up ANI */
47 if ((iter_data.naps + iter_data.nadhocs) > 0) {
48 @@ -1457,6 +1456,7 @@ static int ath9k_add_interface(struct ie
49 struct ath_vif *avp = (void *)vif->drv_priv;
50 int ret = 0;
51
52 + ath9k_ps_wakeup(sc);
53 mutex_lock(&sc->mutex);
54
55 switch (vif->type) {
56 @@ -1503,6 +1503,7 @@ static int ath9k_add_interface(struct ie
57 ath9k_do_vif_add_setup(hw, vif);
58 out:
59 mutex_unlock(&sc->mutex);
60 + ath9k_ps_restore(sc);
61 return ret;
62 }
63
64 @@ -1517,6 +1518,7 @@ static int ath9k_change_interface(struct
65
66 ath_dbg(common, ATH_DBG_CONFIG, "Change Interface\n");
67 mutex_lock(&sc->mutex);
68 + ath9k_ps_wakeup(sc);
69
70 /* See if new interface type is valid. */
71 if ((new_type == NL80211_IFTYPE_ADHOC) &&
72 @@ -1546,6 +1548,7 @@ static int ath9k_change_interface(struct
73
74 ath9k_do_vif_add_setup(hw, vif);
75 out:
76 + ath9k_ps_restore(sc);
77 mutex_unlock(&sc->mutex);
78 return ret;
79 }
80 @@ -1558,6 +1561,7 @@ static void ath9k_remove_interface(struc
81
82 ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n");
83
84 + ath9k_ps_wakeup(sc);
85 mutex_lock(&sc->mutex);
86
87 sc->nvifs--;
88 @@ -1569,6 +1573,7 @@ static void ath9k_remove_interface(struc
89 ath9k_calculate_summary_state(hw, NULL);
90
91 mutex_unlock(&sc->mutex);
92 + ath9k_ps_restore(sc);
93 }
94
95 static void ath9k_enable_ps(struct ath_softc *sc)
96 @@ -1809,6 +1814,7 @@ static int ath9k_conf_tx(struct ieee8021
97
98 txq = sc->tx.txq_map[queue];
99
100 + ath9k_ps_wakeup(sc);
101 mutex_lock(&sc->mutex);
102
103 memset(&qi, 0, sizeof(struct ath9k_tx_queue_info));
104 @@ -1832,6 +1838,7 @@ static int ath9k_conf_tx(struct ieee8021
105 ath_beaconq_config(sc);
106
107 mutex_unlock(&sc->mutex);
108 + ath9k_ps_restore(sc);
109
110 return ret;
111 }
112 @@ -1908,6 +1915,7 @@ static void ath9k_bss_info_changed(struc
113 int slottime;
114 int error;
115
116 + ath9k_ps_wakeup(sc);
117 mutex_lock(&sc->mutex);
118
119 if (changed & BSS_CHANGED_BSSID) {
120 @@ -2008,6 +2016,7 @@ static void ath9k_bss_info_changed(struc
121 }
122
123 mutex_unlock(&sc->mutex);
124 + ath9k_ps_restore(sc);
125 }
126
127 static u64 ath9k_get_tsf(struct ieee80211_hw *hw)
128 --- a/drivers/net/wireless/ath/ath9k/beacon.c
129 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
130 @@ -392,14 +392,6 @@ void ath_beacon_tasklet(unsigned long da
131 tsf += TU_TO_USEC(ah->config.sw_beacon_response_time);
132 tsftu = TSF_TO_TU((tsf * ATH_BCBUF) >>32, tsf * ATH_BCBUF);
133 slot = (tsftu % (intval * ATH_BCBUF)) / intval;
134 - /*
135 - * Reverse the slot order to get slot 0 on the TBTT offset that does
136 - * not require TSF adjustment and other slots adding
137 - * slot/ATH_BCBUF * beacon_int to timestamp. For example, with
138 - * ATH_BCBUF = 4, we process beacon slots as follows: 3 2 1 0 3 2 1 ..
139 - * and slot 0 is at correct offset to TBTT.
140 - */
141 - slot = ATH_BCBUF - slot - 1;
142 vif = sc->beacon.bslot[slot];
143
144 ath_dbg(common, ATH_DBG_BEACON,
145 @@ -708,7 +700,7 @@ void ath_beacon_config(struct ath_softc
146 if (cur_conf->dtim_period == 0)
147 cur_conf->dtim_period = 1;
148
149 - switch (iftype) {
150 + switch (sc->sc_ah->opmode) {
151 case NL80211_IFTYPE_AP:
152 ath_beacon_config_ap(sc, cur_conf);
153 break;
154 --- a/net/mac80211/rx.c
155 +++ b/net/mac80211/rx.c
156 @@ -1585,7 +1585,7 @@ ieee80211_drop_unencrypted_mgmt(struct i
157 }
158
159 static int
160 -__ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
161 +__ieee80211_data_to_8023(struct ieee80211_rx_data *rx, bool *port_control)
162 {
163 struct ieee80211_sub_if_data *sdata = rx->sdata;
164 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
165 @@ -1593,6 +1593,7 @@ __ieee80211_data_to_8023(struct ieee8021
166 struct ethhdr *ehdr;
167 int ret;
168
169 + *port_control = false;
170 if (ieee80211_has_a4(hdr->frame_control) &&
171 sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta)
172 return -1;
173 @@ -1611,11 +1612,13 @@ __ieee80211_data_to_8023(struct ieee8021
174 return -1;
175
176 ret = ieee80211_data_to_8023(rx->skb, sdata->vif.addr, sdata->vif.type);
177 - if (ret < 0 || !check_port_control)
178 + if (ret < 0)
179 return ret;
180
181 ehdr = (struct ethhdr *) rx->skb->data;
182 - if (ehdr->h_proto != rx->sdata->control_port_protocol)
183 + if (ehdr->h_proto == rx->sdata->control_port_protocol)
184 + *port_control = true;
185 + else if (check_port_control)
186 return -1;
187
188 return 0;
189 @@ -1916,6 +1919,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_
190 struct net_device *dev = sdata->dev;
191 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
192 __le16 fc = hdr->frame_control;
193 + bool port_control;
194 int err;
195
196 if (unlikely(!ieee80211_is_data(hdr->frame_control)))
197 @@ -1932,13 +1936,21 @@ ieee80211_rx_h_data(struct ieee80211_rx_
198 sdata->vif.type == NL80211_IFTYPE_AP)
199 return RX_DROP_MONITOR;
200
201 - err = __ieee80211_data_to_8023(rx);
202 + err = __ieee80211_data_to_8023(rx, &port_control);
203 if (unlikely(err))
204 return RX_DROP_UNUSABLE;
205
206 if (!ieee80211_frame_allowed(rx, fc))
207 return RX_DROP_MONITOR;
208
209 + if (rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
210 + unlikely(port_control) && sdata->bss) {
211 + sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
212 + u.ap);
213 + dev = sdata->dev;
214 + rx->sdata = sdata;
215 + }
216 +
217 rx->skb->dev = dev;
218
219 dev->stats.rx_packets++;
220 --- a/drivers/net/wireless/ath/ath9k/recv.c
221 +++ b/drivers/net/wireless/ath/ath9k/recv.c
222 @@ -75,7 +75,6 @@ static void ath_rx_buf_link(struct ath_s
223 *sc->rx.rxlink = bf->bf_daddr;
224
225 sc->rx.rxlink = &ds->ds_link;
226 - ath9k_hw_rxena(ah);
227 }
228
229 static void ath_setdefantenna(struct ath_softc *sc, u32 antenna)
230 @@ -426,9 +425,7 @@ u32 ath_calcrxfilter(struct ath_softc *s
231 else
232 rfilt |= ATH9K_RX_FILTER_BEACON;
233
234 - if ((AR_SREV_9280_20_OR_LATER(sc->sc_ah) ||
235 - AR_SREV_9285_12_OR_LATER(sc->sc_ah)) &&
236 - (sc->sc_ah->opmode == NL80211_IFTYPE_AP) &&
237 + if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) ||
238 (sc->rx.rxfilter & FIF_PSPOLL))
239 rfilt |= ATH9K_RX_FILTER_PSPOLL;
240
241 @@ -486,12 +483,12 @@ start_recv:
242 bool ath_stoprecv(struct ath_softc *sc)
243 {
244 struct ath_hw *ah = sc->sc_ah;
245 - bool stopped;
246 + bool stopped, reset = false;
247
248 spin_lock_bh(&sc->rx.rxbuflock);
249 ath9k_hw_abortpcurecv(ah);
250 ath9k_hw_setrxfilter(ah, 0);
251 - stopped = ath9k_hw_stopdmarecv(ah);
252 + stopped = ath9k_hw_stopdmarecv(ah, &reset);
253
254 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
255 ath_edma_stop_recv(sc);
256 @@ -506,7 +503,7 @@ bool ath_stoprecv(struct ath_softc *sc)
257 "confusing the DMA engine when we start RX up\n");
258 ATH_DBG_WARN_ON_ONCE(!stopped);
259 }
260 - return stopped;
261 + return stopped && !reset;
262 }
263
264 void ath_flushrecv(struct ath_softc *sc)
265 @@ -1767,6 +1764,7 @@ requeue:
266 } else {
267 list_move_tail(&bf->list, &sc->rx.rxbuf);
268 ath_rx_buf_link(sc, bf);
269 + ath9k_hw_rxena(ah);
270 }
271 } while (1);
272
273 --- a/drivers/net/wireless/ath/ath9k/hw.c
274 +++ b/drivers/net/wireless/ath/ath9k/hw.c
275 @@ -1249,15 +1249,6 @@ int ath9k_hw_reset(struct ath_hw *ah, st
276 ah->txchainmask = common->tx_chainmask;
277 ah->rxchainmask = common->rx_chainmask;
278
279 - if ((common->bus_ops->ath_bus_type != ATH_USB) && !ah->chip_fullsleep) {
280 - ath9k_hw_abortpcurecv(ah);
281 - if (!ath9k_hw_stopdmarecv(ah)) {
282 - ath_dbg(common, ATH_DBG_XMIT,
283 - "Failed to stop receive dma\n");
284 - bChannelChange = false;
285 - }
286 - }
287 -
288 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
289 return -EIO;
290
291 --- a/drivers/net/wireless/ath/ath9k/mac.c
292 +++ b/drivers/net/wireless/ath/ath9k/mac.c
293 @@ -710,27 +710,46 @@ void ath9k_hw_abortpcurecv(struct ath_hw
294 }
295 EXPORT_SYMBOL(ath9k_hw_abortpcurecv);
296
297 -bool ath9k_hw_stopdmarecv(struct ath_hw *ah)
298 +bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset)
299 {
300 #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
301 struct ath_common *common = ath9k_hw_common(ah);
302 + u32 mac_status, last_mac_status = 0;
303 int i;
304
305 + /* Enable access to the DMA observation bus */
306 + REG_WRITE(ah, AR_MACMISC,
307 + ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) |
308 + (AR_MACMISC_MISC_OBS_BUS_1 <<
309 + AR_MACMISC_MISC_OBS_BUS_MSB_S)));
310 +
311 REG_WRITE(ah, AR_CR, AR_CR_RXD);
312
313 /* Wait for rx enable bit to go low */
314 for (i = AH_RX_STOP_DMA_TIMEOUT / AH_TIME_QUANTUM; i != 0; i--) {
315 if ((REG_READ(ah, AR_CR) & AR_CR_RXE) == 0)
316 break;
317 +
318 + if (!AR_SREV_9300_20_OR_LATER(ah)) {
319 + mac_status = REG_READ(ah, AR_DMADBG_7) & 0x7f0;
320 + if (mac_status == 0x1c0 && mac_status == last_mac_status) {
321 + *reset = true;
322 + break;
323 + }
324 +
325 + last_mac_status = mac_status;
326 + }
327 +
328 udelay(AH_TIME_QUANTUM);
329 }
330
331 if (i == 0) {
332 ath_err(common,
333 - "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x\n",
334 + "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x DMADBG_7=0x%08x\n",
335 AH_RX_STOP_DMA_TIMEOUT / 1000,
336 REG_READ(ah, AR_CR),
337 - REG_READ(ah, AR_DIAG_SW));
338 + REG_READ(ah, AR_DIAG_SW),
339 + REG_READ(ah, AR_DMADBG_7));
340 return false;
341 } else {
342 return true;
343 --- a/drivers/net/wireless/ath/ath9k/mac.h
344 +++ b/drivers/net/wireless/ath/ath9k/mac.h
345 @@ -695,7 +695,7 @@ bool ath9k_hw_setrxabort(struct ath_hw *
346 void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp);
347 void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning);
348 void ath9k_hw_abortpcurecv(struct ath_hw *ah);
349 -bool ath9k_hw_stopdmarecv(struct ath_hw *ah);
350 +bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset);
351 int ath9k_hw_beaconq_setup(struct ath_hw *ah);
352
353 /* Interrupt Handling */
This page took 0.053565 seconds and 5 git commands to generate.