2 * Copyright (c) 2008-2011 Atheros Communications Inc.
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.
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.
17 #include <linux/nl80211.h>
18 #include <linux/delay.h>
22 static u8
parse_mpdudensity(u8 mpdudensity
)
25 * 802.11n D2.0 defined values for "Minimum MPDU Start Spacing":
26 * 0 for no restriction
35 switch (mpdudensity
) {
41 /* Our lower layer calculations limit our precision to
57 static bool ath9k_has_pending_frames(struct ath_softc
*sc
, struct ath_txq
*txq
)
61 spin_lock_bh(&txq
->axq_lock
);
63 if (txq
->axq_depth
|| !list_empty(&txq
->axq_acq
))
66 spin_unlock_bh(&txq
->axq_lock
);
70 static bool ath9k_setpower(struct ath_softc
*sc
, enum ath9k_power_mode mode
)
75 spin_lock_irqsave(&sc
->sc_pm_lock
, flags
);
76 ret
= ath9k_hw_setpower(sc
->sc_ah
, mode
);
77 spin_unlock_irqrestore(&sc
->sc_pm_lock
, flags
);
82 void ath9k_ps_wakeup(struct ath_softc
*sc
)
84 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
86 enum ath9k_power_mode power_mode
;
88 spin_lock_irqsave(&sc
->sc_pm_lock
, flags
);
89 if (++sc
->ps_usecount
!= 1)
92 power_mode
= sc
->sc_ah
->power_mode
;
93 ath9k_hw_setpower(sc
->sc_ah
, ATH9K_PM_AWAKE
);
96 * While the hardware is asleep, the cycle counters contain no
97 * useful data. Better clear them now so that they don't mess up
98 * survey data results.
100 if (power_mode
!= ATH9K_PM_AWAKE
) {
101 spin_lock(&common
->cc_lock
);
102 ath_hw_cycle_counters_update(common
);
103 memset(&common
->cc_survey
, 0, sizeof(common
->cc_survey
));
104 memset(&common
->cc_ani
, 0, sizeof(common
->cc_ani
));
105 spin_unlock(&common
->cc_lock
);
109 spin_unlock_irqrestore(&sc
->sc_pm_lock
, flags
);
112 void ath9k_ps_restore(struct ath_softc
*sc
)
114 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
115 enum ath9k_power_mode mode
;
119 spin_lock_irqsave(&sc
->sc_pm_lock
, flags
);
120 if (--sc
->ps_usecount
!= 0)
124 ath9k_hw_setrxabort(sc
->sc_ah
, 1);
125 ath9k_hw_stopdmarecv(sc
->sc_ah
, &reset
);
126 mode
= ATH9K_PM_FULL_SLEEP
;
127 } else if (sc
->ps_enabled
&&
128 !(sc
->ps_flags
& (PS_WAIT_FOR_BEACON
|
130 PS_WAIT_FOR_PSPOLL_DATA
|
131 PS_WAIT_FOR_TX_ACK
))) {
132 mode
= ATH9K_PM_NETWORK_SLEEP
;
137 spin_lock(&common
->cc_lock
);
138 ath_hw_cycle_counters_update(common
);
139 spin_unlock(&common
->cc_lock
);
141 ath9k_hw_setpower(sc
->sc_ah
, mode
);
144 spin_unlock_irqrestore(&sc
->sc_pm_lock
, flags
);
147 static void __ath_cancel_work(struct ath_softc
*sc
)
149 cancel_work_sync(&sc
->paprd_work
);
150 cancel_work_sync(&sc
->hw_check_work
);
151 cancel_delayed_work_sync(&sc
->tx_complete_work
);
152 cancel_delayed_work_sync(&sc
->hw_pll_work
);
155 static void ath_cancel_work(struct ath_softc
*sc
)
157 __ath_cancel_work(sc
);
158 cancel_work_sync(&sc
->hw_reset_work
);
161 static void ath_restart_work(struct ath_softc
*sc
)
163 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
165 ieee80211_queue_delayed_work(sc
->hw
, &sc
->tx_complete_work
, 0);
167 if (AR_SREV_9485(sc
->sc_ah
) || AR_SREV_9340(sc
->sc_ah
))
168 ieee80211_queue_delayed_work(sc
->hw
, &sc
->hw_pll_work
,
169 msecs_to_jiffies(ATH_PLL_WORK_INTERVAL
));
171 ath_start_rx_poll(sc
, 3);
173 if (!common
->disable_ani
)
174 ath_start_ani(common
);
177 static bool ath_prepare_reset(struct ath_softc
*sc
, bool retry_tx
, bool flush
)
179 struct ath_hw
*ah
= sc
->sc_ah
;
180 struct ath_common
*common
= ath9k_hw_common(ah
);
183 ieee80211_stop_queues(sc
->hw
);
185 sc
->hw_busy_count
= 0;
186 del_timer_sync(&common
->ani
.timer
);
187 del_timer_sync(&sc
->rx_poll_timer
);
189 ath9k_debug_samp_bb_mac(sc
);
190 ath9k_hw_disable_interrupts(ah
);
192 if (!ath_stoprecv(sc
))
195 if (!ath_drain_all_txq(sc
, retry_tx
))
199 if (ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
)
200 ath_rx_tasklet(sc
, 1, true);
201 ath_rx_tasklet(sc
, 1, false);
209 static bool ath_complete_reset(struct ath_softc
*sc
, bool start
)
211 struct ath_hw
*ah
= sc
->sc_ah
;
212 struct ath_common
*common
= ath9k_hw_common(ah
);
215 if (ath_startrecv(sc
) != 0) {
216 ath_err(common
, "Unable to restart recv logic\n");
220 ath9k_cmn_update_txpow(ah
, sc
->curtxpow
,
221 sc
->config
.txpowlimit
, &sc
->curtxpow
);
223 clear_bit(SC_OP_HW_RESET
, &sc
->sc_flags
);
224 ath9k_hw_set_interrupts(ah
);
225 ath9k_hw_enable_interrupts(ah
);
227 if (!(sc
->hw
->conf
.flags
& IEEE80211_CONF_OFFCHANNEL
) && start
) {
228 if (!test_bit(SC_OP_BEACONS
, &sc
->sc_flags
))
233 if (ah
->opmode
== NL80211_IFTYPE_STATION
&&
234 test_bit(SC_OP_PRIM_STA_VIF
, &sc
->sc_flags
)) {
235 spin_lock_irqsave(&sc
->sc_pm_lock
, flags
);
236 sc
->ps_flags
|= PS_BEACON_SYNC
| PS_WAIT_FOR_BEACON
;
237 spin_unlock_irqrestore(&sc
->sc_pm_lock
, flags
);
240 ath_restart_work(sc
);
243 if ((ah
->caps
.hw_caps
& ATH9K_HW_CAP_ANT_DIV_COMB
) && sc
->ant_rx
!= 3)
244 ath_ant_comb_update(sc
);
246 ieee80211_wake_queues(sc
->hw
);
251 static int ath_reset_internal(struct ath_softc
*sc
, struct ath9k_channel
*hchan
,
254 struct ath_hw
*ah
= sc
->sc_ah
;
255 struct ath_common
*common
= ath9k_hw_common(ah
);
256 struct ath9k_hw_cal_data
*caldata
= NULL
;
261 __ath_cancel_work(sc
);
263 spin_lock_bh(&sc
->sc_pcu_lock
);
265 if (!(sc
->hw
->conf
.flags
& IEEE80211_CONF_OFFCHANNEL
)) {
267 caldata
= &sc
->caldata
;
276 if (!ath_prepare_reset(sc
, retry_tx
, flush
))
279 ath_dbg(common
, CONFIG
, "Reset to %u MHz, HT40: %d fastcc: %d\n",
280 hchan
->channel
, IS_CHAN_HT40(hchan
), fastcc
);
282 r
= ath9k_hw_reset(ah
, hchan
, caldata
, fastcc
);
285 "Unable to reset channel, reset status %d\n", r
);
289 if (!ath_complete_reset(sc
, true))
293 spin_unlock_bh(&sc
->sc_pcu_lock
);
299 * Set/change channels. If the channel is really being changed, it's done
300 * by reseting the chip. To accomplish this we must first cleanup any pending
301 * DMA, then restart stuff.
303 static int ath_set_channel(struct ath_softc
*sc
, struct ieee80211_hw
*hw
,
304 struct ath9k_channel
*hchan
)
308 if (test_bit(SC_OP_INVALID
, &sc
->sc_flags
))
311 r
= ath_reset_internal(sc
, hchan
, false);
316 static void ath_node_attach(struct ath_softc
*sc
, struct ieee80211_sta
*sta
,
317 struct ieee80211_vif
*vif
)
320 an
= (struct ath_node
*)sta
->drv_priv
;
322 #ifdef CONFIG_ATH9K_DEBUGFS
323 spin_lock(&sc
->nodes_lock
);
324 list_add(&an
->list
, &sc
->nodes
);
325 spin_unlock(&sc
->nodes_lock
);
330 if (sc
->sc_ah
->caps
.hw_caps
& ATH9K_HW_CAP_HT
) {
331 ath_tx_node_init(sc
, an
);
332 an
->maxampdu
= 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR
+
333 sta
->ht_cap
.ampdu_factor
);
334 an
->mpdudensity
= parse_mpdudensity(sta
->ht_cap
.ampdu_density
);
338 static void ath_node_detach(struct ath_softc
*sc
, struct ieee80211_sta
*sta
)
340 struct ath_node
*an
= (struct ath_node
*)sta
->drv_priv
;
342 #ifdef CONFIG_ATH9K_DEBUGFS
343 spin_lock(&sc
->nodes_lock
);
345 spin_unlock(&sc
->nodes_lock
);
349 if (sc
->sc_ah
->caps
.hw_caps
& ATH9K_HW_CAP_HT
)
350 ath_tx_node_cleanup(sc
, an
);
353 void ath9k_tasklet(unsigned long data
)
355 struct ath_softc
*sc
= (struct ath_softc
*)data
;
356 struct ath_hw
*ah
= sc
->sc_ah
;
357 struct ath_common
*common
= ath9k_hw_common(ah
);
359 u32 status
= sc
->intrstatus
;
363 spin_lock(&sc
->sc_pcu_lock
);
365 if ((status
& ATH9K_INT_FATAL
) ||
366 (status
& ATH9K_INT_BB_WATCHDOG
)) {
367 #ifdef CONFIG_ATH9K_DEBUGFS
368 enum ath_reset_type type
;
370 if (status
& ATH9K_INT_FATAL
)
371 type
= RESET_TYPE_FATAL_INT
;
373 type
= RESET_TYPE_BB_WATCHDOG
;
375 RESET_STAT_INC(sc
, type
);
377 set_bit(SC_OP_HW_RESET
, &sc
->sc_flags
);
378 ieee80211_queue_work(sc
->hw
, &sc
->hw_reset_work
);
382 spin_lock_irqsave(&sc
->sc_pm_lock
, flags
);
383 if ((status
& ATH9K_INT_TSFOOR
) && sc
->ps_enabled
) {
385 * TSF sync does not look correct; remain awake to sync with
388 ath_dbg(common
, PS
, "TSFOOR - Sync with next Beacon\n");
389 sc
->ps_flags
|= PS_WAIT_FOR_BEACON
| PS_BEACON_SYNC
;
391 spin_unlock_irqrestore(&sc
->sc_pm_lock
, flags
);
393 if (ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
)
394 rxmask
= (ATH9K_INT_RXHP
| ATH9K_INT_RXLP
| ATH9K_INT_RXEOL
|
397 rxmask
= (ATH9K_INT_RX
| ATH9K_INT_RXEOL
| ATH9K_INT_RXORN
);
399 if (status
& rxmask
) {
400 /* Check for high priority Rx first */
401 if ((ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
) &&
402 (status
& ATH9K_INT_RXHP
))
403 ath_rx_tasklet(sc
, 0, true);
405 ath_rx_tasklet(sc
, 0, false);
408 if (status
& ATH9K_INT_TX
) {
409 if (ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
)
410 ath_tx_edma_tasklet(sc
);
415 ath9k_btcoex_handle_interrupt(sc
, status
);
418 /* re-enable hardware interrupt */
419 ath9k_hw_enable_interrupts(ah
);
421 spin_unlock(&sc
->sc_pcu_lock
);
422 ath9k_ps_restore(sc
);
425 irqreturn_t
ath_isr(int irq
, void *dev
)
427 #define SCHED_INTR ( \
429 ATH9K_INT_BB_WATCHDOG | \
439 ATH9K_INT_GENTIMER | \
442 struct ath_softc
*sc
= dev
;
443 struct ath_hw
*ah
= sc
->sc_ah
;
444 struct ath_common
*common
= ath9k_hw_common(ah
);
445 enum ath9k_int status
;
449 * The hardware is not ready/present, don't
450 * touch anything. Note this can happen early
451 * on if the IRQ is shared.
453 if (test_bit(SC_OP_INVALID
, &sc
->sc_flags
))
456 /* shared irq, not for us */
458 if (!ath9k_hw_intrpend(ah
))
461 if(test_bit(SC_OP_HW_RESET
, &sc
->sc_flags
))
465 * Figure out the reason(s) for the interrupt. Note
466 * that the hal returns a pseudo-ISR that may include
467 * bits we haven't explicitly enabled so we mask the
468 * value to insure we only process bits we requested.
470 ath9k_hw_getisr(ah
, &status
); /* NB: clears ISR too */
471 status
&= ah
->imask
; /* discard unasked-for bits */
474 * If there are no status bits set, then this interrupt was not
475 * for me (should have been caught above).
480 /* Cache the status */
481 sc
->intrstatus
= status
;
483 if (status
& SCHED_INTR
)
487 * If a FATAL or RXORN interrupt is received, we have to reset the
490 if ((status
& ATH9K_INT_FATAL
) || ((status
& ATH9K_INT_RXORN
) &&
491 !(ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
)))
494 if ((ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
) &&
495 (status
& ATH9K_INT_BB_WATCHDOG
)) {
497 spin_lock(&common
->cc_lock
);
498 ath_hw_cycle_counters_update(common
);
499 ar9003_hw_bb_watchdog_dbg_info(ah
);
500 spin_unlock(&common
->cc_lock
);
505 if (status
& ATH9K_INT_SWBA
)
506 tasklet_schedule(&sc
->bcon_tasklet
);
508 if (status
& ATH9K_INT_TXURN
)
509 ath9k_hw_updatetxtriglevel(ah
, true);
511 if (status
& ATH9K_INT_RXEOL
) {
512 ah
->imask
&= ~(ATH9K_INT_RXEOL
| ATH9K_INT_RXORN
);
513 ath9k_hw_set_interrupts(ah
);
516 if (status
& ATH9K_INT_MIB
) {
518 * Disable interrupts until we service the MIB
519 * interrupt; otherwise it will continue to
522 ath9k_hw_disable_interrupts(ah
);
524 * Let the hal handle the event. We assume
525 * it will clear whatever condition caused
528 spin_lock(&common
->cc_lock
);
529 ath9k_hw_proc_mib_event(ah
);
530 spin_unlock(&common
->cc_lock
);
531 ath9k_hw_enable_interrupts(ah
);
534 if (!(ah
->caps
.hw_caps
& ATH9K_HW_CAP_AUTOSLEEP
))
535 if (status
& ATH9K_INT_TIM_TIMER
) {
536 if (ATH_DBG_WARN_ON_ONCE(sc
->ps_idle
))
538 /* Clear RxAbort bit so that we can
540 ath9k_setpower(sc
, ATH9K_PM_AWAKE
);
541 spin_lock(&sc
->sc_pm_lock
);
542 ath9k_hw_setrxabort(sc
->sc_ah
, 0);
543 sc
->ps_flags
|= PS_WAIT_FOR_BEACON
;
544 spin_unlock(&sc
->sc_pm_lock
);
549 ath_debug_stat_interrupt(sc
, status
);
552 /* turn off every interrupt */
553 ath9k_hw_disable_interrupts(ah
);
554 tasklet_schedule(&sc
->intr_tq
);
562 static int ath_reset(struct ath_softc
*sc
, bool retry_tx
)
568 r
= ath_reset_internal(sc
, NULL
, retry_tx
);
572 for (i
= 0; i
< ATH9K_NUM_TX_QUEUES
; i
++) {
573 if (ATH_TXQ_SETUP(sc
, i
)) {
574 spin_lock_bh(&sc
->tx
.txq
[i
].axq_lock
);
575 ath_txq_schedule(sc
, &sc
->tx
.txq
[i
]);
576 spin_unlock_bh(&sc
->tx
.txq
[i
].axq_lock
);
581 ath9k_ps_restore(sc
);
586 void ath_reset_work(struct work_struct
*work
)
588 struct ath_softc
*sc
= container_of(work
, struct ath_softc
, hw_reset_work
);
593 /**********************/
594 /* mac80211 callbacks */
595 /**********************/
597 static int ath9k_start(struct ieee80211_hw
*hw
)
599 struct ath_softc
*sc
= hw
->priv
;
600 struct ath_hw
*ah
= sc
->sc_ah
;
601 struct ath_common
*common
= ath9k_hw_common(ah
);
602 struct ieee80211_channel
*curchan
= hw
->conf
.channel
;
603 struct ath9k_channel
*init_channel
;
606 ath_dbg(common
, CONFIG
,
607 "Starting driver with initial channel: %d MHz\n",
608 curchan
->center_freq
);
611 mutex_lock(&sc
->mutex
);
613 init_channel
= ath9k_cmn_get_curchannel(hw
, ah
);
615 /* Reset SERDES registers */
616 ath9k_hw_configpcipowersave(ah
, false);
619 * The basic interface to setting the hardware in a good
620 * state is ``reset''. On return the hardware is known to
621 * be powered up and with interrupts disabled. This must
622 * be followed by initialization of the appropriate bits
623 * and then setup of the interrupt mask.
625 spin_lock_bh(&sc
->sc_pcu_lock
);
627 atomic_set(&ah
->intr_ref_cnt
, -1);
629 r
= ath9k_hw_reset(ah
, init_channel
, ah
->caldata
, false);
632 "Unable to reset hardware; reset status %d (freq %u MHz)\n",
633 r
, curchan
->center_freq
);
634 spin_unlock_bh(&sc
->sc_pcu_lock
);
638 /* Setup our intr mask. */
639 ah
->imask
= ATH9K_INT_TX
| ATH9K_INT_RXEOL
|
640 ATH9K_INT_RXORN
| ATH9K_INT_FATAL
|
643 if (ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
)
644 ah
->imask
|= ATH9K_INT_RXHP
|
646 ATH9K_INT_BB_WATCHDOG
;
648 ah
->imask
|= ATH9K_INT_RX
;
650 ah
->imask
|= ATH9K_INT_GTT
;
652 if (ah
->caps
.hw_caps
& ATH9K_HW_CAP_HT
)
653 ah
->imask
|= ATH9K_INT_CST
;
657 clear_bit(SC_OP_INVALID
, &sc
->sc_flags
);
658 sc
->sc_ah
->is_monitoring
= false;
660 if (!ath_complete_reset(sc
, false)) {
662 spin_unlock_bh(&sc
->sc_pcu_lock
);
666 if (ah
->led_pin
>= 0) {
667 ath9k_hw_cfg_output(ah
, ah
->led_pin
,
668 AR_GPIO_OUTPUT_MUX_AS_OUTPUT
);
669 ath9k_hw_set_gpio(ah
, ah
->led_pin
, 0);
673 * Reset key cache to sane defaults (all entries cleared) instead of
674 * semi-random values after suspend/resume.
676 ath9k_cmn_init_crypto(sc
->sc_ah
);
678 spin_unlock_bh(&sc
->sc_pcu_lock
);
680 ath9k_start_btcoex(sc
);
682 if (ah
->caps
.pcie_lcr_extsync_en
&& common
->bus_ops
->extn_synch_en
)
683 common
->bus_ops
->extn_synch_en(common
);
686 mutex_unlock(&sc
->mutex
);
688 ath9k_ps_restore(sc
);
693 static void ath9k_tx(struct ieee80211_hw
*hw
, struct sk_buff
*skb
)
695 struct ath_softc
*sc
= hw
->priv
;
696 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
697 struct ath_tx_control txctl
;
698 struct ieee80211_hdr
*hdr
= (struct ieee80211_hdr
*) skb
->data
;
701 if (sc
->ps_enabled
) {
703 * mac80211 does not set PM field for normal data frames, so we
704 * need to update that based on the current PS mode.
706 if (ieee80211_is_data(hdr
->frame_control
) &&
707 !ieee80211_is_nullfunc(hdr
->frame_control
) &&
708 !ieee80211_has_pm(hdr
->frame_control
)) {
710 "Add PM=1 for a TX frame while in PS mode\n");
711 hdr
->frame_control
|= cpu_to_le16(IEEE80211_FCTL_PM
);
715 if (unlikely(sc
->sc_ah
->power_mode
== ATH9K_PM_NETWORK_SLEEP
)) {
717 * We are using PS-Poll and mac80211 can request TX while in
718 * power save mode. Need to wake up hardware for the TX to be
719 * completed and if needed, also for RX of buffered frames.
722 spin_lock_irqsave(&sc
->sc_pm_lock
, flags
);
723 if (!(sc
->sc_ah
->caps
.hw_caps
& ATH9K_HW_CAP_AUTOSLEEP
))
724 ath9k_hw_setrxabort(sc
->sc_ah
, 0);
725 if (ieee80211_is_pspoll(hdr
->frame_control
)) {
727 "Sending PS-Poll to pick a buffered frame\n");
728 sc
->ps_flags
|= PS_WAIT_FOR_PSPOLL_DATA
;
730 ath_dbg(common
, PS
, "Wake up to complete TX\n");
731 sc
->ps_flags
|= PS_WAIT_FOR_TX_ACK
;
734 * The actual restore operation will happen only after
735 * the ps_flags bit is cleared. We are just dropping
736 * the ps_usecount here.
738 spin_unlock_irqrestore(&sc
->sc_pm_lock
, flags
);
739 ath9k_ps_restore(sc
);
743 * Cannot tx while the hardware is in full sleep, it first needs a full
744 * chip reset to recover from that
746 if (unlikely(sc
->sc_ah
->power_mode
== ATH9K_PM_FULL_SLEEP
)) {
747 ath_err(common
, "TX while HW is in FULL_SLEEP mode\n");
751 memset(&txctl
, 0, sizeof(struct ath_tx_control
));
752 txctl
.txq
= sc
->tx
.txq_map
[skb_get_queue_mapping(skb
)];
754 ath_dbg(common
, XMIT
, "transmitting packet, skb: %p\n", skb
);
756 if (ath_tx_start(hw
, skb
, &txctl
) != 0) {
757 ath_dbg(common
, XMIT
, "TX failed\n");
758 TX_STAT_INC(txctl
.txq
->axq_qnum
, txfailed
);
764 dev_kfree_skb_any(skb
);
767 static void ath9k_stop(struct ieee80211_hw
*hw
)
769 struct ath_softc
*sc
= hw
->priv
;
770 struct ath_hw
*ah
= sc
->sc_ah
;
771 struct ath_common
*common
= ath9k_hw_common(ah
);
774 mutex_lock(&sc
->mutex
);
777 del_timer_sync(&sc
->rx_poll_timer
);
779 if (test_bit(SC_OP_INVALID
, &sc
->sc_flags
)) {
780 ath_dbg(common
, ANY
, "Device not present\n");
781 mutex_unlock(&sc
->mutex
);
785 /* Ensure HW is awake when we try to shut it down. */
788 ath9k_stop_btcoex(sc
);
790 spin_lock_bh(&sc
->sc_pcu_lock
);
792 /* prevent tasklets to enable interrupts once we disable them */
793 ah
->imask
&= ~ATH9K_INT_GLOBAL
;
795 /* make sure h/w will not generate any interrupt
796 * before setting the invalid flag. */
797 ath9k_hw_disable_interrupts(ah
);
799 spin_unlock_bh(&sc
->sc_pcu_lock
);
801 /* we can now sync irq and kill any running tasklets, since we already
802 * disabled interrupts and not holding a spin lock */
803 synchronize_irq(sc
->irq
);
804 tasklet_kill(&sc
->intr_tq
);
805 tasklet_kill(&sc
->bcon_tasklet
);
807 prev_idle
= sc
->ps_idle
;
810 spin_lock_bh(&sc
->sc_pcu_lock
);
812 if (ah
->led_pin
>= 0) {
813 ath9k_hw_set_gpio(ah
, ah
->led_pin
, 1);
814 ath9k_hw_cfg_gpio_input(ah
, ah
->led_pin
);
817 ath_prepare_reset(sc
, false, true);
820 dev_kfree_skb_any(sc
->rx
.frag
);
825 ah
->curchan
= ath9k_cmn_get_curchannel(hw
, ah
);
827 ath9k_hw_reset(ah
, ah
->curchan
, ah
->caldata
, false);
828 ath9k_hw_phy_disable(ah
);
830 ath9k_hw_configpcipowersave(ah
, true);
832 spin_unlock_bh(&sc
->sc_pcu_lock
);
834 ath9k_ps_restore(sc
);
836 set_bit(SC_OP_INVALID
, &sc
->sc_flags
);
837 sc
->ps_idle
= prev_idle
;
839 mutex_unlock(&sc
->mutex
);
841 ath_dbg(common
, CONFIG
, "Driver halt\n");
844 bool ath9k_uses_beacons(int type
)
847 case NL80211_IFTYPE_AP
:
848 case NL80211_IFTYPE_ADHOC
:
849 case NL80211_IFTYPE_MESH_POINT
:
856 static void ath9k_reclaim_beacon(struct ath_softc
*sc
,
857 struct ieee80211_vif
*vif
)
859 struct ath_vif
*avp
= (void *)vif
->drv_priv
;
861 ath9k_set_beaconing_status(sc
, false);
862 ath_beacon_return(sc
, avp
);
863 ath9k_set_beaconing_status(sc
, true);
866 static void ath9k_vif_iter(void *data
, u8
*mac
, struct ieee80211_vif
*vif
)
868 struct ath9k_vif_iter_data
*iter_data
= data
;
871 if (iter_data
->hw_macaddr
)
872 for (i
= 0; i
< ETH_ALEN
; i
++)
873 iter_data
->mask
[i
] &=
874 ~(iter_data
->hw_macaddr
[i
] ^ mac
[i
]);
877 case NL80211_IFTYPE_AP
:
880 case NL80211_IFTYPE_STATION
:
881 iter_data
->nstations
++;
883 case NL80211_IFTYPE_ADHOC
:
884 iter_data
->nadhocs
++;
886 case NL80211_IFTYPE_MESH_POINT
:
887 iter_data
->nmeshes
++;
889 case NL80211_IFTYPE_WDS
:
897 /* Called with sc->mutex held. */
898 void ath9k_calculate_iter_data(struct ieee80211_hw
*hw
,
899 struct ieee80211_vif
*vif
,
900 struct ath9k_vif_iter_data
*iter_data
)
902 struct ath_softc
*sc
= hw
->priv
;
903 struct ath_hw
*ah
= sc
->sc_ah
;
904 struct ath_common
*common
= ath9k_hw_common(ah
);
907 * Use the hardware MAC address as reference, the hardware uses it
908 * together with the BSSID mask when matching addresses.
910 memset(iter_data
, 0, sizeof(*iter_data
));
911 iter_data
->hw_macaddr
= common
->macaddr
;
912 memset(&iter_data
->mask
, 0xff, ETH_ALEN
);
915 ath9k_vif_iter(iter_data
, vif
->addr
, vif
);
917 /* Get list of all active MAC addresses */
918 ieee80211_iterate_active_interfaces_atomic(sc
->hw
, ath9k_vif_iter
,
922 /* Called with sc->mutex held. */
923 static void ath9k_calculate_summary_state(struct ieee80211_hw
*hw
,
924 struct ieee80211_vif
*vif
)
926 struct ath_softc
*sc
= hw
->priv
;
927 struct ath_hw
*ah
= sc
->sc_ah
;
928 struct ath_common
*common
= ath9k_hw_common(ah
);
929 struct ath9k_vif_iter_data iter_data
;
931 ath9k_calculate_iter_data(hw
, vif
, &iter_data
);
933 /* Set BSSID mask. */
934 memcpy(common
->bssidmask
, iter_data
.mask
, ETH_ALEN
);
935 ath_hw_setbssidmask(common
);
937 /* Set op-mode & TSF */
938 if (iter_data
.naps
> 0) {
939 ath9k_hw_set_tsfadjust(ah
, 1);
940 set_bit(SC_OP_TSF_RESET
, &sc
->sc_flags
);
941 ah
->opmode
= NL80211_IFTYPE_AP
;
943 ath9k_hw_set_tsfadjust(ah
, 0);
944 clear_bit(SC_OP_TSF_RESET
, &sc
->sc_flags
);
946 if (iter_data
.nmeshes
)
947 ah
->opmode
= NL80211_IFTYPE_MESH_POINT
;
948 else if (iter_data
.nwds
)
949 ah
->opmode
= NL80211_IFTYPE_AP
;
950 else if (iter_data
.nadhocs
)
951 ah
->opmode
= NL80211_IFTYPE_ADHOC
;
953 ah
->opmode
= NL80211_IFTYPE_STATION
;
957 * Enable MIB interrupts when there are hardware phy counters.
959 if ((iter_data
.nstations
+ iter_data
.nadhocs
+ iter_data
.nmeshes
) > 0) {
960 if (ah
->config
.enable_ani
)
961 ah
->imask
|= ATH9K_INT_MIB
;
962 ah
->imask
|= ATH9K_INT_TSFOOR
;
964 ah
->imask
&= ~ATH9K_INT_MIB
;
965 ah
->imask
&= ~ATH9K_INT_TSFOOR
;
968 ath9k_hw_set_interrupts(ah
);
971 if (iter_data
.naps
> 0) {
972 sc
->sc_ah
->stats
.avgbrssi
= ATH_RSSI_DUMMY_MARKER
;
974 if (!common
->disable_ani
) {
975 set_bit(SC_OP_ANI_RUN
, &sc
->sc_flags
);
976 ath_start_ani(common
);
980 clear_bit(SC_OP_ANI_RUN
, &sc
->sc_flags
);
981 del_timer_sync(&common
->ani
.timer
);
985 /* Called with sc->mutex held, vif counts set up properly. */
986 static void ath9k_do_vif_add_setup(struct ieee80211_hw
*hw
,
987 struct ieee80211_vif
*vif
)
989 struct ath_softc
*sc
= hw
->priv
;
991 ath9k_calculate_summary_state(hw
, vif
);
993 if (ath9k_uses_beacons(vif
->type
)) {
994 /* Reserve a beacon slot for the vif */
995 ath9k_set_beaconing_status(sc
, false);
996 ath_beacon_alloc(sc
, vif
);
997 ath9k_set_beaconing_status(sc
, true);
1001 static int ath9k_add_interface(struct ieee80211_hw
*hw
,
1002 struct ieee80211_vif
*vif
)
1004 struct ath_softc
*sc
= hw
->priv
;
1005 struct ath_hw
*ah
= sc
->sc_ah
;
1006 struct ath_common
*common
= ath9k_hw_common(ah
);
1009 ath9k_ps_wakeup(sc
);
1010 mutex_lock(&sc
->mutex
);
1012 switch (vif
->type
) {
1013 case NL80211_IFTYPE_STATION
:
1014 case NL80211_IFTYPE_WDS
:
1015 case NL80211_IFTYPE_ADHOC
:
1016 case NL80211_IFTYPE_AP
:
1017 case NL80211_IFTYPE_MESH_POINT
:
1020 ath_err(common
, "Interface type %d not yet supported\n",
1026 if (ath9k_uses_beacons(vif
->type
)) {
1027 if (sc
->nbcnvifs
>= ATH_BCBUF
) {
1028 ath_err(common
, "Not enough beacon buffers when adding"
1029 " new interface of type: %i\n",
1036 if ((ah
->opmode
== NL80211_IFTYPE_ADHOC
) ||
1037 ((vif
->type
== NL80211_IFTYPE_ADHOC
) &&
1039 ath_err(common
, "Cannot create ADHOC interface when other"
1040 " interfaces already exist.\n");
1045 ath_dbg(common
, CONFIG
, "Attach a VIF of type: %d\n", vif
->type
);
1049 ath9k_do_vif_add_setup(hw
, vif
);
1051 mutex_unlock(&sc
->mutex
);
1052 ath9k_ps_restore(sc
);
1056 static int ath9k_change_interface(struct ieee80211_hw
*hw
,
1057 struct ieee80211_vif
*vif
,
1058 enum nl80211_iftype new_type
,
1061 struct ath_softc
*sc
= hw
->priv
;
1062 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
1065 ath_dbg(common
, CONFIG
, "Change Interface\n");
1066 mutex_lock(&sc
->mutex
);
1067 ath9k_ps_wakeup(sc
);
1069 /* See if new interface type is valid. */
1070 if ((new_type
== NL80211_IFTYPE_ADHOC
) &&
1072 ath_err(common
, "When using ADHOC, it must be the only"
1078 if (ath9k_uses_beacons(new_type
) &&
1079 !ath9k_uses_beacons(vif
->type
)) {
1080 if (sc
->nbcnvifs
>= ATH_BCBUF
) {
1081 ath_err(common
, "No beacon slot available\n");
1087 /* Clean up old vif stuff */
1088 if (ath9k_uses_beacons(vif
->type
))
1089 ath9k_reclaim_beacon(sc
, vif
);
1091 /* Add new settings */
1092 vif
->type
= new_type
;
1095 ath9k_do_vif_add_setup(hw
, vif
);
1097 ath9k_ps_restore(sc
);
1098 mutex_unlock(&sc
->mutex
);
1102 static void ath9k_remove_interface(struct ieee80211_hw
*hw
,
1103 struct ieee80211_vif
*vif
)
1105 struct ath_softc
*sc
= hw
->priv
;
1106 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
1108 ath_dbg(common
, CONFIG
, "Detach Interface\n");
1110 ath9k_ps_wakeup(sc
);
1111 mutex_lock(&sc
->mutex
);
1115 /* Reclaim beacon resources */
1116 if (ath9k_uses_beacons(vif
->type
))
1117 ath9k_reclaim_beacon(sc
, vif
);
1119 ath9k_calculate_summary_state(hw
, NULL
);
1121 mutex_unlock(&sc
->mutex
);
1122 ath9k_ps_restore(sc
);
1125 static void ath9k_enable_ps(struct ath_softc
*sc
)
1127 struct ath_hw
*ah
= sc
->sc_ah
;
1128 struct ath_common
*common
= ath9k_hw_common(ah
);
1130 sc
->ps_enabled
= true;
1131 if (!(ah
->caps
.hw_caps
& ATH9K_HW_CAP_AUTOSLEEP
)) {
1132 if ((ah
->imask
& ATH9K_INT_TIM_TIMER
) == 0) {
1133 ah
->imask
|= ATH9K_INT_TIM_TIMER
;
1134 ath9k_hw_set_interrupts(ah
);
1136 ath9k_hw_setrxabort(ah
, 1);
1138 ath_dbg(common
, PS
, "PowerSave enabled\n");
1141 static void ath9k_disable_ps(struct ath_softc
*sc
)
1143 struct ath_hw
*ah
= sc
->sc_ah
;
1144 struct ath_common
*common
= ath9k_hw_common(ah
);
1146 sc
->ps_enabled
= false;
1147 ath9k_hw_setpower(ah
, ATH9K_PM_AWAKE
);
1148 if (!(ah
->caps
.hw_caps
& ATH9K_HW_CAP_AUTOSLEEP
)) {
1149 ath9k_hw_setrxabort(ah
, 0);
1150 sc
->ps_flags
&= ~(PS_WAIT_FOR_BEACON
|
1152 PS_WAIT_FOR_PSPOLL_DATA
|
1153 PS_WAIT_FOR_TX_ACK
);
1154 if (ah
->imask
& ATH9K_INT_TIM_TIMER
) {
1155 ah
->imask
&= ~ATH9K_INT_TIM_TIMER
;
1156 ath9k_hw_set_interrupts(ah
);
1159 ath_dbg(common
, PS
, "PowerSave disabled\n");
1162 static int ath9k_config(struct ieee80211_hw
*hw
, u32 changed
)
1164 struct ath_softc
*sc
= hw
->priv
;
1165 struct ath_hw
*ah
= sc
->sc_ah
;
1166 struct ath_common
*common
= ath9k_hw_common(ah
);
1167 struct ieee80211_conf
*conf
= &hw
->conf
;
1168 bool reset_channel
= false;
1170 ath9k_ps_wakeup(sc
);
1171 mutex_lock(&sc
->mutex
);
1173 if (changed
& IEEE80211_CONF_CHANGE_IDLE
) {
1174 sc
->ps_idle
= !!(conf
->flags
& IEEE80211_CONF_IDLE
);
1176 ath_cancel_work(sc
);
1179 * The chip needs a reset to properly wake up from
1182 reset_channel
= ah
->chip_fullsleep
;
1186 * We just prepare to enable PS. We have to wait until our AP has
1187 * ACK'd our null data frame to disable RX otherwise we'll ignore
1188 * those ACKs and end up retransmitting the same null data frames.
1189 * IEEE80211_CONF_CHANGE_PS is only passed by mac80211 for STA mode.
1191 if (changed
& IEEE80211_CONF_CHANGE_PS
) {
1192 unsigned long flags
;
1193 spin_lock_irqsave(&sc
->sc_pm_lock
, flags
);
1194 if (conf
->flags
& IEEE80211_CONF_PS
)
1195 ath9k_enable_ps(sc
);
1197 ath9k_disable_ps(sc
);
1198 spin_unlock_irqrestore(&sc
->sc_pm_lock
, flags
);
1201 if (changed
& IEEE80211_CONF_CHANGE_MONITOR
) {
1202 if (conf
->flags
& IEEE80211_CONF_MONITOR
) {
1203 ath_dbg(common
, CONFIG
, "Monitor mode is enabled\n");
1204 sc
->sc_ah
->is_monitoring
= true;
1206 ath_dbg(common
, CONFIG
, "Monitor mode is disabled\n");
1207 sc
->sc_ah
->is_monitoring
= false;
1211 if ((changed
& IEEE80211_CONF_CHANGE_CHANNEL
) || reset_channel
) {
1212 struct ieee80211_channel
*curchan
= hw
->conf
.channel
;
1213 int pos
= curchan
->hw_value
;
1215 unsigned long flags
;
1218 old_pos
= ah
->curchan
- &ah
->channels
[0];
1220 ath_dbg(common
, CONFIG
, "Set channel: %d MHz type: %d\n",
1221 curchan
->center_freq
, conf
->channel_type
);
1223 /* update survey stats for the old channel before switching */
1224 spin_lock_irqsave(&common
->cc_lock
, flags
);
1225 ath_update_survey_stats(sc
);
1226 spin_unlock_irqrestore(&common
->cc_lock
, flags
);
1229 * Preserve the current channel values, before updating
1232 if (ah
->curchan
&& (old_pos
== pos
))
1233 ath9k_hw_getnf(ah
, ah
->curchan
);
1235 ath9k_cmn_update_ichannel(&sc
->sc_ah
->channels
[pos
],
1236 curchan
, conf
->channel_type
);
1239 * If the operating channel changes, change the survey in-use flags
1241 * Reset the survey data for the new channel, unless we're switching
1242 * back to the operating channel from an off-channel operation.
1244 if (!(hw
->conf
.flags
& IEEE80211_CONF_OFFCHANNEL
) &&
1245 sc
->cur_survey
!= &sc
->survey
[pos
]) {
1248 sc
->cur_survey
->filled
&= ~SURVEY_INFO_IN_USE
;
1250 sc
->cur_survey
= &sc
->survey
[pos
];
1252 memset(sc
->cur_survey
, 0, sizeof(struct survey_info
));
1253 sc
->cur_survey
->filled
|= SURVEY_INFO_IN_USE
;
1254 } else if (!(sc
->survey
[pos
].filled
& SURVEY_INFO_IN_USE
)) {
1255 memset(&sc
->survey
[pos
], 0, sizeof(struct survey_info
));
1258 if (ath_set_channel(sc
, hw
, &sc
->sc_ah
->channels
[pos
]) < 0) {
1259 ath_err(common
, "Unable to set channel\n");
1260 mutex_unlock(&sc
->mutex
);
1265 * The most recent snapshot of channel->noisefloor for the old
1266 * channel is only available after the hardware reset. Copy it to
1267 * the survey stats now.
1270 ath_update_survey_nf(sc
, old_pos
);
1273 if (changed
& IEEE80211_CONF_CHANGE_POWER
) {
1274 ath_dbg(common
, CONFIG
, "Set power: %d\n", conf
->power_level
);
1275 sc
->config
.txpowlimit
= 2 * conf
->power_level
;
1276 ath9k_cmn_update_txpow(ah
, sc
->curtxpow
,
1277 sc
->config
.txpowlimit
, &sc
->curtxpow
);
1280 mutex_unlock(&sc
->mutex
);
1281 ath9k_ps_restore(sc
);
1286 #define SUPPORTED_FILTERS \
1287 (FIF_PROMISC_IN_BSS | \
1292 FIF_BCN_PRBRESP_PROMISC | \
1296 /* FIXME: sc->sc_full_reset ? */
1297 static void ath9k_configure_filter(struct ieee80211_hw
*hw
,
1298 unsigned int changed_flags
,
1299 unsigned int *total_flags
,
1302 struct ath_softc
*sc
= hw
->priv
;
1305 changed_flags
&= SUPPORTED_FILTERS
;
1306 *total_flags
&= SUPPORTED_FILTERS
;
1308 sc
->rx
.rxfilter
= *total_flags
;
1309 ath9k_ps_wakeup(sc
);
1310 rfilt
= ath_calcrxfilter(sc
);
1311 ath9k_hw_setrxfilter(sc
->sc_ah
, rfilt
);
1312 ath9k_ps_restore(sc
);
1314 ath_dbg(ath9k_hw_common(sc
->sc_ah
), CONFIG
, "Set HW RX filter: 0x%x\n",
1318 static int ath9k_sta_add(struct ieee80211_hw
*hw
,
1319 struct ieee80211_vif
*vif
,
1320 struct ieee80211_sta
*sta
)
1322 struct ath_softc
*sc
= hw
->priv
;
1323 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
1324 struct ath_node
*an
= (struct ath_node
*) sta
->drv_priv
;
1325 struct ieee80211_key_conf ps_key
= { };
1327 ath_node_attach(sc
, sta
, vif
);
1329 if (vif
->type
!= NL80211_IFTYPE_AP
&&
1330 vif
->type
!= NL80211_IFTYPE_AP_VLAN
)
1333 an
->ps_key
= ath_key_config(common
, vif
, sta
, &ps_key
);
1338 static void ath9k_del_ps_key(struct ath_softc
*sc
,
1339 struct ieee80211_vif
*vif
,
1340 struct ieee80211_sta
*sta
)
1342 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
1343 struct ath_node
*an
= (struct ath_node
*) sta
->drv_priv
;
1344 struct ieee80211_key_conf ps_key
= { .hw_key_idx
= an
->ps_key
};
1349 ath_key_delete(common
, &ps_key
);
1352 static int ath9k_sta_remove(struct ieee80211_hw
*hw
,
1353 struct ieee80211_vif
*vif
,
1354 struct ieee80211_sta
*sta
)
1356 struct ath_softc
*sc
= hw
->priv
;
1358 ath9k_del_ps_key(sc
, vif
, sta
);
1359 ath_node_detach(sc
, sta
);
1364 static void ath9k_sta_notify(struct ieee80211_hw
*hw
,
1365 struct ieee80211_vif
*vif
,
1366 enum sta_notify_cmd cmd
,
1367 struct ieee80211_sta
*sta
)
1369 struct ath_softc
*sc
= hw
->priv
;
1370 struct ath_node
*an
= (struct ath_node
*) sta
->drv_priv
;
1372 if (!sta
->ht_cap
.ht_supported
)
1376 case STA_NOTIFY_SLEEP
:
1377 an
->sleeping
= true;
1378 ath_tx_aggr_sleep(sta
, sc
, an
);
1380 case STA_NOTIFY_AWAKE
:
1381 an
->sleeping
= false;
1382 ath_tx_aggr_wakeup(sc
, an
);
1387 static int ath9k_conf_tx(struct ieee80211_hw
*hw
,
1388 struct ieee80211_vif
*vif
, u16 queue
,
1389 const struct ieee80211_tx_queue_params
*params
)
1391 struct ath_softc
*sc
= hw
->priv
;
1392 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
1393 struct ath_txq
*txq
;
1394 struct ath9k_tx_queue_info qi
;
1397 if (queue
>= WME_NUM_AC
)
1400 txq
= sc
->tx
.txq_map
[queue
];
1402 ath9k_ps_wakeup(sc
);
1403 mutex_lock(&sc
->mutex
);
1405 memset(&qi
, 0, sizeof(struct ath9k_tx_queue_info
));
1407 qi
.tqi_aifs
= params
->aifs
;
1408 qi
.tqi_cwmin
= params
->cw_min
;
1409 qi
.tqi_cwmax
= params
->cw_max
;
1410 qi
.tqi_burstTime
= params
->txop
;
1412 ath_dbg(common
, CONFIG
,
1413 "Configure tx [queue/halq] [%d/%d], aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n",
1414 queue
, txq
->axq_qnum
, params
->aifs
, params
->cw_min
,
1415 params
->cw_max
, params
->txop
);
1417 ret
= ath_txq_update(sc
, txq
->axq_qnum
, &qi
);
1419 ath_err(common
, "TXQ Update failed\n");
1421 if (sc
->sc_ah
->opmode
== NL80211_IFTYPE_ADHOC
)
1422 if (queue
== WME_AC_BE
&& !ret
)
1423 ath_beaconq_config(sc
);
1425 mutex_unlock(&sc
->mutex
);
1426 ath9k_ps_restore(sc
);
1431 static int ath9k_set_key(struct ieee80211_hw
*hw
,
1432 enum set_key_cmd cmd
,
1433 struct ieee80211_vif
*vif
,
1434 struct ieee80211_sta
*sta
,
1435 struct ieee80211_key_conf
*key
)
1437 struct ath_softc
*sc
= hw
->priv
;
1438 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
1441 if (ath9k_modparam_nohwcrypt
)
1444 if ((vif
->type
== NL80211_IFTYPE_ADHOC
||
1445 vif
->type
== NL80211_IFTYPE_MESH_POINT
) &&
1446 (key
->cipher
== WLAN_CIPHER_SUITE_TKIP
||
1447 key
->cipher
== WLAN_CIPHER_SUITE_CCMP
) &&
1448 !(key
->flags
& IEEE80211_KEY_FLAG_PAIRWISE
)) {
1450 * For now, disable hw crypto for the RSN IBSS group keys. This
1451 * could be optimized in the future to use a modified key cache
1452 * design to support per-STA RX GTK, but until that gets
1453 * implemented, use of software crypto for group addressed
1454 * frames is a acceptable to allow RSN IBSS to be used.
1459 mutex_lock(&sc
->mutex
);
1460 ath9k_ps_wakeup(sc
);
1461 ath_dbg(common
, CONFIG
, "Set HW Key\n");
1466 ath9k_del_ps_key(sc
, vif
, sta
);
1468 ret
= ath_key_config(common
, vif
, sta
, key
);
1470 key
->hw_key_idx
= ret
;
1471 /* push IV and Michael MIC generation to stack */
1472 key
->flags
|= IEEE80211_KEY_FLAG_GENERATE_IV
;
1473 if (key
->cipher
== WLAN_CIPHER_SUITE_TKIP
)
1474 key
->flags
|= IEEE80211_KEY_FLAG_GENERATE_MMIC
;
1475 if (sc
->sc_ah
->sw_mgmt_crypto
&&
1476 key
->cipher
== WLAN_CIPHER_SUITE_CCMP
)
1477 key
->flags
|= IEEE80211_KEY_FLAG_SW_MGMT
;
1482 ath_key_delete(common
, key
);
1488 ath9k_ps_restore(sc
);
1489 mutex_unlock(&sc
->mutex
);
1493 static void ath9k_bss_iter(void *data
, u8
*mac
, struct ieee80211_vif
*vif
)
1495 struct ath_softc
*sc
= data
;
1496 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
1497 struct ieee80211_bss_conf
*bss_conf
= &vif
->bss_conf
;
1498 struct ath_vif
*avp
= (void *)vif
->drv_priv
;
1499 unsigned long flags
;
1501 * Skip iteration if primary station vif's bss info
1504 if (test_bit(SC_OP_PRIM_STA_VIF
, &sc
->sc_flags
))
1507 if (bss_conf
->assoc
) {
1508 set_bit(SC_OP_PRIM_STA_VIF
, &sc
->sc_flags
);
1509 avp
->primary_sta_vif
= true;
1510 memcpy(common
->curbssid
, bss_conf
->bssid
, ETH_ALEN
);
1511 common
->curaid
= bss_conf
->aid
;
1512 ath9k_hw_write_associd(sc
->sc_ah
);
1513 ath_dbg(common
, CONFIG
, "Bss Info ASSOC %d, bssid: %pM\n",
1514 bss_conf
->aid
, common
->curbssid
);
1515 ath_beacon_config(sc
, vif
);
1517 * Request a re-configuration of Beacon related timers
1518 * on the receipt of the first Beacon frame (i.e.,
1519 * after time sync with the AP).
1521 spin_lock_irqsave(&sc
->sc_pm_lock
, flags
);
1522 sc
->ps_flags
|= PS_BEACON_SYNC
| PS_WAIT_FOR_BEACON
;
1523 spin_unlock_irqrestore(&sc
->sc_pm_lock
, flags
);
1525 /* Reset rssi stats */
1526 sc
->last_rssi
= ATH_RSSI_DUMMY_MARKER
;
1527 sc
->sc_ah
->stats
.avgbrssi
= ATH_RSSI_DUMMY_MARKER
;
1529 ath_start_rx_poll(sc
, 3);
1531 if (!common
->disable_ani
) {
1532 set_bit(SC_OP_ANI_RUN
, &sc
->sc_flags
);
1533 ath_start_ani(common
);
1539 static void ath9k_config_bss(struct ath_softc
*sc
, struct ieee80211_vif
*vif
)
1541 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
1542 struct ieee80211_bss_conf
*bss_conf
= &vif
->bss_conf
;
1543 struct ath_vif
*avp
= (void *)vif
->drv_priv
;
1545 if (sc
->sc_ah
->opmode
!= NL80211_IFTYPE_STATION
)
1548 /* Reconfigure bss info */
1549 if (avp
->primary_sta_vif
&& !bss_conf
->assoc
) {
1550 ath_dbg(common
, CONFIG
, "Bss Info DISASSOC %d, bssid %pM\n",
1551 common
->curaid
, common
->curbssid
);
1552 clear_bit(SC_OP_PRIM_STA_VIF
, &sc
->sc_flags
);
1553 clear_bit(SC_OP_BEACONS
, &sc
->sc_flags
);
1554 avp
->primary_sta_vif
= false;
1555 memset(common
->curbssid
, 0, ETH_ALEN
);
1559 ieee80211_iterate_active_interfaces_atomic(
1560 sc
->hw
, ath9k_bss_iter
, sc
);
1563 * None of station vifs are associated.
1566 if (!test_bit(SC_OP_PRIM_STA_VIF
, &sc
->sc_flags
)) {
1567 ath9k_hw_write_associd(sc
->sc_ah
);
1568 clear_bit(SC_OP_ANI_RUN
, &sc
->sc_flags
);
1569 del_timer_sync(&common
->ani
.timer
);
1570 del_timer_sync(&sc
->rx_poll_timer
);
1571 memset(&sc
->caldata
, 0, sizeof(sc
->caldata
));
1575 static void ath9k_bss_info_changed(struct ieee80211_hw
*hw
,
1576 struct ieee80211_vif
*vif
,
1577 struct ieee80211_bss_conf
*bss_conf
,
1580 struct ath_softc
*sc
= hw
->priv
;
1581 struct ath_hw
*ah
= sc
->sc_ah
;
1582 struct ath_common
*common
= ath9k_hw_common(ah
);
1583 struct ath_vif
*avp
= (void *)vif
->drv_priv
;
1586 ath9k_ps_wakeup(sc
);
1587 mutex_lock(&sc
->mutex
);
1589 if (changed
& BSS_CHANGED_ASSOC
) {
1590 ath9k_config_bss(sc
, vif
);
1592 ath_dbg(common
, CONFIG
, "BSSID: %pM aid: 0x%x\n",
1593 common
->curbssid
, common
->curaid
);
1596 if (changed
& BSS_CHANGED_IBSS
) {
1597 /* There can be only one vif available */
1598 memcpy(common
->curbssid
, bss_conf
->bssid
, ETH_ALEN
);
1599 common
->curaid
= bss_conf
->aid
;
1600 ath9k_hw_write_associd(sc
->sc_ah
);
1602 if (bss_conf
->ibss_joined
) {
1603 sc
->sc_ah
->stats
.avgbrssi
= ATH_RSSI_DUMMY_MARKER
;
1605 if (!common
->disable_ani
) {
1606 set_bit(SC_OP_ANI_RUN
, &sc
->sc_flags
);
1607 ath_start_ani(common
);
1611 clear_bit(SC_OP_ANI_RUN
, &sc
->sc_flags
);
1612 del_timer_sync(&common
->ani
.timer
);
1613 del_timer_sync(&sc
->rx_poll_timer
);
1618 * In case of AP mode, the HW TSF has to be reset
1619 * when the beacon interval changes.
1621 if ((changed
& BSS_CHANGED_BEACON_INT
) &&
1622 (vif
->type
== NL80211_IFTYPE_AP
))
1623 set_bit(SC_OP_TSF_RESET
, &sc
->sc_flags
);
1625 /* Configure beaconing (AP, IBSS, MESH) */
1626 if (ath9k_uses_beacons(vif
->type
) &&
1627 ((changed
& BSS_CHANGED_BEACON
) ||
1628 (changed
& BSS_CHANGED_BEACON_ENABLED
) ||
1629 (changed
& BSS_CHANGED_BEACON_INT
))) {
1630 ath9k_set_beaconing_status(sc
, false);
1631 if (bss_conf
->enable_beacon
)
1632 ath_beacon_alloc(sc
, vif
);
1634 avp
->is_bslot_active
= false;
1635 ath_beacon_config(sc
, vif
);
1636 ath9k_set_beaconing_status(sc
, true);
1639 if (changed
& BSS_CHANGED_ERP_SLOT
) {
1640 if (bss_conf
->use_short_slot
)
1644 if (vif
->type
== NL80211_IFTYPE_AP
) {
1646 * Defer update, so that connected stations can adjust
1647 * their settings at the same time.
1648 * See beacon.c for more details
1650 sc
->beacon
.slottime
= slottime
;
1651 sc
->beacon
.updateslot
= UPDATE
;
1653 ah
->slottime
= slottime
;
1654 ath9k_hw_init_global_settings(ah
);
1658 mutex_unlock(&sc
->mutex
);
1659 ath9k_ps_restore(sc
);
1662 static u64
ath9k_get_tsf(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
)
1664 struct ath_softc
*sc
= hw
->priv
;
1667 mutex_lock(&sc
->mutex
);
1668 ath9k_ps_wakeup(sc
);
1669 tsf
= ath9k_hw_gettsf64(sc
->sc_ah
);
1670 ath9k_ps_restore(sc
);
1671 mutex_unlock(&sc
->mutex
);
1676 static void ath9k_set_tsf(struct ieee80211_hw
*hw
,
1677 struct ieee80211_vif
*vif
,
1680 struct ath_softc
*sc
= hw
->priv
;
1682 mutex_lock(&sc
->mutex
);
1683 ath9k_ps_wakeup(sc
);
1684 ath9k_hw_settsf64(sc
->sc_ah
, tsf
);
1685 ath9k_ps_restore(sc
);
1686 mutex_unlock(&sc
->mutex
);
1689 static void ath9k_reset_tsf(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
)
1691 struct ath_softc
*sc
= hw
->priv
;
1693 mutex_lock(&sc
->mutex
);
1695 ath9k_ps_wakeup(sc
);
1696 ath9k_hw_reset_tsf(sc
->sc_ah
);
1697 ath9k_ps_restore(sc
);
1699 mutex_unlock(&sc
->mutex
);
1702 static int ath9k_ampdu_action(struct ieee80211_hw
*hw
,
1703 struct ieee80211_vif
*vif
,
1704 enum ieee80211_ampdu_mlme_action action
,
1705 struct ieee80211_sta
*sta
,
1706 u16 tid
, u16
*ssn
, u8 buf_size
)
1708 struct ath_softc
*sc
= hw
->priv
;
1714 case IEEE80211_AMPDU_RX_START
:
1716 case IEEE80211_AMPDU_RX_STOP
:
1718 case IEEE80211_AMPDU_TX_START
:
1719 ath9k_ps_wakeup(sc
);
1720 ret
= ath_tx_aggr_start(sc
, sta
, tid
, ssn
);
1722 ieee80211_start_tx_ba_cb_irqsafe(vif
, sta
->addr
, tid
);
1723 ath9k_ps_restore(sc
);
1725 case IEEE80211_AMPDU_TX_STOP
:
1726 ath9k_ps_wakeup(sc
);
1727 ath_tx_aggr_stop(sc
, sta
, tid
);
1728 ieee80211_stop_tx_ba_cb_irqsafe(vif
, sta
->addr
, tid
);
1729 ath9k_ps_restore(sc
);
1731 case IEEE80211_AMPDU_TX_OPERATIONAL
:
1732 ath9k_ps_wakeup(sc
);
1733 ath_tx_aggr_resume(sc
, sta
, tid
);
1734 ath9k_ps_restore(sc
);
1737 ath_err(ath9k_hw_common(sc
->sc_ah
), "Unknown AMPDU action\n");
1745 static int ath9k_get_survey(struct ieee80211_hw
*hw
, int idx
,
1746 struct survey_info
*survey
)
1748 struct ath_softc
*sc
= hw
->priv
;
1749 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
1750 struct ieee80211_supported_band
*sband
;
1751 struct ieee80211_channel
*chan
;
1752 unsigned long flags
;
1755 spin_lock_irqsave(&common
->cc_lock
, flags
);
1757 ath_update_survey_stats(sc
);
1759 sband
= hw
->wiphy
->bands
[IEEE80211_BAND_2GHZ
];
1760 if (sband
&& idx
>= sband
->n_channels
) {
1761 idx
-= sband
->n_channels
;
1766 sband
= hw
->wiphy
->bands
[IEEE80211_BAND_5GHZ
];
1768 if (!sband
|| idx
>= sband
->n_channels
) {
1769 spin_unlock_irqrestore(&common
->cc_lock
, flags
);
1773 chan
= &sband
->channels
[idx
];
1774 pos
= chan
->hw_value
;
1775 memcpy(survey
, &sc
->survey
[pos
], sizeof(*survey
));
1776 survey
->channel
= chan
;
1777 spin_unlock_irqrestore(&common
->cc_lock
, flags
);
1782 static void ath9k_set_coverage_class(struct ieee80211_hw
*hw
, u8 coverage_class
)
1784 struct ath_softc
*sc
= hw
->priv
;
1785 struct ath_hw
*ah
= sc
->sc_ah
;
1787 mutex_lock(&sc
->mutex
);
1788 ah
->coverage_class
= coverage_class
;
1790 ath9k_ps_wakeup(sc
);
1791 ath9k_hw_init_global_settings(ah
);
1792 ath9k_ps_restore(sc
);
1794 mutex_unlock(&sc
->mutex
);
1797 static void ath9k_flush(struct ieee80211_hw
*hw
, bool drop
)
1799 struct ath_softc
*sc
= hw
->priv
;
1800 struct ath_hw
*ah
= sc
->sc_ah
;
1801 struct ath_common
*common
= ath9k_hw_common(ah
);
1802 int timeout
= 200; /* ms */
1806 mutex_lock(&sc
->mutex
);
1807 cancel_delayed_work_sync(&sc
->tx_complete_work
);
1809 if (ah
->ah_flags
& AH_UNPLUGGED
) {
1810 ath_dbg(common
, ANY
, "Device has been unplugged!\n");
1811 mutex_unlock(&sc
->mutex
);
1815 if (test_bit(SC_OP_INVALID
, &sc
->sc_flags
)) {
1816 ath_dbg(common
, ANY
, "Device not present\n");
1817 mutex_unlock(&sc
->mutex
);
1821 for (j
= 0; j
< timeout
; j
++) {
1825 usleep_range(1000, 2000);
1827 for (i
= 0; i
< ATH9K_NUM_TX_QUEUES
; i
++) {
1828 if (!ATH_TXQ_SETUP(sc
, i
))
1831 npend
= ath9k_has_pending_frames(sc
, &sc
->tx
.txq
[i
]);
1842 ath9k_ps_wakeup(sc
);
1843 spin_lock_bh(&sc
->sc_pcu_lock
);
1844 drain_txq
= ath_drain_all_txq(sc
, false);
1845 spin_unlock_bh(&sc
->sc_pcu_lock
);
1848 ath_reset(sc
, false);
1850 ath9k_ps_restore(sc
);
1851 ieee80211_wake_queues(hw
);
1854 ieee80211_queue_delayed_work(hw
, &sc
->tx_complete_work
, 0);
1855 mutex_unlock(&sc
->mutex
);
1858 static bool ath9k_tx_frames_pending(struct ieee80211_hw
*hw
)
1860 struct ath_softc
*sc
= hw
->priv
;
1863 for (i
= 0; i
< ATH9K_NUM_TX_QUEUES
; i
++) {
1864 if (!ATH_TXQ_SETUP(sc
, i
))
1867 if (ath9k_has_pending_frames(sc
, &sc
->tx
.txq
[i
]))
1873 static int ath9k_tx_last_beacon(struct ieee80211_hw
*hw
)
1875 struct ath_softc
*sc
= hw
->priv
;
1876 struct ath_hw
*ah
= sc
->sc_ah
;
1877 struct ieee80211_vif
*vif
;
1878 struct ath_vif
*avp
;
1880 struct ath_tx_status ts
;
1881 bool edma
= !!(ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
);
1884 vif
= sc
->beacon
.bslot
[0];
1888 avp
= (void *)vif
->drv_priv
;
1889 if (!avp
->is_bslot_active
)
1892 if (!sc
->beacon
.tx_processed
&& !edma
) {
1893 tasklet_disable(&sc
->bcon_tasklet
);
1896 if (!bf
|| !bf
->bf_mpdu
)
1899 status
= ath9k_hw_txprocdesc(ah
, bf
->bf_desc
, &ts
);
1900 if (status
== -EINPROGRESS
)
1903 sc
->beacon
.tx_processed
= true;
1904 sc
->beacon
.tx_last
= !(ts
.ts_status
& ATH9K_TXERR_MASK
);
1907 tasklet_enable(&sc
->bcon_tasklet
);
1910 return sc
->beacon
.tx_last
;
1913 static int ath9k_get_stats(struct ieee80211_hw
*hw
,
1914 struct ieee80211_low_level_stats
*stats
)
1916 struct ath_softc
*sc
= hw
->priv
;
1917 struct ath_hw
*ah
= sc
->sc_ah
;
1918 struct ath9k_mib_stats
*mib_stats
= &ah
->ah_mibStats
;
1920 stats
->dot11ACKFailureCount
= mib_stats
->ackrcv_bad
;
1921 stats
->dot11RTSFailureCount
= mib_stats
->rts_bad
;
1922 stats
->dot11FCSErrorCount
= mib_stats
->fcs_bad
;
1923 stats
->dot11RTSSuccessCount
= mib_stats
->rts_good
;
1927 static u32
fill_chainmask(u32 cap
, u32
new)
1932 for (i
= 0; cap
&& new; i
++, cap
>>= 1) {
1933 if (!(cap
& BIT(0)))
1945 static int ath9k_set_antenna(struct ieee80211_hw
*hw
, u32 tx_ant
, u32 rx_ant
)
1947 struct ath_softc
*sc
= hw
->priv
;
1948 struct ath_hw
*ah
= sc
->sc_ah
;
1950 if (!rx_ant
|| !tx_ant
)
1953 sc
->ant_rx
= rx_ant
;
1954 sc
->ant_tx
= tx_ant
;
1956 if (ah
->caps
.rx_chainmask
== 1)
1959 /* AR9100 runs into calibration issues if not all rx chains are enabled */
1960 if (AR_SREV_9100(ah
))
1961 ah
->rxchainmask
= 0x7;
1963 ah
->rxchainmask
= fill_chainmask(ah
->caps
.rx_chainmask
, rx_ant
);
1965 ah
->txchainmask
= fill_chainmask(ah
->caps
.tx_chainmask
, tx_ant
);
1966 ath9k_reload_chainmask_settings(sc
);
1971 static int ath9k_get_antenna(struct ieee80211_hw
*hw
, u32
*tx_ant
, u32
*rx_ant
)
1973 struct ath_softc
*sc
= hw
->priv
;
1975 *tx_ant
= sc
->ant_tx
;
1976 *rx_ant
= sc
->ant_rx
;
1980 #ifdef CONFIG_ATH9K_DEBUGFS
1982 /* Ethtool support for get-stats */
1984 #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"
1985 static const char ath9k_gstrings_stats
[][ETH_GSTRING_LEN
] = {
1992 AMKSTR(d_tx_mpdus_queued
),
1993 AMKSTR(d_tx_mpdus_completed
),
1994 AMKSTR(d_tx_mpdu_xretries
),
1995 AMKSTR(d_tx_aggregates
),
1996 AMKSTR(d_tx_ampdus_queued_hw
),
1997 AMKSTR(d_tx_ampdus_queued_sw
),
1998 AMKSTR(d_tx_ampdus_completed
),
1999 AMKSTR(d_tx_ampdu_retries
),
2000 AMKSTR(d_tx_ampdu_xretries
),
2001 AMKSTR(d_tx_fifo_underrun
),
2002 AMKSTR(d_tx_op_exceeded
),
2003 AMKSTR(d_tx_timer_expiry
),
2004 AMKSTR(d_tx_desc_cfg_err
),
2005 AMKSTR(d_tx_data_underrun
),
2006 AMKSTR(d_tx_delim_underrun
),
2008 "d_rx_decrypt_crc_err",
2011 "d_rx_pre_delim_crc_err",
2012 "d_rx_post_delim_crc_err",
2013 "d_rx_decrypt_busy_err",
2015 "d_rx_phyerr_radar",
2016 "d_rx_phyerr_ofdm_timing",
2017 "d_rx_phyerr_cck_timing",
2020 #define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats)
2022 static void ath9k_get_et_strings(struct ieee80211_hw
*hw
,
2023 struct ieee80211_vif
*vif
,
2026 if (sset
== ETH_SS_STATS
)
2027 memcpy(data
, *ath9k_gstrings_stats
,
2028 sizeof(ath9k_gstrings_stats
));
2031 static int ath9k_get_et_sset_count(struct ieee80211_hw
*hw
,
2032 struct ieee80211_vif
*vif
, int sset
)
2034 if (sset
== ETH_SS_STATS
)
2035 return ATH9K_SSTATS_LEN
;
2039 #define PR_QNUM(_n) (sc->tx.txq_map[_n]->axq_qnum)
2040 #define AWDATA(elem) \
2042 data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].elem; \
2043 data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].elem; \
2044 data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].elem; \
2045 data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].elem; \
2048 #define AWDATA_RX(elem) \
2050 data[i++] = sc->debug.stats.rxstats.elem; \
2053 static void ath9k_get_et_stats(struct ieee80211_hw
*hw
,
2054 struct ieee80211_vif
*vif
,
2055 struct ethtool_stats
*stats
, u64
*data
)
2057 struct ath_softc
*sc
= hw
->priv
;
2060 data
[i
++] = (sc
->debug
.stats
.txstats
[PR_QNUM(WME_AC_BE
)].tx_pkts_all
+
2061 sc
->debug
.stats
.txstats
[PR_QNUM(WME_AC_BK
)].tx_pkts_all
+
2062 sc
->debug
.stats
.txstats
[PR_QNUM(WME_AC_VI
)].tx_pkts_all
+
2063 sc
->debug
.stats
.txstats
[PR_QNUM(WME_AC_VO
)].tx_pkts_all
);
2064 data
[i
++] = (sc
->debug
.stats
.txstats
[PR_QNUM(WME_AC_BE
)].tx_bytes_all
+
2065 sc
->debug
.stats
.txstats
[PR_QNUM(WME_AC_BK
)].tx_bytes_all
+
2066 sc
->debug
.stats
.txstats
[PR_QNUM(WME_AC_VI
)].tx_bytes_all
+
2067 sc
->debug
.stats
.txstats
[PR_QNUM(WME_AC_VO
)].tx_bytes_all
);
2068 AWDATA_RX(rx_pkts_all
);
2069 AWDATA_RX(rx_bytes_all
);
2071 AWDATA(tx_pkts_all
);
2072 AWDATA(tx_bytes_all
);
2077 AWDATA(a_queued_hw
);
2078 AWDATA(a_queued_sw
);
2079 AWDATA(a_completed
);
2082 AWDATA(fifo_underrun
);
2085 AWDATA(desc_cfg_err
);
2086 AWDATA(data_underrun
);
2087 AWDATA(delim_underrun
);
2089 AWDATA_RX(decrypt_crc_err
);
2092 AWDATA_RX(pre_delim_crc_err
);
2093 AWDATA_RX(post_delim_crc_err
);
2094 AWDATA_RX(decrypt_busy_err
);
2096 AWDATA_RX(phy_err_stats
[ATH9K_PHYERR_RADAR
]);
2097 AWDATA_RX(phy_err_stats
[ATH9K_PHYERR_OFDM_TIMING
]);
2098 AWDATA_RX(phy_err_stats
[ATH9K_PHYERR_CCK_TIMING
]);
2100 WARN_ON(i
!= ATH9K_SSTATS_LEN
);
2103 /* End of ethtool get-stats functions */
2108 struct ieee80211_ops ath9k_ops
= {
2110 .start
= ath9k_start
,
2112 .add_interface
= ath9k_add_interface
,
2113 .change_interface
= ath9k_change_interface
,
2114 .remove_interface
= ath9k_remove_interface
,
2115 .config
= ath9k_config
,
2116 .configure_filter
= ath9k_configure_filter
,
2117 .sta_add
= ath9k_sta_add
,
2118 .sta_remove
= ath9k_sta_remove
,
2119 .sta_notify
= ath9k_sta_notify
,
2120 .conf_tx
= ath9k_conf_tx
,
2121 .bss_info_changed
= ath9k_bss_info_changed
,
2122 .set_key
= ath9k_set_key
,
2123 .get_tsf
= ath9k_get_tsf
,
2124 .set_tsf
= ath9k_set_tsf
,
2125 .reset_tsf
= ath9k_reset_tsf
,
2126 .ampdu_action
= ath9k_ampdu_action
,
2127 .get_survey
= ath9k_get_survey
,
2128 .rfkill_poll
= ath9k_rfkill_poll_state
,
2129 .set_coverage_class
= ath9k_set_coverage_class
,
2130 .flush
= ath9k_flush
,
2131 .tx_frames_pending
= ath9k_tx_frames_pending
,
2132 .tx_last_beacon
= ath9k_tx_last_beacon
,
2133 .get_stats
= ath9k_get_stats
,
2134 .set_antenna
= ath9k_set_antenna
,
2135 .get_antenna
= ath9k_get_antenna
,
2137 #ifdef CONFIG_ATH9K_DEBUGFS
2138 .get_et_sset_count
= ath9k_get_et_sset_count
,
2139 .get_et_stats
= ath9k_get_et_stats
,
2140 .get_et_strings
= ath9k_get_et_strings
,