Merge tag 'pci-v3.15-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaa...
[deliverable/linux.git] / drivers / net / wireless / ath / ath9k / htc_drv_main.c
1 /*
2 * Copyright (c) 2010-2011 Atheros Communications Inc.
3 *
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
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #include "htc.h"
18
19 /*************/
20 /* Utilities */
21 /*************/
22
23 /* HACK Alert: Use 11NG for 2.4, use 11NA for 5 */
24 static enum htc_phymode ath9k_htc_get_curmode(struct ath9k_htc_priv *priv,
25 struct ath9k_channel *ichan)
26 {
27 if (IS_CHAN_5GHZ(ichan))
28 return HTC_MODE_11NA;
29
30 return HTC_MODE_11NG;
31 }
32
33 bool ath9k_htc_setpower(struct ath9k_htc_priv *priv,
34 enum ath9k_power_mode mode)
35 {
36 bool ret;
37
38 mutex_lock(&priv->htc_pm_lock);
39 ret = ath9k_hw_setpower(priv->ah, mode);
40 mutex_unlock(&priv->htc_pm_lock);
41
42 return ret;
43 }
44
45 void ath9k_htc_ps_wakeup(struct ath9k_htc_priv *priv)
46 {
47 mutex_lock(&priv->htc_pm_lock);
48 if (++priv->ps_usecount != 1)
49 goto unlock;
50 ath9k_hw_setpower(priv->ah, ATH9K_PM_AWAKE);
51
52 unlock:
53 mutex_unlock(&priv->htc_pm_lock);
54 }
55
56 void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv)
57 {
58 bool reset;
59
60 mutex_lock(&priv->htc_pm_lock);
61 if (--priv->ps_usecount != 0)
62 goto unlock;
63
64 if (priv->ps_idle) {
65 ath9k_hw_setrxabort(priv->ah, true);
66 ath9k_hw_stopdmarecv(priv->ah, &reset);
67 ath9k_hw_setpower(priv->ah, ATH9K_PM_FULL_SLEEP);
68 } else if (priv->ps_enabled) {
69 ath9k_hw_setpower(priv->ah, ATH9K_PM_NETWORK_SLEEP);
70 }
71
72 unlock:
73 mutex_unlock(&priv->htc_pm_lock);
74 }
75
76 void ath9k_ps_work(struct work_struct *work)
77 {
78 struct ath9k_htc_priv *priv =
79 container_of(work, struct ath9k_htc_priv,
80 ps_work);
81 ath9k_htc_setpower(priv, ATH9K_PM_AWAKE);
82
83 /* The chip wakes up after receiving the first beacon
84 while network sleep is enabled. For the driver to
85 be in sync with the hw, set the chip to awake and
86 only then set it to sleep.
87 */
88 ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP);
89 }
90
91 static void ath9k_htc_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
92 {
93 struct ath9k_htc_priv *priv = data;
94 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
95
96 if ((vif->type == NL80211_IFTYPE_AP ||
97 vif->type == NL80211_IFTYPE_MESH_POINT) &&
98 bss_conf->enable_beacon)
99 priv->reconfig_beacon = true;
100
101 if (bss_conf->assoc) {
102 priv->rearm_ani = true;
103 priv->reconfig_beacon = true;
104 }
105 }
106
107 static void ath9k_htc_vif_reconfig(struct ath9k_htc_priv *priv)
108 {
109 priv->rearm_ani = false;
110 priv->reconfig_beacon = false;
111
112 ieee80211_iterate_active_interfaces_atomic(
113 priv->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
114 ath9k_htc_vif_iter, priv);
115 if (priv->rearm_ani)
116 ath9k_htc_start_ani(priv);
117
118 if (priv->reconfig_beacon) {
119 ath9k_htc_ps_wakeup(priv);
120 ath9k_htc_beacon_reconfig(priv);
121 ath9k_htc_ps_restore(priv);
122 }
123 }
124
125 static void ath9k_htc_bssid_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
126 {
127 struct ath9k_vif_iter_data *iter_data = data;
128 int i;
129
130 if (iter_data->hw_macaddr != NULL) {
131 for (i = 0; i < ETH_ALEN; i++)
132 iter_data->mask[i] &= ~(iter_data->hw_macaddr[i] ^ mac[i]);
133 } else {
134 iter_data->hw_macaddr = mac;
135 }
136 }
137
138 static void ath9k_htc_set_mac_bssid_mask(struct ath9k_htc_priv *priv,
139 struct ieee80211_vif *vif)
140 {
141 struct ath_common *common = ath9k_hw_common(priv->ah);
142 struct ath9k_vif_iter_data iter_data;
143
144 /*
145 * Pick the MAC address of the first interface as the new hardware
146 * MAC address. The hardware will use it together with the BSSID mask
147 * when matching addresses.
148 */
149 iter_data.hw_macaddr = NULL;
150 memset(&iter_data.mask, 0xff, ETH_ALEN);
151
152 if (vif)
153 ath9k_htc_bssid_iter(&iter_data, vif->addr, vif);
154
155 /* Get list of all active MAC addresses */
156 ieee80211_iterate_active_interfaces_atomic(
157 priv->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
158 ath9k_htc_bssid_iter, &iter_data);
159
160 memcpy(common->bssidmask, iter_data.mask, ETH_ALEN);
161
162 if (iter_data.hw_macaddr)
163 memcpy(common->macaddr, iter_data.hw_macaddr, ETH_ALEN);
164
165 ath_hw_setbssidmask(common);
166 }
167
168 static void ath9k_htc_set_opmode(struct ath9k_htc_priv *priv)
169 {
170 if (priv->num_ibss_vif)
171 priv->ah->opmode = NL80211_IFTYPE_ADHOC;
172 else if (priv->num_ap_vif)
173 priv->ah->opmode = NL80211_IFTYPE_AP;
174 else if (priv->num_mbss_vif)
175 priv->ah->opmode = NL80211_IFTYPE_MESH_POINT;
176 else
177 priv->ah->opmode = NL80211_IFTYPE_STATION;
178
179 ath9k_hw_setopmode(priv->ah);
180 }
181
182 void ath9k_htc_reset(struct ath9k_htc_priv *priv)
183 {
184 struct ath_hw *ah = priv->ah;
185 struct ath_common *common = ath9k_hw_common(ah);
186 struct ieee80211_channel *channel = priv->hw->conf.chandef.chan;
187 struct ath9k_hw_cal_data *caldata = NULL;
188 enum htc_phymode mode;
189 __be16 htc_mode;
190 u8 cmd_rsp;
191 int ret;
192
193 mutex_lock(&priv->mutex);
194 ath9k_htc_ps_wakeup(priv);
195
196 ath9k_htc_stop_ani(priv);
197 ieee80211_stop_queues(priv->hw);
198
199 del_timer_sync(&priv->tx.cleanup_timer);
200 ath9k_htc_tx_drain(priv);
201
202 WMI_CMD(WMI_DISABLE_INTR_CMDID);
203 WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID);
204 WMI_CMD(WMI_STOP_RECV_CMDID);
205
206 ath9k_wmi_event_drain(priv);
207
208 caldata = &priv->caldata;
209 ret = ath9k_hw_reset(ah, ah->curchan, caldata, false);
210 if (ret) {
211 ath_err(common,
212 "Unable to reset device (%u Mhz) reset status %d\n",
213 channel->center_freq, ret);
214 }
215
216 ath9k_cmn_update_txpow(ah, priv->curtxpow, priv->txpowlimit,
217 &priv->curtxpow);
218
219 WMI_CMD(WMI_START_RECV_CMDID);
220 ath9k_host_rx_init(priv);
221
222 mode = ath9k_htc_get_curmode(priv, ah->curchan);
223 htc_mode = cpu_to_be16(mode);
224 WMI_CMD_BUF(WMI_SET_MODE_CMDID, &htc_mode);
225
226 WMI_CMD(WMI_ENABLE_INTR_CMDID);
227 htc_start(priv->htc);
228 ath9k_htc_vif_reconfig(priv);
229 ieee80211_wake_queues(priv->hw);
230
231 mod_timer(&priv->tx.cleanup_timer,
232 jiffies + msecs_to_jiffies(ATH9K_HTC_TX_CLEANUP_INTERVAL));
233
234 ath9k_htc_ps_restore(priv);
235 mutex_unlock(&priv->mutex);
236 }
237
238 static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
239 struct ieee80211_hw *hw,
240 struct ath9k_channel *hchan)
241 {
242 struct ath_hw *ah = priv->ah;
243 struct ath_common *common = ath9k_hw_common(ah);
244 struct ieee80211_conf *conf = &common->hw->conf;
245 bool fastcc;
246 struct ieee80211_channel *channel = hw->conf.chandef.chan;
247 struct ath9k_hw_cal_data *caldata = NULL;
248 enum htc_phymode mode;
249 __be16 htc_mode;
250 u8 cmd_rsp;
251 int ret;
252
253 if (test_bit(OP_INVALID, &priv->op_flags))
254 return -EIO;
255
256 fastcc = !!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL);
257
258 ath9k_htc_ps_wakeup(priv);
259
260 del_timer_sync(&priv->tx.cleanup_timer);
261 ath9k_htc_tx_drain(priv);
262
263 WMI_CMD(WMI_DISABLE_INTR_CMDID);
264 WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID);
265 WMI_CMD(WMI_STOP_RECV_CMDID);
266
267 ath9k_wmi_event_drain(priv);
268
269 ath_dbg(common, CONFIG,
270 "(%u MHz) -> (%u MHz), HT: %d, HT40: %d fastcc: %d\n",
271 priv->ah->curchan->channel,
272 channel->center_freq, conf_is_ht(conf), conf_is_ht40(conf),
273 fastcc);
274
275 if (!fastcc)
276 caldata = &priv->caldata;
277
278 ret = ath9k_hw_reset(ah, hchan, caldata, fastcc);
279 if (ret) {
280 ath_err(common,
281 "Unable to reset channel (%u Mhz) reset status %d\n",
282 channel->center_freq, ret);
283 goto err;
284 }
285
286 ath9k_cmn_update_txpow(ah, priv->curtxpow, priv->txpowlimit,
287 &priv->curtxpow);
288
289 WMI_CMD(WMI_START_RECV_CMDID);
290 if (ret)
291 goto err;
292
293 ath9k_host_rx_init(priv);
294
295 mode = ath9k_htc_get_curmode(priv, hchan);
296 htc_mode = cpu_to_be16(mode);
297 WMI_CMD_BUF(WMI_SET_MODE_CMDID, &htc_mode);
298 if (ret)
299 goto err;
300
301 WMI_CMD(WMI_ENABLE_INTR_CMDID);
302 if (ret)
303 goto err;
304
305 htc_start(priv->htc);
306
307 if (!test_bit(OP_SCANNING, &priv->op_flags) &&
308 !(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL))
309 ath9k_htc_vif_reconfig(priv);
310
311 mod_timer(&priv->tx.cleanup_timer,
312 jiffies + msecs_to_jiffies(ATH9K_HTC_TX_CLEANUP_INTERVAL));
313
314 err:
315 ath9k_htc_ps_restore(priv);
316 return ret;
317 }
318
319 /*
320 * Monitor mode handling is a tad complicated because the firmware requires
321 * an interface to be created exclusively, while mac80211 doesn't associate
322 * an interface with the mode.
323 *
324 * So, for now, only one monitor interface can be configured.
325 */
326 static void __ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv)
327 {
328 struct ath_common *common = ath9k_hw_common(priv->ah);
329 struct ath9k_htc_target_vif hvif;
330 int ret = 0;
331 u8 cmd_rsp;
332
333 memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
334 memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN);
335 hvif.index = priv->mon_vif_idx;
336 WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif);
337 if (ret) {
338 ath_err(common, "Unable to remove monitor interface at idx: %d\n",
339 priv->mon_vif_idx);
340 }
341
342 priv->nvifs--;
343 priv->vif_slot &= ~(1 << priv->mon_vif_idx);
344 }
345
346 static int ath9k_htc_add_monitor_interface(struct ath9k_htc_priv *priv)
347 {
348 struct ath_common *common = ath9k_hw_common(priv->ah);
349 struct ath9k_htc_target_vif hvif;
350 struct ath9k_htc_target_sta tsta;
351 int ret = 0, sta_idx;
352 u8 cmd_rsp;
353
354 if ((priv->nvifs >= ATH9K_HTC_MAX_VIF) ||
355 (priv->nstations >= ATH9K_HTC_MAX_STA)) {
356 ret = -ENOBUFS;
357 goto err_vif;
358 }
359
360 sta_idx = ffz(priv->sta_slot);
361 if ((sta_idx < 0) || (sta_idx > ATH9K_HTC_MAX_STA)) {
362 ret = -ENOBUFS;
363 goto err_vif;
364 }
365
366 /*
367 * Add an interface.
368 */
369 memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
370 memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN);
371
372 hvif.opmode = HTC_M_MONITOR;
373 hvif.index = ffz(priv->vif_slot);
374
375 WMI_CMD_BUF(WMI_VAP_CREATE_CMDID, &hvif);
376 if (ret)
377 goto err_vif;
378
379 /*
380 * Assign the monitor interface index as a special case here.
381 * This is needed when the interface is brought down.
382 */
383 priv->mon_vif_idx = hvif.index;
384 priv->vif_slot |= (1 << hvif.index);
385
386 /*
387 * Set the hardware mode to monitor only if there are no
388 * other interfaces.
389 */
390 if (!priv->nvifs)
391 priv->ah->opmode = NL80211_IFTYPE_MONITOR;
392
393 priv->nvifs++;
394
395 /*
396 * Associate a station with the interface for packet injection.
397 */
398 memset(&tsta, 0, sizeof(struct ath9k_htc_target_sta));
399
400 memcpy(&tsta.macaddr, common->macaddr, ETH_ALEN);
401
402 tsta.is_vif_sta = 1;
403 tsta.sta_index = sta_idx;
404 tsta.vif_index = hvif.index;
405 tsta.maxampdu = cpu_to_be16(0xffff);
406
407 WMI_CMD_BUF(WMI_NODE_CREATE_CMDID, &tsta);
408 if (ret) {
409 ath_err(common, "Unable to add station entry for monitor mode\n");
410 goto err_sta;
411 }
412
413 priv->sta_slot |= (1 << sta_idx);
414 priv->nstations++;
415 priv->vif_sta_pos[priv->mon_vif_idx] = sta_idx;
416 priv->ah->is_monitoring = true;
417
418 ath_dbg(common, CONFIG,
419 "Attached a monitor interface at idx: %d, sta idx: %d\n",
420 priv->mon_vif_idx, sta_idx);
421
422 return 0;
423
424 err_sta:
425 /*
426 * Remove the interface from the target.
427 */
428 __ath9k_htc_remove_monitor_interface(priv);
429 err_vif:
430 ath_dbg(common, FATAL, "Unable to attach a monitor interface\n");
431
432 return ret;
433 }
434
435 static int ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv)
436 {
437 struct ath_common *common = ath9k_hw_common(priv->ah);
438 int ret = 0;
439 u8 cmd_rsp, sta_idx;
440
441 __ath9k_htc_remove_monitor_interface(priv);
442
443 sta_idx = priv->vif_sta_pos[priv->mon_vif_idx];
444
445 WMI_CMD_BUF(WMI_NODE_REMOVE_CMDID, &sta_idx);
446 if (ret) {
447 ath_err(common, "Unable to remove station entry for monitor mode\n");
448 return ret;
449 }
450
451 priv->sta_slot &= ~(1 << sta_idx);
452 priv->nstations--;
453 priv->ah->is_monitoring = false;
454
455 ath_dbg(common, CONFIG,
456 "Removed a monitor interface at idx: %d, sta idx: %d\n",
457 priv->mon_vif_idx, sta_idx);
458
459 return 0;
460 }
461
462 static int ath9k_htc_add_station(struct ath9k_htc_priv *priv,
463 struct ieee80211_vif *vif,
464 struct ieee80211_sta *sta)
465 {
466 struct ath_common *common = ath9k_hw_common(priv->ah);
467 struct ath9k_htc_target_sta tsta;
468 struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv;
469 struct ath9k_htc_sta *ista;
470 int ret, sta_idx;
471 u8 cmd_rsp;
472 u16 maxampdu;
473
474 if (priv->nstations >= ATH9K_HTC_MAX_STA)
475 return -ENOBUFS;
476
477 sta_idx = ffz(priv->sta_slot);
478 if ((sta_idx < 0) || (sta_idx > ATH9K_HTC_MAX_STA))
479 return -ENOBUFS;
480
481 memset(&tsta, 0, sizeof(struct ath9k_htc_target_sta));
482
483 if (sta) {
484 ista = (struct ath9k_htc_sta *) sta->drv_priv;
485 memcpy(&tsta.macaddr, sta->addr, ETH_ALEN);
486 memcpy(&tsta.bssid, common->curbssid, ETH_ALEN);
487 ista->index = sta_idx;
488 tsta.is_vif_sta = 0;
489 maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
490 sta->ht_cap.ampdu_factor);
491 tsta.maxampdu = cpu_to_be16(maxampdu);
492 } else {
493 memcpy(&tsta.macaddr, vif->addr, ETH_ALEN);
494 tsta.is_vif_sta = 1;
495 tsta.maxampdu = cpu_to_be16(0xffff);
496 }
497
498 tsta.sta_index = sta_idx;
499 tsta.vif_index = avp->index;
500
501 WMI_CMD_BUF(WMI_NODE_CREATE_CMDID, &tsta);
502 if (ret) {
503 if (sta)
504 ath_err(common,
505 "Unable to add station entry for: %pM\n",
506 sta->addr);
507 return ret;
508 }
509
510 if (sta) {
511 ath_dbg(common, CONFIG,
512 "Added a station entry for: %pM (idx: %d)\n",
513 sta->addr, tsta.sta_index);
514 } else {
515 ath_dbg(common, CONFIG,
516 "Added a station entry for VIF %d (idx: %d)\n",
517 avp->index, tsta.sta_index);
518 }
519
520 priv->sta_slot |= (1 << sta_idx);
521 priv->nstations++;
522 if (!sta)
523 priv->vif_sta_pos[avp->index] = sta_idx;
524
525 return 0;
526 }
527
528 static int ath9k_htc_remove_station(struct ath9k_htc_priv *priv,
529 struct ieee80211_vif *vif,
530 struct ieee80211_sta *sta)
531 {
532 struct ath_common *common = ath9k_hw_common(priv->ah);
533 struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv;
534 struct ath9k_htc_sta *ista;
535 int ret;
536 u8 cmd_rsp, sta_idx;
537
538 if (sta) {
539 ista = (struct ath9k_htc_sta *) sta->drv_priv;
540 sta_idx = ista->index;
541 } else {
542 sta_idx = priv->vif_sta_pos[avp->index];
543 }
544
545 WMI_CMD_BUF(WMI_NODE_REMOVE_CMDID, &sta_idx);
546 if (ret) {
547 if (sta)
548 ath_err(common,
549 "Unable to remove station entry for: %pM\n",
550 sta->addr);
551 return ret;
552 }
553
554 if (sta) {
555 ath_dbg(common, CONFIG,
556 "Removed a station entry for: %pM (idx: %d)\n",
557 sta->addr, sta_idx);
558 } else {
559 ath_dbg(common, CONFIG,
560 "Removed a station entry for VIF %d (idx: %d)\n",
561 avp->index, sta_idx);
562 }
563
564 priv->sta_slot &= ~(1 << sta_idx);
565 priv->nstations--;
566
567 return 0;
568 }
569
570 int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv,
571 u8 enable_coex)
572 {
573 struct ath9k_htc_cap_target tcap;
574 int ret;
575 u8 cmd_rsp;
576
577 memset(&tcap, 0, sizeof(struct ath9k_htc_cap_target));
578
579 tcap.ampdu_limit = cpu_to_be32(0xffff);
580 tcap.ampdu_subframes = 0xff;
581 tcap.enable_coex = enable_coex;
582 tcap.tx_chainmask = priv->ah->caps.tx_chainmask;
583
584 WMI_CMD_BUF(WMI_TARGET_IC_UPDATE_CMDID, &tcap);
585
586 return ret;
587 }
588
589 static void ath9k_htc_setup_rate(struct ath9k_htc_priv *priv,
590 struct ieee80211_sta *sta,
591 struct ath9k_htc_target_rate *trate)
592 {
593 struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv;
594 struct ieee80211_supported_band *sband;
595 u32 caps = 0;
596 int i, j;
597
598 sband = priv->hw->wiphy->bands[priv->hw->conf.chandef.chan->band];
599
600 for (i = 0, j = 0; i < sband->n_bitrates; i++) {
601 if (sta->supp_rates[sband->band] & BIT(i)) {
602 trate->rates.legacy_rates.rs_rates[j]
603 = (sband->bitrates[i].bitrate * 2) / 10;
604 j++;
605 }
606 }
607 trate->rates.legacy_rates.rs_nrates = j;
608
609 if (sta->ht_cap.ht_supported) {
610 for (i = 0, j = 0; i < 77; i++) {
611 if (sta->ht_cap.mcs.rx_mask[i/8] & (1<<(i%8)))
612 trate->rates.ht_rates.rs_rates[j++] = i;
613 if (j == ATH_HTC_RATE_MAX)
614 break;
615 }
616 trate->rates.ht_rates.rs_nrates = j;
617
618 caps = WLAN_RC_HT_FLAG;
619 if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
620 caps |= ATH_RC_TX_STBC_FLAG;
621 if (sta->ht_cap.mcs.rx_mask[1])
622 caps |= WLAN_RC_DS_FLAG;
623 if ((sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
624 (conf_is_ht40(&priv->hw->conf)))
625 caps |= WLAN_RC_40_FLAG;
626 if (conf_is_ht40(&priv->hw->conf) &&
627 (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40))
628 caps |= WLAN_RC_SGI_FLAG;
629 else if (conf_is_ht20(&priv->hw->conf) &&
630 (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20))
631 caps |= WLAN_RC_SGI_FLAG;
632 }
633
634 trate->sta_index = ista->index;
635 trate->isnew = 1;
636 trate->capflags = cpu_to_be32(caps);
637 }
638
639 static int ath9k_htc_send_rate_cmd(struct ath9k_htc_priv *priv,
640 struct ath9k_htc_target_rate *trate)
641 {
642 struct ath_common *common = ath9k_hw_common(priv->ah);
643 int ret;
644 u8 cmd_rsp;
645
646 WMI_CMD_BUF(WMI_RC_RATE_UPDATE_CMDID, trate);
647 if (ret) {
648 ath_err(common,
649 "Unable to initialize Rate information on target\n");
650 }
651
652 return ret;
653 }
654
655 static void ath9k_htc_init_rate(struct ath9k_htc_priv *priv,
656 struct ieee80211_sta *sta)
657 {
658 struct ath_common *common = ath9k_hw_common(priv->ah);
659 struct ath9k_htc_target_rate trate;
660 int ret;
661
662 memset(&trate, 0, sizeof(struct ath9k_htc_target_rate));
663 ath9k_htc_setup_rate(priv, sta, &trate);
664 ret = ath9k_htc_send_rate_cmd(priv, &trate);
665 if (!ret)
666 ath_dbg(common, CONFIG,
667 "Updated target sta: %pM, rate caps: 0x%X\n",
668 sta->addr, be32_to_cpu(trate.capflags));
669 }
670
671 static void ath9k_htc_update_rate(struct ath9k_htc_priv *priv,
672 struct ieee80211_vif *vif,
673 struct ieee80211_bss_conf *bss_conf)
674 {
675 struct ath_common *common = ath9k_hw_common(priv->ah);
676 struct ath9k_htc_target_rate trate;
677 struct ieee80211_sta *sta;
678 int ret;
679
680 memset(&trate, 0, sizeof(struct ath9k_htc_target_rate));
681
682 rcu_read_lock();
683 sta = ieee80211_find_sta(vif, bss_conf->bssid);
684 if (!sta) {
685 rcu_read_unlock();
686 return;
687 }
688 ath9k_htc_setup_rate(priv, sta, &trate);
689 rcu_read_unlock();
690
691 ret = ath9k_htc_send_rate_cmd(priv, &trate);
692 if (!ret)
693 ath_dbg(common, CONFIG,
694 "Updated target sta: %pM, rate caps: 0x%X\n",
695 bss_conf->bssid, be32_to_cpu(trate.capflags));
696 }
697
698 static int ath9k_htc_tx_aggr_oper(struct ath9k_htc_priv *priv,
699 struct ieee80211_vif *vif,
700 struct ieee80211_sta *sta,
701 enum ieee80211_ampdu_mlme_action action,
702 u16 tid)
703 {
704 struct ath_common *common = ath9k_hw_common(priv->ah);
705 struct ath9k_htc_target_aggr aggr;
706 struct ath9k_htc_sta *ista;
707 int ret = 0;
708 u8 cmd_rsp;
709
710 if (tid >= ATH9K_HTC_MAX_TID)
711 return -EINVAL;
712
713 memset(&aggr, 0, sizeof(struct ath9k_htc_target_aggr));
714 ista = (struct ath9k_htc_sta *) sta->drv_priv;
715
716 aggr.sta_index = ista->index;
717 aggr.tidno = tid & 0xf;
718 aggr.aggr_enable = (action == IEEE80211_AMPDU_TX_START) ? true : false;
719
720 WMI_CMD_BUF(WMI_TX_AGGR_ENABLE_CMDID, &aggr);
721 if (ret)
722 ath_dbg(common, CONFIG,
723 "Unable to %s TX aggregation for (%pM, %d)\n",
724 (aggr.aggr_enable) ? "start" : "stop", sta->addr, tid);
725 else
726 ath_dbg(common, CONFIG,
727 "%s TX aggregation for (%pM, %d)\n",
728 (aggr.aggr_enable) ? "Starting" : "Stopping",
729 sta->addr, tid);
730
731 spin_lock_bh(&priv->tx.tx_lock);
732 ista->tid_state[tid] = (aggr.aggr_enable && !ret) ? AGGR_START : AGGR_STOP;
733 spin_unlock_bh(&priv->tx.tx_lock);
734
735 return ret;
736 }
737
738 /*******/
739 /* ANI */
740 /*******/
741
742 void ath9k_htc_start_ani(struct ath9k_htc_priv *priv)
743 {
744 struct ath_common *common = ath9k_hw_common(priv->ah);
745 unsigned long timestamp = jiffies_to_msecs(jiffies);
746
747 common->ani.longcal_timer = timestamp;
748 common->ani.shortcal_timer = timestamp;
749 common->ani.checkani_timer = timestamp;
750
751 set_bit(OP_ANI_RUNNING, &priv->op_flags);
752
753 ieee80211_queue_delayed_work(common->hw, &priv->ani_work,
754 msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
755 }
756
757 void ath9k_htc_stop_ani(struct ath9k_htc_priv *priv)
758 {
759 cancel_delayed_work_sync(&priv->ani_work);
760 clear_bit(OP_ANI_RUNNING, &priv->op_flags);
761 }
762
763 void ath9k_htc_ani_work(struct work_struct *work)
764 {
765 struct ath9k_htc_priv *priv =
766 container_of(work, struct ath9k_htc_priv, ani_work.work);
767 struct ath_hw *ah = priv->ah;
768 struct ath_common *common = ath9k_hw_common(ah);
769 bool longcal = false;
770 bool shortcal = false;
771 bool aniflag = false;
772 unsigned int timestamp = jiffies_to_msecs(jiffies);
773 u32 cal_interval, short_cal_interval;
774
775 short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ?
776 ATH_AP_SHORT_CALINTERVAL : ATH_STA_SHORT_CALINTERVAL;
777
778 /* Only calibrate if awake */
779 if (ah->power_mode != ATH9K_PM_AWAKE)
780 goto set_timer;
781
782 /* Long calibration runs independently of short calibration. */
783 if ((timestamp - common->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) {
784 longcal = true;
785 ath_dbg(common, ANI, "longcal @%lu\n", jiffies);
786 common->ani.longcal_timer = timestamp;
787 }
788
789 /* Short calibration applies only while caldone is false */
790 if (!common->ani.caldone) {
791 if ((timestamp - common->ani.shortcal_timer) >=
792 short_cal_interval) {
793 shortcal = true;
794 ath_dbg(common, ANI, "shortcal @%lu\n", jiffies);
795 common->ani.shortcal_timer = timestamp;
796 common->ani.resetcal_timer = timestamp;
797 }
798 } else {
799 if ((timestamp - common->ani.resetcal_timer) >=
800 ATH_RESTART_CALINTERVAL) {
801 common->ani.caldone = ath9k_hw_reset_calvalid(ah);
802 if (common->ani.caldone)
803 common->ani.resetcal_timer = timestamp;
804 }
805 }
806
807 /* Verify whether we must check ANI */
808 if ((timestamp - common->ani.checkani_timer) >= ATH_ANI_POLLINTERVAL) {
809 aniflag = true;
810 common->ani.checkani_timer = timestamp;
811 }
812
813 /* Skip all processing if there's nothing to do. */
814 if (longcal || shortcal || aniflag) {
815
816 ath9k_htc_ps_wakeup(priv);
817
818 /* Call ANI routine if necessary */
819 if (aniflag)
820 ath9k_hw_ani_monitor(ah, ah->curchan);
821
822 /* Perform calibration if necessary */
823 if (longcal || shortcal)
824 common->ani.caldone =
825 ath9k_hw_calibrate(ah, ah->curchan,
826 ah->rxchainmask, longcal);
827
828 ath9k_htc_ps_restore(priv);
829 }
830
831 set_timer:
832 /*
833 * Set timer interval based on previous results.
834 * The interval must be the shortest necessary to satisfy ANI,
835 * short calibration and long calibration.
836 */
837 cal_interval = ATH_LONG_CALINTERVAL;
838 cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
839 if (!common->ani.caldone)
840 cal_interval = min(cal_interval, (u32)short_cal_interval);
841
842 ieee80211_queue_delayed_work(common->hw, &priv->ani_work,
843 msecs_to_jiffies(cal_interval));
844 }
845
846 /**********************/
847 /* mac80211 Callbacks */
848 /**********************/
849
850 static void ath9k_htc_tx(struct ieee80211_hw *hw,
851 struct ieee80211_tx_control *control,
852 struct sk_buff *skb)
853 {
854 struct ieee80211_hdr *hdr;
855 struct ath9k_htc_priv *priv = hw->priv;
856 struct ath_common *common = ath9k_hw_common(priv->ah);
857 int padpos, padsize, ret, slot;
858
859 hdr = (struct ieee80211_hdr *) skb->data;
860
861 /* Add the padding after the header if this is not already done */
862 padpos = ieee80211_hdrlen(hdr->frame_control);
863 padsize = padpos & 3;
864 if (padsize && skb->len > padpos) {
865 if (skb_headroom(skb) < padsize) {
866 ath_dbg(common, XMIT, "No room for padding\n");
867 goto fail_tx;
868 }
869 skb_push(skb, padsize);
870 memmove(skb->data, skb->data + padsize, padpos);
871 }
872
873 slot = ath9k_htc_tx_get_slot(priv);
874 if (slot < 0) {
875 ath_dbg(common, XMIT, "No free TX slot\n");
876 goto fail_tx;
877 }
878
879 ret = ath9k_htc_tx_start(priv, control->sta, skb, slot, false);
880 if (ret != 0) {
881 ath_dbg(common, XMIT, "Tx failed\n");
882 goto clear_slot;
883 }
884
885 ath9k_htc_check_stop_queues(priv);
886
887 return;
888
889 clear_slot:
890 ath9k_htc_tx_clear_slot(priv, slot);
891 fail_tx:
892 dev_kfree_skb_any(skb);
893 }
894
895 static int ath9k_htc_start(struct ieee80211_hw *hw)
896 {
897 struct ath9k_htc_priv *priv = hw->priv;
898 struct ath_hw *ah = priv->ah;
899 struct ath_common *common = ath9k_hw_common(ah);
900 struct ieee80211_channel *curchan = hw->conf.chandef.chan;
901 struct ath9k_channel *init_channel;
902 int ret = 0;
903 enum htc_phymode mode;
904 __be16 htc_mode;
905 u8 cmd_rsp;
906
907 mutex_lock(&priv->mutex);
908
909 ath_dbg(common, CONFIG,
910 "Starting driver with initial channel: %d MHz\n",
911 curchan->center_freq);
912
913 /* Ensure that HW is awake before flushing RX */
914 ath9k_htc_setpower(priv, ATH9K_PM_AWAKE);
915 WMI_CMD(WMI_FLUSH_RECV_CMDID);
916
917 /* setup initial channel */
918 init_channel = ath9k_cmn_get_channel(hw, ah, &hw->conf.chandef);
919
920 ret = ath9k_hw_reset(ah, init_channel, ah->caldata, false);
921 if (ret) {
922 ath_err(common,
923 "Unable to reset hardware; reset status %d (freq %u MHz)\n",
924 ret, curchan->center_freq);
925 mutex_unlock(&priv->mutex);
926 return ret;
927 }
928
929 ath9k_cmn_update_txpow(ah, priv->curtxpow, priv->txpowlimit,
930 &priv->curtxpow);
931
932 mode = ath9k_htc_get_curmode(priv, init_channel);
933 htc_mode = cpu_to_be16(mode);
934 WMI_CMD_BUF(WMI_SET_MODE_CMDID, &htc_mode);
935 WMI_CMD(WMI_ATH_INIT_CMDID);
936 WMI_CMD(WMI_START_RECV_CMDID);
937
938 ath9k_host_rx_init(priv);
939
940 ret = ath9k_htc_update_cap_target(priv, 0);
941 if (ret)
942 ath_dbg(common, CONFIG,
943 "Failed to update capability in target\n");
944
945 clear_bit(OP_INVALID, &priv->op_flags);
946 htc_start(priv->htc);
947
948 spin_lock_bh(&priv->tx.tx_lock);
949 priv->tx.flags &= ~ATH9K_HTC_OP_TX_QUEUES_STOP;
950 spin_unlock_bh(&priv->tx.tx_lock);
951
952 ieee80211_wake_queues(hw);
953
954 mod_timer(&priv->tx.cleanup_timer,
955 jiffies + msecs_to_jiffies(ATH9K_HTC_TX_CLEANUP_INTERVAL));
956
957 ath9k_htc_start_btcoex(priv);
958
959 mutex_unlock(&priv->mutex);
960
961 return ret;
962 }
963
964 static void ath9k_htc_stop(struct ieee80211_hw *hw)
965 {
966 struct ath9k_htc_priv *priv = hw->priv;
967 struct ath_hw *ah = priv->ah;
968 struct ath_common *common = ath9k_hw_common(ah);
969 int ret __attribute__ ((unused));
970 u8 cmd_rsp;
971
972 mutex_lock(&priv->mutex);
973
974 if (test_bit(OP_INVALID, &priv->op_flags)) {
975 ath_dbg(common, ANY, "Device not present\n");
976 mutex_unlock(&priv->mutex);
977 return;
978 }
979
980 ath9k_htc_ps_wakeup(priv);
981
982 WMI_CMD(WMI_DISABLE_INTR_CMDID);
983 WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID);
984 WMI_CMD(WMI_STOP_RECV_CMDID);
985
986 tasklet_kill(&priv->rx_tasklet);
987
988 del_timer_sync(&priv->tx.cleanup_timer);
989 ath9k_htc_tx_drain(priv);
990 ath9k_wmi_event_drain(priv);
991
992 mutex_unlock(&priv->mutex);
993
994 /* Cancel all the running timers/work .. */
995 cancel_work_sync(&priv->fatal_work);
996 cancel_work_sync(&priv->ps_work);
997
998 #ifdef CONFIG_MAC80211_LEDS
999 cancel_work_sync(&priv->led_work);
1000 #endif
1001 ath9k_htc_stop_ani(priv);
1002
1003 mutex_lock(&priv->mutex);
1004
1005 ath9k_htc_stop_btcoex(priv);
1006
1007 /* Remove a monitor interface if it's present. */
1008 if (priv->ah->is_monitoring)
1009 ath9k_htc_remove_monitor_interface(priv);
1010
1011 ath9k_hw_phy_disable(ah);
1012 ath9k_hw_disable(ah);
1013 ath9k_htc_ps_restore(priv);
1014 ath9k_htc_setpower(priv, ATH9K_PM_FULL_SLEEP);
1015
1016 set_bit(OP_INVALID, &priv->op_flags);
1017
1018 ath_dbg(common, CONFIG, "Driver halt\n");
1019 mutex_unlock(&priv->mutex);
1020 }
1021
1022 static int ath9k_htc_add_interface(struct ieee80211_hw *hw,
1023 struct ieee80211_vif *vif)
1024 {
1025 struct ath9k_htc_priv *priv = hw->priv;
1026 struct ath9k_htc_vif *avp = (void *)vif->drv_priv;
1027 struct ath_common *common = ath9k_hw_common(priv->ah);
1028 struct ath9k_htc_target_vif hvif;
1029 int ret = 0;
1030 u8 cmd_rsp;
1031
1032 mutex_lock(&priv->mutex);
1033
1034 ath9k_htc_ps_wakeup(priv);
1035 memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
1036 memcpy(&hvif.myaddr, vif->addr, ETH_ALEN);
1037
1038 switch (vif->type) {
1039 case NL80211_IFTYPE_STATION:
1040 hvif.opmode = HTC_M_STA;
1041 break;
1042 case NL80211_IFTYPE_ADHOC:
1043 hvif.opmode = HTC_M_IBSS;
1044 break;
1045 case NL80211_IFTYPE_AP:
1046 hvif.opmode = HTC_M_HOSTAP;
1047 break;
1048 case NL80211_IFTYPE_MESH_POINT:
1049 hvif.opmode = HTC_M_WDS; /* close enough */
1050 break;
1051 default:
1052 ath_err(common,
1053 "Interface type %d not yet supported\n", vif->type);
1054 ret = -EOPNOTSUPP;
1055 goto out;
1056 }
1057
1058 /* Index starts from zero on the target */
1059 avp->index = hvif.index = ffz(priv->vif_slot);
1060 hvif.rtsthreshold = cpu_to_be16(2304);
1061 WMI_CMD_BUF(WMI_VAP_CREATE_CMDID, &hvif);
1062 if (ret)
1063 goto out;
1064
1065 /*
1066 * We need a node in target to tx mgmt frames
1067 * before association.
1068 */
1069 ret = ath9k_htc_add_station(priv, vif, NULL);
1070 if (ret) {
1071 WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif);
1072 goto out;
1073 }
1074
1075 ath9k_htc_set_mac_bssid_mask(priv, vif);
1076
1077 priv->vif_slot |= (1 << avp->index);
1078 priv->nvifs++;
1079
1080 INC_VIF(priv, vif->type);
1081
1082 if ((vif->type == NL80211_IFTYPE_AP) ||
1083 (vif->type == NL80211_IFTYPE_MESH_POINT) ||
1084 (vif->type == NL80211_IFTYPE_ADHOC))
1085 ath9k_htc_assign_bslot(priv, vif);
1086
1087 ath9k_htc_set_opmode(priv);
1088
1089 if ((priv->ah->opmode == NL80211_IFTYPE_AP) &&
1090 !test_bit(OP_ANI_RUNNING, &priv->op_flags)) {
1091 ath9k_hw_set_tsfadjust(priv->ah, true);
1092 ath9k_htc_start_ani(priv);
1093 }
1094
1095 ath_dbg(common, CONFIG, "Attach a VIF of type: %d at idx: %d\n",
1096 vif->type, avp->index);
1097
1098 out:
1099 ath9k_htc_ps_restore(priv);
1100 mutex_unlock(&priv->mutex);
1101
1102 return ret;
1103 }
1104
1105 static void ath9k_htc_remove_interface(struct ieee80211_hw *hw,
1106 struct ieee80211_vif *vif)
1107 {
1108 struct ath9k_htc_priv *priv = hw->priv;
1109 struct ath_common *common = ath9k_hw_common(priv->ah);
1110 struct ath9k_htc_vif *avp = (void *)vif->drv_priv;
1111 struct ath9k_htc_target_vif hvif;
1112 int ret = 0;
1113 u8 cmd_rsp;
1114
1115 mutex_lock(&priv->mutex);
1116 ath9k_htc_ps_wakeup(priv);
1117
1118 memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
1119 memcpy(&hvif.myaddr, vif->addr, ETH_ALEN);
1120 hvif.index = avp->index;
1121 WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif);
1122 if (ret) {
1123 ath_err(common, "Unable to remove interface at idx: %d\n",
1124 avp->index);
1125 }
1126 priv->nvifs--;
1127 priv->vif_slot &= ~(1 << avp->index);
1128
1129 ath9k_htc_remove_station(priv, vif, NULL);
1130
1131 DEC_VIF(priv, vif->type);
1132
1133 if ((vif->type == NL80211_IFTYPE_AP) ||
1134 vif->type == NL80211_IFTYPE_MESH_POINT ||
1135 (vif->type == NL80211_IFTYPE_ADHOC))
1136 ath9k_htc_remove_bslot(priv, vif);
1137
1138 ath9k_htc_set_opmode(priv);
1139
1140 ath9k_htc_set_mac_bssid_mask(priv, vif);
1141
1142 /*
1143 * Stop ANI only if there are no associated station interfaces.
1144 */
1145 if ((vif->type == NL80211_IFTYPE_AP) && (priv->num_ap_vif == 0)) {
1146 priv->rearm_ani = false;
1147 ieee80211_iterate_active_interfaces_atomic(
1148 priv->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
1149 ath9k_htc_vif_iter, priv);
1150 if (!priv->rearm_ani)
1151 ath9k_htc_stop_ani(priv);
1152 }
1153
1154 ath_dbg(common, CONFIG, "Detach Interface at idx: %d\n", avp->index);
1155
1156 ath9k_htc_ps_restore(priv);
1157 mutex_unlock(&priv->mutex);
1158 }
1159
1160 static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
1161 {
1162 struct ath9k_htc_priv *priv = hw->priv;
1163 struct ath_common *common = ath9k_hw_common(priv->ah);
1164 struct ieee80211_conf *conf = &hw->conf;
1165 bool chip_reset = false;
1166 int ret = 0;
1167
1168 mutex_lock(&priv->mutex);
1169 ath9k_htc_ps_wakeup(priv);
1170
1171 if (changed & IEEE80211_CONF_CHANGE_IDLE) {
1172 mutex_lock(&priv->htc_pm_lock);
1173
1174 priv->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE);
1175 if (!priv->ps_idle)
1176 chip_reset = true;
1177
1178 mutex_unlock(&priv->htc_pm_lock);
1179 }
1180
1181 /*
1182 * Monitor interface should be added before
1183 * IEEE80211_CONF_CHANGE_CHANNEL is handled.
1184 */
1185 if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
1186 if ((conf->flags & IEEE80211_CONF_MONITOR) &&
1187 !priv->ah->is_monitoring)
1188 ath9k_htc_add_monitor_interface(priv);
1189 else if (priv->ah->is_monitoring)
1190 ath9k_htc_remove_monitor_interface(priv);
1191 }
1192
1193 if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) {
1194 struct ieee80211_channel *curchan = hw->conf.chandef.chan;
1195 int pos = curchan->hw_value;
1196
1197 ath_dbg(common, CONFIG, "Set channel: %d MHz\n",
1198 curchan->center_freq);
1199
1200 ath9k_cmn_get_channel(hw, priv->ah, &hw->conf.chandef);
1201 if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) {
1202 ath_err(common, "Unable to set channel\n");
1203 ret = -EINVAL;
1204 goto out;
1205 }
1206
1207 }
1208
1209 if (changed & IEEE80211_CONF_CHANGE_PS) {
1210 if (conf->flags & IEEE80211_CONF_PS) {
1211 ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP);
1212 priv->ps_enabled = true;
1213 } else {
1214 priv->ps_enabled = false;
1215 cancel_work_sync(&priv->ps_work);
1216 ath9k_htc_setpower(priv, ATH9K_PM_AWAKE);
1217 }
1218 }
1219
1220 if (changed & IEEE80211_CONF_CHANGE_POWER) {
1221 priv->txpowlimit = 2 * conf->power_level;
1222 ath9k_cmn_update_txpow(priv->ah, priv->curtxpow,
1223 priv->txpowlimit, &priv->curtxpow);
1224 }
1225
1226 out:
1227 ath9k_htc_ps_restore(priv);
1228 mutex_unlock(&priv->mutex);
1229 return ret;
1230 }
1231
1232 #define SUPPORTED_FILTERS \
1233 (FIF_PROMISC_IN_BSS | \
1234 FIF_ALLMULTI | \
1235 FIF_CONTROL | \
1236 FIF_PSPOLL | \
1237 FIF_OTHER_BSS | \
1238 FIF_BCN_PRBRESP_PROMISC | \
1239 FIF_PROBE_REQ | \
1240 FIF_FCSFAIL)
1241
1242 static void ath9k_htc_configure_filter(struct ieee80211_hw *hw,
1243 unsigned int changed_flags,
1244 unsigned int *total_flags,
1245 u64 multicast)
1246 {
1247 struct ath9k_htc_priv *priv = hw->priv;
1248 u32 rfilt;
1249
1250 mutex_lock(&priv->mutex);
1251 changed_flags &= SUPPORTED_FILTERS;
1252 *total_flags &= SUPPORTED_FILTERS;
1253
1254 if (test_bit(OP_INVALID, &priv->op_flags)) {
1255 ath_dbg(ath9k_hw_common(priv->ah), ANY,
1256 "Unable to configure filter on invalid state\n");
1257 mutex_unlock(&priv->mutex);
1258 return;
1259 }
1260 ath9k_htc_ps_wakeup(priv);
1261
1262 priv->rxfilter = *total_flags;
1263 rfilt = ath9k_htc_calcrxfilter(priv);
1264 ath9k_hw_setrxfilter(priv->ah, rfilt);
1265
1266 ath_dbg(ath9k_hw_common(priv->ah), CONFIG, "Set HW RX filter: 0x%x\n",
1267 rfilt);
1268
1269 ath9k_htc_ps_restore(priv);
1270 mutex_unlock(&priv->mutex);
1271 }
1272
1273 static void ath9k_htc_sta_rc_update_work(struct work_struct *work)
1274 {
1275 struct ath9k_htc_sta *ista =
1276 container_of(work, struct ath9k_htc_sta, rc_update_work);
1277 struct ieee80211_sta *sta =
1278 container_of((void *)ista, struct ieee80211_sta, drv_priv);
1279 struct ath9k_htc_priv *priv = ista->htc_priv;
1280 struct ath_common *common = ath9k_hw_common(priv->ah);
1281 struct ath9k_htc_target_rate trate;
1282
1283 mutex_lock(&priv->mutex);
1284 ath9k_htc_ps_wakeup(priv);
1285
1286 memset(&trate, 0, sizeof(struct ath9k_htc_target_rate));
1287 ath9k_htc_setup_rate(priv, sta, &trate);
1288 if (!ath9k_htc_send_rate_cmd(priv, &trate))
1289 ath_dbg(common, CONFIG,
1290 "Supported rates for sta: %pM updated, rate caps: 0x%X\n",
1291 sta->addr, be32_to_cpu(trate.capflags));
1292 else
1293 ath_dbg(common, CONFIG,
1294 "Unable to update supported rates for sta: %pM\n",
1295 sta->addr);
1296
1297 ath9k_htc_ps_restore(priv);
1298 mutex_unlock(&priv->mutex);
1299 }
1300
1301 static int ath9k_htc_sta_add(struct ieee80211_hw *hw,
1302 struct ieee80211_vif *vif,
1303 struct ieee80211_sta *sta)
1304 {
1305 struct ath9k_htc_priv *priv = hw->priv;
1306 struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv;
1307 int ret;
1308
1309 mutex_lock(&priv->mutex);
1310 ath9k_htc_ps_wakeup(priv);
1311 ret = ath9k_htc_add_station(priv, vif, sta);
1312 if (!ret) {
1313 INIT_WORK(&ista->rc_update_work, ath9k_htc_sta_rc_update_work);
1314 ista->htc_priv = priv;
1315 ath9k_htc_init_rate(priv, sta);
1316 }
1317 ath9k_htc_ps_restore(priv);
1318 mutex_unlock(&priv->mutex);
1319
1320 return ret;
1321 }
1322
1323 static int ath9k_htc_sta_remove(struct ieee80211_hw *hw,
1324 struct ieee80211_vif *vif,
1325 struct ieee80211_sta *sta)
1326 {
1327 struct ath9k_htc_priv *priv = hw->priv;
1328 struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv;
1329 int ret;
1330
1331 cancel_work_sync(&ista->rc_update_work);
1332
1333 mutex_lock(&priv->mutex);
1334 ath9k_htc_ps_wakeup(priv);
1335 htc_sta_drain(priv->htc, ista->index);
1336 ret = ath9k_htc_remove_station(priv, vif, sta);
1337 ath9k_htc_ps_restore(priv);
1338 mutex_unlock(&priv->mutex);
1339
1340 return ret;
1341 }
1342
1343 static void ath9k_htc_sta_rc_update(struct ieee80211_hw *hw,
1344 struct ieee80211_vif *vif,
1345 struct ieee80211_sta *sta, u32 changed)
1346 {
1347 struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv;
1348
1349 if (!(changed & IEEE80211_RC_SUPP_RATES_CHANGED))
1350 return;
1351
1352 schedule_work(&ista->rc_update_work);
1353 }
1354
1355 static int ath9k_htc_conf_tx(struct ieee80211_hw *hw,
1356 struct ieee80211_vif *vif, u16 queue,
1357 const struct ieee80211_tx_queue_params *params)
1358 {
1359 struct ath9k_htc_priv *priv = hw->priv;
1360 struct ath_common *common = ath9k_hw_common(priv->ah);
1361 struct ath9k_tx_queue_info qi;
1362 int ret = 0, qnum;
1363
1364 if (queue >= IEEE80211_NUM_ACS)
1365 return 0;
1366
1367 mutex_lock(&priv->mutex);
1368 ath9k_htc_ps_wakeup(priv);
1369
1370 memset(&qi, 0, sizeof(struct ath9k_tx_queue_info));
1371
1372 qi.tqi_aifs = params->aifs;
1373 qi.tqi_cwmin = params->cw_min;
1374 qi.tqi_cwmax = params->cw_max;
1375 qi.tqi_burstTime = params->txop * 32;
1376
1377 qnum = get_hw_qnum(queue, priv->hwq_map);
1378
1379 ath_dbg(common, CONFIG,
1380 "Configure tx [queue/hwq] [%d/%d], aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n",
1381 queue, qnum, params->aifs, params->cw_min,
1382 params->cw_max, params->txop);
1383
1384 ret = ath_htc_txq_update(priv, qnum, &qi);
1385 if (ret) {
1386 ath_err(common, "TXQ Update failed\n");
1387 goto out;
1388 }
1389
1390 if ((priv->ah->opmode == NL80211_IFTYPE_ADHOC) &&
1391 (qnum == priv->hwq_map[IEEE80211_AC_BE]))
1392 ath9k_htc_beaconq_config(priv);
1393 out:
1394 ath9k_htc_ps_restore(priv);
1395 mutex_unlock(&priv->mutex);
1396
1397 return ret;
1398 }
1399
1400 static int ath9k_htc_set_key(struct ieee80211_hw *hw,
1401 enum set_key_cmd cmd,
1402 struct ieee80211_vif *vif,
1403 struct ieee80211_sta *sta,
1404 struct ieee80211_key_conf *key)
1405 {
1406 struct ath9k_htc_priv *priv = hw->priv;
1407 struct ath_common *common = ath9k_hw_common(priv->ah);
1408 int ret = 0;
1409
1410 if (htc_modparam_nohwcrypt)
1411 return -ENOSPC;
1412
1413 if ((vif->type == NL80211_IFTYPE_ADHOC ||
1414 vif->type == NL80211_IFTYPE_MESH_POINT) &&
1415 (key->cipher == WLAN_CIPHER_SUITE_TKIP ||
1416 key->cipher == WLAN_CIPHER_SUITE_CCMP) &&
1417 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) {
1418 /*
1419 * For now, disable hw crypto for the RSN IBSS group keys. This
1420 * could be optimized in the future to use a modified key cache
1421 * design to support per-STA RX GTK, but until that gets
1422 * implemented, use of software crypto for group addressed
1423 * frames is a acceptable to allow RSN IBSS to be used.
1424 */
1425 return -EOPNOTSUPP;
1426 }
1427
1428 mutex_lock(&priv->mutex);
1429 ath_dbg(common, CONFIG, "Set HW Key\n");
1430 ath9k_htc_ps_wakeup(priv);
1431
1432 switch (cmd) {
1433 case SET_KEY:
1434 ret = ath_key_config(common, vif, sta, key);
1435 if (ret >= 0) {
1436 key->hw_key_idx = ret;
1437 /* push IV and Michael MIC generation to stack */
1438 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
1439 if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
1440 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
1441 if (priv->ah->sw_mgmt_crypto &&
1442 key->cipher == WLAN_CIPHER_SUITE_CCMP)
1443 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
1444 ret = 0;
1445 }
1446 break;
1447 case DISABLE_KEY:
1448 ath_key_delete(common, key);
1449 break;
1450 default:
1451 ret = -EINVAL;
1452 }
1453
1454 ath9k_htc_ps_restore(priv);
1455 mutex_unlock(&priv->mutex);
1456
1457 return ret;
1458 }
1459
1460 static void ath9k_htc_set_bssid(struct ath9k_htc_priv *priv)
1461 {
1462 struct ath_common *common = ath9k_hw_common(priv->ah);
1463
1464 ath9k_hw_write_associd(priv->ah);
1465 ath_dbg(common, CONFIG, "BSSID: %pM aid: 0x%x\n",
1466 common->curbssid, common->curaid);
1467 }
1468
1469 static void ath9k_htc_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
1470 {
1471 struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data;
1472 struct ath_common *common = ath9k_hw_common(priv->ah);
1473 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
1474
1475 if ((vif->type == NL80211_IFTYPE_STATION) && bss_conf->assoc) {
1476 common->curaid = bss_conf->aid;
1477 memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
1478 }
1479 }
1480
1481 static void ath9k_htc_choose_set_bssid(struct ath9k_htc_priv *priv)
1482 {
1483 if (priv->num_sta_assoc_vif == 1) {
1484 ieee80211_iterate_active_interfaces_atomic(
1485 priv->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
1486 ath9k_htc_bss_iter, priv);
1487 ath9k_htc_set_bssid(priv);
1488 }
1489 }
1490
1491 static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
1492 struct ieee80211_vif *vif,
1493 struct ieee80211_bss_conf *bss_conf,
1494 u32 changed)
1495 {
1496 struct ath9k_htc_priv *priv = hw->priv;
1497 struct ath_hw *ah = priv->ah;
1498 struct ath_common *common = ath9k_hw_common(ah);
1499
1500 mutex_lock(&priv->mutex);
1501 ath9k_htc_ps_wakeup(priv);
1502
1503 if (changed & BSS_CHANGED_ASSOC) {
1504 ath_dbg(common, CONFIG, "BSS Changed ASSOC %d\n",
1505 bss_conf->assoc);
1506
1507 bss_conf->assoc ?
1508 priv->num_sta_assoc_vif++ : priv->num_sta_assoc_vif--;
1509
1510 if (priv->ah->opmode == NL80211_IFTYPE_STATION) {
1511 ath9k_htc_choose_set_bssid(priv);
1512 if (bss_conf->assoc && (priv->num_sta_assoc_vif == 1))
1513 ath9k_htc_start_ani(priv);
1514 else if (priv->num_sta_assoc_vif == 0)
1515 ath9k_htc_stop_ani(priv);
1516 }
1517 }
1518
1519 if (changed & BSS_CHANGED_IBSS) {
1520 if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) {
1521 common->curaid = bss_conf->aid;
1522 memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
1523 ath9k_htc_set_bssid(priv);
1524 }
1525 }
1526
1527 if ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon) {
1528 ath_dbg(common, CONFIG, "Beacon enabled for BSS: %pM\n",
1529 bss_conf->bssid);
1530 ath9k_htc_set_tsfadjust(priv, vif);
1531 set_bit(OP_ENABLE_BEACON, &priv->op_flags);
1532 ath9k_htc_beacon_config(priv, vif);
1533 }
1534
1535 if ((changed & BSS_CHANGED_BEACON_ENABLED) && !bss_conf->enable_beacon) {
1536 /*
1537 * Disable SWBA interrupt only if there are no
1538 * concurrent AP/mesh or IBSS interfaces.
1539 */
1540 if ((priv->num_ap_vif + priv->num_mbss_vif <= 1) ||
1541 priv->num_ibss_vif) {
1542 ath_dbg(common, CONFIG,
1543 "Beacon disabled for BSS: %pM\n",
1544 bss_conf->bssid);
1545 clear_bit(OP_ENABLE_BEACON, &priv->op_flags);
1546 ath9k_htc_beacon_config(priv, vif);
1547 }
1548 }
1549
1550 if (changed & BSS_CHANGED_BEACON_INT) {
1551 /*
1552 * Reset the HW TSF for the first AP or mesh interface.
1553 */
1554 if (priv->nvifs == 1 &&
1555 ((priv->ah->opmode == NL80211_IFTYPE_AP &&
1556 vif->type == NL80211_IFTYPE_AP &&
1557 priv->num_ap_vif == 1) ||
1558 (priv->ah->opmode == NL80211_IFTYPE_MESH_POINT &&
1559 vif->type == NL80211_IFTYPE_MESH_POINT &&
1560 priv->num_mbss_vif == 1))) {
1561 set_bit(OP_TSF_RESET, &priv->op_flags);
1562 }
1563 ath_dbg(common, CONFIG,
1564 "Beacon interval changed for BSS: %pM\n",
1565 bss_conf->bssid);
1566 ath9k_htc_beacon_config(priv, vif);
1567 }
1568
1569 if (changed & BSS_CHANGED_ERP_SLOT) {
1570 if (bss_conf->use_short_slot)
1571 ah->slottime = 9;
1572 else
1573 ah->slottime = 20;
1574
1575 ath9k_hw_init_global_settings(ah);
1576 }
1577
1578 if (changed & BSS_CHANGED_HT)
1579 ath9k_htc_update_rate(priv, vif, bss_conf);
1580
1581 ath9k_htc_ps_restore(priv);
1582 mutex_unlock(&priv->mutex);
1583 }
1584
1585 static u64 ath9k_htc_get_tsf(struct ieee80211_hw *hw,
1586 struct ieee80211_vif *vif)
1587 {
1588 struct ath9k_htc_priv *priv = hw->priv;
1589 u64 tsf;
1590
1591 mutex_lock(&priv->mutex);
1592 ath9k_htc_ps_wakeup(priv);
1593 tsf = ath9k_hw_gettsf64(priv->ah);
1594 ath9k_htc_ps_restore(priv);
1595 mutex_unlock(&priv->mutex);
1596
1597 return tsf;
1598 }
1599
1600 static void ath9k_htc_set_tsf(struct ieee80211_hw *hw,
1601 struct ieee80211_vif *vif, u64 tsf)
1602 {
1603 struct ath9k_htc_priv *priv = hw->priv;
1604
1605 mutex_lock(&priv->mutex);
1606 ath9k_htc_ps_wakeup(priv);
1607 ath9k_hw_settsf64(priv->ah, tsf);
1608 ath9k_htc_ps_restore(priv);
1609 mutex_unlock(&priv->mutex);
1610 }
1611
1612 static void ath9k_htc_reset_tsf(struct ieee80211_hw *hw,
1613 struct ieee80211_vif *vif)
1614 {
1615 struct ath9k_htc_priv *priv = hw->priv;
1616
1617 mutex_lock(&priv->mutex);
1618 ath9k_htc_ps_wakeup(priv);
1619 ath9k_hw_reset_tsf(priv->ah);
1620 ath9k_htc_ps_restore(priv);
1621 mutex_unlock(&priv->mutex);
1622 }
1623
1624 static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw,
1625 struct ieee80211_vif *vif,
1626 enum ieee80211_ampdu_mlme_action action,
1627 struct ieee80211_sta *sta,
1628 u16 tid, u16 *ssn, u8 buf_size)
1629 {
1630 struct ath9k_htc_priv *priv = hw->priv;
1631 struct ath9k_htc_sta *ista;
1632 int ret = 0;
1633
1634 mutex_lock(&priv->mutex);
1635 ath9k_htc_ps_wakeup(priv);
1636
1637 switch (action) {
1638 case IEEE80211_AMPDU_RX_START:
1639 break;
1640 case IEEE80211_AMPDU_RX_STOP:
1641 break;
1642 case IEEE80211_AMPDU_TX_START:
1643 ret = ath9k_htc_tx_aggr_oper(priv, vif, sta, action, tid);
1644 if (!ret)
1645 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1646 break;
1647 case IEEE80211_AMPDU_TX_STOP_CONT:
1648 case IEEE80211_AMPDU_TX_STOP_FLUSH:
1649 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
1650 ath9k_htc_tx_aggr_oper(priv, vif, sta, action, tid);
1651 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1652 break;
1653 case IEEE80211_AMPDU_TX_OPERATIONAL:
1654 ista = (struct ath9k_htc_sta *) sta->drv_priv;
1655 spin_lock_bh(&priv->tx.tx_lock);
1656 ista->tid_state[tid] = AGGR_OPERATIONAL;
1657 spin_unlock_bh(&priv->tx.tx_lock);
1658 break;
1659 default:
1660 ath_err(ath9k_hw_common(priv->ah), "Unknown AMPDU action\n");
1661 }
1662
1663 ath9k_htc_ps_restore(priv);
1664 mutex_unlock(&priv->mutex);
1665
1666 return ret;
1667 }
1668
1669 static void ath9k_htc_sw_scan_start(struct ieee80211_hw *hw)
1670 {
1671 struct ath9k_htc_priv *priv = hw->priv;
1672
1673 mutex_lock(&priv->mutex);
1674 spin_lock_bh(&priv->beacon_lock);
1675 set_bit(OP_SCANNING, &priv->op_flags);
1676 spin_unlock_bh(&priv->beacon_lock);
1677 cancel_work_sync(&priv->ps_work);
1678 ath9k_htc_stop_ani(priv);
1679 mutex_unlock(&priv->mutex);
1680 }
1681
1682 static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw)
1683 {
1684 struct ath9k_htc_priv *priv = hw->priv;
1685
1686 mutex_lock(&priv->mutex);
1687 spin_lock_bh(&priv->beacon_lock);
1688 clear_bit(OP_SCANNING, &priv->op_flags);
1689 spin_unlock_bh(&priv->beacon_lock);
1690 ath9k_htc_ps_wakeup(priv);
1691 ath9k_htc_vif_reconfig(priv);
1692 ath9k_htc_ps_restore(priv);
1693 mutex_unlock(&priv->mutex);
1694 }
1695
1696 static int ath9k_htc_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
1697 {
1698 return 0;
1699 }
1700
1701 static void ath9k_htc_set_coverage_class(struct ieee80211_hw *hw,
1702 u8 coverage_class)
1703 {
1704 struct ath9k_htc_priv *priv = hw->priv;
1705
1706 mutex_lock(&priv->mutex);
1707 ath9k_htc_ps_wakeup(priv);
1708 priv->ah->coverage_class = coverage_class;
1709 ath9k_hw_init_global_settings(priv->ah);
1710 ath9k_htc_ps_restore(priv);
1711 mutex_unlock(&priv->mutex);
1712 }
1713
1714 /*
1715 * Currently, this is used only for selecting the minimum rate
1716 * for management frames, rate selection for data frames remain
1717 * unaffected.
1718 */
1719 static int ath9k_htc_set_bitrate_mask(struct ieee80211_hw *hw,
1720 struct ieee80211_vif *vif,
1721 const struct cfg80211_bitrate_mask *mask)
1722 {
1723 struct ath9k_htc_priv *priv = hw->priv;
1724 struct ath_common *common = ath9k_hw_common(priv->ah);
1725 struct ath9k_htc_target_rate_mask tmask;
1726 struct ath9k_htc_vif *avp = (void *)vif->drv_priv;
1727 int ret = 0;
1728 u8 cmd_rsp;
1729
1730 memset(&tmask, 0, sizeof(struct ath9k_htc_target_rate_mask));
1731
1732 tmask.vif_index = avp->index;
1733 tmask.band = IEEE80211_BAND_2GHZ;
1734 tmask.mask = cpu_to_be32(mask->control[IEEE80211_BAND_2GHZ].legacy);
1735
1736 WMI_CMD_BUF(WMI_BITRATE_MASK_CMDID, &tmask);
1737 if (ret) {
1738 ath_err(common,
1739 "Unable to set 2G rate mask for "
1740 "interface at idx: %d\n", avp->index);
1741 goto out;
1742 }
1743
1744 tmask.band = IEEE80211_BAND_5GHZ;
1745 tmask.mask = cpu_to_be32(mask->control[IEEE80211_BAND_5GHZ].legacy);
1746
1747 WMI_CMD_BUF(WMI_BITRATE_MASK_CMDID, &tmask);
1748 if (ret) {
1749 ath_err(common,
1750 "Unable to set 5G rate mask for "
1751 "interface at idx: %d\n", avp->index);
1752 goto out;
1753 }
1754
1755 ath_dbg(common, CONFIG, "Set bitrate masks: 0x%x, 0x%x\n",
1756 mask->control[IEEE80211_BAND_2GHZ].legacy,
1757 mask->control[IEEE80211_BAND_5GHZ].legacy);
1758 out:
1759 return ret;
1760 }
1761
1762
1763 static int ath9k_htc_get_stats(struct ieee80211_hw *hw,
1764 struct ieee80211_low_level_stats *stats)
1765 {
1766 struct ath9k_htc_priv *priv = hw->priv;
1767 struct ath_hw *ah = priv->ah;
1768 struct ath9k_mib_stats *mib_stats = &ah->ah_mibStats;
1769
1770 stats->dot11ACKFailureCount = mib_stats->ackrcv_bad;
1771 stats->dot11RTSFailureCount = mib_stats->rts_bad;
1772 stats->dot11FCSErrorCount = mib_stats->fcs_bad;
1773 stats->dot11RTSSuccessCount = mib_stats->rts_good;
1774
1775 return 0;
1776 }
1777
1778 struct base_eep_header *ath9k_htc_get_eeprom_base(struct ath9k_htc_priv *priv)
1779 {
1780 struct base_eep_header *pBase = NULL;
1781 /*
1782 * This can be done since all the 3 EEPROM families have the
1783 * same base header upto a certain point, and we are interested in
1784 * the data only upto that point.
1785 */
1786
1787 if (AR_SREV_9271(priv->ah))
1788 pBase = (struct base_eep_header *)
1789 &priv->ah->eeprom.map4k.baseEepHeader;
1790 else if (priv->ah->hw_version.usbdev == AR9280_USB)
1791 pBase = (struct base_eep_header *)
1792 &priv->ah->eeprom.def.baseEepHeader;
1793 else if (priv->ah->hw_version.usbdev == AR9287_USB)
1794 pBase = (struct base_eep_header *)
1795 &priv->ah->eeprom.map9287.baseEepHeader;
1796 return pBase;
1797 }
1798
1799
1800 static int ath9k_htc_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant,
1801 u32 *rx_ant)
1802 {
1803 struct ath9k_htc_priv *priv = hw->priv;
1804 struct base_eep_header *pBase = ath9k_htc_get_eeprom_base(priv);
1805 if (pBase) {
1806 *tx_ant = pBase->txMask;
1807 *rx_ant = pBase->rxMask;
1808 } else {
1809 *tx_ant = 0;
1810 *rx_ant = 0;
1811 }
1812 return 0;
1813 }
1814
1815 struct ieee80211_ops ath9k_htc_ops = {
1816 .tx = ath9k_htc_tx,
1817 .start = ath9k_htc_start,
1818 .stop = ath9k_htc_stop,
1819 .add_interface = ath9k_htc_add_interface,
1820 .remove_interface = ath9k_htc_remove_interface,
1821 .config = ath9k_htc_config,
1822 .configure_filter = ath9k_htc_configure_filter,
1823 .sta_add = ath9k_htc_sta_add,
1824 .sta_remove = ath9k_htc_sta_remove,
1825 .conf_tx = ath9k_htc_conf_tx,
1826 .sta_rc_update = ath9k_htc_sta_rc_update,
1827 .bss_info_changed = ath9k_htc_bss_info_changed,
1828 .set_key = ath9k_htc_set_key,
1829 .get_tsf = ath9k_htc_get_tsf,
1830 .set_tsf = ath9k_htc_set_tsf,
1831 .reset_tsf = ath9k_htc_reset_tsf,
1832 .ampdu_action = ath9k_htc_ampdu_action,
1833 .sw_scan_start = ath9k_htc_sw_scan_start,
1834 .sw_scan_complete = ath9k_htc_sw_scan_complete,
1835 .set_rts_threshold = ath9k_htc_set_rts_threshold,
1836 .rfkill_poll = ath9k_htc_rfkill_poll_state,
1837 .set_coverage_class = ath9k_htc_set_coverage_class,
1838 .set_bitrate_mask = ath9k_htc_set_bitrate_mask,
1839 .get_stats = ath9k_htc_get_stats,
1840 .get_antenna = ath9k_htc_get_antenna,
1841
1842 #ifdef CONFIG_ATH9K_HTC_DEBUGFS
1843 .get_et_sset_count = ath9k_htc_get_et_sset_count,
1844 .get_et_stats = ath9k_htc_get_et_stats,
1845 .get_et_strings = ath9k_htc_get_et_strings,
1846 #endif
1847 };
This page took 0.069852 seconds and 5 git commands to generate.