diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 1871 |
1 files changed, 1092 insertions, 779 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 3caa32316e7b..2ca351fe6d3c 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2008-2009 Atheros Communications Inc. | 2 | * Copyright (c) 2008-2011 Atheros Communications Inc. |
3 | * | 3 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 4 | * Permission to use, copy, modify, and/or distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above | 5 | * purpose with or without fee is hereby granted, provided that the above |
@@ -15,50 +15,10 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/nl80211.h> | 17 | #include <linux/nl80211.h> |
18 | #include <linux/delay.h> | ||
18 | #include "ath9k.h" | 19 | #include "ath9k.h" |
19 | #include "btcoex.h" | 20 | #include "btcoex.h" |
20 | 21 | ||
21 | static void ath_cache_conf_rate(struct ath_softc *sc, | ||
22 | struct ieee80211_conf *conf) | ||
23 | { | ||
24 | switch (conf->channel->band) { | ||
25 | case IEEE80211_BAND_2GHZ: | ||
26 | if (conf_is_ht20(conf)) | ||
27 | sc->cur_rate_mode = ATH9K_MODE_11NG_HT20; | ||
28 | else if (conf_is_ht40_minus(conf)) | ||
29 | sc->cur_rate_mode = ATH9K_MODE_11NG_HT40MINUS; | ||
30 | else if (conf_is_ht40_plus(conf)) | ||
31 | sc->cur_rate_mode = ATH9K_MODE_11NG_HT40PLUS; | ||
32 | else | ||
33 | sc->cur_rate_mode = ATH9K_MODE_11G; | ||
34 | break; | ||
35 | case IEEE80211_BAND_5GHZ: | ||
36 | if (conf_is_ht20(conf)) | ||
37 | sc->cur_rate_mode = ATH9K_MODE_11NA_HT20; | ||
38 | else if (conf_is_ht40_minus(conf)) | ||
39 | sc->cur_rate_mode = ATH9K_MODE_11NA_HT40MINUS; | ||
40 | else if (conf_is_ht40_plus(conf)) | ||
41 | sc->cur_rate_mode = ATH9K_MODE_11NA_HT40PLUS; | ||
42 | else | ||
43 | sc->cur_rate_mode = ATH9K_MODE_11A; | ||
44 | break; | ||
45 | default: | ||
46 | BUG_ON(1); | ||
47 | break; | ||
48 | } | ||
49 | } | ||
50 | |||
51 | static void ath_update_txpow(struct ath_softc *sc) | ||
52 | { | ||
53 | struct ath_hw *ah = sc->sc_ah; | ||
54 | |||
55 | if (sc->curtxpow != sc->config.txpowlimit) { | ||
56 | ath9k_hw_set_txpowerlimit(ah, sc->config.txpowlimit); | ||
57 | /* read back in case value is clamped */ | ||
58 | sc->curtxpow = ath9k_hw_regulatory(ah)->power_limit; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | static u8 parse_mpdudensity(u8 mpdudensity) | 22 | static u8 parse_mpdudensity(u8 mpdudensity) |
63 | { | 23 | { |
64 | /* | 24 | /* |
@@ -94,17 +54,19 @@ static u8 parse_mpdudensity(u8 mpdudensity) | |||
94 | } | 54 | } |
95 | } | 55 | } |
96 | 56 | ||
97 | static struct ath9k_channel *ath_get_curchannel(struct ath_softc *sc, | 57 | static bool ath9k_has_pending_frames(struct ath_softc *sc, struct ath_txq *txq) |
98 | struct ieee80211_hw *hw) | ||
99 | { | 58 | { |
100 | struct ieee80211_channel *curchan = hw->conf.channel; | 59 | bool pending = false; |
101 | struct ath9k_channel *channel; | 60 | |
102 | u8 chan_idx; | 61 | spin_lock_bh(&txq->axq_lock); |
62 | |||
63 | if (txq->axq_depth || !list_empty(&txq->axq_acq)) | ||
64 | pending = true; | ||
65 | else if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) | ||
66 | pending = !list_empty(&txq->txq_fifo_pending); | ||
103 | 67 | ||
104 | chan_idx = curchan->hw_value; | 68 | spin_unlock_bh(&txq->axq_lock); |
105 | channel = &sc->sc_ah->channels[chan_idx]; | 69 | return pending; |
106 | ath9k_update_ichannel(sc, hw, channel); | ||
107 | return channel; | ||
108 | } | 70 | } |
109 | 71 | ||
110 | bool ath9k_setpower(struct ath_softc *sc, enum ath9k_power_mode mode) | 72 | bool ath9k_setpower(struct ath_softc *sc, enum ath9k_power_mode mode) |
@@ -121,26 +83,46 @@ bool ath9k_setpower(struct ath_softc *sc, enum ath9k_power_mode mode) | |||
121 | 83 | ||
122 | void ath9k_ps_wakeup(struct ath_softc *sc) | 84 | void ath9k_ps_wakeup(struct ath_softc *sc) |
123 | { | 85 | { |
86 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
124 | unsigned long flags; | 87 | unsigned long flags; |
88 | enum ath9k_power_mode power_mode; | ||
125 | 89 | ||
126 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | 90 | spin_lock_irqsave(&sc->sc_pm_lock, flags); |
127 | if (++sc->ps_usecount != 1) | 91 | if (++sc->ps_usecount != 1) |
128 | goto unlock; | 92 | goto unlock; |
129 | 93 | ||
94 | power_mode = sc->sc_ah->power_mode; | ||
130 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); | 95 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); |
131 | 96 | ||
97 | /* | ||
98 | * While the hardware is asleep, the cycle counters contain no | ||
99 | * useful data. Better clear them now so that they don't mess up | ||
100 | * survey data results. | ||
101 | */ | ||
102 | if (power_mode != ATH9K_PM_AWAKE) { | ||
103 | spin_lock(&common->cc_lock); | ||
104 | ath_hw_cycle_counters_update(common); | ||
105 | memset(&common->cc_survey, 0, sizeof(common->cc_survey)); | ||
106 | spin_unlock(&common->cc_lock); | ||
107 | } | ||
108 | |||
132 | unlock: | 109 | unlock: |
133 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | 110 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |
134 | } | 111 | } |
135 | 112 | ||
136 | void ath9k_ps_restore(struct ath_softc *sc) | 113 | void ath9k_ps_restore(struct ath_softc *sc) |
137 | { | 114 | { |
115 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
138 | unsigned long flags; | 116 | unsigned long flags; |
139 | 117 | ||
140 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | 118 | spin_lock_irqsave(&sc->sc_pm_lock, flags); |
141 | if (--sc->ps_usecount != 0) | 119 | if (--sc->ps_usecount != 0) |
142 | goto unlock; | 120 | goto unlock; |
143 | 121 | ||
122 | spin_lock(&common->cc_lock); | ||
123 | ath_hw_cycle_counters_update(common); | ||
124 | spin_unlock(&common->cc_lock); | ||
125 | |||
144 | if (sc->ps_idle) | 126 | if (sc->ps_idle) |
145 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP); | 127 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP); |
146 | else if (sc->ps_enabled && | 128 | else if (sc->ps_enabled && |
@@ -175,6 +157,63 @@ static void ath_start_ani(struct ath_common *common) | |||
175 | msecs_to_jiffies((u32)ah->config.ani_poll_interval)); | 157 | msecs_to_jiffies((u32)ah->config.ani_poll_interval)); |
176 | } | 158 | } |
177 | 159 | ||
160 | static void ath_update_survey_nf(struct ath_softc *sc, int channel) | ||
161 | { | ||
162 | struct ath_hw *ah = sc->sc_ah; | ||
163 | struct ath9k_channel *chan = &ah->channels[channel]; | ||
164 | struct survey_info *survey = &sc->survey[channel]; | ||
165 | |||
166 | if (chan->noisefloor) { | ||
167 | survey->filled |= SURVEY_INFO_NOISE_DBM; | ||
168 | survey->noise = chan->noisefloor; | ||
169 | } | ||
170 | } | ||
171 | |||
172 | /* | ||
173 | * Updates the survey statistics and returns the busy time since last | ||
174 | * update in %, if the measurement duration was long enough for the | ||
175 | * result to be useful, -1 otherwise. | ||
176 | */ | ||
177 | static int ath_update_survey_stats(struct ath_softc *sc) | ||
178 | { | ||
179 | struct ath_hw *ah = sc->sc_ah; | ||
180 | struct ath_common *common = ath9k_hw_common(ah); | ||
181 | int pos = ah->curchan - &ah->channels[0]; | ||
182 | struct survey_info *survey = &sc->survey[pos]; | ||
183 | struct ath_cycle_counters *cc = &common->cc_survey; | ||
184 | unsigned int div = common->clockrate * 1000; | ||
185 | int ret = 0; | ||
186 | |||
187 | if (!ah->curchan) | ||
188 | return -1; | ||
189 | |||
190 | if (ah->power_mode == ATH9K_PM_AWAKE) | ||
191 | ath_hw_cycle_counters_update(common); | ||
192 | |||
193 | if (cc->cycles > 0) { | ||
194 | survey->filled |= SURVEY_INFO_CHANNEL_TIME | | ||
195 | SURVEY_INFO_CHANNEL_TIME_BUSY | | ||
196 | SURVEY_INFO_CHANNEL_TIME_RX | | ||
197 | SURVEY_INFO_CHANNEL_TIME_TX; | ||
198 | survey->channel_time += cc->cycles / div; | ||
199 | survey->channel_time_busy += cc->rx_busy / div; | ||
200 | survey->channel_time_rx += cc->rx_frame / div; | ||
201 | survey->channel_time_tx += cc->tx_frame / div; | ||
202 | } | ||
203 | |||
204 | if (cc->cycles < div) | ||
205 | return -1; | ||
206 | |||
207 | if (cc->cycles > 0) | ||
208 | ret = cc->rx_busy * 100 / cc->cycles; | ||
209 | |||
210 | memset(cc, 0, sizeof(*cc)); | ||
211 | |||
212 | ath_update_survey_nf(sc, pos); | ||
213 | |||
214 | return ret; | ||
215 | } | ||
216 | |||
178 | /* | 217 | /* |
179 | * Set/change channels. If the channel is really being changed, it's done | 218 | * Set/change channels. If the channel is really being changed, it's done |
180 | * by reseting the chip. To accomplish this we must first cleanup any pending | 219 | * by reseting the chip. To accomplish this we must first cleanup any pending |
@@ -183,7 +222,6 @@ static void ath_start_ani(struct ath_common *common) | |||
183 | int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, | 222 | int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, |
184 | struct ath9k_channel *hchan) | 223 | struct ath9k_channel *hchan) |
185 | { | 224 | { |
186 | struct ath_wiphy *aphy = hw->priv; | ||
187 | struct ath_hw *ah = sc->sc_ah; | 225 | struct ath_hw *ah = sc->sc_ah; |
188 | struct ath_common *common = ath9k_hw_common(ah); | 226 | struct ath_common *common = ath9k_hw_common(ah); |
189 | struct ieee80211_conf *conf = &common->hw->conf; | 227 | struct ieee80211_conf *conf = &common->hw->conf; |
@@ -195,13 +233,18 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, | |||
195 | if (sc->sc_flags & SC_OP_INVALID) | 233 | if (sc->sc_flags & SC_OP_INVALID) |
196 | return -EIO; | 234 | return -EIO; |
197 | 235 | ||
236 | sc->hw_busy_count = 0; | ||
237 | |||
198 | del_timer_sync(&common->ani.timer); | 238 | del_timer_sync(&common->ani.timer); |
199 | cancel_work_sync(&sc->paprd_work); | 239 | cancel_work_sync(&sc->paprd_work); |
200 | cancel_work_sync(&sc->hw_check_work); | 240 | cancel_work_sync(&sc->hw_check_work); |
201 | cancel_delayed_work_sync(&sc->tx_complete_work); | 241 | cancel_delayed_work_sync(&sc->tx_complete_work); |
242 | cancel_delayed_work_sync(&sc->hw_pll_work); | ||
202 | 243 | ||
203 | ath9k_ps_wakeup(sc); | 244 | ath9k_ps_wakeup(sc); |
204 | 245 | ||
246 | spin_lock_bh(&sc->sc_pcu_lock); | ||
247 | |||
205 | /* | 248 | /* |
206 | * This is only performed if the channel settings have | 249 | * This is only performed if the channel settings have |
207 | * actually changed. | 250 | * actually changed. |
@@ -211,9 +254,14 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, | |||
211 | * hardware at the new frequency, and then re-enable | 254 | * hardware at the new frequency, and then re-enable |
212 | * the relevant bits of the h/w. | 255 | * the relevant bits of the h/w. |
213 | */ | 256 | */ |
214 | ath9k_hw_set_interrupts(ah, 0); | 257 | ath9k_hw_disable_interrupts(ah); |
215 | ath_drain_all_txq(sc, false); | 258 | stopped = ath_drain_all_txq(sc, false); |
216 | stopped = ath_stoprecv(sc); | 259 | |
260 | if (!ath_stoprecv(sc)) | ||
261 | stopped = false; | ||
262 | |||
263 | if (!ath9k_hw_check_alive(ah)) | ||
264 | stopped = false; | ||
217 | 265 | ||
218 | /* XXX: do not flush receive queue here. We don't want | 266 | /* XXX: do not flush receive queue here. We don't want |
219 | * to flush data frames already in queue because of | 267 | * to flush data frames already in queue because of |
@@ -223,44 +271,45 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, | |||
223 | fastcc = false; | 271 | fastcc = false; |
224 | 272 | ||
225 | if (!(sc->sc_flags & SC_OP_OFFCHANNEL)) | 273 | if (!(sc->sc_flags & SC_OP_OFFCHANNEL)) |
226 | caldata = &aphy->caldata; | 274 | caldata = &sc->caldata; |
227 | |||
228 | ath_print(common, ATH_DBG_CONFIG, | ||
229 | "(%u MHz) -> (%u MHz), conf_is_ht40: %d\n", | ||
230 | sc->sc_ah->curchan->channel, | ||
231 | channel->center_freq, conf_is_ht40(conf)); | ||
232 | 275 | ||
233 | spin_lock_bh(&sc->sc_resetlock); | 276 | ath_dbg(common, ATH_DBG_CONFIG, |
277 | "(%u MHz) -> (%u MHz), conf_is_ht40: %d fastcc: %d\n", | ||
278 | sc->sc_ah->curchan->channel, | ||
279 | channel->center_freq, conf_is_ht40(conf), | ||
280 | fastcc); | ||
234 | 281 | ||
235 | r = ath9k_hw_reset(ah, hchan, caldata, fastcc); | 282 | r = ath9k_hw_reset(ah, hchan, caldata, fastcc); |
236 | if (r) { | 283 | if (r) { |
237 | ath_print(common, ATH_DBG_FATAL, | 284 | ath_err(common, |
238 | "Unable to reset channel (%u MHz), " | 285 | "Unable to reset channel (%u MHz), reset status %d\n", |
239 | "reset status %d\n", | 286 | channel->center_freq, r); |
240 | channel->center_freq, r); | ||
241 | spin_unlock_bh(&sc->sc_resetlock); | ||
242 | goto ps_restore; | 287 | goto ps_restore; |
243 | } | 288 | } |
244 | spin_unlock_bh(&sc->sc_resetlock); | ||
245 | 289 | ||
246 | if (ath_startrecv(sc) != 0) { | 290 | if (ath_startrecv(sc) != 0) { |
247 | ath_print(common, ATH_DBG_FATAL, | 291 | ath_err(common, "Unable to restart recv logic\n"); |
248 | "Unable to restart recv logic\n"); | ||
249 | r = -EIO; | 292 | r = -EIO; |
250 | goto ps_restore; | 293 | goto ps_restore; |
251 | } | 294 | } |
252 | 295 | ||
253 | ath_cache_conf_rate(sc, &hw->conf); | 296 | ath9k_cmn_update_txpow(ah, sc->curtxpow, |
254 | ath_update_txpow(sc); | 297 | sc->config.txpowlimit, &sc->curtxpow); |
255 | ath9k_hw_set_interrupts(ah, ah->imask); | 298 | ath9k_hw_set_interrupts(ah, ah->imask); |
256 | 299 | ||
257 | if (!(sc->sc_flags & (SC_OP_OFFCHANNEL | SC_OP_SCANNING))) { | 300 | if (!(sc->sc_flags & (SC_OP_OFFCHANNEL))) { |
258 | ath_start_ani(common); | 301 | if (sc->sc_flags & SC_OP_BEACONS) |
302 | ath_set_beacon(sc); | ||
259 | ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); | 303 | ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); |
260 | ath_beacon_config(sc, NULL); | 304 | ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, HZ/2); |
305 | ath_start_ani(common); | ||
261 | } | 306 | } |
262 | 307 | ||
263 | ps_restore: | 308 | ps_restore: |
309 | ieee80211_wake_queues(hw); | ||
310 | |||
311 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
312 | |||
264 | ath9k_ps_restore(sc); | 313 | ath9k_ps_restore(sc); |
265 | return r; | 314 | return r; |
266 | } | 315 | } |
@@ -269,6 +318,7 @@ static void ath_paprd_activate(struct ath_softc *sc) | |||
269 | { | 318 | { |
270 | struct ath_hw *ah = sc->sc_ah; | 319 | struct ath_hw *ah = sc->sc_ah; |
271 | struct ath9k_hw_cal_data *caldata = ah->caldata; | 320 | struct ath9k_hw_cal_data *caldata = ah->caldata; |
321 | struct ath_common *common = ath9k_hw_common(ah); | ||
272 | int chain; | 322 | int chain; |
273 | 323 | ||
274 | if (!caldata || !caldata->paprd_done) | 324 | if (!caldata || !caldata->paprd_done) |
@@ -277,7 +327,7 @@ static void ath_paprd_activate(struct ath_softc *sc) | |||
277 | ath9k_ps_wakeup(sc); | 327 | ath9k_ps_wakeup(sc); |
278 | ar9003_paprd_enable(ah, false); | 328 | ar9003_paprd_enable(ah, false); |
279 | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { | 329 | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { |
280 | if (!(ah->caps.tx_chainmask & BIT(chain))) | 330 | if (!(common->tx_chainmask & BIT(chain))) |
281 | continue; | 331 | continue; |
282 | 332 | ||
283 | ar9003_paprd_populate_single_table(ah, caldata, chain); | 333 | ar9003_paprd_populate_single_table(ah, caldata, chain); |
@@ -287,6 +337,46 @@ static void ath_paprd_activate(struct ath_softc *sc) | |||
287 | ath9k_ps_restore(sc); | 337 | ath9k_ps_restore(sc); |
288 | } | 338 | } |
289 | 339 | ||
340 | static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int chain) | ||
341 | { | ||
342 | struct ieee80211_hw *hw = sc->hw; | ||
343 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | ||
344 | struct ath_hw *ah = sc->sc_ah; | ||
345 | struct ath_common *common = ath9k_hw_common(ah); | ||
346 | struct ath_tx_control txctl; | ||
347 | int time_left; | ||
348 | |||
349 | memset(&txctl, 0, sizeof(txctl)); | ||
350 | txctl.txq = sc->tx.txq_map[WME_AC_BE]; | ||
351 | |||
352 | memset(tx_info, 0, sizeof(*tx_info)); | ||
353 | tx_info->band = hw->conf.channel->band; | ||
354 | tx_info->flags |= IEEE80211_TX_CTL_NO_ACK; | ||
355 | tx_info->control.rates[0].idx = 0; | ||
356 | tx_info->control.rates[0].count = 1; | ||
357 | tx_info->control.rates[0].flags = IEEE80211_TX_RC_MCS; | ||
358 | tx_info->control.rates[1].idx = -1; | ||
359 | |||
360 | init_completion(&sc->paprd_complete); | ||
361 | txctl.paprd = BIT(chain); | ||
362 | |||
363 | if (ath_tx_start(hw, skb, &txctl) != 0) { | ||
364 | ath_dbg(common, ATH_DBG_XMIT, "PAPRD TX failed\n"); | ||
365 | dev_kfree_skb_any(skb); | ||
366 | return false; | ||
367 | } | ||
368 | |||
369 | time_left = wait_for_completion_timeout(&sc->paprd_complete, | ||
370 | msecs_to_jiffies(ATH_PAPRD_TIMEOUT)); | ||
371 | |||
372 | if (!time_left) | ||
373 | ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CALIBRATE, | ||
374 | "Timeout waiting for paprd training on TX chain %d\n", | ||
375 | chain); | ||
376 | |||
377 | return !!time_left; | ||
378 | } | ||
379 | |||
290 | void ath_paprd_calibrate(struct work_struct *work) | 380 | void ath_paprd_calibrate(struct work_struct *work) |
291 | { | 381 | { |
292 | struct ath_softc *sc = container_of(work, struct ath_softc, paprd_work); | 382 | struct ath_softc *sc = container_of(work, struct ath_softc, paprd_work); |
@@ -294,27 +384,23 @@ void ath_paprd_calibrate(struct work_struct *work) | |||
294 | struct ath_hw *ah = sc->sc_ah; | 384 | struct ath_hw *ah = sc->sc_ah; |
295 | struct ieee80211_hdr *hdr; | 385 | struct ieee80211_hdr *hdr; |
296 | struct sk_buff *skb = NULL; | 386 | struct sk_buff *skb = NULL; |
297 | struct ieee80211_tx_info *tx_info; | ||
298 | int band = hw->conf.channel->band; | ||
299 | struct ieee80211_supported_band *sband = &sc->sbands[band]; | ||
300 | struct ath_tx_control txctl; | ||
301 | struct ath9k_hw_cal_data *caldata = ah->caldata; | 387 | struct ath9k_hw_cal_data *caldata = ah->caldata; |
302 | int qnum, ftype; | 388 | struct ath_common *common = ath9k_hw_common(ah); |
389 | int ftype; | ||
303 | int chain_ok = 0; | 390 | int chain_ok = 0; |
304 | int chain; | 391 | int chain; |
305 | int len = 1800; | 392 | int len = 1800; |
306 | int time_left; | ||
307 | int i; | ||
308 | 393 | ||
309 | if (!caldata) | 394 | if (!caldata) |
310 | return; | 395 | return; |
311 | 396 | ||
397 | if (ar9003_paprd_init_table(ah) < 0) | ||
398 | return; | ||
399 | |||
312 | skb = alloc_skb(len, GFP_KERNEL); | 400 | skb = alloc_skb(len, GFP_KERNEL); |
313 | if (!skb) | 401 | if (!skb) |
314 | return; | 402 | return; |
315 | 403 | ||
316 | tx_info = IEEE80211_SKB_CB(skb); | ||
317 | |||
318 | skb_put(skb, len); | 404 | skb_put(skb, len); |
319 | memset(skb->data, 0, len); | 405 | memset(skb->data, 0, len); |
320 | hdr = (struct ieee80211_hdr *)skb->data; | 406 | hdr = (struct ieee80211_hdr *)skb->data; |
@@ -325,40 +411,25 @@ void ath_paprd_calibrate(struct work_struct *work) | |||
325 | memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN); | 411 | memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN); |
326 | memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); | 412 | memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); |
327 | 413 | ||
328 | memset(&txctl, 0, sizeof(txctl)); | ||
329 | qnum = sc->tx.hwq_map[WME_AC_BE]; | ||
330 | txctl.txq = &sc->tx.txq[qnum]; | ||
331 | |||
332 | ath9k_ps_wakeup(sc); | 414 | ath9k_ps_wakeup(sc); |
333 | ar9003_paprd_init_table(ah); | ||
334 | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { | 415 | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { |
335 | if (!(ah->caps.tx_chainmask & BIT(chain))) | 416 | if (!(common->tx_chainmask & BIT(chain))) |
336 | continue; | 417 | continue; |
337 | 418 | ||
338 | chain_ok = 0; | 419 | chain_ok = 0; |
339 | memset(tx_info, 0, sizeof(*tx_info)); | ||
340 | tx_info->band = band; | ||
341 | 420 | ||
342 | for (i = 0; i < 4; i++) { | 421 | ath_dbg(common, ATH_DBG_CALIBRATE, |
343 | tx_info->control.rates[i].idx = sband->n_bitrates - 1; | 422 | "Sending PAPRD frame for thermal measurement " |
344 | tx_info->control.rates[i].count = 6; | 423 | "on chain %d\n", chain); |
345 | } | 424 | if (!ath_paprd_send_frame(sc, skb, chain)) |
425 | goto fail_paprd; | ||
346 | 426 | ||
347 | init_completion(&sc->paprd_complete); | ||
348 | ar9003_paprd_setup_gain_table(ah, chain); | 427 | ar9003_paprd_setup_gain_table(ah, chain); |
349 | txctl.paprd = BIT(chain); | ||
350 | if (ath_tx_start(hw, skb, &txctl) != 0) | ||
351 | break; | ||
352 | 428 | ||
353 | time_left = wait_for_completion_timeout(&sc->paprd_complete, | 429 | ath_dbg(common, ATH_DBG_CALIBRATE, |
354 | msecs_to_jiffies(ATH_PAPRD_TIMEOUT)); | 430 | "Sending PAPRD training frame on chain %d\n", chain); |
355 | if (!time_left) { | 431 | if (!ath_paprd_send_frame(sc, skb, chain)) |
356 | ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, | ||
357 | "Timeout waiting for paprd training on " | ||
358 | "TX chain %d\n", | ||
359 | chain); | ||
360 | goto fail_paprd; | 432 | goto fail_paprd; |
361 | } | ||
362 | 433 | ||
363 | if (!ar9003_paprd_is_done(ah)) | 434 | if (!ar9003_paprd_is_done(ah)) |
364 | break; | 435 | break; |
@@ -395,7 +466,13 @@ void ath_ani_calibrate(unsigned long data) | |||
395 | bool shortcal = false; | 466 | bool shortcal = false; |
396 | bool aniflag = false; | 467 | bool aniflag = false; |
397 | unsigned int timestamp = jiffies_to_msecs(jiffies); | 468 | unsigned int timestamp = jiffies_to_msecs(jiffies); |
398 | u32 cal_interval, short_cal_interval; | 469 | u32 cal_interval, short_cal_interval, long_cal_interval; |
470 | unsigned long flags; | ||
471 | |||
472 | if (ah->caldata && ah->caldata->nfcal_interference) | ||
473 | long_cal_interval = ATH_LONG_CALINTERVAL_INT; | ||
474 | else | ||
475 | long_cal_interval = ATH_LONG_CALINTERVAL; | ||
399 | 476 | ||
400 | short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ? | 477 | short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ? |
401 | ATH_AP_SHORT_CALINTERVAL : ATH_STA_SHORT_CALINTERVAL; | 478 | ATH_AP_SHORT_CALINTERVAL : ATH_STA_SHORT_CALINTERVAL; |
@@ -407,9 +484,9 @@ void ath_ani_calibrate(unsigned long data) | |||
407 | ath9k_ps_wakeup(sc); | 484 | ath9k_ps_wakeup(sc); |
408 | 485 | ||
409 | /* Long calibration runs independently of short calibration. */ | 486 | /* Long calibration runs independently of short calibration. */ |
410 | if ((timestamp - common->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) { | 487 | if ((timestamp - common->ani.longcal_timer) >= long_cal_interval) { |
411 | longcal = true; | 488 | longcal = true; |
412 | ath_print(common, ATH_DBG_ANI, "longcal @%lu\n", jiffies); | 489 | ath_dbg(common, ATH_DBG_ANI, "longcal @%lu\n", jiffies); |
413 | common->ani.longcal_timer = timestamp; | 490 | common->ani.longcal_timer = timestamp; |
414 | } | 491 | } |
415 | 492 | ||
@@ -417,8 +494,8 @@ void ath_ani_calibrate(unsigned long data) | |||
417 | if (!common->ani.caldone) { | 494 | if (!common->ani.caldone) { |
418 | if ((timestamp - common->ani.shortcal_timer) >= short_cal_interval) { | 495 | if ((timestamp - common->ani.shortcal_timer) >= short_cal_interval) { |
419 | shortcal = true; | 496 | shortcal = true; |
420 | ath_print(common, ATH_DBG_ANI, | 497 | ath_dbg(common, ATH_DBG_ANI, |
421 | "shortcal @%lu\n", jiffies); | 498 | "shortcal @%lu\n", jiffies); |
422 | common->ani.shortcal_timer = timestamp; | 499 | common->ani.shortcal_timer = timestamp; |
423 | common->ani.resetcal_timer = timestamp; | 500 | common->ani.resetcal_timer = timestamp; |
424 | } | 501 | } |
@@ -441,8 +518,12 @@ void ath_ani_calibrate(unsigned long data) | |||
441 | /* Skip all processing if there's nothing to do. */ | 518 | /* Skip all processing if there's nothing to do. */ |
442 | if (longcal || shortcal || aniflag) { | 519 | if (longcal || shortcal || aniflag) { |
443 | /* Call ANI routine if necessary */ | 520 | /* Call ANI routine if necessary */ |
444 | if (aniflag) | 521 | if (aniflag) { |
522 | spin_lock_irqsave(&common->cc_lock, flags); | ||
445 | ath9k_hw_ani_monitor(ah, ah->curchan); | 523 | ath9k_hw_ani_monitor(ah, ah->curchan); |
524 | ath_update_survey_stats(sc); | ||
525 | spin_unlock_irqrestore(&common->cc_lock, flags); | ||
526 | } | ||
446 | 527 | ||
447 | /* Perform calibration if necessary */ | 528 | /* Perform calibration if necessary */ |
448 | if (longcal || shortcal) { | 529 | if (longcal || shortcal) { |
@@ -451,16 +532,6 @@ void ath_ani_calibrate(unsigned long data) | |||
451 | ah->curchan, | 532 | ah->curchan, |
452 | common->rx_chainmask, | 533 | common->rx_chainmask, |
453 | longcal); | 534 | longcal); |
454 | |||
455 | if (longcal) | ||
456 | common->ani.noise_floor = ath9k_hw_getchan_noise(ah, | ||
457 | ah->curchan); | ||
458 | |||
459 | ath_print(common, ATH_DBG_ANI, | ||
460 | " calibrate chan %u/%x nf: %d\n", | ||
461 | ah->curchan->channel, | ||
462 | ah->curchan->channelFlags, | ||
463 | common->ani.noise_floor); | ||
464 | } | 535 | } |
465 | } | 536 | } |
466 | 537 | ||
@@ -483,49 +554,31 @@ set_timer: | |||
483 | if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->caldata) { | 554 | if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->caldata) { |
484 | if (!ah->caldata->paprd_done) | 555 | if (!ah->caldata->paprd_done) |
485 | ieee80211_queue_work(sc->hw, &sc->paprd_work); | 556 | ieee80211_queue_work(sc->hw, &sc->paprd_work); |
486 | else | 557 | else if (!ah->paprd_table_write_done) |
487 | ath_paprd_activate(sc); | 558 | ath_paprd_activate(sc); |
488 | } | 559 | } |
489 | } | 560 | } |
490 | 561 | ||
491 | /* | ||
492 | * Update tx/rx chainmask. For legacy association, | ||
493 | * hard code chainmask to 1x1, for 11n association, use | ||
494 | * the chainmask configuration, for bt coexistence, use | ||
495 | * the chainmask configuration even in legacy mode. | ||
496 | */ | ||
497 | void ath_update_chainmask(struct ath_softc *sc, int is_ht) | ||
498 | { | ||
499 | struct ath_hw *ah = sc->sc_ah; | ||
500 | struct ath_common *common = ath9k_hw_common(ah); | ||
501 | |||
502 | if ((sc->sc_flags & SC_OP_OFFCHANNEL) || is_ht || | ||
503 | (ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE)) { | ||
504 | common->tx_chainmask = ah->caps.tx_chainmask; | ||
505 | common->rx_chainmask = ah->caps.rx_chainmask; | ||
506 | } else { | ||
507 | common->tx_chainmask = 1; | ||
508 | common->rx_chainmask = 1; | ||
509 | } | ||
510 | |||
511 | ath_print(common, ATH_DBG_CONFIG, | ||
512 | "tx chmask: %d, rx chmask: %d\n", | ||
513 | common->tx_chainmask, | ||
514 | common->rx_chainmask); | ||
515 | } | ||
516 | |||
517 | static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta) | 562 | static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta) |
518 | { | 563 | { |
519 | struct ath_node *an; | 564 | struct ath_node *an; |
520 | 565 | struct ath_hw *ah = sc->sc_ah; | |
521 | an = (struct ath_node *)sta->drv_priv; | 566 | an = (struct ath_node *)sta->drv_priv; |
522 | 567 | ||
568 | #ifdef CONFIG_ATH9K_DEBUGFS | ||
569 | spin_lock(&sc->nodes_lock); | ||
570 | list_add(&an->list, &sc->nodes); | ||
571 | spin_unlock(&sc->nodes_lock); | ||
572 | an->sta = sta; | ||
573 | #endif | ||
574 | if ((ah->caps.hw_caps) & ATH9K_HW_CAP_APM) | ||
575 | sc->sc_flags |= SC_OP_ENABLE_APM; | ||
576 | |||
523 | if (sc->sc_flags & SC_OP_TXAGGR) { | 577 | if (sc->sc_flags & SC_OP_TXAGGR) { |
524 | ath_tx_node_init(sc, an); | 578 | ath_tx_node_init(sc, an); |
525 | an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + | 579 | an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + |
526 | sta->ht_cap.ampdu_factor); | 580 | sta->ht_cap.ampdu_factor); |
527 | an->mpdudensity = parse_mpdudensity(sta->ht_cap.ampdu_density); | 581 | an->mpdudensity = parse_mpdudensity(sta->ht_cap.ampdu_density); |
528 | an->last_rssi = ATH_RSSI_DUMMY_MARKER; | ||
529 | } | 582 | } |
530 | } | 583 | } |
531 | 584 | ||
@@ -533,6 +586,13 @@ static void ath_node_detach(struct ath_softc *sc, struct ieee80211_sta *sta) | |||
533 | { | 586 | { |
534 | struct ath_node *an = (struct ath_node *)sta->drv_priv; | 587 | struct ath_node *an = (struct ath_node *)sta->drv_priv; |
535 | 588 | ||
589 | #ifdef CONFIG_ATH9K_DEBUGFS | ||
590 | spin_lock(&sc->nodes_lock); | ||
591 | list_del(&an->list); | ||
592 | spin_unlock(&sc->nodes_lock); | ||
593 | an->sta = NULL; | ||
594 | #endif | ||
595 | |||
536 | if (sc->sc_flags & SC_OP_TXAGGR) | 596 | if (sc->sc_flags & SC_OP_TXAGGR) |
537 | ath_tx_node_cleanup(sc, an); | 597 | ath_tx_node_cleanup(sc, an); |
538 | } | 598 | } |
@@ -540,22 +600,67 @@ static void ath_node_detach(struct ath_softc *sc, struct ieee80211_sta *sta) | |||
540 | void ath_hw_check(struct work_struct *work) | 600 | void ath_hw_check(struct work_struct *work) |
541 | { | 601 | { |
542 | struct ath_softc *sc = container_of(work, struct ath_softc, hw_check_work); | 602 | struct ath_softc *sc = container_of(work, struct ath_softc, hw_check_work); |
543 | int i; | 603 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
604 | unsigned long flags; | ||
605 | int busy; | ||
544 | 606 | ||
545 | ath9k_ps_wakeup(sc); | 607 | ath9k_ps_wakeup(sc); |
608 | if (ath9k_hw_check_alive(sc->sc_ah)) | ||
609 | goto out; | ||
546 | 610 | ||
547 | for (i = 0; i < 3; i++) { | 611 | spin_lock_irqsave(&common->cc_lock, flags); |
548 | if (ath9k_hw_check_alive(sc->sc_ah)) | 612 | busy = ath_update_survey_stats(sc); |
549 | goto out; | 613 | spin_unlock_irqrestore(&common->cc_lock, flags); |
550 | 614 | ||
551 | msleep(1); | 615 | ath_dbg(common, ATH_DBG_RESET, "Possible baseband hang, " |
552 | } | 616 | "busy=%d (try %d)\n", busy, sc->hw_busy_count + 1); |
553 | ath_reset(sc, false); | 617 | if (busy >= 99) { |
618 | if (++sc->hw_busy_count >= 3) | ||
619 | ath_reset(sc, true); | ||
620 | } else if (busy >= 0) | ||
621 | sc->hw_busy_count = 0; | ||
554 | 622 | ||
555 | out: | 623 | out: |
556 | ath9k_ps_restore(sc); | 624 | ath9k_ps_restore(sc); |
557 | } | 625 | } |
558 | 626 | ||
627 | static void ath_hw_pll_rx_hang_check(struct ath_softc *sc, u32 pll_sqsum) | ||
628 | { | ||
629 | static int count; | ||
630 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
631 | |||
632 | if (pll_sqsum >= 0x40000) { | ||
633 | count++; | ||
634 | if (count == 3) { | ||
635 | /* Rx is hung for more than 500ms. Reset it */ | ||
636 | ath_dbg(common, ATH_DBG_RESET, | ||
637 | "Possible RX hang, resetting"); | ||
638 | ath_reset(sc, true); | ||
639 | count = 0; | ||
640 | } | ||
641 | } else | ||
642 | count = 0; | ||
643 | } | ||
644 | |||
645 | void ath_hw_pll_work(struct work_struct *work) | ||
646 | { | ||
647 | struct ath_softc *sc = container_of(work, struct ath_softc, | ||
648 | hw_pll_work.work); | ||
649 | u32 pll_sqsum; | ||
650 | |||
651 | if (AR_SREV_9485(sc->sc_ah)) { | ||
652 | |||
653 | ath9k_ps_wakeup(sc); | ||
654 | pll_sqsum = ar9003_get_pll_sqsum_dvc(sc->sc_ah); | ||
655 | ath9k_ps_restore(sc); | ||
656 | |||
657 | ath_hw_pll_rx_hang_check(sc, pll_sqsum); | ||
658 | |||
659 | ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, HZ/5); | ||
660 | } | ||
661 | } | ||
662 | |||
663 | |||
559 | void ath9k_tasklet(unsigned long data) | 664 | void ath9k_tasklet(unsigned long data) |
560 | { | 665 | { |
561 | struct ath_softc *sc = (struct ath_softc *)data; | 666 | struct ath_softc *sc = (struct ath_softc *)data; |
@@ -565,17 +670,37 @@ void ath9k_tasklet(unsigned long data) | |||
565 | u32 status = sc->intrstatus; | 670 | u32 status = sc->intrstatus; |
566 | u32 rxmask; | 671 | u32 rxmask; |
567 | 672 | ||
568 | ath9k_ps_wakeup(sc); | 673 | if ((status & ATH9K_INT_FATAL) || |
569 | 674 | (status & ATH9K_INT_BB_WATCHDOG)) { | |
570 | if (status & ATH9K_INT_FATAL) { | 675 | ath_reset(sc, true); |
571 | ath_reset(sc, false); | ||
572 | ath9k_ps_restore(sc); | ||
573 | return; | 676 | return; |
574 | } | 677 | } |
575 | 678 | ||
576 | if (!ath9k_hw_check_alive(ah)) | 679 | ath9k_ps_wakeup(sc); |
680 | spin_lock(&sc->sc_pcu_lock); | ||
681 | |||
682 | /* | ||
683 | * Only run the baseband hang check if beacons stop working in AP or | ||
684 | * IBSS mode, because it has a high false positive rate. For station | ||
685 | * mode it should not be necessary, since the upper layers will detect | ||
686 | * this through a beacon miss automatically and the following channel | ||
687 | * change will trigger a hardware reset anyway | ||
688 | */ | ||
689 | if (ath9k_hw_numtxpending(ah, sc->beacon.beaconq) != 0 && | ||
690 | !ath9k_hw_check_alive(ah)) | ||
577 | ieee80211_queue_work(sc->hw, &sc->hw_check_work); | 691 | ieee80211_queue_work(sc->hw, &sc->hw_check_work); |
578 | 692 | ||
693 | if ((status & ATH9K_INT_TSFOOR) && sc->ps_enabled) { | ||
694 | /* | ||
695 | * TSF sync does not look correct; remain awake to sync with | ||
696 | * the next Beacon. | ||
697 | */ | ||
698 | ath_dbg(common, ATH_DBG_PS, | ||
699 | "TSFOOR - Sync with next Beacon\n"); | ||
700 | sc->ps_flags |= PS_WAIT_FOR_BEACON | PS_BEACON_SYNC | | ||
701 | PS_TSFOOR_SYNC; | ||
702 | } | ||
703 | |||
579 | if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) | 704 | if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) |
580 | rxmask = (ATH9K_INT_RXHP | ATH9K_INT_RXLP | ATH9K_INT_RXEOL | | 705 | rxmask = (ATH9K_INT_RXHP | ATH9K_INT_RXLP | ATH9K_INT_RXEOL | |
581 | ATH9K_INT_RXORN); | 706 | ATH9K_INT_RXORN); |
@@ -583,15 +708,12 @@ void ath9k_tasklet(unsigned long data) | |||
583 | rxmask = (ATH9K_INT_RX | ATH9K_INT_RXEOL | ATH9K_INT_RXORN); | 708 | rxmask = (ATH9K_INT_RX | ATH9K_INT_RXEOL | ATH9K_INT_RXORN); |
584 | 709 | ||
585 | if (status & rxmask) { | 710 | if (status & rxmask) { |
586 | spin_lock_bh(&sc->rx.rxflushlock); | ||
587 | |||
588 | /* Check for high priority Rx first */ | 711 | /* Check for high priority Rx first */ |
589 | if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && | 712 | if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && |
590 | (status & ATH9K_INT_RXHP)) | 713 | (status & ATH9K_INT_RXHP)) |
591 | ath_rx_tasklet(sc, 0, true); | 714 | ath_rx_tasklet(sc, 0, true); |
592 | 715 | ||
593 | ath_rx_tasklet(sc, 0, false); | 716 | ath_rx_tasklet(sc, 0, false); |
594 | spin_unlock_bh(&sc->rx.rxflushlock); | ||
595 | } | 717 | } |
596 | 718 | ||
597 | if (status & ATH9K_INT_TX) { | 719 | if (status & ATH9K_INT_TX) { |
@@ -601,22 +723,14 @@ void ath9k_tasklet(unsigned long data) | |||
601 | ath_tx_tasklet(sc); | 723 | ath_tx_tasklet(sc); |
602 | } | 724 | } |
603 | 725 | ||
604 | if ((status & ATH9K_INT_TSFOOR) && sc->ps_enabled) { | ||
605 | /* | ||
606 | * TSF sync does not look correct; remain awake to sync with | ||
607 | * the next Beacon. | ||
608 | */ | ||
609 | ath_print(common, ATH_DBG_PS, | ||
610 | "TSFOOR - Sync with next Beacon\n"); | ||
611 | sc->ps_flags |= PS_WAIT_FOR_BEACON | PS_BEACON_SYNC; | ||
612 | } | ||
613 | |||
614 | if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) | 726 | if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) |
615 | if (status & ATH9K_INT_GENTIMER) | 727 | if (status & ATH9K_INT_GENTIMER) |
616 | ath_gen_timer_isr(sc->sc_ah); | 728 | ath_gen_timer_isr(sc->sc_ah); |
617 | 729 | ||
618 | /* re-enable hardware interrupt */ | 730 | /* re-enable hardware interrupt */ |
619 | ath9k_hw_set_interrupts(ah, ah->imask); | 731 | ath9k_hw_enable_interrupts(ah); |
732 | |||
733 | spin_unlock(&sc->sc_pcu_lock); | ||
620 | ath9k_ps_restore(sc); | 734 | ath9k_ps_restore(sc); |
621 | } | 735 | } |
622 | 736 | ||
@@ -624,6 +738,7 @@ irqreturn_t ath_isr(int irq, void *dev) | |||
624 | { | 738 | { |
625 | #define SCHED_INTR ( \ | 739 | #define SCHED_INTR ( \ |
626 | ATH9K_INT_FATAL | \ | 740 | ATH9K_INT_FATAL | \ |
741 | ATH9K_INT_BB_WATCHDOG | \ | ||
627 | ATH9K_INT_RXORN | \ | 742 | ATH9K_INT_RXORN | \ |
628 | ATH9K_INT_RXEOL | \ | 743 | ATH9K_INT_RXEOL | \ |
629 | ATH9K_INT_RX | \ | 744 | ATH9K_INT_RX | \ |
@@ -637,6 +752,7 @@ irqreturn_t ath_isr(int irq, void *dev) | |||
637 | 752 | ||
638 | struct ath_softc *sc = dev; | 753 | struct ath_softc *sc = dev; |
639 | struct ath_hw *ah = sc->sc_ah; | 754 | struct ath_hw *ah = sc->sc_ah; |
755 | struct ath_common *common = ath9k_hw_common(ah); | ||
640 | enum ath9k_int status; | 756 | enum ath9k_int status; |
641 | bool sched = false; | 757 | bool sched = false; |
642 | 758 | ||
@@ -686,7 +802,12 @@ irqreturn_t ath_isr(int irq, void *dev) | |||
686 | 802 | ||
687 | if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && | 803 | if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && |
688 | (status & ATH9K_INT_BB_WATCHDOG)) { | 804 | (status & ATH9K_INT_BB_WATCHDOG)) { |
805 | |||
806 | spin_lock(&common->cc_lock); | ||
807 | ath_hw_cycle_counters_update(common); | ||
689 | ar9003_hw_bb_watchdog_dbg_info(ah); | 808 | ar9003_hw_bb_watchdog_dbg_info(ah); |
809 | spin_unlock(&common->cc_lock); | ||
810 | |||
690 | goto chip_reset; | 811 | goto chip_reset; |
691 | } | 812 | } |
692 | 813 | ||
@@ -709,18 +830,22 @@ irqreturn_t ath_isr(int irq, void *dev) | |||
709 | * interrupt; otherwise it will continue to | 830 | * interrupt; otherwise it will continue to |
710 | * fire. | 831 | * fire. |
711 | */ | 832 | */ |
712 | ath9k_hw_set_interrupts(ah, 0); | 833 | ath9k_hw_disable_interrupts(ah); |
713 | /* | 834 | /* |
714 | * Let the hal handle the event. We assume | 835 | * Let the hal handle the event. We assume |
715 | * it will clear whatever condition caused | 836 | * it will clear whatever condition caused |
716 | * the interrupt. | 837 | * the interrupt. |
717 | */ | 838 | */ |
718 | ath9k_hw_procmibevent(ah); | 839 | spin_lock(&common->cc_lock); |
719 | ath9k_hw_set_interrupts(ah, ah->imask); | 840 | ath9k_hw_proc_mib_event(ah); |
841 | spin_unlock(&common->cc_lock); | ||
842 | ath9k_hw_enable_interrupts(ah); | ||
720 | } | 843 | } |
721 | 844 | ||
722 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) | 845 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) |
723 | if (status & ATH9K_INT_TIM_TIMER) { | 846 | if (status & ATH9K_INT_TIM_TIMER) { |
847 | if (ATH_DBG_WARN_ON_ONCE(sc->ps_idle)) | ||
848 | goto chip_reset; | ||
724 | /* Clear RxAbort bit so that we can | 849 | /* Clear RxAbort bit so that we can |
725 | * receive frames */ | 850 | * receive frames */ |
726 | ath9k_setpower(sc, ATH9K_PM_AWAKE); | 851 | ath9k_setpower(sc, ATH9K_PM_AWAKE); |
@@ -733,8 +858,8 @@ chip_reset: | |||
733 | ath_debug_stat_interrupt(sc, status); | 858 | ath_debug_stat_interrupt(sc, status); |
734 | 859 | ||
735 | if (sched) { | 860 | if (sched) { |
736 | /* turn off every interrupt except SWBA */ | 861 | /* turn off every interrupt */ |
737 | ath9k_hw_set_interrupts(ah, (ah->imask & ATH9K_INT_SWBA)); | 862 | ath9k_hw_disable_interrupts(ah); |
738 | tasklet_schedule(&sc->intr_tq); | 863 | tasklet_schedule(&sc->intr_tq); |
739 | } | 864 | } |
740 | 865 | ||
@@ -743,88 +868,6 @@ chip_reset: | |||
743 | #undef SCHED_INTR | 868 | #undef SCHED_INTR |
744 | } | 869 | } |
745 | 870 | ||
746 | static u32 ath_get_extchanmode(struct ath_softc *sc, | ||
747 | struct ieee80211_channel *chan, | ||
748 | enum nl80211_channel_type channel_type) | ||
749 | { | ||
750 | u32 chanmode = 0; | ||
751 | |||
752 | switch (chan->band) { | ||
753 | case IEEE80211_BAND_2GHZ: | ||
754 | switch(channel_type) { | ||
755 | case NL80211_CHAN_NO_HT: | ||
756 | case NL80211_CHAN_HT20: | ||
757 | chanmode = CHANNEL_G_HT20; | ||
758 | break; | ||
759 | case NL80211_CHAN_HT40PLUS: | ||
760 | chanmode = CHANNEL_G_HT40PLUS; | ||
761 | break; | ||
762 | case NL80211_CHAN_HT40MINUS: | ||
763 | chanmode = CHANNEL_G_HT40MINUS; | ||
764 | break; | ||
765 | } | ||
766 | break; | ||
767 | case IEEE80211_BAND_5GHZ: | ||
768 | switch(channel_type) { | ||
769 | case NL80211_CHAN_NO_HT: | ||
770 | case NL80211_CHAN_HT20: | ||
771 | chanmode = CHANNEL_A_HT20; | ||
772 | break; | ||
773 | case NL80211_CHAN_HT40PLUS: | ||
774 | chanmode = CHANNEL_A_HT40PLUS; | ||
775 | break; | ||
776 | case NL80211_CHAN_HT40MINUS: | ||
777 | chanmode = CHANNEL_A_HT40MINUS; | ||
778 | break; | ||
779 | } | ||
780 | break; | ||
781 | default: | ||
782 | break; | ||
783 | } | ||
784 | |||
785 | return chanmode; | ||
786 | } | ||
787 | |||
788 | static void ath9k_bss_assoc_info(struct ath_softc *sc, | ||
789 | struct ieee80211_vif *vif, | ||
790 | struct ieee80211_bss_conf *bss_conf) | ||
791 | { | ||
792 | struct ath_hw *ah = sc->sc_ah; | ||
793 | struct ath_common *common = ath9k_hw_common(ah); | ||
794 | |||
795 | if (bss_conf->assoc) { | ||
796 | ath_print(common, ATH_DBG_CONFIG, | ||
797 | "Bss Info ASSOC %d, bssid: %pM\n", | ||
798 | bss_conf->aid, common->curbssid); | ||
799 | |||
800 | /* New association, store aid */ | ||
801 | common->curaid = bss_conf->aid; | ||
802 | ath9k_hw_write_associd(ah); | ||
803 | |||
804 | /* | ||
805 | * Request a re-configuration of Beacon related timers | ||
806 | * on the receipt of the first Beacon frame (i.e., | ||
807 | * after time sync with the AP). | ||
808 | */ | ||
809 | sc->ps_flags |= PS_BEACON_SYNC; | ||
810 | |||
811 | /* Configure the beacon */ | ||
812 | ath_beacon_config(sc, vif); | ||
813 | |||
814 | /* Reset rssi stats */ | ||
815 | sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; | ||
816 | |||
817 | sc->sc_flags |= SC_OP_ANI_RUN; | ||
818 | ath_start_ani(common); | ||
819 | } else { | ||
820 | ath_print(common, ATH_DBG_CONFIG, "Bss Info DISASSOC\n"); | ||
821 | common->curaid = 0; | ||
822 | /* Stop ANI */ | ||
823 | sc->sc_flags &= ~SC_OP_ANI_RUN; | ||
824 | del_timer_sync(&common->ani.timer); | ||
825 | } | ||
826 | } | ||
827 | |||
828 | void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) | 871 | void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) |
829 | { | 872 | { |
830 | struct ath_hw *ah = sc->sc_ah; | 873 | struct ath_hw *ah = sc->sc_ah; |
@@ -833,30 +876,28 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
833 | int r; | 876 | int r; |
834 | 877 | ||
835 | ath9k_ps_wakeup(sc); | 878 | ath9k_ps_wakeup(sc); |
879 | spin_lock_bh(&sc->sc_pcu_lock); | ||
880 | |||
836 | ath9k_hw_configpcipowersave(ah, 0, 0); | 881 | ath9k_hw_configpcipowersave(ah, 0, 0); |
837 | 882 | ||
838 | if (!ah->curchan) | 883 | if (!ah->curchan) |
839 | ah->curchan = ath_get_curchannel(sc, sc->hw); | 884 | ah->curchan = ath9k_cmn_get_curchannel(sc->hw, ah); |
840 | 885 | ||
841 | spin_lock_bh(&sc->sc_resetlock); | ||
842 | r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); | 886 | r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); |
843 | if (r) { | 887 | if (r) { |
844 | ath_print(common, ATH_DBG_FATAL, | 888 | ath_err(common, |
845 | "Unable to reset channel (%u MHz), " | 889 | "Unable to reset channel (%u MHz), reset status %d\n", |
846 | "reset status %d\n", | 890 | channel->center_freq, r); |
847 | channel->center_freq, r); | ||
848 | } | 891 | } |
849 | spin_unlock_bh(&sc->sc_resetlock); | ||
850 | 892 | ||
851 | ath_update_txpow(sc); | 893 | ath9k_cmn_update_txpow(ah, sc->curtxpow, |
894 | sc->config.txpowlimit, &sc->curtxpow); | ||
852 | if (ath_startrecv(sc) != 0) { | 895 | if (ath_startrecv(sc) != 0) { |
853 | ath_print(common, ATH_DBG_FATAL, | 896 | ath_err(common, "Unable to restart recv logic\n"); |
854 | "Unable to restart recv logic\n"); | 897 | goto out; |
855 | return; | ||
856 | } | 898 | } |
857 | |||
858 | if (sc->sc_flags & SC_OP_BEACONS) | 899 | if (sc->sc_flags & SC_OP_BEACONS) |
859 | ath_beacon_config(sc, NULL); /* restart beacons */ | 900 | ath_set_beacon(sc); /* restart beacons */ |
860 | 901 | ||
861 | /* Re-Enable interrupts */ | 902 | /* Re-Enable interrupts */ |
862 | ath9k_hw_set_interrupts(ah, ah->imask); | 903 | ath9k_hw_set_interrupts(ah, ah->imask); |
@@ -867,6 +908,11 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
867 | ath9k_hw_set_gpio(ah, ah->led_pin, 0); | 908 | ath9k_hw_set_gpio(ah, ah->led_pin, 0); |
868 | 909 | ||
869 | ieee80211_wake_queues(hw); | 910 | ieee80211_wake_queues(hw); |
911 | ieee80211_queue_delayed_work(hw, &sc->hw_pll_work, HZ/2); | ||
912 | |||
913 | out: | ||
914 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
915 | |||
870 | ath9k_ps_restore(sc); | 916 | ath9k_ps_restore(sc); |
871 | } | 917 | } |
872 | 918 | ||
@@ -877,6 +923,10 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
877 | int r; | 923 | int r; |
878 | 924 | ||
879 | ath9k_ps_wakeup(sc); | 925 | ath9k_ps_wakeup(sc); |
926 | cancel_delayed_work_sync(&sc->hw_pll_work); | ||
927 | |||
928 | spin_lock_bh(&sc->sc_pcu_lock); | ||
929 | |||
880 | ieee80211_stop_queues(hw); | 930 | ieee80211_stop_queues(hw); |
881 | 931 | ||
882 | /* | 932 | /* |
@@ -889,29 +939,29 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
889 | } | 939 | } |
890 | 940 | ||
891 | /* Disable interrupts */ | 941 | /* Disable interrupts */ |
892 | ath9k_hw_set_interrupts(ah, 0); | 942 | ath9k_hw_disable_interrupts(ah); |
893 | 943 | ||
894 | ath_drain_all_txq(sc, false); /* clear pending tx frames */ | 944 | ath_drain_all_txq(sc, false); /* clear pending tx frames */ |
945 | |||
895 | ath_stoprecv(sc); /* turn off frame recv */ | 946 | ath_stoprecv(sc); /* turn off frame recv */ |
896 | ath_flushrecv(sc); /* flush recv queue */ | 947 | ath_flushrecv(sc); /* flush recv queue */ |
897 | 948 | ||
898 | if (!ah->curchan) | 949 | if (!ah->curchan) |
899 | ah->curchan = ath_get_curchannel(sc, hw); | 950 | ah->curchan = ath9k_cmn_get_curchannel(hw, ah); |
900 | 951 | ||
901 | spin_lock_bh(&sc->sc_resetlock); | ||
902 | r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); | 952 | r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); |
903 | if (r) { | 953 | if (r) { |
904 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, | 954 | ath_err(ath9k_hw_common(sc->sc_ah), |
905 | "Unable to reset channel (%u MHz), " | 955 | "Unable to reset channel (%u MHz), reset status %d\n", |
906 | "reset status %d\n", | 956 | channel->center_freq, r); |
907 | channel->center_freq, r); | ||
908 | } | 957 | } |
909 | spin_unlock_bh(&sc->sc_resetlock); | ||
910 | 958 | ||
911 | ath9k_hw_phy_disable(ah); | 959 | ath9k_hw_phy_disable(ah); |
960 | |||
912 | ath9k_hw_configpcipowersave(ah, 1, 1); | 961 | ath9k_hw_configpcipowersave(ah, 1, 1); |
962 | |||
963 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
913 | ath9k_ps_restore(sc); | 964 | ath9k_ps_restore(sc); |
914 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); | ||
915 | } | 965 | } |
916 | 966 | ||
917 | int ath_reset(struct ath_softc *sc, bool retry_tx) | 967 | int ath_reset(struct ath_softc *sc, bool retry_tx) |
@@ -921,38 +971,40 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
921 | struct ieee80211_hw *hw = sc->hw; | 971 | struct ieee80211_hw *hw = sc->hw; |
922 | int r; | 972 | int r; |
923 | 973 | ||
974 | sc->hw_busy_count = 0; | ||
975 | |||
924 | /* Stop ANI */ | 976 | /* Stop ANI */ |
925 | del_timer_sync(&common->ani.timer); | 977 | del_timer_sync(&common->ani.timer); |
926 | 978 | ||
979 | ath9k_ps_wakeup(sc); | ||
980 | spin_lock_bh(&sc->sc_pcu_lock); | ||
981 | |||
927 | ieee80211_stop_queues(hw); | 982 | ieee80211_stop_queues(hw); |
928 | 983 | ||
929 | ath9k_hw_set_interrupts(ah, 0); | 984 | ath9k_hw_disable_interrupts(ah); |
930 | ath_drain_all_txq(sc, retry_tx); | 985 | ath_drain_all_txq(sc, retry_tx); |
986 | |||
931 | ath_stoprecv(sc); | 987 | ath_stoprecv(sc); |
932 | ath_flushrecv(sc); | 988 | ath_flushrecv(sc); |
933 | 989 | ||
934 | spin_lock_bh(&sc->sc_resetlock); | ||
935 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); | 990 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); |
936 | if (r) | 991 | if (r) |
937 | ath_print(common, ATH_DBG_FATAL, | 992 | ath_err(common, |
938 | "Unable to reset hardware; reset status %d\n", r); | 993 | "Unable to reset hardware; reset status %d\n", r); |
939 | spin_unlock_bh(&sc->sc_resetlock); | ||
940 | 994 | ||
941 | if (ath_startrecv(sc) != 0) | 995 | if (ath_startrecv(sc) != 0) |
942 | ath_print(common, ATH_DBG_FATAL, | 996 | ath_err(common, "Unable to start recv logic\n"); |
943 | "Unable to start recv logic\n"); | ||
944 | 997 | ||
945 | /* | 998 | /* |
946 | * We may be doing a reset in response to a request | 999 | * We may be doing a reset in response to a request |
947 | * that changes the channel so update any state that | 1000 | * that changes the channel so update any state that |
948 | * might change as a result. | 1001 | * might change as a result. |
949 | */ | 1002 | */ |
950 | ath_cache_conf_rate(sc, &hw->conf); | 1003 | ath9k_cmn_update_txpow(ah, sc->curtxpow, |
1004 | sc->config.txpowlimit, &sc->curtxpow); | ||
951 | 1005 | ||
952 | ath_update_txpow(sc); | 1006 | if ((sc->sc_flags & SC_OP_BEACONS) || !(sc->sc_flags & (SC_OP_OFFCHANNEL))) |
953 | 1007 | ath_set_beacon(sc); /* restart beacons */ | |
954 | if (sc->sc_flags & SC_OP_BEACONS) | ||
955 | ath_beacon_config(sc, NULL); /* restart beacons */ | ||
956 | 1008 | ||
957 | ath9k_hw_set_interrupts(ah, ah->imask); | 1009 | ath9k_hw_set_interrupts(ah, ah->imask); |
958 | 1010 | ||
@@ -968,133 +1020,40 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
968 | } | 1020 | } |
969 | 1021 | ||
970 | ieee80211_wake_queues(hw); | 1022 | ieee80211_wake_queues(hw); |
1023 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
971 | 1024 | ||
972 | /* Start ANI */ | 1025 | /* Start ANI */ |
973 | ath_start_ani(common); | 1026 | ath_start_ani(common); |
1027 | ath9k_ps_restore(sc); | ||
974 | 1028 | ||
975 | return r; | 1029 | return r; |
976 | } | 1030 | } |
977 | 1031 | ||
978 | static int ath_get_hal_qnum(u16 queue, struct ath_softc *sc) | ||
979 | { | ||
980 | int qnum; | ||
981 | |||
982 | switch (queue) { | ||
983 | case 0: | ||
984 | qnum = sc->tx.hwq_map[WME_AC_VO]; | ||
985 | break; | ||
986 | case 1: | ||
987 | qnum = sc->tx.hwq_map[WME_AC_VI]; | ||
988 | break; | ||
989 | case 2: | ||
990 | qnum = sc->tx.hwq_map[WME_AC_BE]; | ||
991 | break; | ||
992 | case 3: | ||
993 | qnum = sc->tx.hwq_map[WME_AC_BK]; | ||
994 | break; | ||
995 | default: | ||
996 | qnum = sc->tx.hwq_map[WME_AC_BE]; | ||
997 | break; | ||
998 | } | ||
999 | |||
1000 | return qnum; | ||
1001 | } | ||
1002 | |||
1003 | int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc) | ||
1004 | { | ||
1005 | int qnum; | ||
1006 | |||
1007 | switch (queue) { | ||
1008 | case WME_AC_VO: | ||
1009 | qnum = 0; | ||
1010 | break; | ||
1011 | case WME_AC_VI: | ||
1012 | qnum = 1; | ||
1013 | break; | ||
1014 | case WME_AC_BE: | ||
1015 | qnum = 2; | ||
1016 | break; | ||
1017 | case WME_AC_BK: | ||
1018 | qnum = 3; | ||
1019 | break; | ||
1020 | default: | ||
1021 | qnum = -1; | ||
1022 | break; | ||
1023 | } | ||
1024 | |||
1025 | return qnum; | ||
1026 | } | ||
1027 | |||
1028 | /* XXX: Remove me once we don't depend on ath9k_channel for all | ||
1029 | * this redundant data */ | ||
1030 | void ath9k_update_ichannel(struct ath_softc *sc, struct ieee80211_hw *hw, | ||
1031 | struct ath9k_channel *ichan) | ||
1032 | { | ||
1033 | struct ieee80211_channel *chan = hw->conf.channel; | ||
1034 | struct ieee80211_conf *conf = &hw->conf; | ||
1035 | |||
1036 | ichan->channel = chan->center_freq; | ||
1037 | ichan->chan = chan; | ||
1038 | |||
1039 | if (chan->band == IEEE80211_BAND_2GHZ) { | ||
1040 | ichan->chanmode = CHANNEL_G; | ||
1041 | ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM | CHANNEL_G; | ||
1042 | } else { | ||
1043 | ichan->chanmode = CHANNEL_A; | ||
1044 | ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM; | ||
1045 | } | ||
1046 | |||
1047 | if (conf_is_ht(conf)) | ||
1048 | ichan->chanmode = ath_get_extchanmode(sc, chan, | ||
1049 | conf->channel_type); | ||
1050 | } | ||
1051 | |||
1052 | /**********************/ | 1032 | /**********************/ |
1053 | /* mac80211 callbacks */ | 1033 | /* mac80211 callbacks */ |
1054 | /**********************/ | 1034 | /**********************/ |
1055 | 1035 | ||
1056 | static int ath9k_start(struct ieee80211_hw *hw) | 1036 | static int ath9k_start(struct ieee80211_hw *hw) |
1057 | { | 1037 | { |
1058 | struct ath_wiphy *aphy = hw->priv; | 1038 | struct ath_softc *sc = hw->priv; |
1059 | struct ath_softc *sc = aphy->sc; | ||
1060 | struct ath_hw *ah = sc->sc_ah; | 1039 | struct ath_hw *ah = sc->sc_ah; |
1061 | struct ath_common *common = ath9k_hw_common(ah); | 1040 | struct ath_common *common = ath9k_hw_common(ah); |
1062 | struct ieee80211_channel *curchan = hw->conf.channel; | 1041 | struct ieee80211_channel *curchan = hw->conf.channel; |
1063 | struct ath9k_channel *init_channel; | 1042 | struct ath9k_channel *init_channel; |
1064 | int r; | 1043 | int r; |
1065 | 1044 | ||
1066 | ath_print(common, ATH_DBG_CONFIG, | 1045 | ath_dbg(common, ATH_DBG_CONFIG, |
1067 | "Starting driver with initial channel: %d MHz\n", | 1046 | "Starting driver with initial channel: %d MHz\n", |
1068 | curchan->center_freq); | 1047 | curchan->center_freq); |
1069 | 1048 | ||
1070 | mutex_lock(&sc->mutex); | 1049 | ath9k_ps_wakeup(sc); |
1071 | 1050 | ||
1072 | if (ath9k_wiphy_started(sc)) { | 1051 | mutex_lock(&sc->mutex); |
1073 | if (sc->chan_idx == curchan->hw_value) { | ||
1074 | /* | ||
1075 | * Already on the operational channel, the new wiphy | ||
1076 | * can be marked active. | ||
1077 | */ | ||
1078 | aphy->state = ATH_WIPHY_ACTIVE; | ||
1079 | ieee80211_wake_queues(hw); | ||
1080 | } else { | ||
1081 | /* | ||
1082 | * Another wiphy is on another channel, start the new | ||
1083 | * wiphy in paused state. | ||
1084 | */ | ||
1085 | aphy->state = ATH_WIPHY_PAUSED; | ||
1086 | ieee80211_stop_queues(hw); | ||
1087 | } | ||
1088 | mutex_unlock(&sc->mutex); | ||
1089 | return 0; | ||
1090 | } | ||
1091 | aphy->state = ATH_WIPHY_ACTIVE; | ||
1092 | 1052 | ||
1093 | /* setup initial channel */ | 1053 | /* setup initial channel */ |
1094 | |||
1095 | sc->chan_idx = curchan->hw_value; | 1054 | sc->chan_idx = curchan->hw_value; |
1096 | 1055 | ||
1097 | init_channel = ath_get_curchannel(sc, hw); | 1056 | init_channel = ath9k_cmn_get_curchannel(hw, ah); |
1098 | 1057 | ||
1099 | /* Reset SERDES registers */ | 1058 | /* Reset SERDES registers */ |
1100 | ath9k_hw_configpcipowersave(ah, 0, 0); | 1059 | ath9k_hw_configpcipowersave(ah, 0, 0); |
@@ -1106,23 +1065,22 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1106 | * be followed by initialization of the appropriate bits | 1065 | * be followed by initialization of the appropriate bits |
1107 | * and then setup of the interrupt mask. | 1066 | * and then setup of the interrupt mask. |
1108 | */ | 1067 | */ |
1109 | spin_lock_bh(&sc->sc_resetlock); | 1068 | spin_lock_bh(&sc->sc_pcu_lock); |
1110 | r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); | 1069 | r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); |
1111 | if (r) { | 1070 | if (r) { |
1112 | ath_print(common, ATH_DBG_FATAL, | 1071 | ath_err(common, |
1113 | "Unable to reset hardware; reset status %d " | 1072 | "Unable to reset hardware; reset status %d (freq %u MHz)\n", |
1114 | "(freq %u MHz)\n", r, | 1073 | r, curchan->center_freq); |
1115 | curchan->center_freq); | 1074 | spin_unlock_bh(&sc->sc_pcu_lock); |
1116 | spin_unlock_bh(&sc->sc_resetlock); | ||
1117 | goto mutex_unlock; | 1075 | goto mutex_unlock; |
1118 | } | 1076 | } |
1119 | spin_unlock_bh(&sc->sc_resetlock); | ||
1120 | 1077 | ||
1121 | /* | 1078 | /* |
1122 | * This is needed only to setup initial state | 1079 | * This is needed only to setup initial state |
1123 | * but it's best done after a reset. | 1080 | * but it's best done after a reset. |
1124 | */ | 1081 | */ |
1125 | ath_update_txpow(sc); | 1082 | ath9k_cmn_update_txpow(ah, sc->curtxpow, |
1083 | sc->config.txpowlimit, &sc->curtxpow); | ||
1126 | 1084 | ||
1127 | /* | 1085 | /* |
1128 | * Setup the hardware after reset: | 1086 | * Setup the hardware after reset: |
@@ -1132,11 +1090,12 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1132 | * here except setup the interrupt mask. | 1090 | * here except setup the interrupt mask. |
1133 | */ | 1091 | */ |
1134 | if (ath_startrecv(sc) != 0) { | 1092 | if (ath_startrecv(sc) != 0) { |
1135 | ath_print(common, ATH_DBG_FATAL, | 1093 | ath_err(common, "Unable to start recv logic\n"); |
1136 | "Unable to start recv logic\n"); | ||
1137 | r = -EIO; | 1094 | r = -EIO; |
1095 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
1138 | goto mutex_unlock; | 1096 | goto mutex_unlock; |
1139 | } | 1097 | } |
1098 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
1140 | 1099 | ||
1141 | /* Setup our intr mask. */ | 1100 | /* Setup our intr mask. */ |
1142 | ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL | | 1101 | ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL | |
@@ -1150,15 +1109,13 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1150 | else | 1109 | else |
1151 | ah->imask |= ATH9K_INT_RX; | 1110 | ah->imask |= ATH9K_INT_RX; |
1152 | 1111 | ||
1153 | if (ah->caps.hw_caps & ATH9K_HW_CAP_GTT) | 1112 | ah->imask |= ATH9K_INT_GTT; |
1154 | ah->imask |= ATH9K_INT_GTT; | ||
1155 | 1113 | ||
1156 | if (ah->caps.hw_caps & ATH9K_HW_CAP_HT) | 1114 | if (ah->caps.hw_caps & ATH9K_HW_CAP_HT) |
1157 | ah->imask |= ATH9K_INT_CST; | 1115 | ah->imask |= ATH9K_INT_CST; |
1158 | 1116 | ||
1159 | ath_cache_conf_rate(sc, &hw->conf); | ||
1160 | |||
1161 | sc->sc_flags &= ~SC_OP_INVALID; | 1117 | sc->sc_flags &= ~SC_OP_INVALID; |
1118 | sc->sc_ah->is_monitoring = false; | ||
1162 | 1119 | ||
1163 | /* Disable BMISS interrupt when we're not associated */ | 1120 | /* Disable BMISS interrupt when we're not associated */ |
1164 | ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); | 1121 | ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); |
@@ -1180,30 +1137,23 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1180 | ath9k_btcoex_timer_resume(sc); | 1137 | ath9k_btcoex_timer_resume(sc); |
1181 | } | 1138 | } |
1182 | 1139 | ||
1140 | if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en) | ||
1141 | common->bus_ops->extn_synch_en(common); | ||
1142 | |||
1183 | mutex_unlock: | 1143 | mutex_unlock: |
1184 | mutex_unlock(&sc->mutex); | 1144 | mutex_unlock(&sc->mutex); |
1185 | 1145 | ||
1146 | ath9k_ps_restore(sc); | ||
1147 | |||
1186 | return r; | 1148 | return r; |
1187 | } | 1149 | } |
1188 | 1150 | ||
1189 | static int ath9k_tx(struct ieee80211_hw *hw, | 1151 | static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
1190 | struct sk_buff *skb) | ||
1191 | { | 1152 | { |
1192 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1153 | struct ath_softc *sc = hw->priv; |
1193 | struct ath_wiphy *aphy = hw->priv; | ||
1194 | struct ath_softc *sc = aphy->sc; | ||
1195 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1154 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1196 | struct ath_tx_control txctl; | 1155 | struct ath_tx_control txctl; |
1197 | int padpos, padsize; | ||
1198 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 1156 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1199 | int qnum; | ||
1200 | |||
1201 | if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) { | ||
1202 | ath_print(common, ATH_DBG_XMIT, | ||
1203 | "ath9k: %s: TX in unexpected wiphy state " | ||
1204 | "%d\n", wiphy_name(hw->wiphy), aphy->state); | ||
1205 | goto exit; | ||
1206 | } | ||
1207 | 1157 | ||
1208 | if (sc->ps_enabled) { | 1158 | if (sc->ps_enabled) { |
1209 | /* | 1159 | /* |
@@ -1213,8 +1163,8 @@ static int ath9k_tx(struct ieee80211_hw *hw, | |||
1213 | if (ieee80211_is_data(hdr->frame_control) && | 1163 | if (ieee80211_is_data(hdr->frame_control) && |
1214 | !ieee80211_is_nullfunc(hdr->frame_control) && | 1164 | !ieee80211_is_nullfunc(hdr->frame_control) && |
1215 | !ieee80211_has_pm(hdr->frame_control)) { | 1165 | !ieee80211_has_pm(hdr->frame_control)) { |
1216 | ath_print(common, ATH_DBG_PS, "Add PM=1 for a TX frame " | 1166 | ath_dbg(common, ATH_DBG_PS, |
1217 | "while in PS mode\n"); | 1167 | "Add PM=1 for a TX frame while in PS mode\n"); |
1218 | hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); | 1168 | hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); |
1219 | } | 1169 | } |
1220 | } | 1170 | } |
@@ -1229,12 +1179,12 @@ static int ath9k_tx(struct ieee80211_hw *hw, | |||
1229 | if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) | 1179 | if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) |
1230 | ath9k_hw_setrxabort(sc->sc_ah, 0); | 1180 | ath9k_hw_setrxabort(sc->sc_ah, 0); |
1231 | if (ieee80211_is_pspoll(hdr->frame_control)) { | 1181 | if (ieee80211_is_pspoll(hdr->frame_control)) { |
1232 | ath_print(common, ATH_DBG_PS, | 1182 | ath_dbg(common, ATH_DBG_PS, |
1233 | "Sending PS-Poll to pick a buffered frame\n"); | 1183 | "Sending PS-Poll to pick a buffered frame\n"); |
1234 | sc->ps_flags |= PS_WAIT_FOR_PSPOLL_DATA; | 1184 | sc->ps_flags |= PS_WAIT_FOR_PSPOLL_DATA; |
1235 | } else { | 1185 | } else { |
1236 | ath_print(common, ATH_DBG_PS, | 1186 | ath_dbg(common, ATH_DBG_PS, |
1237 | "Wake up to complete TX\n"); | 1187 | "Wake up to complete TX\n"); |
1238 | sc->ps_flags |= PS_WAIT_FOR_TX_ACK; | 1188 | sc->ps_flags |= PS_WAIT_FOR_TX_ACK; |
1239 | } | 1189 | } |
1240 | /* | 1190 | /* |
@@ -1246,85 +1196,39 @@ static int ath9k_tx(struct ieee80211_hw *hw, | |||
1246 | } | 1196 | } |
1247 | 1197 | ||
1248 | memset(&txctl, 0, sizeof(struct ath_tx_control)); | 1198 | memset(&txctl, 0, sizeof(struct ath_tx_control)); |
1199 | txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)]; | ||
1249 | 1200 | ||
1250 | /* | 1201 | ath_dbg(common, ATH_DBG_XMIT, "transmitting packet, skb: %p\n", skb); |
1251 | * As a temporary workaround, assign seq# here; this will likely need | ||
1252 | * to be cleaned up to work better with Beacon transmission and virtual | ||
1253 | * BSSes. | ||
1254 | */ | ||
1255 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | ||
1256 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) | ||
1257 | sc->tx.seq_no += 0x10; | ||
1258 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | ||
1259 | hdr->seq_ctrl |= cpu_to_le16(sc->tx.seq_no); | ||
1260 | } | ||
1261 | |||
1262 | /* Add the padding after the header if this is not already done */ | ||
1263 | padpos = ath9k_cmn_padpos(hdr->frame_control); | ||
1264 | padsize = padpos & 3; | ||
1265 | if (padsize && skb->len>padpos) { | ||
1266 | if (skb_headroom(skb) < padsize) | ||
1267 | return -1; | ||
1268 | skb_push(skb, padsize); | ||
1269 | memmove(skb->data, skb->data + padsize, padpos); | ||
1270 | } | ||
1271 | |||
1272 | qnum = ath_get_hal_qnum(skb_get_queue_mapping(skb), sc); | ||
1273 | txctl.txq = &sc->tx.txq[qnum]; | ||
1274 | |||
1275 | ath_print(common, ATH_DBG_XMIT, "transmitting packet, skb: %p\n", skb); | ||
1276 | 1202 | ||
1277 | if (ath_tx_start(hw, skb, &txctl) != 0) { | 1203 | if (ath_tx_start(hw, skb, &txctl) != 0) { |
1278 | ath_print(common, ATH_DBG_XMIT, "TX failed\n"); | 1204 | ath_dbg(common, ATH_DBG_XMIT, "TX failed\n"); |
1279 | goto exit; | 1205 | goto exit; |
1280 | } | 1206 | } |
1281 | 1207 | ||
1282 | return 0; | 1208 | return; |
1283 | exit: | 1209 | exit: |
1284 | dev_kfree_skb_any(skb); | 1210 | dev_kfree_skb_any(skb); |
1285 | return 0; | ||
1286 | } | 1211 | } |
1287 | 1212 | ||
1288 | static void ath9k_stop(struct ieee80211_hw *hw) | 1213 | static void ath9k_stop(struct ieee80211_hw *hw) |
1289 | { | 1214 | { |
1290 | struct ath_wiphy *aphy = hw->priv; | 1215 | struct ath_softc *sc = hw->priv; |
1291 | struct ath_softc *sc = aphy->sc; | ||
1292 | struct ath_hw *ah = sc->sc_ah; | 1216 | struct ath_hw *ah = sc->sc_ah; |
1293 | struct ath_common *common = ath9k_hw_common(ah); | 1217 | struct ath_common *common = ath9k_hw_common(ah); |
1294 | int i; | ||
1295 | 1218 | ||
1296 | mutex_lock(&sc->mutex); | 1219 | mutex_lock(&sc->mutex); |
1297 | 1220 | ||
1298 | aphy->state = ATH_WIPHY_INACTIVE; | ||
1299 | |||
1300 | if (led_blink) | ||
1301 | cancel_delayed_work_sync(&sc->ath_led_blink_work); | ||
1302 | |||
1303 | cancel_delayed_work_sync(&sc->tx_complete_work); | 1221 | cancel_delayed_work_sync(&sc->tx_complete_work); |
1222 | cancel_delayed_work_sync(&sc->hw_pll_work); | ||
1304 | cancel_work_sync(&sc->paprd_work); | 1223 | cancel_work_sync(&sc->paprd_work); |
1305 | cancel_work_sync(&sc->hw_check_work); | 1224 | cancel_work_sync(&sc->hw_check_work); |
1306 | 1225 | ||
1307 | for (i = 0; i < sc->num_sec_wiphy; i++) { | ||
1308 | if (sc->sec_wiphy[i]) | ||
1309 | break; | ||
1310 | } | ||
1311 | |||
1312 | if (i == sc->num_sec_wiphy) { | ||
1313 | cancel_delayed_work_sync(&sc->wiphy_work); | ||
1314 | cancel_work_sync(&sc->chan_work); | ||
1315 | } | ||
1316 | |||
1317 | if (sc->sc_flags & SC_OP_INVALID) { | 1226 | if (sc->sc_flags & SC_OP_INVALID) { |
1318 | ath_print(common, ATH_DBG_ANY, "Device not present\n"); | 1227 | ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); |
1319 | mutex_unlock(&sc->mutex); | 1228 | mutex_unlock(&sc->mutex); |
1320 | return; | 1229 | return; |
1321 | } | 1230 | } |
1322 | 1231 | ||
1323 | if (ath9k_wiphy_started(sc)) { | ||
1324 | mutex_unlock(&sc->mutex); | ||
1325 | return; /* another wiphy still in use */ | ||
1326 | } | ||
1327 | |||
1328 | /* Ensure HW is awake when we try to shut it down. */ | 1232 | /* Ensure HW is awake when we try to shut it down. */ |
1329 | ath9k_ps_wakeup(sc); | 1233 | ath9k_ps_wakeup(sc); |
1330 | 1234 | ||
@@ -1334,9 +1238,14 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
1334 | ath9k_btcoex_timer_pause(sc); | 1238 | ath9k_btcoex_timer_pause(sc); |
1335 | } | 1239 | } |
1336 | 1240 | ||
1241 | spin_lock_bh(&sc->sc_pcu_lock); | ||
1242 | |||
1243 | /* prevent tasklets to enable interrupts once we disable them */ | ||
1244 | ah->imask &= ~ATH9K_INT_GLOBAL; | ||
1245 | |||
1337 | /* make sure h/w will not generate any interrupt | 1246 | /* make sure h/w will not generate any interrupt |
1338 | * before setting the invalid flag. */ | 1247 | * before setting the invalid flag. */ |
1339 | ath9k_hw_set_interrupts(ah, 0); | 1248 | ath9k_hw_disable_interrupts(ah); |
1340 | 1249 | ||
1341 | if (!(sc->sc_flags & SC_OP_INVALID)) { | 1250 | if (!(sc->sc_flags & SC_OP_INVALID)) { |
1342 | ath_drain_all_txq(sc, false); | 1251 | ath_drain_all_txq(sc, false); |
@@ -1345,153 +1254,325 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
1345 | } else | 1254 | } else |
1346 | sc->rx.rxlink = NULL; | 1255 | sc->rx.rxlink = NULL; |
1347 | 1256 | ||
1257 | if (sc->rx.frag) { | ||
1258 | dev_kfree_skb_any(sc->rx.frag); | ||
1259 | sc->rx.frag = NULL; | ||
1260 | } | ||
1261 | |||
1348 | /* disable HAL and put h/w to sleep */ | 1262 | /* disable HAL and put h/w to sleep */ |
1349 | ath9k_hw_disable(ah); | 1263 | ath9k_hw_disable(ah); |
1350 | ath9k_hw_configpcipowersave(ah, 1, 1); | 1264 | ath9k_hw_configpcipowersave(ah, 1, 1); |
1265 | |||
1266 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
1267 | |||
1268 | /* we can now sync irq and kill any running tasklets, since we already | ||
1269 | * disabled interrupts and not holding a spin lock */ | ||
1270 | synchronize_irq(sc->irq); | ||
1271 | tasklet_kill(&sc->intr_tq); | ||
1272 | tasklet_kill(&sc->bcon_tasklet); | ||
1273 | |||
1351 | ath9k_ps_restore(sc); | 1274 | ath9k_ps_restore(sc); |
1352 | 1275 | ||
1353 | /* Finally, put the chip in FULL SLEEP mode */ | 1276 | sc->ps_idle = true; |
1354 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); | 1277 | ath_radio_disable(sc, hw); |
1355 | 1278 | ||
1356 | sc->sc_flags |= SC_OP_INVALID; | 1279 | sc->sc_flags |= SC_OP_INVALID; |
1357 | 1280 | ||
1358 | mutex_unlock(&sc->mutex); | 1281 | mutex_unlock(&sc->mutex); |
1359 | 1282 | ||
1360 | ath_print(common, ATH_DBG_CONFIG, "Driver halt\n"); | 1283 | ath_dbg(common, ATH_DBG_CONFIG, "Driver halt\n"); |
1361 | } | 1284 | } |
1362 | 1285 | ||
1363 | static int ath9k_add_interface(struct ieee80211_hw *hw, | 1286 | bool ath9k_uses_beacons(int type) |
1364 | struct ieee80211_vif *vif) | 1287 | { |
1288 | switch (type) { | ||
1289 | case NL80211_IFTYPE_AP: | ||
1290 | case NL80211_IFTYPE_ADHOC: | ||
1291 | case NL80211_IFTYPE_MESH_POINT: | ||
1292 | return true; | ||
1293 | default: | ||
1294 | return false; | ||
1295 | } | ||
1296 | } | ||
1297 | |||
1298 | static void ath9k_reclaim_beacon(struct ath_softc *sc, | ||
1299 | struct ieee80211_vif *vif) | ||
1365 | { | 1300 | { |
1366 | struct ath_wiphy *aphy = hw->priv; | ||
1367 | struct ath_softc *sc = aphy->sc; | ||
1368 | struct ath_hw *ah = sc->sc_ah; | ||
1369 | struct ath_common *common = ath9k_hw_common(ah); | ||
1370 | struct ath_vif *avp = (void *)vif->drv_priv; | 1301 | struct ath_vif *avp = (void *)vif->drv_priv; |
1371 | enum nl80211_iftype ic_opmode = NL80211_IFTYPE_UNSPECIFIED; | ||
1372 | int ret = 0; | ||
1373 | 1302 | ||
1374 | mutex_lock(&sc->mutex); | 1303 | ath9k_set_beaconing_status(sc, false); |
1304 | ath_beacon_return(sc, avp); | ||
1305 | ath9k_set_beaconing_status(sc, true); | ||
1306 | sc->sc_flags &= ~SC_OP_BEACONS; | ||
1307 | } | ||
1375 | 1308 | ||
1376 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) && | 1309 | static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) |
1377 | sc->nvifs > 0) { | 1310 | { |
1378 | ret = -ENOBUFS; | 1311 | struct ath9k_vif_iter_data *iter_data = data; |
1379 | goto out; | 1312 | int i; |
1380 | } | 1313 | |
1314 | if (iter_data->hw_macaddr) | ||
1315 | for (i = 0; i < ETH_ALEN; i++) | ||
1316 | iter_data->mask[i] &= | ||
1317 | ~(iter_data->hw_macaddr[i] ^ mac[i]); | ||
1381 | 1318 | ||
1382 | switch (vif->type) { | 1319 | switch (vif->type) { |
1320 | case NL80211_IFTYPE_AP: | ||
1321 | iter_data->naps++; | ||
1322 | break; | ||
1383 | case NL80211_IFTYPE_STATION: | 1323 | case NL80211_IFTYPE_STATION: |
1384 | ic_opmode = NL80211_IFTYPE_STATION; | 1324 | iter_data->nstations++; |
1385 | break; | 1325 | break; |
1386 | case NL80211_IFTYPE_ADHOC: | 1326 | case NL80211_IFTYPE_ADHOC: |
1387 | case NL80211_IFTYPE_AP: | 1327 | iter_data->nadhocs++; |
1328 | break; | ||
1388 | case NL80211_IFTYPE_MESH_POINT: | 1329 | case NL80211_IFTYPE_MESH_POINT: |
1389 | if (sc->nbcnvifs >= ATH_BCBUF) { | 1330 | iter_data->nmeshes++; |
1390 | ret = -ENOBUFS; | 1331 | break; |
1391 | goto out; | 1332 | case NL80211_IFTYPE_WDS: |
1392 | } | 1333 | iter_data->nwds++; |
1393 | ic_opmode = vif->type; | ||
1394 | break; | 1334 | break; |
1395 | default: | 1335 | default: |
1396 | ath_print(common, ATH_DBG_FATAL, | 1336 | iter_data->nothers++; |
1397 | "Interface type %d not yet supported\n", vif->type); | 1337 | break; |
1398 | ret = -EOPNOTSUPP; | ||
1399 | goto out; | ||
1400 | } | 1338 | } |
1339 | } | ||
1401 | 1340 | ||
1402 | ath_print(common, ATH_DBG_CONFIG, | 1341 | /* Called with sc->mutex held. */ |
1403 | "Attach a VIF of type: %d\n", ic_opmode); | 1342 | void ath9k_calculate_iter_data(struct ieee80211_hw *hw, |
1343 | struct ieee80211_vif *vif, | ||
1344 | struct ath9k_vif_iter_data *iter_data) | ||
1345 | { | ||
1346 | struct ath_softc *sc = hw->priv; | ||
1347 | struct ath_hw *ah = sc->sc_ah; | ||
1348 | struct ath_common *common = ath9k_hw_common(ah); | ||
1349 | |||
1350 | /* | ||
1351 | * Use the hardware MAC address as reference, the hardware uses it | ||
1352 | * together with the BSSID mask when matching addresses. | ||
1353 | */ | ||
1354 | memset(iter_data, 0, sizeof(*iter_data)); | ||
1355 | iter_data->hw_macaddr = common->macaddr; | ||
1356 | memset(&iter_data->mask, 0xff, ETH_ALEN); | ||
1404 | 1357 | ||
1405 | /* Set the VIF opmode */ | 1358 | if (vif) |
1406 | avp->av_opmode = ic_opmode; | 1359 | ath9k_vif_iter(iter_data, vif->addr, vif); |
1407 | avp->av_bslot = -1; | ||
1408 | 1360 | ||
1409 | sc->nvifs++; | 1361 | /* Get list of all active MAC addresses */ |
1362 | ieee80211_iterate_active_interfaces_atomic(sc->hw, ath9k_vif_iter, | ||
1363 | iter_data); | ||
1364 | } | ||
1365 | |||
1366 | /* Called with sc->mutex held. */ | ||
1367 | static void ath9k_calculate_summary_state(struct ieee80211_hw *hw, | ||
1368 | struct ieee80211_vif *vif) | ||
1369 | { | ||
1370 | struct ath_softc *sc = hw->priv; | ||
1371 | struct ath_hw *ah = sc->sc_ah; | ||
1372 | struct ath_common *common = ath9k_hw_common(ah); | ||
1373 | struct ath9k_vif_iter_data iter_data; | ||
1410 | 1374 | ||
1411 | if (ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) | 1375 | ath9k_calculate_iter_data(hw, vif, &iter_data); |
1412 | ath9k_set_bssid_mask(hw); | ||
1413 | 1376 | ||
1414 | if (sc->nvifs > 1) | 1377 | /* Set BSSID mask. */ |
1415 | goto out; /* skip global settings for secondary vif */ | 1378 | memcpy(common->bssidmask, iter_data.mask, ETH_ALEN); |
1379 | ath_hw_setbssidmask(common); | ||
1416 | 1380 | ||
1417 | if (ic_opmode == NL80211_IFTYPE_AP) { | 1381 | /* Set op-mode & TSF */ |
1382 | if (iter_data.naps > 0) { | ||
1418 | ath9k_hw_set_tsfadjust(ah, 1); | 1383 | ath9k_hw_set_tsfadjust(ah, 1); |
1419 | sc->sc_flags |= SC_OP_TSF_RESET; | 1384 | sc->sc_flags |= SC_OP_TSF_RESET; |
1385 | ah->opmode = NL80211_IFTYPE_AP; | ||
1386 | } else { | ||
1387 | ath9k_hw_set_tsfadjust(ah, 0); | ||
1388 | sc->sc_flags &= ~SC_OP_TSF_RESET; | ||
1389 | |||
1390 | if (iter_data.nmeshes) | ||
1391 | ah->opmode = NL80211_IFTYPE_MESH_POINT; | ||
1392 | else if (iter_data.nwds) | ||
1393 | ah->opmode = NL80211_IFTYPE_AP; | ||
1394 | else if (iter_data.nadhocs) | ||
1395 | ah->opmode = NL80211_IFTYPE_ADHOC; | ||
1396 | else | ||
1397 | ah->opmode = NL80211_IFTYPE_STATION; | ||
1420 | } | 1398 | } |
1421 | 1399 | ||
1422 | /* Set the device opmode */ | ||
1423 | ah->opmode = ic_opmode; | ||
1424 | |||
1425 | /* | 1400 | /* |
1426 | * Enable MIB interrupts when there are hardware phy counters. | 1401 | * Enable MIB interrupts when there are hardware phy counters. |
1427 | * Note we only do this (at the moment) for station mode. | ||
1428 | */ | 1402 | */ |
1429 | if ((vif->type == NL80211_IFTYPE_STATION) || | 1403 | if ((iter_data.nstations + iter_data.nadhocs + iter_data.nmeshes) > 0) { |
1430 | (vif->type == NL80211_IFTYPE_ADHOC) || | ||
1431 | (vif->type == NL80211_IFTYPE_MESH_POINT)) { | ||
1432 | if (ah->config.enable_ani) | 1404 | if (ah->config.enable_ani) |
1433 | ah->imask |= ATH9K_INT_MIB; | 1405 | ah->imask |= ATH9K_INT_MIB; |
1434 | ah->imask |= ATH9K_INT_TSFOOR; | 1406 | ah->imask |= ATH9K_INT_TSFOOR; |
1407 | } else { | ||
1408 | ah->imask &= ~ATH9K_INT_MIB; | ||
1409 | ah->imask &= ~ATH9K_INT_TSFOOR; | ||
1435 | } | 1410 | } |
1436 | 1411 | ||
1437 | ath9k_hw_set_interrupts(ah, ah->imask); | 1412 | ath9k_hw_set_interrupts(ah, ah->imask); |
1438 | 1413 | ||
1439 | if (vif->type == NL80211_IFTYPE_AP || | 1414 | /* Set up ANI */ |
1440 | vif->type == NL80211_IFTYPE_ADHOC || | 1415 | if ((iter_data.naps + iter_data.nadhocs) > 0) { |
1441 | vif->type == NL80211_IFTYPE_MONITOR) { | 1416 | sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; |
1442 | sc->sc_flags |= SC_OP_ANI_RUN; | 1417 | sc->sc_flags |= SC_OP_ANI_RUN; |
1443 | ath_start_ani(common); | 1418 | ath_start_ani(common); |
1419 | } else { | ||
1420 | sc->sc_flags &= ~SC_OP_ANI_RUN; | ||
1421 | del_timer_sync(&common->ani.timer); | ||
1444 | } | 1422 | } |
1423 | } | ||
1424 | |||
1425 | /* Called with sc->mutex held, vif counts set up properly. */ | ||
1426 | static void ath9k_do_vif_add_setup(struct ieee80211_hw *hw, | ||
1427 | struct ieee80211_vif *vif) | ||
1428 | { | ||
1429 | struct ath_softc *sc = hw->priv; | ||
1430 | |||
1431 | ath9k_calculate_summary_state(hw, vif); | ||
1432 | |||
1433 | if (ath9k_uses_beacons(vif->type)) { | ||
1434 | int error; | ||
1435 | /* This may fail because upper levels do not have beacons | ||
1436 | * properly configured yet. That's OK, we assume it | ||
1437 | * will be properly configured and then we will be notified | ||
1438 | * in the info_changed method and set up beacons properly | ||
1439 | * there. | ||
1440 | */ | ||
1441 | ath9k_set_beaconing_status(sc, false); | ||
1442 | error = ath_beacon_alloc(sc, vif); | ||
1443 | if (!error) | ||
1444 | ath_beacon_config(sc, vif); | ||
1445 | ath9k_set_beaconing_status(sc, true); | ||
1446 | } | ||
1447 | } | ||
1445 | 1448 | ||
1449 | |||
1450 | static int ath9k_add_interface(struct ieee80211_hw *hw, | ||
1451 | struct ieee80211_vif *vif) | ||
1452 | { | ||
1453 | struct ath_softc *sc = hw->priv; | ||
1454 | struct ath_hw *ah = sc->sc_ah; | ||
1455 | struct ath_common *common = ath9k_hw_common(ah); | ||
1456 | int ret = 0; | ||
1457 | |||
1458 | ath9k_ps_wakeup(sc); | ||
1459 | mutex_lock(&sc->mutex); | ||
1460 | |||
1461 | switch (vif->type) { | ||
1462 | case NL80211_IFTYPE_STATION: | ||
1463 | case NL80211_IFTYPE_WDS: | ||
1464 | case NL80211_IFTYPE_ADHOC: | ||
1465 | case NL80211_IFTYPE_AP: | ||
1466 | case NL80211_IFTYPE_MESH_POINT: | ||
1467 | break; | ||
1468 | default: | ||
1469 | ath_err(common, "Interface type %d not yet supported\n", | ||
1470 | vif->type); | ||
1471 | ret = -EOPNOTSUPP; | ||
1472 | goto out; | ||
1473 | } | ||
1474 | |||
1475 | if (ath9k_uses_beacons(vif->type)) { | ||
1476 | if (sc->nbcnvifs >= ATH_BCBUF) { | ||
1477 | ath_err(common, "Not enough beacon buffers when adding" | ||
1478 | " new interface of type: %i\n", | ||
1479 | vif->type); | ||
1480 | ret = -ENOBUFS; | ||
1481 | goto out; | ||
1482 | } | ||
1483 | } | ||
1484 | |||
1485 | if ((ah->opmode == NL80211_IFTYPE_ADHOC) || | ||
1486 | ((vif->type == NL80211_IFTYPE_ADHOC) && | ||
1487 | sc->nvifs > 0)) { | ||
1488 | ath_err(common, "Cannot create ADHOC interface when other" | ||
1489 | " interfaces already exist.\n"); | ||
1490 | ret = -EINVAL; | ||
1491 | goto out; | ||
1492 | } | ||
1493 | |||
1494 | ath_dbg(common, ATH_DBG_CONFIG, | ||
1495 | "Attach a VIF of type: %d\n", vif->type); | ||
1496 | |||
1497 | sc->nvifs++; | ||
1498 | |||
1499 | ath9k_do_vif_add_setup(hw, vif); | ||
1446 | out: | 1500 | out: |
1447 | mutex_unlock(&sc->mutex); | 1501 | mutex_unlock(&sc->mutex); |
1502 | ath9k_ps_restore(sc); | ||
1448 | return ret; | 1503 | return ret; |
1449 | } | 1504 | } |
1450 | 1505 | ||
1451 | static void ath9k_remove_interface(struct ieee80211_hw *hw, | 1506 | static int ath9k_change_interface(struct ieee80211_hw *hw, |
1452 | struct ieee80211_vif *vif) | 1507 | struct ieee80211_vif *vif, |
1508 | enum nl80211_iftype new_type, | ||
1509 | bool p2p) | ||
1453 | { | 1510 | { |
1454 | struct ath_wiphy *aphy = hw->priv; | 1511 | struct ath_softc *sc = hw->priv; |
1455 | struct ath_softc *sc = aphy->sc; | ||
1456 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1512 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1457 | struct ath_vif *avp = (void *)vif->drv_priv; | 1513 | int ret = 0; |
1458 | int i; | ||
1459 | |||
1460 | ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n"); | ||
1461 | 1514 | ||
1515 | ath_dbg(common, ATH_DBG_CONFIG, "Change Interface\n"); | ||
1462 | mutex_lock(&sc->mutex); | 1516 | mutex_lock(&sc->mutex); |
1517 | ath9k_ps_wakeup(sc); | ||
1463 | 1518 | ||
1464 | /* Stop ANI */ | 1519 | /* See if new interface type is valid. */ |
1465 | sc->sc_flags &= ~SC_OP_ANI_RUN; | 1520 | if ((new_type == NL80211_IFTYPE_ADHOC) && |
1466 | del_timer_sync(&common->ani.timer); | 1521 | (sc->nvifs > 1)) { |
1467 | 1522 | ath_err(common, "When using ADHOC, it must be the only" | |
1468 | /* Reclaim beacon resources */ | 1523 | " interface.\n"); |
1469 | if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || | 1524 | ret = -EINVAL; |
1470 | (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || | 1525 | goto out; |
1471 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { | ||
1472 | ath9k_ps_wakeup(sc); | ||
1473 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | ||
1474 | ath9k_ps_restore(sc); | ||
1475 | } | 1526 | } |
1476 | 1527 | ||
1477 | ath_beacon_return(sc, avp); | 1528 | if (ath9k_uses_beacons(new_type) && |
1478 | sc->sc_flags &= ~SC_OP_BEACONS; | 1529 | !ath9k_uses_beacons(vif->type)) { |
1479 | 1530 | if (sc->nbcnvifs >= ATH_BCBUF) { | |
1480 | for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) { | 1531 | ath_err(common, "No beacon slot available\n"); |
1481 | if (sc->beacon.bslot[i] == vif) { | 1532 | ret = -ENOBUFS; |
1482 | printk(KERN_DEBUG "%s: vif had allocated beacon " | 1533 | goto out; |
1483 | "slot\n", __func__); | ||
1484 | sc->beacon.bslot[i] = NULL; | ||
1485 | sc->beacon.bslot_aphy[i] = NULL; | ||
1486 | } | 1534 | } |
1487 | } | 1535 | } |
1488 | 1536 | ||
1537 | /* Clean up old vif stuff */ | ||
1538 | if (ath9k_uses_beacons(vif->type)) | ||
1539 | ath9k_reclaim_beacon(sc, vif); | ||
1540 | |||
1541 | /* Add new settings */ | ||
1542 | vif->type = new_type; | ||
1543 | vif->p2p = p2p; | ||
1544 | |||
1545 | ath9k_do_vif_add_setup(hw, vif); | ||
1546 | out: | ||
1547 | ath9k_ps_restore(sc); | ||
1548 | mutex_unlock(&sc->mutex); | ||
1549 | return ret; | ||
1550 | } | ||
1551 | |||
1552 | static void ath9k_remove_interface(struct ieee80211_hw *hw, | ||
1553 | struct ieee80211_vif *vif) | ||
1554 | { | ||
1555 | struct ath_softc *sc = hw->priv; | ||
1556 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
1557 | |||
1558 | ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n"); | ||
1559 | |||
1560 | ath9k_ps_wakeup(sc); | ||
1561 | mutex_lock(&sc->mutex); | ||
1562 | |||
1489 | sc->nvifs--; | 1563 | sc->nvifs--; |
1490 | 1564 | ||
1565 | /* Reclaim beacon resources */ | ||
1566 | if (ath9k_uses_beacons(vif->type)) | ||
1567 | ath9k_reclaim_beacon(sc, vif); | ||
1568 | |||
1569 | ath9k_calculate_summary_state(hw, NULL); | ||
1570 | |||
1491 | mutex_unlock(&sc->mutex); | 1571 | mutex_unlock(&sc->mutex); |
1572 | ath9k_ps_restore(sc); | ||
1492 | } | 1573 | } |
1493 | 1574 | ||
1494 | void ath9k_enable_ps(struct ath_softc *sc) | 1575 | static void ath9k_enable_ps(struct ath_softc *sc) |
1495 | { | 1576 | { |
1496 | struct ath_hw *ah = sc->sc_ah; | 1577 | struct ath_hw *ah = sc->sc_ah; |
1497 | 1578 | ||
@@ -1505,14 +1586,33 @@ void ath9k_enable_ps(struct ath_softc *sc) | |||
1505 | } | 1586 | } |
1506 | } | 1587 | } |
1507 | 1588 | ||
1589 | static void ath9k_disable_ps(struct ath_softc *sc) | ||
1590 | { | ||
1591 | struct ath_hw *ah = sc->sc_ah; | ||
1592 | |||
1593 | sc->ps_enabled = false; | ||
1594 | ath9k_hw_setpower(ah, ATH9K_PM_AWAKE); | ||
1595 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { | ||
1596 | ath9k_hw_setrxabort(ah, 0); | ||
1597 | sc->ps_flags &= ~(PS_WAIT_FOR_BEACON | | ||
1598 | PS_WAIT_FOR_CAB | | ||
1599 | PS_WAIT_FOR_PSPOLL_DATA | | ||
1600 | PS_WAIT_FOR_TX_ACK); | ||
1601 | if (ah->imask & ATH9K_INT_TIM_TIMER) { | ||
1602 | ah->imask &= ~ATH9K_INT_TIM_TIMER; | ||
1603 | ath9k_hw_set_interrupts(ah, ah->imask); | ||
1604 | } | ||
1605 | } | ||
1606 | |||
1607 | } | ||
1608 | |||
1508 | static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | 1609 | static int ath9k_config(struct ieee80211_hw *hw, u32 changed) |
1509 | { | 1610 | { |
1510 | struct ath_wiphy *aphy = hw->priv; | 1611 | struct ath_softc *sc = hw->priv; |
1511 | struct ath_softc *sc = aphy->sc; | ||
1512 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
1513 | struct ieee80211_conf *conf = &hw->conf; | ||
1514 | struct ath_hw *ah = sc->sc_ah; | 1612 | struct ath_hw *ah = sc->sc_ah; |
1515 | bool disable_radio; | 1613 | struct ath_common *common = ath9k_hw_common(ah); |
1614 | struct ieee80211_conf *conf = &hw->conf; | ||
1615 | bool disable_radio = false; | ||
1516 | 1616 | ||
1517 | mutex_lock(&sc->mutex); | 1617 | mutex_lock(&sc->mutex); |
1518 | 1618 | ||
@@ -1523,29 +1623,13 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1523 | * the end. | 1623 | * the end. |
1524 | */ | 1624 | */ |
1525 | if (changed & IEEE80211_CONF_CHANGE_IDLE) { | 1625 | if (changed & IEEE80211_CONF_CHANGE_IDLE) { |
1526 | bool enable_radio; | 1626 | sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); |
1527 | bool all_wiphys_idle; | 1627 | if (!sc->ps_idle) { |
1528 | bool idle = !!(conf->flags & IEEE80211_CONF_IDLE); | ||
1529 | |||
1530 | spin_lock_bh(&sc->wiphy_lock); | ||
1531 | all_wiphys_idle = ath9k_all_wiphys_idle(sc); | ||
1532 | ath9k_set_wiphy_idle(aphy, idle); | ||
1533 | |||
1534 | enable_radio = (!idle && all_wiphys_idle); | ||
1535 | |||
1536 | /* | ||
1537 | * After we unlock here its possible another wiphy | ||
1538 | * can be re-renabled so to account for that we will | ||
1539 | * only disable the radio toward the end of this routine | ||
1540 | * if by then all wiphys are still idle. | ||
1541 | */ | ||
1542 | spin_unlock_bh(&sc->wiphy_lock); | ||
1543 | |||
1544 | if (enable_radio) { | ||
1545 | sc->ps_idle = false; | ||
1546 | ath_radio_enable(sc, hw); | 1628 | ath_radio_enable(sc, hw); |
1547 | ath_print(common, ATH_DBG_CONFIG, | 1629 | ath_dbg(common, ATH_DBG_CONFIG, |
1548 | "not-idle: enabling radio\n"); | 1630 | "not-idle: enabling radio\n"); |
1631 | } else { | ||
1632 | disable_radio = true; | ||
1549 | } | 1633 | } |
1550 | } | 1634 | } |
1551 | 1635 | ||
@@ -1556,96 +1640,100 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1556 | * IEEE80211_CONF_CHANGE_PS is only passed by mac80211 for STA mode. | 1640 | * IEEE80211_CONF_CHANGE_PS is only passed by mac80211 for STA mode. |
1557 | */ | 1641 | */ |
1558 | if (changed & IEEE80211_CONF_CHANGE_PS) { | 1642 | if (changed & IEEE80211_CONF_CHANGE_PS) { |
1559 | if (conf->flags & IEEE80211_CONF_PS) { | 1643 | unsigned long flags; |
1560 | sc->ps_flags |= PS_ENABLED; | 1644 | spin_lock_irqsave(&sc->sc_pm_lock, flags); |
1561 | /* | 1645 | if (conf->flags & IEEE80211_CONF_PS) |
1562 | * At this point we know hardware has received an ACK | 1646 | ath9k_enable_ps(sc); |
1563 | * of a previously sent null data frame. | 1647 | else |
1564 | */ | 1648 | ath9k_disable_ps(sc); |
1565 | if ((sc->ps_flags & PS_NULLFUNC_COMPLETED)) { | 1649 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |
1566 | sc->ps_flags &= ~PS_NULLFUNC_COMPLETED; | ||
1567 | ath9k_enable_ps(sc); | ||
1568 | } | ||
1569 | } else { | ||
1570 | sc->ps_enabled = false; | ||
1571 | sc->ps_flags &= ~(PS_ENABLED | | ||
1572 | PS_NULLFUNC_COMPLETED); | ||
1573 | ath9k_setpower(sc, ATH9K_PM_AWAKE); | ||
1574 | if (!(ah->caps.hw_caps & | ||
1575 | ATH9K_HW_CAP_AUTOSLEEP)) { | ||
1576 | ath9k_hw_setrxabort(sc->sc_ah, 0); | ||
1577 | sc->ps_flags &= ~(PS_WAIT_FOR_BEACON | | ||
1578 | PS_WAIT_FOR_CAB | | ||
1579 | PS_WAIT_FOR_PSPOLL_DATA | | ||
1580 | PS_WAIT_FOR_TX_ACK); | ||
1581 | if (ah->imask & ATH9K_INT_TIM_TIMER) { | ||
1582 | ah->imask &= ~ATH9K_INT_TIM_TIMER; | ||
1583 | ath9k_hw_set_interrupts(sc->sc_ah, | ||
1584 | ah->imask); | ||
1585 | } | ||
1586 | } | ||
1587 | } | ||
1588 | } | 1650 | } |
1589 | 1651 | ||
1590 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) { | 1652 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) { |
1591 | if (conf->flags & IEEE80211_CONF_MONITOR) { | 1653 | if (conf->flags & IEEE80211_CONF_MONITOR) { |
1592 | ath_print(common, ATH_DBG_CONFIG, | 1654 | ath_dbg(common, ATH_DBG_CONFIG, |
1593 | "HW opmode set to Monitor mode\n"); | 1655 | "Monitor mode is enabled\n"); |
1594 | sc->sc_ah->opmode = NL80211_IFTYPE_MONITOR; | 1656 | sc->sc_ah->is_monitoring = true; |
1657 | } else { | ||
1658 | ath_dbg(common, ATH_DBG_CONFIG, | ||
1659 | "Monitor mode is disabled\n"); | ||
1660 | sc->sc_ah->is_monitoring = false; | ||
1595 | } | 1661 | } |
1596 | } | 1662 | } |
1597 | 1663 | ||
1598 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { | 1664 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { |
1599 | struct ieee80211_channel *curchan = hw->conf.channel; | 1665 | struct ieee80211_channel *curchan = hw->conf.channel; |
1600 | int pos = curchan->hw_value; | 1666 | int pos = curchan->hw_value; |
1667 | int old_pos = -1; | ||
1668 | unsigned long flags; | ||
1669 | |||
1670 | if (ah->curchan) | ||
1671 | old_pos = ah->curchan - &ah->channels[0]; | ||
1601 | 1672 | ||
1602 | aphy->chan_idx = pos; | ||
1603 | aphy->chan_is_ht = conf_is_ht(conf); | ||
1604 | if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) | 1673 | if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) |
1605 | sc->sc_flags |= SC_OP_OFFCHANNEL; | 1674 | sc->sc_flags |= SC_OP_OFFCHANNEL; |
1606 | else | 1675 | else |
1607 | sc->sc_flags &= ~SC_OP_OFFCHANNEL; | 1676 | sc->sc_flags &= ~SC_OP_OFFCHANNEL; |
1608 | 1677 | ||
1609 | if (aphy->state == ATH_WIPHY_SCAN || | 1678 | ath_dbg(common, ATH_DBG_CONFIG, |
1610 | aphy->state == ATH_WIPHY_ACTIVE) | 1679 | "Set channel: %d MHz type: %d\n", |
1611 | ath9k_wiphy_pause_all_forced(sc, aphy); | 1680 | curchan->center_freq, conf->channel_type); |
1612 | else { | ||
1613 | /* | ||
1614 | * Do not change operational channel based on a paused | ||
1615 | * wiphy changes. | ||
1616 | */ | ||
1617 | goto skip_chan_change; | ||
1618 | } | ||
1619 | 1681 | ||
1620 | ath_print(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n", | 1682 | ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos], |
1621 | curchan->center_freq); | 1683 | curchan, conf->channel_type); |
1622 | 1684 | ||
1623 | /* XXX: remove me eventualy */ | 1685 | /* update survey stats for the old channel before switching */ |
1624 | ath9k_update_ichannel(sc, hw, &sc->sc_ah->channels[pos]); | 1686 | spin_lock_irqsave(&common->cc_lock, flags); |
1687 | ath_update_survey_stats(sc); | ||
1688 | spin_unlock_irqrestore(&common->cc_lock, flags); | ||
1625 | 1689 | ||
1626 | ath_update_chainmask(sc, conf_is_ht(conf)); | 1690 | /* |
1691 | * If the operating channel changes, change the survey in-use flags | ||
1692 | * along with it. | ||
1693 | * Reset the survey data for the new channel, unless we're switching | ||
1694 | * back to the operating channel from an off-channel operation. | ||
1695 | */ | ||
1696 | if (!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) && | ||
1697 | sc->cur_survey != &sc->survey[pos]) { | ||
1698 | |||
1699 | if (sc->cur_survey) | ||
1700 | sc->cur_survey->filled &= ~SURVEY_INFO_IN_USE; | ||
1701 | |||
1702 | sc->cur_survey = &sc->survey[pos]; | ||
1703 | |||
1704 | memset(sc->cur_survey, 0, sizeof(struct survey_info)); | ||
1705 | sc->cur_survey->filled |= SURVEY_INFO_IN_USE; | ||
1706 | } else if (!(sc->survey[pos].filled & SURVEY_INFO_IN_USE)) { | ||
1707 | memset(&sc->survey[pos], 0, sizeof(struct survey_info)); | ||
1708 | } | ||
1627 | 1709 | ||
1628 | if (ath_set_channel(sc, hw, &sc->sc_ah->channels[pos]) < 0) { | 1710 | if (ath_set_channel(sc, hw, &sc->sc_ah->channels[pos]) < 0) { |
1629 | ath_print(common, ATH_DBG_FATAL, | 1711 | ath_err(common, "Unable to set channel\n"); |
1630 | "Unable to set channel\n"); | ||
1631 | mutex_unlock(&sc->mutex); | 1712 | mutex_unlock(&sc->mutex); |
1632 | return -EINVAL; | 1713 | return -EINVAL; |
1633 | } | 1714 | } |
1715 | |||
1716 | /* | ||
1717 | * The most recent snapshot of channel->noisefloor for the old | ||
1718 | * channel is only available after the hardware reset. Copy it to | ||
1719 | * the survey stats now. | ||
1720 | */ | ||
1721 | if (old_pos >= 0) | ||
1722 | ath_update_survey_nf(sc, old_pos); | ||
1634 | } | 1723 | } |
1635 | 1724 | ||
1636 | skip_chan_change: | ||
1637 | if (changed & IEEE80211_CONF_CHANGE_POWER) { | 1725 | if (changed & IEEE80211_CONF_CHANGE_POWER) { |
1726 | ath_dbg(common, ATH_DBG_CONFIG, | ||
1727 | "Set power: %d\n", conf->power_level); | ||
1638 | sc->config.txpowlimit = 2 * conf->power_level; | 1728 | sc->config.txpowlimit = 2 * conf->power_level; |
1639 | ath_update_txpow(sc); | 1729 | ath9k_ps_wakeup(sc); |
1730 | ath9k_cmn_update_txpow(ah, sc->curtxpow, | ||
1731 | sc->config.txpowlimit, &sc->curtxpow); | ||
1732 | ath9k_ps_restore(sc); | ||
1640 | } | 1733 | } |
1641 | 1734 | ||
1642 | spin_lock_bh(&sc->wiphy_lock); | ||
1643 | disable_radio = ath9k_all_wiphys_idle(sc); | ||
1644 | spin_unlock_bh(&sc->wiphy_lock); | ||
1645 | |||
1646 | if (disable_radio) { | 1735 | if (disable_radio) { |
1647 | ath_print(common, ATH_DBG_CONFIG, "idle: disabling radio\n"); | 1736 | ath_dbg(common, ATH_DBG_CONFIG, "idle: disabling radio\n"); |
1648 | sc->ps_idle = true; | ||
1649 | ath_radio_disable(sc, hw); | 1737 | ath_radio_disable(sc, hw); |
1650 | } | 1738 | } |
1651 | 1739 | ||
@@ -1661,6 +1749,7 @@ skip_chan_change: | |||
1661 | FIF_PSPOLL | \ | 1749 | FIF_PSPOLL | \ |
1662 | FIF_OTHER_BSS | \ | 1750 | FIF_OTHER_BSS | \ |
1663 | FIF_BCN_PRBRESP_PROMISC | \ | 1751 | FIF_BCN_PRBRESP_PROMISC | \ |
1752 | FIF_PROBE_REQ | \ | ||
1664 | FIF_FCSFAIL) | 1753 | FIF_FCSFAIL) |
1665 | 1754 | ||
1666 | /* FIXME: sc->sc_full_reset ? */ | 1755 | /* FIXME: sc->sc_full_reset ? */ |
@@ -1669,8 +1758,7 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw, | |||
1669 | unsigned int *total_flags, | 1758 | unsigned int *total_flags, |
1670 | u64 multicast) | 1759 | u64 multicast) |
1671 | { | 1760 | { |
1672 | struct ath_wiphy *aphy = hw->priv; | 1761 | struct ath_softc *sc = hw->priv; |
1673 | struct ath_softc *sc = aphy->sc; | ||
1674 | u32 rfilt; | 1762 | u32 rfilt; |
1675 | 1763 | ||
1676 | changed_flags &= SUPPORTED_FILTERS; | 1764 | changed_flags &= SUPPORTED_FILTERS; |
@@ -1682,46 +1770,92 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw, | |||
1682 | ath9k_hw_setrxfilter(sc->sc_ah, rfilt); | 1770 | ath9k_hw_setrxfilter(sc->sc_ah, rfilt); |
1683 | ath9k_ps_restore(sc); | 1771 | ath9k_ps_restore(sc); |
1684 | 1772 | ||
1685 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG, | 1773 | ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG, |
1686 | "Set HW RX filter: 0x%x\n", rfilt); | 1774 | "Set HW RX filter: 0x%x\n", rfilt); |
1687 | } | 1775 | } |
1688 | 1776 | ||
1689 | static int ath9k_sta_add(struct ieee80211_hw *hw, | 1777 | static int ath9k_sta_add(struct ieee80211_hw *hw, |
1690 | struct ieee80211_vif *vif, | 1778 | struct ieee80211_vif *vif, |
1691 | struct ieee80211_sta *sta) | 1779 | struct ieee80211_sta *sta) |
1692 | { | 1780 | { |
1693 | struct ath_wiphy *aphy = hw->priv; | 1781 | struct ath_softc *sc = hw->priv; |
1694 | struct ath_softc *sc = aphy->sc; | 1782 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1783 | struct ath_node *an = (struct ath_node *) sta->drv_priv; | ||
1784 | struct ieee80211_key_conf ps_key = { }; | ||
1695 | 1785 | ||
1696 | ath_node_attach(sc, sta); | 1786 | ath_node_attach(sc, sta); |
1697 | 1787 | ||
1788 | if (vif->type != NL80211_IFTYPE_AP && | ||
1789 | vif->type != NL80211_IFTYPE_AP_VLAN) | ||
1790 | return 0; | ||
1791 | |||
1792 | an->ps_key = ath_key_config(common, vif, sta, &ps_key); | ||
1793 | |||
1698 | return 0; | 1794 | return 0; |
1699 | } | 1795 | } |
1700 | 1796 | ||
1797 | static void ath9k_del_ps_key(struct ath_softc *sc, | ||
1798 | struct ieee80211_vif *vif, | ||
1799 | struct ieee80211_sta *sta) | ||
1800 | { | ||
1801 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
1802 | struct ath_node *an = (struct ath_node *) sta->drv_priv; | ||
1803 | struct ieee80211_key_conf ps_key = { .hw_key_idx = an->ps_key }; | ||
1804 | |||
1805 | if (!an->ps_key) | ||
1806 | return; | ||
1807 | |||
1808 | ath_key_delete(common, &ps_key); | ||
1809 | } | ||
1810 | |||
1701 | static int ath9k_sta_remove(struct ieee80211_hw *hw, | 1811 | static int ath9k_sta_remove(struct ieee80211_hw *hw, |
1702 | struct ieee80211_vif *vif, | 1812 | struct ieee80211_vif *vif, |
1703 | struct ieee80211_sta *sta) | 1813 | struct ieee80211_sta *sta) |
1704 | { | 1814 | { |
1705 | struct ath_wiphy *aphy = hw->priv; | 1815 | struct ath_softc *sc = hw->priv; |
1706 | struct ath_softc *sc = aphy->sc; | ||
1707 | 1816 | ||
1817 | ath9k_del_ps_key(sc, vif, sta); | ||
1708 | ath_node_detach(sc, sta); | 1818 | ath_node_detach(sc, sta); |
1709 | 1819 | ||
1710 | return 0; | 1820 | return 0; |
1711 | } | 1821 | } |
1712 | 1822 | ||
1823 | static void ath9k_sta_notify(struct ieee80211_hw *hw, | ||
1824 | struct ieee80211_vif *vif, | ||
1825 | enum sta_notify_cmd cmd, | ||
1826 | struct ieee80211_sta *sta) | ||
1827 | { | ||
1828 | struct ath_softc *sc = hw->priv; | ||
1829 | struct ath_node *an = (struct ath_node *) sta->drv_priv; | ||
1830 | |||
1831 | switch (cmd) { | ||
1832 | case STA_NOTIFY_SLEEP: | ||
1833 | an->sleeping = true; | ||
1834 | if (ath_tx_aggr_sleep(sc, an)) | ||
1835 | ieee80211_sta_set_tim(sta); | ||
1836 | break; | ||
1837 | case STA_NOTIFY_AWAKE: | ||
1838 | an->sleeping = false; | ||
1839 | ath_tx_aggr_wakeup(sc, an); | ||
1840 | break; | ||
1841 | } | ||
1842 | } | ||
1843 | |||
1713 | static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue, | 1844 | static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue, |
1714 | const struct ieee80211_tx_queue_params *params) | 1845 | const struct ieee80211_tx_queue_params *params) |
1715 | { | 1846 | { |
1716 | struct ath_wiphy *aphy = hw->priv; | 1847 | struct ath_softc *sc = hw->priv; |
1717 | struct ath_softc *sc = aphy->sc; | ||
1718 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1848 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1849 | struct ath_txq *txq; | ||
1719 | struct ath9k_tx_queue_info qi; | 1850 | struct ath9k_tx_queue_info qi; |
1720 | int ret = 0, qnum; | 1851 | int ret = 0; |
1721 | 1852 | ||
1722 | if (queue >= WME_NUM_AC) | 1853 | if (queue >= WME_NUM_AC) |
1723 | return 0; | 1854 | return 0; |
1724 | 1855 | ||
1856 | txq = sc->tx.txq_map[queue]; | ||
1857 | |||
1858 | ath9k_ps_wakeup(sc); | ||
1725 | mutex_lock(&sc->mutex); | 1859 | mutex_lock(&sc->mutex); |
1726 | 1860 | ||
1727 | memset(&qi, 0, sizeof(struct ath9k_tx_queue_info)); | 1861 | memset(&qi, 0, sizeof(struct ath9k_tx_queue_info)); |
@@ -1730,23 +1864,22 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
1730 | qi.tqi_cwmin = params->cw_min; | 1864 | qi.tqi_cwmin = params->cw_min; |
1731 | qi.tqi_cwmax = params->cw_max; | 1865 | qi.tqi_cwmax = params->cw_max; |
1732 | qi.tqi_burstTime = params->txop; | 1866 | qi.tqi_burstTime = params->txop; |
1733 | qnum = ath_get_hal_qnum(queue, sc); | ||
1734 | 1867 | ||
1735 | ath_print(common, ATH_DBG_CONFIG, | 1868 | ath_dbg(common, ATH_DBG_CONFIG, |
1736 | "Configure tx [queue/halq] [%d/%d], " | 1869 | "Configure tx [queue/halq] [%d/%d], aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", |
1737 | "aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", | 1870 | queue, txq->axq_qnum, params->aifs, params->cw_min, |
1738 | queue, qnum, params->aifs, params->cw_min, | 1871 | params->cw_max, params->txop); |
1739 | params->cw_max, params->txop); | ||
1740 | 1872 | ||
1741 | ret = ath_txq_update(sc, qnum, &qi); | 1873 | ret = ath_txq_update(sc, txq->axq_qnum, &qi); |
1742 | if (ret) | 1874 | if (ret) |
1743 | ath_print(common, ATH_DBG_FATAL, "TXQ Update failed\n"); | 1875 | ath_err(common, "TXQ Update failed\n"); |
1744 | 1876 | ||
1745 | if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) | 1877 | if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) |
1746 | if ((qnum == sc->tx.hwq_map[WME_AC_BE]) && !ret) | 1878 | if (queue == WME_AC_BE && !ret) |
1747 | ath_beaconq_config(sc); | 1879 | ath_beaconq_config(sc); |
1748 | 1880 | ||
1749 | mutex_unlock(&sc->mutex); | 1881 | mutex_unlock(&sc->mutex); |
1882 | ath9k_ps_restore(sc); | ||
1750 | 1883 | ||
1751 | return ret; | 1884 | return ret; |
1752 | } | 1885 | } |
@@ -1757,34 +1890,51 @@ static int ath9k_set_key(struct ieee80211_hw *hw, | |||
1757 | struct ieee80211_sta *sta, | 1890 | struct ieee80211_sta *sta, |
1758 | struct ieee80211_key_conf *key) | 1891 | struct ieee80211_key_conf *key) |
1759 | { | 1892 | { |
1760 | struct ath_wiphy *aphy = hw->priv; | 1893 | struct ath_softc *sc = hw->priv; |
1761 | struct ath_softc *sc = aphy->sc; | ||
1762 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1894 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1763 | int ret = 0; | 1895 | int ret = 0; |
1764 | 1896 | ||
1765 | if (modparam_nohwcrypt) | 1897 | if (ath9k_modparam_nohwcrypt) |
1766 | return -ENOSPC; | 1898 | return -ENOSPC; |
1767 | 1899 | ||
1900 | if (vif->type == NL80211_IFTYPE_ADHOC && | ||
1901 | (key->cipher == WLAN_CIPHER_SUITE_TKIP || | ||
1902 | key->cipher == WLAN_CIPHER_SUITE_CCMP) && | ||
1903 | !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { | ||
1904 | /* | ||
1905 | * For now, disable hw crypto for the RSN IBSS group keys. This | ||
1906 | * could be optimized in the future to use a modified key cache | ||
1907 | * design to support per-STA RX GTK, but until that gets | ||
1908 | * implemented, use of software crypto for group addressed | ||
1909 | * frames is a acceptable to allow RSN IBSS to be used. | ||
1910 | */ | ||
1911 | return -EOPNOTSUPP; | ||
1912 | } | ||
1913 | |||
1768 | mutex_lock(&sc->mutex); | 1914 | mutex_lock(&sc->mutex); |
1769 | ath9k_ps_wakeup(sc); | 1915 | ath9k_ps_wakeup(sc); |
1770 | ath_print(common, ATH_DBG_CONFIG, "Set HW Key\n"); | 1916 | ath_dbg(common, ATH_DBG_CONFIG, "Set HW Key\n"); |
1771 | 1917 | ||
1772 | switch (cmd) { | 1918 | switch (cmd) { |
1773 | case SET_KEY: | 1919 | case SET_KEY: |
1774 | ret = ath9k_cmn_key_config(common, vif, sta, key); | 1920 | if (sta) |
1921 | ath9k_del_ps_key(sc, vif, sta); | ||
1922 | |||
1923 | ret = ath_key_config(common, vif, sta, key); | ||
1775 | if (ret >= 0) { | 1924 | if (ret >= 0) { |
1776 | key->hw_key_idx = ret; | 1925 | key->hw_key_idx = ret; |
1777 | /* push IV and Michael MIC generation to stack */ | 1926 | /* push IV and Michael MIC generation to stack */ |
1778 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | 1927 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
1779 | if (key->alg == ALG_TKIP) | 1928 | if (key->cipher == WLAN_CIPHER_SUITE_TKIP) |
1780 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | 1929 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; |
1781 | if (sc->sc_ah->sw_mgmt_crypto && key->alg == ALG_CCMP) | 1930 | if (sc->sc_ah->sw_mgmt_crypto && |
1931 | key->cipher == WLAN_CIPHER_SUITE_CCMP) | ||
1782 | key->flags |= IEEE80211_KEY_FLAG_SW_MGMT; | 1932 | key->flags |= IEEE80211_KEY_FLAG_SW_MGMT; |
1783 | ret = 0; | 1933 | ret = 0; |
1784 | } | 1934 | } |
1785 | break; | 1935 | break; |
1786 | case DISABLE_KEY: | 1936 | case DISABLE_KEY: |
1787 | ath9k_cmn_key_delete(common, key); | 1937 | ath_key_delete(common, key); |
1788 | break; | 1938 | break; |
1789 | default: | 1939 | default: |
1790 | ret = -EINVAL; | 1940 | ret = -EINVAL; |
@@ -1795,51 +1945,123 @@ static int ath9k_set_key(struct ieee80211_hw *hw, | |||
1795 | 1945 | ||
1796 | return ret; | 1946 | return ret; |
1797 | } | 1947 | } |
1948 | static void ath9k_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif) | ||
1949 | { | ||
1950 | struct ath_softc *sc = data; | ||
1951 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
1952 | struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; | ||
1953 | struct ath_vif *avp = (void *)vif->drv_priv; | ||
1954 | |||
1955 | switch (sc->sc_ah->opmode) { | ||
1956 | case NL80211_IFTYPE_ADHOC: | ||
1957 | /* There can be only one vif available */ | ||
1958 | memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); | ||
1959 | common->curaid = bss_conf->aid; | ||
1960 | ath9k_hw_write_associd(sc->sc_ah); | ||
1961 | /* configure beacon */ | ||
1962 | if (bss_conf->enable_beacon) | ||
1963 | ath_beacon_config(sc, vif); | ||
1964 | break; | ||
1965 | case NL80211_IFTYPE_STATION: | ||
1966 | /* | ||
1967 | * Skip iteration if primary station vif's bss info | ||
1968 | * was not changed | ||
1969 | */ | ||
1970 | if (sc->sc_flags & SC_OP_PRIM_STA_VIF) | ||
1971 | break; | ||
1972 | |||
1973 | if (bss_conf->assoc) { | ||
1974 | sc->sc_flags |= SC_OP_PRIM_STA_VIF; | ||
1975 | avp->primary_sta_vif = true; | ||
1976 | memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); | ||
1977 | common->curaid = bss_conf->aid; | ||
1978 | ath9k_hw_write_associd(sc->sc_ah); | ||
1979 | ath_dbg(common, ATH_DBG_CONFIG, | ||
1980 | "Bss Info ASSOC %d, bssid: %pM\n", | ||
1981 | bss_conf->aid, common->curbssid); | ||
1982 | ath_beacon_config(sc, vif); | ||
1983 | /* | ||
1984 | * Request a re-configuration of Beacon related timers | ||
1985 | * on the receipt of the first Beacon frame (i.e., | ||
1986 | * after time sync with the AP). | ||
1987 | */ | ||
1988 | sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; | ||
1989 | /* Reset rssi stats */ | ||
1990 | sc->last_rssi = ATH_RSSI_DUMMY_MARKER; | ||
1991 | sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; | ||
1992 | |||
1993 | sc->sc_flags |= SC_OP_ANI_RUN; | ||
1994 | ath_start_ani(common); | ||
1995 | } | ||
1996 | break; | ||
1997 | default: | ||
1998 | break; | ||
1999 | } | ||
2000 | } | ||
2001 | |||
2002 | static void ath9k_config_bss(struct ath_softc *sc, struct ieee80211_vif *vif) | ||
2003 | { | ||
2004 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
2005 | struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; | ||
2006 | struct ath_vif *avp = (void *)vif->drv_priv; | ||
2007 | |||
2008 | /* Reconfigure bss info */ | ||
2009 | if (avp->primary_sta_vif && !bss_conf->assoc) { | ||
2010 | ath_dbg(common, ATH_DBG_CONFIG, | ||
2011 | "Bss Info DISASSOC %d, bssid %pM\n", | ||
2012 | common->curaid, common->curbssid); | ||
2013 | sc->sc_flags &= ~(SC_OP_PRIM_STA_VIF | SC_OP_BEACONS); | ||
2014 | avp->primary_sta_vif = false; | ||
2015 | memset(common->curbssid, 0, ETH_ALEN); | ||
2016 | common->curaid = 0; | ||
2017 | } | ||
2018 | |||
2019 | ieee80211_iterate_active_interfaces_atomic( | ||
2020 | sc->hw, ath9k_bss_iter, sc); | ||
2021 | |||
2022 | /* | ||
2023 | * None of station vifs are associated. | ||
2024 | * Clear bssid & aid | ||
2025 | */ | ||
2026 | if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) && | ||
2027 | !(sc->sc_flags & SC_OP_PRIM_STA_VIF)) { | ||
2028 | ath9k_hw_write_associd(sc->sc_ah); | ||
2029 | /* Stop ANI */ | ||
2030 | sc->sc_flags &= ~SC_OP_ANI_RUN; | ||
2031 | del_timer_sync(&common->ani.timer); | ||
2032 | } | ||
2033 | } | ||
1798 | 2034 | ||
1799 | static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | 2035 | static void ath9k_bss_info_changed(struct ieee80211_hw *hw, |
1800 | struct ieee80211_vif *vif, | 2036 | struct ieee80211_vif *vif, |
1801 | struct ieee80211_bss_conf *bss_conf, | 2037 | struct ieee80211_bss_conf *bss_conf, |
1802 | u32 changed) | 2038 | u32 changed) |
1803 | { | 2039 | { |
1804 | struct ath_wiphy *aphy = hw->priv; | 2040 | struct ath_softc *sc = hw->priv; |
1805 | struct ath_softc *sc = aphy->sc; | ||
1806 | struct ath_hw *ah = sc->sc_ah; | 2041 | struct ath_hw *ah = sc->sc_ah; |
1807 | struct ath_common *common = ath9k_hw_common(ah); | 2042 | struct ath_common *common = ath9k_hw_common(ah); |
1808 | struct ath_vif *avp = (void *)vif->drv_priv; | 2043 | struct ath_vif *avp = (void *)vif->drv_priv; |
1809 | int slottime; | 2044 | int slottime; |
1810 | int error; | 2045 | int error; |
1811 | 2046 | ||
2047 | ath9k_ps_wakeup(sc); | ||
1812 | mutex_lock(&sc->mutex); | 2048 | mutex_lock(&sc->mutex); |
1813 | 2049 | ||
1814 | if (changed & BSS_CHANGED_BSSID) { | 2050 | if (changed & BSS_CHANGED_BSSID) { |
1815 | /* Set BSSID */ | 2051 | ath9k_config_bss(sc, vif); |
1816 | memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); | ||
1817 | memcpy(avp->bssid, bss_conf->bssid, ETH_ALEN); | ||
1818 | common->curaid = 0; | ||
1819 | ath9k_hw_write_associd(ah); | ||
1820 | |||
1821 | /* Set aggregation protection mode parameters */ | ||
1822 | sc->config.ath_aggr_prot = 0; | ||
1823 | 2052 | ||
1824 | /* Only legacy IBSS for now */ | 2053 | ath_dbg(common, ATH_DBG_CONFIG, "BSSID: %pM aid: 0x%x\n", |
1825 | if (vif->type == NL80211_IFTYPE_ADHOC) | 2054 | common->curbssid, common->curaid); |
1826 | ath_update_chainmask(sc, 0); | ||
1827 | |||
1828 | ath_print(common, ATH_DBG_CONFIG, | ||
1829 | "BSSID: %pM aid: 0x%x\n", | ||
1830 | common->curbssid, common->curaid); | ||
1831 | |||
1832 | /* need to reconfigure the beacon */ | ||
1833 | sc->sc_flags &= ~SC_OP_BEACONS ; | ||
1834 | } | 2055 | } |
1835 | 2056 | ||
1836 | /* Enable transmission of beacons (AP, IBSS, MESH) */ | 2057 | /* Enable transmission of beacons (AP, IBSS, MESH) */ |
1837 | if ((changed & BSS_CHANGED_BEACON) || | 2058 | if ((changed & BSS_CHANGED_BEACON) || |
1838 | ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon)) { | 2059 | ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon)) { |
1839 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | 2060 | ath9k_set_beaconing_status(sc, false); |
1840 | error = ath_beacon_alloc(aphy, vif); | 2061 | error = ath_beacon_alloc(sc, vif); |
1841 | if (!error) | 2062 | if (!error) |
1842 | ath_beacon_config(sc, vif); | 2063 | ath_beacon_config(sc, vif); |
2064 | ath9k_set_beaconing_status(sc, true); | ||
1843 | } | 2065 | } |
1844 | 2066 | ||
1845 | if (changed & BSS_CHANGED_ERP_SLOT) { | 2067 | if (changed & BSS_CHANGED_ERP_SLOT) { |
@@ -1862,29 +2084,32 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
1862 | } | 2084 | } |
1863 | 2085 | ||
1864 | /* Disable transmission of beacons */ | 2086 | /* Disable transmission of beacons */ |
1865 | if ((changed & BSS_CHANGED_BEACON_ENABLED) && !bss_conf->enable_beacon) | 2087 | if ((changed & BSS_CHANGED_BEACON_ENABLED) && |
1866 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | 2088 | !bss_conf->enable_beacon) { |
2089 | ath9k_set_beaconing_status(sc, false); | ||
2090 | avp->is_bslot_active = false; | ||
2091 | ath9k_set_beaconing_status(sc, true); | ||
2092 | } | ||
1867 | 2093 | ||
1868 | if (changed & BSS_CHANGED_BEACON_INT) { | 2094 | if (changed & BSS_CHANGED_BEACON_INT) { |
1869 | sc->beacon_interval = bss_conf->beacon_int; | ||
1870 | /* | 2095 | /* |
1871 | * In case of AP mode, the HW TSF has to be reset | 2096 | * In case of AP mode, the HW TSF has to be reset |
1872 | * when the beacon interval changes. | 2097 | * when the beacon interval changes. |
1873 | */ | 2098 | */ |
1874 | if (vif->type == NL80211_IFTYPE_AP) { | 2099 | if (vif->type == NL80211_IFTYPE_AP) { |
1875 | sc->sc_flags |= SC_OP_TSF_RESET; | 2100 | sc->sc_flags |= SC_OP_TSF_RESET; |
1876 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | 2101 | ath9k_set_beaconing_status(sc, false); |
1877 | error = ath_beacon_alloc(aphy, vif); | 2102 | error = ath_beacon_alloc(sc, vif); |
1878 | if (!error) | 2103 | if (!error) |
1879 | ath_beacon_config(sc, vif); | 2104 | ath_beacon_config(sc, vif); |
1880 | } else { | 2105 | ath9k_set_beaconing_status(sc, true); |
2106 | } else | ||
1881 | ath_beacon_config(sc, vif); | 2107 | ath_beacon_config(sc, vif); |
1882 | } | ||
1883 | } | 2108 | } |
1884 | 2109 | ||
1885 | if (changed & BSS_CHANGED_ERP_PREAMBLE) { | 2110 | if (changed & BSS_CHANGED_ERP_PREAMBLE) { |
1886 | ath_print(common, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n", | 2111 | ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n", |
1887 | bss_conf->use_short_preamble); | 2112 | bss_conf->use_short_preamble); |
1888 | if (bss_conf->use_short_preamble) | 2113 | if (bss_conf->use_short_preamble) |
1889 | sc->sc_flags |= SC_OP_PREAMBLE_SHORT; | 2114 | sc->sc_flags |= SC_OP_PREAMBLE_SHORT; |
1890 | else | 2115 | else |
@@ -1892,8 +2117,8 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
1892 | } | 2117 | } |
1893 | 2118 | ||
1894 | if (changed & BSS_CHANGED_ERP_CTS_PROT) { | 2119 | if (changed & BSS_CHANGED_ERP_CTS_PROT) { |
1895 | ath_print(common, ATH_DBG_CONFIG, "BSS Changed CTS PROT %d\n", | 2120 | ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed CTS PROT %d\n", |
1896 | bss_conf->use_cts_prot); | 2121 | bss_conf->use_cts_prot); |
1897 | if (bss_conf->use_cts_prot && | 2122 | if (bss_conf->use_cts_prot && |
1898 | hw->conf.channel->band != IEEE80211_BAND_5GHZ) | 2123 | hw->conf.channel->band != IEEE80211_BAND_5GHZ) |
1899 | sc->sc_flags |= SC_OP_PROTECT_ENABLE; | 2124 | sc->sc_flags |= SC_OP_PROTECT_ENABLE; |
@@ -1901,23 +2126,19 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
1901 | sc->sc_flags &= ~SC_OP_PROTECT_ENABLE; | 2126 | sc->sc_flags &= ~SC_OP_PROTECT_ENABLE; |
1902 | } | 2127 | } |
1903 | 2128 | ||
1904 | if (changed & BSS_CHANGED_ASSOC) { | ||
1905 | ath_print(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n", | ||
1906 | bss_conf->assoc); | ||
1907 | ath9k_bss_assoc_info(sc, vif, bss_conf); | ||
1908 | } | ||
1909 | |||
1910 | mutex_unlock(&sc->mutex); | 2129 | mutex_unlock(&sc->mutex); |
2130 | ath9k_ps_restore(sc); | ||
1911 | } | 2131 | } |
1912 | 2132 | ||
1913 | static u64 ath9k_get_tsf(struct ieee80211_hw *hw) | 2133 | static u64 ath9k_get_tsf(struct ieee80211_hw *hw) |
1914 | { | 2134 | { |
2135 | struct ath_softc *sc = hw->priv; | ||
1915 | u64 tsf; | 2136 | u64 tsf; |
1916 | struct ath_wiphy *aphy = hw->priv; | ||
1917 | struct ath_softc *sc = aphy->sc; | ||
1918 | 2137 | ||
1919 | mutex_lock(&sc->mutex); | 2138 | mutex_lock(&sc->mutex); |
2139 | ath9k_ps_wakeup(sc); | ||
1920 | tsf = ath9k_hw_gettsf64(sc->sc_ah); | 2140 | tsf = ath9k_hw_gettsf64(sc->sc_ah); |
2141 | ath9k_ps_restore(sc); | ||
1921 | mutex_unlock(&sc->mutex); | 2142 | mutex_unlock(&sc->mutex); |
1922 | 2143 | ||
1923 | return tsf; | 2144 | return tsf; |
@@ -1925,18 +2146,18 @@ static u64 ath9k_get_tsf(struct ieee80211_hw *hw) | |||
1925 | 2146 | ||
1926 | static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf) | 2147 | static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf) |
1927 | { | 2148 | { |
1928 | struct ath_wiphy *aphy = hw->priv; | 2149 | struct ath_softc *sc = hw->priv; |
1929 | struct ath_softc *sc = aphy->sc; | ||
1930 | 2150 | ||
1931 | mutex_lock(&sc->mutex); | 2151 | mutex_lock(&sc->mutex); |
2152 | ath9k_ps_wakeup(sc); | ||
1932 | ath9k_hw_settsf64(sc->sc_ah, tsf); | 2153 | ath9k_hw_settsf64(sc->sc_ah, tsf); |
2154 | ath9k_ps_restore(sc); | ||
1933 | mutex_unlock(&sc->mutex); | 2155 | mutex_unlock(&sc->mutex); |
1934 | } | 2156 | } |
1935 | 2157 | ||
1936 | static void ath9k_reset_tsf(struct ieee80211_hw *hw) | 2158 | static void ath9k_reset_tsf(struct ieee80211_hw *hw) |
1937 | { | 2159 | { |
1938 | struct ath_wiphy *aphy = hw->priv; | 2160 | struct ath_softc *sc = hw->priv; |
1939 | struct ath_softc *sc = aphy->sc; | ||
1940 | 2161 | ||
1941 | mutex_lock(&sc->mutex); | 2162 | mutex_lock(&sc->mutex); |
1942 | 2163 | ||
@@ -1951,10 +2172,9 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
1951 | struct ieee80211_vif *vif, | 2172 | struct ieee80211_vif *vif, |
1952 | enum ieee80211_ampdu_mlme_action action, | 2173 | enum ieee80211_ampdu_mlme_action action, |
1953 | struct ieee80211_sta *sta, | 2174 | struct ieee80211_sta *sta, |
1954 | u16 tid, u16 *ssn) | 2175 | u16 tid, u16 *ssn, u8 buf_size) |
1955 | { | 2176 | { |
1956 | struct ath_wiphy *aphy = hw->priv; | 2177 | struct ath_softc *sc = hw->priv; |
1957 | struct ath_softc *sc = aphy->sc; | ||
1958 | int ret = 0; | 2178 | int ret = 0; |
1959 | 2179 | ||
1960 | local_bh_disable(); | 2180 | local_bh_disable(); |
@@ -1967,9 +2187,13 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
1967 | case IEEE80211_AMPDU_RX_STOP: | 2187 | case IEEE80211_AMPDU_RX_STOP: |
1968 | break; | 2188 | break; |
1969 | case IEEE80211_AMPDU_TX_START: | 2189 | case IEEE80211_AMPDU_TX_START: |
2190 | if (!(sc->sc_flags & SC_OP_TXAGGR)) | ||
2191 | return -EOPNOTSUPP; | ||
2192 | |||
1970 | ath9k_ps_wakeup(sc); | 2193 | ath9k_ps_wakeup(sc); |
1971 | ath_tx_aggr_start(sc, sta, tid, ssn); | 2194 | ret = ath_tx_aggr_start(sc, sta, tid, ssn); |
1972 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 2195 | if (!ret) |
2196 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | ||
1973 | ath9k_ps_restore(sc); | 2197 | ath9k_ps_restore(sc); |
1974 | break; | 2198 | break; |
1975 | case IEEE80211_AMPDU_TX_STOP: | 2199 | case IEEE80211_AMPDU_TX_STOP: |
@@ -1984,8 +2208,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
1984 | ath9k_ps_restore(sc); | 2208 | ath9k_ps_restore(sc); |
1985 | break; | 2209 | break; |
1986 | default: | 2210 | default: |
1987 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, | 2211 | ath_err(ath9k_hw_common(sc->sc_ah), "Unknown AMPDU action\n"); |
1988 | "Unknown AMPDU action\n"); | ||
1989 | } | 2212 | } |
1990 | 2213 | ||
1991 | local_bh_enable(); | 2214 | local_bh_enable(); |
@@ -1996,71 +2219,158 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
1996 | static int ath9k_get_survey(struct ieee80211_hw *hw, int idx, | 2219 | static int ath9k_get_survey(struct ieee80211_hw *hw, int idx, |
1997 | struct survey_info *survey) | 2220 | struct survey_info *survey) |
1998 | { | 2221 | { |
1999 | struct ath_wiphy *aphy = hw->priv; | 2222 | struct ath_softc *sc = hw->priv; |
2000 | struct ath_softc *sc = aphy->sc; | 2223 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
2001 | struct ath_hw *ah = sc->sc_ah; | 2224 | struct ieee80211_supported_band *sband; |
2002 | struct ath_common *common = ath9k_hw_common(ah); | 2225 | struct ieee80211_channel *chan; |
2003 | struct ieee80211_conf *conf = &hw->conf; | 2226 | unsigned long flags; |
2227 | int pos; | ||
2004 | 2228 | ||
2005 | if (idx != 0) | 2229 | spin_lock_irqsave(&common->cc_lock, flags); |
2230 | if (idx == 0) | ||
2231 | ath_update_survey_stats(sc); | ||
2232 | |||
2233 | sband = hw->wiphy->bands[IEEE80211_BAND_2GHZ]; | ||
2234 | if (sband && idx >= sband->n_channels) { | ||
2235 | idx -= sband->n_channels; | ||
2236 | sband = NULL; | ||
2237 | } | ||
2238 | |||
2239 | if (!sband) | ||
2240 | sband = hw->wiphy->bands[IEEE80211_BAND_5GHZ]; | ||
2241 | |||
2242 | if (!sband || idx >= sband->n_channels) { | ||
2243 | spin_unlock_irqrestore(&common->cc_lock, flags); | ||
2006 | return -ENOENT; | 2244 | return -ENOENT; |
2245 | } | ||
2007 | 2246 | ||
2008 | survey->channel = conf->channel; | 2247 | chan = &sband->channels[idx]; |
2009 | survey->filled = SURVEY_INFO_NOISE_DBM; | 2248 | pos = chan->hw_value; |
2010 | survey->noise = common->ani.noise_floor; | 2249 | memcpy(survey, &sc->survey[pos], sizeof(*survey)); |
2250 | survey->channel = chan; | ||
2251 | spin_unlock_irqrestore(&common->cc_lock, flags); | ||
2011 | 2252 | ||
2012 | return 0; | 2253 | return 0; |
2013 | } | 2254 | } |
2014 | 2255 | ||
2015 | static void ath9k_sw_scan_start(struct ieee80211_hw *hw) | 2256 | static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class) |
2016 | { | 2257 | { |
2017 | struct ath_wiphy *aphy = hw->priv; | 2258 | struct ath_softc *sc = hw->priv; |
2018 | struct ath_softc *sc = aphy->sc; | 2259 | struct ath_hw *ah = sc->sc_ah; |
2019 | 2260 | ||
2020 | mutex_lock(&sc->mutex); | 2261 | mutex_lock(&sc->mutex); |
2021 | if (ath9k_wiphy_scanning(sc)) { | 2262 | ah->coverage_class = coverage_class; |
2022 | /* | 2263 | ath9k_hw_init_global_settings(ah); |
2023 | * There is a race here in mac80211 but fixing it requires | 2264 | mutex_unlock(&sc->mutex); |
2024 | * we revisit how we handle the scan complete callback. | 2265 | } |
2025 | * After mac80211 fixes we will not have configured hardware | 2266 | |
2026 | * to the home channel nor would we have configured the RX | 2267 | static void ath9k_flush(struct ieee80211_hw *hw, bool drop) |
2027 | * filter yet. | 2268 | { |
2028 | */ | 2269 | struct ath_softc *sc = hw->priv; |
2270 | struct ath_hw *ah = sc->sc_ah; | ||
2271 | struct ath_common *common = ath9k_hw_common(ah); | ||
2272 | int timeout = 200; /* ms */ | ||
2273 | int i, j; | ||
2274 | bool drain_txq; | ||
2275 | |||
2276 | mutex_lock(&sc->mutex); | ||
2277 | cancel_delayed_work_sync(&sc->tx_complete_work); | ||
2278 | |||
2279 | if (sc->sc_flags & SC_OP_INVALID) { | ||
2280 | ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); | ||
2029 | mutex_unlock(&sc->mutex); | 2281 | mutex_unlock(&sc->mutex); |
2030 | return; | 2282 | return; |
2031 | } | 2283 | } |
2032 | 2284 | ||
2033 | aphy->state = ATH_WIPHY_SCAN; | 2285 | if (drop) |
2034 | ath9k_wiphy_pause_all_forced(sc, aphy); | 2286 | timeout = 1; |
2035 | sc->sc_flags |= SC_OP_SCANNING; | 2287 | |
2288 | for (j = 0; j < timeout; j++) { | ||
2289 | bool npend = false; | ||
2290 | |||
2291 | if (j) | ||
2292 | usleep_range(1000, 2000); | ||
2293 | |||
2294 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { | ||
2295 | if (!ATH_TXQ_SETUP(sc, i)) | ||
2296 | continue; | ||
2297 | |||
2298 | npend = ath9k_has_pending_frames(sc, &sc->tx.txq[i]); | ||
2299 | |||
2300 | if (npend) | ||
2301 | break; | ||
2302 | } | ||
2303 | |||
2304 | if (!npend) | ||
2305 | goto out; | ||
2306 | } | ||
2307 | |||
2308 | ath9k_ps_wakeup(sc); | ||
2309 | spin_lock_bh(&sc->sc_pcu_lock); | ||
2310 | drain_txq = ath_drain_all_txq(sc, false); | ||
2311 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
2312 | if (!drain_txq) | ||
2313 | ath_reset(sc, false); | ||
2314 | ath9k_ps_restore(sc); | ||
2315 | ieee80211_wake_queues(hw); | ||
2316 | |||
2317 | out: | ||
2318 | ieee80211_queue_delayed_work(hw, &sc->tx_complete_work, 0); | ||
2036 | mutex_unlock(&sc->mutex); | 2319 | mutex_unlock(&sc->mutex); |
2037 | } | 2320 | } |
2038 | 2321 | ||
2039 | /* | 2322 | static bool ath9k_tx_frames_pending(struct ieee80211_hw *hw) |
2040 | * XXX: this requires a revisit after the driver | ||
2041 | * scan_complete gets moved to another place/removed in mac80211. | ||
2042 | */ | ||
2043 | static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) | ||
2044 | { | 2323 | { |
2045 | struct ath_wiphy *aphy = hw->priv; | 2324 | struct ath_softc *sc = hw->priv; |
2046 | struct ath_softc *sc = aphy->sc; | 2325 | int i; |
2047 | 2326 | ||
2048 | mutex_lock(&sc->mutex); | 2327 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { |
2049 | aphy->state = ATH_WIPHY_ACTIVE; | 2328 | if (!ATH_TXQ_SETUP(sc, i)) |
2050 | sc->sc_flags &= ~SC_OP_SCANNING; | 2329 | continue; |
2051 | mutex_unlock(&sc->mutex); | 2330 | |
2331 | if (ath9k_has_pending_frames(sc, &sc->tx.txq[i])) | ||
2332 | return true; | ||
2333 | } | ||
2334 | return false; | ||
2052 | } | 2335 | } |
2053 | 2336 | ||
2054 | static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class) | 2337 | int ath9k_tx_last_beacon(struct ieee80211_hw *hw) |
2055 | { | 2338 | { |
2056 | struct ath_wiphy *aphy = hw->priv; | 2339 | struct ath_softc *sc = hw->priv; |
2057 | struct ath_softc *sc = aphy->sc; | ||
2058 | struct ath_hw *ah = sc->sc_ah; | 2340 | struct ath_hw *ah = sc->sc_ah; |
2341 | struct ieee80211_vif *vif; | ||
2342 | struct ath_vif *avp; | ||
2343 | struct ath_buf *bf; | ||
2344 | struct ath_tx_status ts; | ||
2345 | int status; | ||
2346 | |||
2347 | vif = sc->beacon.bslot[0]; | ||
2348 | if (!vif) | ||
2349 | return 0; | ||
2059 | 2350 | ||
2060 | mutex_lock(&sc->mutex); | 2351 | avp = (void *)vif->drv_priv; |
2061 | ah->coverage_class = coverage_class; | 2352 | if (!avp->is_bslot_active) |
2062 | ath9k_hw_init_global_settings(ah); | 2353 | return 0; |
2063 | mutex_unlock(&sc->mutex); | 2354 | |
2355 | if (!sc->beacon.tx_processed) { | ||
2356 | tasklet_disable(&sc->bcon_tasklet); | ||
2357 | |||
2358 | bf = avp->av_bcbuf; | ||
2359 | if (!bf || !bf->bf_mpdu) | ||
2360 | goto skip; | ||
2361 | |||
2362 | status = ath9k_hw_txprocdesc(ah, bf->bf_desc, &ts); | ||
2363 | if (status == -EINPROGRESS) | ||
2364 | goto skip; | ||
2365 | |||
2366 | sc->beacon.tx_processed = true; | ||
2367 | sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK); | ||
2368 | |||
2369 | skip: | ||
2370 | tasklet_enable(&sc->bcon_tasklet); | ||
2371 | } | ||
2372 | |||
2373 | return sc->beacon.tx_last; | ||
2064 | } | 2374 | } |
2065 | 2375 | ||
2066 | struct ieee80211_ops ath9k_ops = { | 2376 | struct ieee80211_ops ath9k_ops = { |
@@ -2068,11 +2378,13 @@ struct ieee80211_ops ath9k_ops = { | |||
2068 | .start = ath9k_start, | 2378 | .start = ath9k_start, |
2069 | .stop = ath9k_stop, | 2379 | .stop = ath9k_stop, |
2070 | .add_interface = ath9k_add_interface, | 2380 | .add_interface = ath9k_add_interface, |
2381 | .change_interface = ath9k_change_interface, | ||
2071 | .remove_interface = ath9k_remove_interface, | 2382 | .remove_interface = ath9k_remove_interface, |
2072 | .config = ath9k_config, | 2383 | .config = ath9k_config, |
2073 | .configure_filter = ath9k_configure_filter, | 2384 | .configure_filter = ath9k_configure_filter, |
2074 | .sta_add = ath9k_sta_add, | 2385 | .sta_add = ath9k_sta_add, |
2075 | .sta_remove = ath9k_sta_remove, | 2386 | .sta_remove = ath9k_sta_remove, |
2387 | .sta_notify = ath9k_sta_notify, | ||
2076 | .conf_tx = ath9k_conf_tx, | 2388 | .conf_tx = ath9k_conf_tx, |
2077 | .bss_info_changed = ath9k_bss_info_changed, | 2389 | .bss_info_changed = ath9k_bss_info_changed, |
2078 | .set_key = ath9k_set_key, | 2390 | .set_key = ath9k_set_key, |
@@ -2081,8 +2393,9 @@ struct ieee80211_ops ath9k_ops = { | |||
2081 | .reset_tsf = ath9k_reset_tsf, | 2393 | .reset_tsf = ath9k_reset_tsf, |
2082 | .ampdu_action = ath9k_ampdu_action, | 2394 | .ampdu_action = ath9k_ampdu_action, |
2083 | .get_survey = ath9k_get_survey, | 2395 | .get_survey = ath9k_get_survey, |
2084 | .sw_scan_start = ath9k_sw_scan_start, | ||
2085 | .sw_scan_complete = ath9k_sw_scan_complete, | ||
2086 | .rfkill_poll = ath9k_rfkill_poll_state, | 2396 | .rfkill_poll = ath9k_rfkill_poll_state, |
2087 | .set_coverage_class = ath9k_set_coverage_class, | 2397 | .set_coverage_class = ath9k_set_coverage_class, |
2398 | .flush = ath9k_flush, | ||
2399 | .tx_frames_pending = ath9k_tx_frames_pending, | ||
2400 | .tx_last_beacon = ath9k_tx_last_beacon, | ||
2088 | }; | 2401 | }; |