Lines Matching +full:channel +full:- +full:spacing

2  * Copyright (c) 2008-2011 Atheros Communications Inc.
28 * 802.11n D2.0 defined values for "Minimum MPDU Start Spacing": in ath9k_parse_mpdudensity()
65 spin_lock_bh(&txq->axq_lock); in ath9k_has_pending_frames()
67 if (txq->axq_depth) { in ath9k_has_pending_frames()
75 if (txq->mac80211_qnum >= 0) { in ath9k_has_pending_frames()
78 acq = &sc->cur_chan->acq[txq->mac80211_qnum]; in ath9k_has_pending_frames()
79 if (!list_empty(&acq->acq_new) || !list_empty(&acq->acq_old)) in ath9k_has_pending_frames()
83 spin_unlock_bh(&txq->axq_lock); in ath9k_has_pending_frames()
92 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath9k_setpower()
93 ret = ath9k_hw_setpower(sc->sc_ah, mode); in ath9k_setpower()
94 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath9k_setpower()
102 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_ps_full_sleep()
106 spin_lock_irqsave(&common->cc_lock, flags); in ath_ps_full_sleep()
108 spin_unlock_irqrestore(&common->cc_lock, flags); in ath_ps_full_sleep()
110 ath9k_hw_setrxabort(sc->sc_ah, 1); in ath_ps_full_sleep()
111 ath9k_hw_stopdmarecv(sc->sc_ah, &reset); in ath_ps_full_sleep()
113 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP); in ath_ps_full_sleep()
118 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_ps_wakeup()
122 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath9k_ps_wakeup()
123 if (++sc->ps_usecount != 1) in ath9k_ps_wakeup()
126 del_timer_sync(&sc->sleep_timer); in ath9k_ps_wakeup()
127 power_mode = sc->sc_ah->power_mode; in ath9k_ps_wakeup()
128 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); in ath9k_ps_wakeup()
136 spin_lock(&common->cc_lock); in ath9k_ps_wakeup()
138 memset(&common->cc, 0, sizeof(common->cc)); in ath9k_ps_wakeup()
139 spin_unlock(&common->cc_lock); in ath9k_ps_wakeup()
143 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath9k_ps_wakeup()
148 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_ps_restore()
152 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath9k_ps_restore()
153 if (--sc->ps_usecount != 0) in ath9k_ps_restore()
156 if (sc->ps_idle) { in ath9k_ps_restore()
157 mod_timer(&sc->sleep_timer, jiffies + HZ / 10); in ath9k_ps_restore()
161 if (sc->ps_enabled && in ath9k_ps_restore()
162 !(sc->ps_flags & (PS_WAIT_FOR_BEACON | in ath9k_ps_restore()
168 if (ath9k_hw_btcoex_is_enabled(sc->sc_ah)) in ath9k_ps_restore()
174 spin_lock(&common->cc_lock); in ath9k_ps_restore()
176 spin_unlock(&common->cc_lock); in ath9k_ps_restore()
178 ath9k_hw_setpower(sc->sc_ah, mode); in ath9k_ps_restore()
181 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath9k_ps_restore()
186 cancel_work_sync(&sc->paprd_work); in __ath_cancel_work()
187 cancel_delayed_work_sync(&sc->hw_check_work); in __ath_cancel_work()
188 cancel_delayed_work_sync(&sc->hw_pll_work); in __ath_cancel_work()
191 if (ath9k_hw_mci_is_enabled(sc->sc_ah)) in __ath_cancel_work()
192 cancel_work_sync(&sc->mci_work); in __ath_cancel_work()
199 cancel_work_sync(&sc->hw_reset_work); in ath_cancel_work()
204 ieee80211_queue_delayed_work(sc->hw, &sc->hw_check_work, in ath_restart_work()
207 if (AR_SREV_9340(sc->sc_ah) || AR_SREV_9330(sc->sc_ah)) in ath_restart_work()
208 ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, in ath_restart_work()
216 struct ath_hw *ah = sc->sc_ah; in ath_prepare_reset()
219 ieee80211_stop_queues(sc->hw); in ath_prepare_reset()
236 struct ath_hw *ah = sc->sc_ah; in ath_complete_reset()
240 ath9k_calculate_summary_state(sc, sc->cur_chan); in ath_complete_reset()
242 ath9k_cmn_update_txpow(ah, sc->cur_chan->cur_txpower, in ath_complete_reset()
243 sc->cur_chan->txpower, in ath_complete_reset()
244 &sc->cur_chan->cur_txpower); in ath_complete_reset()
245 clear_bit(ATH_OP_HW_RESET, &common->op_flags); in ath_complete_reset()
247 if (!sc->cur_chan->offchannel && start) { in ath_complete_reset()
249 if (sc->cur_chan->tsf_val) { in ath_complete_reset()
252 offset = ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, in ath_complete_reset()
254 ath9k_hw_settsf64(ah, sc->cur_chan->tsf_val + offset); in ath_complete_reset()
258 if (!test_bit(ATH_OP_BEACONS, &common->op_flags)) in ath_complete_reset()
261 if (ah->opmode == NL80211_IFTYPE_STATION && in ath_complete_reset()
262 test_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags)) { in ath_complete_reset()
263 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath_complete_reset()
264 sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; in ath_complete_reset()
265 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath_complete_reset()
274 sc->gtt_cnt = 0; in ath_complete_reset()
278 ieee80211_wake_queues(sc->hw); in ath_complete_reset()
286 struct ath_hw *ah = sc->sc_ah; in ath_reset_internal()
294 disable_irq(sc->irq); in ath_reset_internal()
295 tasklet_disable(&sc->intr_tq); in ath_reset_internal()
296 tasklet_disable(&sc->bcon_tasklet); in ath_reset_internal()
297 spin_lock_bh(&sc->sc_pcu_lock); in ath_reset_internal()
299 if (!sc->cur_chan->offchannel) { in ath_reset_internal()
301 caldata = &sc->cur_chan->caldata; in ath_reset_internal()
306 hchan = ah->curchan; in ath_reset_internal()
311 hchan = ath9k_cmn_get_channel(sc->hw, ah, &sc->cur_chan->chandef); in ath_reset_internal()
320 spin_lock_bh(&sc->chan_lock); in ath_reset_internal()
321 sc->cur_chandef = sc->cur_chan->chandef; in ath_reset_internal()
322 spin_unlock_bh(&sc->chan_lock); in ath_reset_internal()
325 hchan->channel, IS_CHAN_HT40(hchan), fastcc); in ath_reset_internal()
330 "Unable to reset channel, reset status %d\n", r); in ath_reset_internal()
338 if (ath9k_hw_mci_is_enabled(sc->sc_ah) && in ath_reset_internal()
339 sc->cur_chan->offchannel) in ath_reset_internal()
343 r = -EIO; in ath_reset_internal()
346 enable_irq(sc->irq); in ath_reset_internal()
347 spin_unlock_bh(&sc->sc_pcu_lock); in ath_reset_internal()
348 tasklet_enable(&sc->bcon_tasklet); in ath_reset_internal()
349 tasklet_enable(&sc->intr_tq); in ath_reset_internal()
358 an = (struct ath_node *)sta->drv_priv; in ath_node_attach()
360 an->sc = sc; in ath_node_attach()
361 an->sta = sta; in ath_node_attach()
362 an->vif = vif; in ath_node_attach()
363 memset(&an->key_idx, 0, sizeof(an->key_idx)); in ath_node_attach()
367 ath_dynack_node_init(sc->sc_ah, an); in ath_node_attach()
372 struct ath_node *an = (struct ath_node *)sta->drv_priv; in ath_node_detach()
375 ath_dynack_node_deinit(sc->sc_ah, an); in ath_node_detach()
381 struct ath_hw *ah = sc->sc_ah; in ath9k_tasklet()
388 spin_lock_irqsave(&sc->intr_lock, flags); in ath9k_tasklet()
389 status = sc->intrstatus; in ath9k_tasklet()
390 sc->intrstatus = 0; in ath9k_tasklet()
391 spin_unlock_irqrestore(&sc->intr_lock, flags); in ath9k_tasklet()
394 spin_lock(&sc->sc_pcu_lock); in ath9k_tasklet()
403 if ((ah->config.hw_hang_checks & HW_BB_WATCHDOG) && in ath9k_tasklet()
405 spin_lock_irqsave(&common->cc_lock, flags); in ath9k_tasklet()
408 spin_unlock_irqrestore(&common->cc_lock, flags); in ath9k_tasklet()
421 sc->gtt_cnt++; in ath9k_tasklet()
423 if ((sc->gtt_cnt >= MAX_GTT_CNT) && !ath9k_hw_check_alive(ah)) { in ath9k_tasklet()
432 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath9k_tasklet()
433 if ((status & ATH9K_INT_TSFOOR) && sc->ps_enabled) { in ath9k_tasklet()
438 ath_dbg(common, PS, "TSFOOR - Sync with next Beacon\n"); in ath9k_tasklet()
439 sc->ps_flags |= PS_WAIT_FOR_BEACON | PS_BEACON_SYNC; in ath9k_tasklet()
441 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath9k_tasklet()
443 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) in ath9k_tasklet()
451 if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && in ath9k_tasklet()
459 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { in ath9k_tasklet()
466 sc->gtt_cnt = 0; in ath9k_tasklet()
473 wake_up(&sc->tx_wait); in ath9k_tasklet()
477 ath_gen_timer_isr(sc->sc_ah); in ath9k_tasklet()
481 /* re-enable hardware interrupt */ in ath9k_tasklet()
484 spin_unlock(&sc->sc_pcu_lock); in ath9k_tasklet()
507 struct ath_hw *ah = sc->sc_ah; in ath_isr()
518 if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags)) in ath_isr()
527 * that the hal returns a pseudo-ISR that may include in ath_isr()
533 status &= ah->imask; /* discard unasked-for bits */ in ath_isr()
535 if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) { in ath_isr()
536 ath9k_hw_kill_interrupts(sc->sc_ah); in ath_isr()
548 spin_lock(&sc->intr_lock); in ath_isr()
549 sc->intrstatus |= status; in ath_isr()
550 spin_unlock(&sc->intr_lock); in ath_isr()
562 if ((ah->config.hw_hang_checks & HW_BB_WATCHDOG) && in ath_isr()
567 tasklet_schedule(&sc->bcon_tasklet); in ath_isr()
573 ah->imask &= ~(ATH9K_INT_RXEOL | ATH9K_INT_RXORN); in ath_isr()
577 if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) in ath_isr()
579 if (ATH_DBG_WARN_ON_ONCE(sc->ps_idle)) in ath_isr()
584 spin_lock(&sc->sc_pm_lock); in ath_isr()
585 ath9k_hw_setrxabort(sc->sc_ah, 0); in ath_isr()
586 sc->ps_flags |= PS_WAIT_FOR_BEACON; in ath_isr()
587 spin_unlock(&sc->sc_pm_lock); in ath_isr()
597 tasklet_schedule(&sc->intr_tq); in ath_isr()
611 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_reset()
614 ath9k_hw_kill_interrupts(sc->sc_ah); in ath_reset()
615 set_bit(ATH_OP_HW_RESET, &common->op_flags); in ath_reset()
631 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_queue_reset()
635 ath9k_hw_kill_interrupts(sc->sc_ah); in ath9k_queue_reset()
636 set_bit(ATH_OP_HW_RESET, &common->op_flags); in ath9k_queue_reset()
637 ieee80211_queue_work(sc->hw, &sc->hw_reset_work); in ath9k_queue_reset()
655 struct ath_softc *sc = hw->priv; in ath9k_start()
656 struct ath_hw *ah = sc->sc_ah; in ath9k_start()
658 struct ieee80211_channel *curchan = sc->cur_chan->chandef.chan; in ath9k_start()
659 struct ath_chanctx *ctx = sc->cur_chan; in ath9k_start()
664 "Starting driver with initial channel: %d MHz\n", in ath9k_start()
665 curchan->center_freq); in ath9k_start()
668 mutex_lock(&sc->mutex); in ath9k_start()
670 init_channel = ath9k_cmn_get_channel(hw, ah, &ctx->chandef); in ath9k_start()
671 sc->cur_chandef = hw->conf.chandef; in ath9k_start()
683 spin_lock_bh(&sc->sc_pcu_lock); in ath9k_start()
685 atomic_set(&ah->intr_ref_cnt, -1); in ath9k_start()
687 r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); in ath9k_start()
691 r, curchan->center_freq); in ath9k_start()
692 ah->reset_power_on = false; in ath9k_start()
696 ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL | in ath9k_start()
700 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) in ath9k_start()
701 ah->imask |= ATH9K_INT_RXHP | in ath9k_start()
704 ah->imask |= ATH9K_INT_RX; in ath9k_start()
706 if (ah->config.hw_hang_checks & HW_BB_WATCHDOG) in ath9k_start()
707 ah->imask |= ATH9K_INT_BB_WATCHDOG; in ath9k_start()
714 ah->imask |= ATH9K_INT_GTT; in ath9k_start()
716 if (ah->caps.hw_caps & ATH9K_HW_CAP_HT) in ath9k_start()
717 ah->imask |= ATH9K_INT_CST; in ath9k_start()
721 clear_bit(ATH_OP_INVALID, &common->op_flags); in ath9k_start()
722 sc->sc_ah->is_monitoring = false; in ath9k_start()
725 ah->reset_power_on = false; in ath9k_start()
727 if (ah->led_pin >= 0) { in ath9k_start()
728 ath9k_hw_set_gpio(ah, ah->led_pin, in ath9k_start()
729 (ah->config.led_active_high) ? 1 : 0); in ath9k_start()
730 ath9k_hw_gpio_request_out(ah, ah->led_pin, NULL, in ath9k_start()
736 * semi-random values after suspend/resume. in ath9k_start()
738 ath9k_cmn_init_crypto(sc->sc_ah); in ath9k_start()
742 spin_unlock_bh(&sc->sc_pcu_lock); in ath9k_start()
746 mutex_unlock(&sc->mutex); in ath9k_start()
757 struct ath_softc *sc = hw->priv; in ath9k_tx()
758 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_tx()
760 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; in ath9k_tx()
763 if (sc->ps_enabled) { in ath9k_tx()
768 if (ieee80211_is_data(hdr->frame_control) && in ath9k_tx()
769 !ieee80211_is_nullfunc(hdr->frame_control) && in ath9k_tx()
770 !ieee80211_has_pm(hdr->frame_control)) { in ath9k_tx()
773 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); in ath9k_tx()
777 if (unlikely(sc->sc_ah->power_mode == ATH9K_PM_NETWORK_SLEEP)) { in ath9k_tx()
779 * We are using PS-Poll and mac80211 can request TX while in in ath9k_tx()
784 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath9k_tx()
785 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) in ath9k_tx()
786 ath9k_hw_setrxabort(sc->sc_ah, 0); in ath9k_tx()
787 if (ieee80211_is_pspoll(hdr->frame_control)) { in ath9k_tx()
789 "Sending PS-Poll to pick a buffered frame\n"); in ath9k_tx()
790 sc->ps_flags |= PS_WAIT_FOR_PSPOLL_DATA; in ath9k_tx()
793 sc->ps_flags |= PS_WAIT_FOR_TX_ACK; in ath9k_tx()
800 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath9k_tx()
808 if (unlikely(sc->sc_ah->power_mode == ATH9K_PM_FULL_SLEEP)) { in ath9k_tx()
814 txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)]; in ath9k_tx()
815 txctl.sta = control->sta; in ath9k_tx()
821 TX_STAT_INC(sc, txctl.txq->axq_qnum, txfailed); in ath9k_tx()
837 if (bf->bf_state.stale || !bf->bf_mpdu) in ath9k_txq_list_has_key()
840 txinfo = IEEE80211_SKB_CB(bf->bf_mpdu); in ath9k_txq_list_has_key()
841 fi = (struct ath_frame_info *)&txinfo->status.status_driver_data[0]; in ath9k_txq_list_has_key()
842 if (fi->keyix == keyix) in ath9k_txq_list_has_key()
851 struct ath_hw *ah = sc->sc_ah; in ath9k_txq_has_key()
859 txq = &sc->tx.txq[i]; in ath9k_txq_has_key()
860 if (!txq->axq_depth) in ath9k_txq_has_key()
862 if (!ath9k_hw_numtxpending(ah, txq->axq_qnum)) in ath9k_txq_has_key()
866 key_in_use = ath9k_txq_list_has_key(&txq->axq_q, keyix); in ath9k_txq_has_key()
867 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { in ath9k_txq_has_key()
868 int idx = txq->txq_tailidx; in ath9k_txq_has_key()
871 !list_empty(&txq->txq_fifo[idx]) && in ath9k_txq_has_key()
874 &txq->txq_fifo[idx], keyix); in ath9k_txq_has_key()
886 struct ath_hw *ah = sc->sc_ah; in ath9k_pending_key_del()
889 if (!test_bit(keyix, ah->pending_del_keymap) || in ath9k_pending_key_del()
894 clear_bit(keyix, ah->pending_del_keymap); in ath9k_pending_key_del()
900 struct ath_softc *sc = hw->priv; in ath9k_stop()
901 struct ath_hw *ah = sc->sc_ah; in ath9k_stop()
908 mutex_lock(&sc->mutex); in ath9k_stop()
914 if (test_bit(ATH_OP_INVALID, &common->op_flags)) { in ath9k_stop()
916 mutex_unlock(&sc->mutex); in ath9k_stop()
923 spin_lock_bh(&sc->sc_pcu_lock); in ath9k_stop()
926 ah->imask &= ~ATH9K_INT_GLOBAL; in ath9k_stop()
932 spin_unlock_bh(&sc->sc_pcu_lock); in ath9k_stop()
936 synchronize_irq(sc->irq); in ath9k_stop()
937 tasklet_kill(&sc->intr_tq); in ath9k_stop()
938 tasklet_kill(&sc->bcon_tasklet); in ath9k_stop()
940 prev_idle = sc->ps_idle; in ath9k_stop()
941 sc->ps_idle = true; in ath9k_stop()
943 spin_lock_bh(&sc->sc_pcu_lock); in ath9k_stop()
945 if (ah->led_pin >= 0) { in ath9k_stop()
946 ath9k_hw_set_gpio(ah, ah->led_pin, in ath9k_stop()
947 (ah->config.led_active_high) ? 0 : 1); in ath9k_stop()
948 ath9k_hw_gpio_request_in(ah, ah->led_pin, NULL); in ath9k_stop()
953 if (sc->rx.frag) { in ath9k_stop()
954 dev_kfree_skb_any(sc->rx.frag); in ath9k_stop()
955 sc->rx.frag = NULL; in ath9k_stop()
958 if (!ah->curchan) in ath9k_stop()
959 ah->curchan = ath9k_cmn_get_channel(hw, ah, in ath9k_stop()
960 &sc->cur_chan->chandef); in ath9k_stop()
962 ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); in ath9k_stop()
964 set_bit(ATH_OP_INVALID, &common->op_flags); in ath9k_stop()
970 spin_unlock_bh(&sc->sc_pcu_lock); in ath9k_stop()
978 ath9k_cmn_init_crypto(sc->sc_ah); in ath9k_stop()
982 sc->ps_idle = prev_idle; in ath9k_stop()
984 mutex_unlock(&sc->mutex); in ath9k_stop()
1005 if (!iter_data->primary_beacon_vif) { in ath9k_vif_iter_set_beacon()
1006 iter_data->primary_beacon_vif = vif; in ath9k_vif_iter_set_beacon()
1008 if (iter_data->primary_beacon_vif->type != NL80211_IFTYPE_AP && in ath9k_vif_iter_set_beacon()
1009 vif->type == NL80211_IFTYPE_AP) in ath9k_vif_iter_set_beacon()
1010 iter_data->primary_beacon_vif = vif; in ath9k_vif_iter_set_beacon()
1013 iter_data->beacons = true; in ath9k_vif_iter_set_beacon()
1014 iter_data->nbcnvifs += 1; in ath9k_vif_iter_set_beacon()
1020 struct ath_vif *avp = (struct ath_vif *)vif->drv_priv; in ath9k_vif_iter()
1023 if (iter_data->has_hw_macaddr) { in ath9k_vif_iter()
1025 iter_data->mask[i] &= in ath9k_vif_iter()
1026 ~(iter_data->hw_macaddr[i] ^ mac[i]); in ath9k_vif_iter()
1028 memcpy(iter_data->hw_macaddr, mac, ETH_ALEN); in ath9k_vif_iter()
1029 iter_data->has_hw_macaddr = true; in ath9k_vif_iter()
1032 if (!vif->bss_conf.use_short_slot) in ath9k_vif_iter()
1033 iter_data->slottime = 20; in ath9k_vif_iter()
1035 switch (vif->type) { in ath9k_vif_iter()
1037 iter_data->naps++; in ath9k_vif_iter()
1038 if (vif->bss_conf.enable_beacon) in ath9k_vif_iter()
1042 iter_data->nstations++; in ath9k_vif_iter()
1043 if (avp->assoc && !iter_data->primary_sta) in ath9k_vif_iter()
1044 iter_data->primary_sta = vif; in ath9k_vif_iter()
1047 iter_data->nocbs++; in ath9k_vif_iter()
1050 iter_data->nadhocs++; in ath9k_vif_iter()
1051 if (vif->bss_conf.enable_beacon) in ath9k_vif_iter()
1055 iter_data->nmeshes++; in ath9k_vif_iter()
1056 if (vif->bss_conf.enable_beacon) in ath9k_vif_iter()
1068 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_update_bssid_mask()
1075 list_for_each_entry(avp, &ctx->vifs, list) { in ath9k_update_bssid_mask()
1076 if (ctx->nvifs_assigned != 1) in ath9k_update_bssid_mask()
1079 if (!iter_data->has_hw_macaddr) in ath9k_update_bssid_mask()
1082 ether_addr_copy(common->curbssid, avp->bssid); in ath9k_update_bssid_mask()
1086 iter_data->mask[i] &= in ath9k_update_bssid_mask()
1087 ~(iter_data->hw_macaddr[i] ^ in ath9k_update_bssid_mask()
1088 sc->hw->wiphy->perm_addr[i]); in ath9k_update_bssid_mask()
1092 /* Called with sc->mutex held. */
1104 eth_broadcast_addr(iter_data->mask); in ath9k_calculate_iter_data()
1105 iter_data->slottime = 9; in ath9k_calculate_iter_data()
1107 list_for_each_entry(avp, &ctx->vifs, list) in ath9k_calculate_iter_data()
1108 ath9k_vif_iter(iter_data, avp->vif->addr, avp->vif); in ath9k_calculate_iter_data()
1116 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_set_assoc_state()
1117 struct ath_vif *avp = (struct ath_vif *)vif->drv_priv; in ath9k_set_assoc_state()
1120 set_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags); in ath9k_set_assoc_state()
1122 ether_addr_copy(common->curbssid, avp->bssid); in ath9k_set_assoc_state()
1123 common->curaid = avp->aid; in ath9k_set_assoc_state()
1124 ath9k_hw_write_associd(sc->sc_ah); in ath9k_set_assoc_state()
1127 common->last_rssi = ATH_RSSI_DUMMY_MARKER; in ath9k_set_assoc_state()
1128 sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; in ath9k_set_assoc_state()
1130 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath9k_set_assoc_state()
1131 sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; in ath9k_set_assoc_state()
1132 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath9k_set_assoc_state()
1135 if (ath9k_hw_mci_is_enabled(sc->sc_ah)) in ath9k_set_assoc_state()
1140 vif->addr, common->curbssid); in ath9k_set_assoc_state()
1146 struct ath_hw *ah = sc->sc_ah; in ath9k_set_offchannel_state()
1152 if (sc->offchannel.state < ATH_OFFCHANNEL_ROC_START) in ath9k_set_offchannel_state()
1153 vif = sc->offchannel.scan_vif; in ath9k_set_offchannel_state()
1155 vif = sc->offchannel.roc_vif; in ath9k_set_offchannel_state()
1160 eth_zero_addr(common->curbssid); in ath9k_set_offchannel_state()
1161 eth_broadcast_addr(common->bssidmask); in ath9k_set_offchannel_state()
1162 memcpy(common->macaddr, vif->addr, ETH_ALEN); in ath9k_set_offchannel_state()
1163 common->curaid = 0; in ath9k_set_offchannel_state()
1164 ah->opmode = vif->type; in ath9k_set_offchannel_state()
1165 ah->imask &= ~ATH9K_INT_SWBA; in ath9k_set_offchannel_state()
1166 ah->imask &= ~ATH9K_INT_TSFOOR; in ath9k_set_offchannel_state()
1167 ah->slottime = 9; in ath9k_set_offchannel_state()
1171 ath9k_hw_write_associd(sc->sc_ah); in ath9k_set_offchannel_state()
1180 /* Called with sc->mutex held. */
1184 struct ath_hw *ah = sc->sc_ah; in ath9k_calculate_summary_state()
1190 if (ctx != sc->cur_chan) in ath9k_calculate_summary_state()
1194 if (ctx == &sc->offchannel.chan) in ath9k_calculate_summary_state()
1202 memcpy(common->macaddr, iter_data.hw_macaddr, ETH_ALEN); in ath9k_calculate_summary_state()
1204 memcpy(common->bssidmask, iter_data.mask, ETH_ALEN); in ath9k_calculate_summary_state()
1209 ah->opmode = NL80211_IFTYPE_AP; in ath9k_calculate_summary_state()
1216 ah->opmode = NL80211_IFTYPE_MESH_POINT; in ath9k_calculate_summary_state()
1218 ah->opmode = NL80211_IFTYPE_OCB; in ath9k_calculate_summary_state()
1220 ah->opmode = NL80211_IFTYPE_ADHOC; in ath9k_calculate_summary_state()
1222 ah->opmode = NL80211_IFTYPE_STATION; in ath9k_calculate_summary_state()
1227 ctx->switch_after_beacon = false; in ath9k_calculate_summary_state()
1229 ah->imask |= ATH9K_INT_TSFOOR; in ath9k_calculate_summary_state()
1231 ah->imask &= ~ATH9K_INT_TSFOOR; in ath9k_calculate_summary_state()
1233 ctx->switch_after_beacon = true; in ath9k_calculate_summary_state()
1236 if (ah->opmode == NL80211_IFTYPE_STATION) { in ath9k_calculate_summary_state()
1237 bool changed = (iter_data.primary_sta != ctx->primary_sta); in ath9k_calculate_summary_state()
1244 ctx->primary_sta = iter_data.primary_sta; in ath9k_calculate_summary_state()
1246 ctx->primary_sta = NULL; in ath9k_calculate_summary_state()
1247 eth_zero_addr(common->curbssid); in ath9k_calculate_summary_state()
1248 common->curaid = 0; in ath9k_calculate_summary_state()
1249 ath9k_hw_write_associd(sc->sc_ah); in ath9k_calculate_summary_state()
1250 if (ath9k_hw_mci_is_enabled(sc->sc_ah)) in ath9k_calculate_summary_state()
1254 sc->nbcnvifs = iter_data.nbcnvifs; in ath9k_calculate_summary_state()
1259 if (ah->slottime != iter_data.slottime) { in ath9k_calculate_summary_state()
1260 ah->slottime = iter_data.slottime; in ath9k_calculate_summary_state()
1265 set_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags); in ath9k_calculate_summary_state()
1267 clear_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags); in ath9k_calculate_summary_state()
1271 common->macaddr, common->curbssid, common->bssidmask); in ath9k_calculate_summary_state()
1280 if (vif->bss_conf.txpower == INT_MIN) in ath9k_tpc_vif_iter()
1283 if (*power < vif->bss_conf.txpower) in ath9k_tpc_vif_iter()
1284 *power = vif->bss_conf.txpower; in ath9k_tpc_vif_iter()
1287 /* Called with sc->mutex held. */
1291 struct ath_hw *ah = sc->sc_ah; in ath9k_set_txpower()
1295 if (ah->tpc_enabled) { in ath9k_set_txpower()
1296 power = (vif) ? vif->bss_conf.txpower : -1; in ath9k_set_txpower()
1298 sc->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in ath9k_set_txpower()
1300 if (power == -1) in ath9k_set_txpower()
1301 power = sc->hw->conf.power_level; in ath9k_set_txpower()
1303 power = sc->hw->conf.power_level; in ath9k_set_txpower()
1305 sc->cur_chan->txpower = 2 * power; in ath9k_set_txpower()
1306 ath9k_hw_set_txpowerlimit(ah, sc->cur_chan->txpower, false); in ath9k_set_txpower()
1307 sc->cur_chan->cur_txpower = reg->max_power_level; in ath9k_set_txpower()
1320 vif->hw_queue[i] = i; in ath9k_assign_hw_queues()
1322 if (vif->type == NL80211_IFTYPE_AP || in ath9k_assign_hw_queues()
1323 vif->type == NL80211_IFTYPE_MESH_POINT) in ath9k_assign_hw_queues()
1324 vif->cab_queue = hw->queues - 2; in ath9k_assign_hw_queues()
1326 vif->cab_queue = IEEE80211_INVAL_HW_QUEUE; in ath9k_assign_hw_queues()
1332 struct ath_softc *sc = hw->priv; in ath9k_add_interface()
1333 struct ath_hw *ah = sc->sc_ah; in ath9k_add_interface()
1335 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_add_interface()
1336 struct ath_node *an = &avp->mcast_node; in ath9k_add_interface()
1338 mutex_lock(&sc->mutex); in ath9k_add_interface()
1340 if (sc->cur_chan->nvifs >= 1) { in ath9k_add_interface()
1341 mutex_unlock(&sc->mutex); in ath9k_add_interface()
1342 return -EOPNOTSUPP; in ath9k_add_interface()
1344 sc->tx99_vif = vif; in ath9k_add_interface()
1347 ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); in ath9k_add_interface()
1348 sc->cur_chan->nvifs++; in ath9k_add_interface()
1350 if (vif->type == NL80211_IFTYPE_STATION && ath9k_is_chanctx_enabled()) in ath9k_add_interface()
1351 vif->driver_flags |= IEEE80211_VIF_GET_NOA_UPDATE; in ath9k_add_interface()
1353 if (ath9k_uses_beacons(vif->type)) in ath9k_add_interface()
1356 avp->vif = vif; in ath9k_add_interface()
1358 avp->chanctx = sc->cur_chan; in ath9k_add_interface()
1359 list_add_tail(&avp->list, &avp->chanctx->vifs); in ath9k_add_interface()
1362 ath9k_calculate_summary_state(sc, avp->chanctx); in ath9k_add_interface()
1368 an->sc = sc; in ath9k_add_interface()
1369 an->sta = NULL; in ath9k_add_interface()
1370 an->vif = vif; in ath9k_add_interface()
1371 an->no_ps_filter = true; in ath9k_add_interface()
1374 mutex_unlock(&sc->mutex); in ath9k_add_interface()
1383 struct ath_softc *sc = hw->priv; in ath9k_change_interface()
1384 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_change_interface()
1385 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_change_interface()
1387 mutex_lock(&sc->mutex); in ath9k_change_interface()
1390 mutex_unlock(&sc->mutex); in ath9k_change_interface()
1391 return -EOPNOTSUPP; in ath9k_change_interface()
1396 if (ath9k_uses_beacons(vif->type)) in ath9k_change_interface()
1399 vif->type = new_type; in ath9k_change_interface()
1400 vif->p2p = p2p; in ath9k_change_interface()
1402 if (ath9k_uses_beacons(vif->type)) in ath9k_change_interface()
1406 ath9k_calculate_summary_state(sc, avp->chanctx); in ath9k_change_interface()
1410 mutex_unlock(&sc->mutex); in ath9k_change_interface()
1417 struct ath_softc *sc = hw->priv; in ath9k_remove_interface()
1418 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_remove_interface()
1419 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_remove_interface()
1423 mutex_lock(&sc->mutex); in ath9k_remove_interface()
1427 sc->cur_chan->nvifs--; in ath9k_remove_interface()
1428 sc->tx99_vif = NULL; in ath9k_remove_interface()
1430 list_del(&avp->list); in ath9k_remove_interface()
1432 if (ath9k_uses_beacons(vif->type)) in ath9k_remove_interface()
1435 ath_tx_node_cleanup(sc, &avp->mcast_node); in ath9k_remove_interface()
1437 ath9k_calculate_summary_state(sc, avp->chanctx); in ath9k_remove_interface()
1441 mutex_unlock(&sc->mutex); in ath9k_remove_interface()
1446 struct ath_hw *ah = sc->sc_ah; in ath9k_enable_ps()
1452 sc->ps_enabled = true; in ath9k_enable_ps()
1453 if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { in ath9k_enable_ps()
1454 if ((ah->imask & ATH9K_INT_TIM_TIMER) == 0) { in ath9k_enable_ps()
1455 ah->imask |= ATH9K_INT_TIM_TIMER; in ath9k_enable_ps()
1465 struct ath_hw *ah = sc->sc_ah; in ath9k_disable_ps()
1471 sc->ps_enabled = false; in ath9k_disable_ps()
1473 if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { in ath9k_disable_ps()
1475 sc->ps_flags &= ~(PS_WAIT_FOR_BEACON | in ath9k_disable_ps()
1479 if (ah->imask & ATH9K_INT_TIM_TIMER) { in ath9k_disable_ps()
1480 ah->imask &= ~ATH9K_INT_TIM_TIMER; in ath9k_disable_ps()
1489 struct ath_softc *sc = hw->priv; in ath9k_config()
1490 struct ath_hw *ah = sc->sc_ah; in ath9k_config()
1492 struct ieee80211_conf *conf = &hw->conf; in ath9k_config()
1493 struct ath_chanctx *ctx = sc->cur_chan; in ath9k_config()
1496 mutex_lock(&sc->mutex); in ath9k_config()
1499 sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); in ath9k_config()
1500 if (sc->ps_idle) { in ath9k_config()
1509 ath_chanctx_set_channel(sc, ctx, &ctx->chandef); in ath9k_config()
1521 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath9k_config()
1522 if (conf->flags & IEEE80211_CONF_PS) in ath9k_config()
1526 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath9k_config()
1530 if (conf->flags & IEEE80211_CONF_MONITOR) { in ath9k_config()
1532 sc->sc_ah->is_monitoring = true; in ath9k_config()
1535 sc->sc_ah->is_monitoring = false; in ath9k_config()
1540 ctx->offchannel = !!(conf->flags & IEEE80211_CONF_OFFCHANNEL); in ath9k_config()
1541 ath_chanctx_set_channel(sc, ctx, &hw->conf.chandef); in ath9k_config()
1547 mutex_unlock(&sc->mutex); in ath9k_config()
1563 /* FIXME: sc->sc_full_reset ? */
1569 struct ath_softc *sc = hw->priv; in ath9k_configure_filter()
1575 spin_lock_bh(&sc->chan_lock); in ath9k_configure_filter()
1577 ctx->rxfilter = *total_flags; in ath9k_configure_filter()
1579 sc->offchannel.chan.rxfilter = *total_flags; in ath9k_configure_filter()
1581 spin_unlock_bh(&sc->chan_lock); in ath9k_configure_filter()
1585 ath9k_hw_setrxfilter(sc->sc_ah, rfilt); in ath9k_configure_filter()
1588 ath_dbg(ath9k_hw_common(sc->sc_ah), CONFIG, "Set HW RX filter: 0x%x\n", in ath9k_configure_filter()
1596 struct ath_softc *sc = hw->priv; in ath9k_sta_add()
1597 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_sta_add()
1598 struct ath_node *an = (struct ath_node *) sta->drv_priv; in ath9k_sta_add()
1604 if (vif->type != NL80211_IFTYPE_AP && in ath9k_sta_add()
1605 vif->type != NL80211_IFTYPE_AP_VLAN) in ath9k_sta_add()
1610 an->ps_key = key; in ath9k_sta_add()
1611 an->key_idx[0] = key; in ath9k_sta_add()
1621 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_del_ps_key()
1622 struct ath_node *an = (struct ath_node *) sta->drv_priv; in ath9k_del_ps_key()
1624 if (!an->ps_key) in ath9k_del_ps_key()
1627 ath_key_delete(common, an->ps_key); in ath9k_del_ps_key()
1628 an->ps_key = 0; in ath9k_del_ps_key()
1629 an->key_idx[0] = 0; in ath9k_del_ps_key()
1636 struct ath_softc *sc = hw->priv; in ath9k_sta_remove()
1650 struct ath_softc *sc = hw->priv; in ath9k_sta_state()
1651 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_sta_state()
1658 "Add station: %pM\n", sta->addr); in ath9k_sta_state()
1663 "Remove station: %pM\n", sta->addr); in ath9k_sta_state()
1667 if (vif->type == NL80211_IFTYPE_STATION) { in ath9k_sta_state()
1684 for (i = 0; i < ARRAY_SIZE(an->key_idx); i++) { in ath9k_sta_set_tx_filter()
1685 if (!an->key_idx[i]) in ath9k_sta_set_tx_filter()
1687 ath9k_hw_set_tx_filter(ah, an->key_idx[i], set); in ath9k_sta_set_tx_filter()
1696 struct ath_softc *sc = hw->priv; in ath9k_sta_notify()
1697 struct ath_node *an = (struct ath_node *) sta->drv_priv; in ath9k_sta_notify()
1701 an->sleeping = true; in ath9k_sta_notify()
1703 ath9k_sta_set_tx_filter(sc->sc_ah, an, true); in ath9k_sta_notify()
1706 ath9k_sta_set_tx_filter(sc->sc_ah, an, false); in ath9k_sta_notify()
1707 an->sleeping = false; in ath9k_sta_notify()
1718 struct ath_softc *sc = hw->priv; in ath9k_conf_tx()
1719 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_conf_tx()
1727 txq = sc->tx.txq_map[queue]; in ath9k_conf_tx()
1730 mutex_lock(&sc->mutex); in ath9k_conf_tx()
1734 qi.tqi_aifs = params->aifs; in ath9k_conf_tx()
1735 qi.tqi_cwmin = params->cw_min; in ath9k_conf_tx()
1736 qi.tqi_cwmax = params->cw_max; in ath9k_conf_tx()
1737 qi.tqi_burstTime = params->txop * 32; in ath9k_conf_tx()
1741 queue, txq->axq_qnum, params->aifs, params->cw_min, in ath9k_conf_tx()
1742 params->cw_max, params->txop); in ath9k_conf_tx()
1745 ret = ath_txq_update(sc, txq->axq_qnum, &qi); in ath9k_conf_tx()
1749 mutex_unlock(&sc->mutex); in ath9k_conf_tx()
1761 struct ath_softc *sc = hw->priv; in ath9k_set_key()
1762 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_set_key()
1767 return -ENOSPC; in ath9k_set_key()
1769 if ((vif->type == NL80211_IFTYPE_ADHOC || in ath9k_set_key()
1770 vif->type == NL80211_IFTYPE_MESH_POINT) && in ath9k_set_key()
1771 (key->cipher == WLAN_CIPHER_SUITE_TKIP || in ath9k_set_key()
1772 key->cipher == WLAN_CIPHER_SUITE_CCMP) && in ath9k_set_key()
1773 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { in ath9k_set_key()
1777 * design to support per-STA RX GTK, but until that gets in ath9k_set_key()
1781 return -EOPNOTSUPP; in ath9k_set_key()
1787 if (cmd == DISABLE_KEY && key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { in ath9k_set_key()
1793 mutex_lock(&sc->mutex); in ath9k_set_key()
1797 an = (struct ath_node *)sta->drv_priv; in ath9k_set_key()
1810 key->hw_key_idx = 0; in ath9k_set_key()
1813 key->hw_key_idx = ret; in ath9k_set_key()
1815 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; in ath9k_set_key()
1816 if (key->cipher == WLAN_CIPHER_SUITE_TKIP) in ath9k_set_key()
1817 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; in ath9k_set_key()
1818 if (sc->sc_ah->sw_mgmt_crypto_tx && in ath9k_set_key()
1819 key->cipher == WLAN_CIPHER_SUITE_CCMP) in ath9k_set_key()
1820 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; in ath9k_set_key()
1823 if (an && key->hw_key_idx) { in ath9k_set_key()
1824 for (i = 0; i < ARRAY_SIZE(an->key_idx); i++) { in ath9k_set_key()
1825 if (an->key_idx[i]) in ath9k_set_key()
1827 an->key_idx[i] = key->hw_key_idx; in ath9k_set_key()
1830 WARN_ON(i == ARRAY_SIZE(an->key_idx)); in ath9k_set_key()
1834 if (ath9k_txq_has_key(sc, key->hw_key_idx)) { in ath9k_set_key()
1838 set_bit(key->hw_key_idx, sc->sc_ah->pending_del_keymap); in ath9k_set_key()
1839 ath_hw_keysetmac(common, key->hw_key_idx, NULL); in ath9k_set_key()
1841 ath_key_delete(common, key->hw_key_idx); in ath9k_set_key()
1844 for (i = 0; i < ARRAY_SIZE(an->key_idx); i++) { in ath9k_set_key()
1845 if (an->key_idx[i] != key->hw_key_idx) in ath9k_set_key()
1847 an->key_idx[i] = 0; in ath9k_set_key()
1851 key->hw_key_idx = 0; in ath9k_set_key()
1854 ret = -EINVAL; in ath9k_set_key()
1858 mutex_unlock(&sc->mutex); in ath9k_set_key()
1873 struct ath_softc *sc = hw->priv; in ath9k_bss_info_changed()
1874 struct ath_hw *ah = sc->sc_ah; in ath9k_bss_info_changed()
1876 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_bss_info_changed()
1880 mutex_lock(&sc->mutex); in ath9k_bss_info_changed()
1884 bss_conf->bssid, vif->cfg.assoc); in ath9k_bss_info_changed()
1886 memcpy(avp->bssid, bss_conf->bssid, ETH_ALEN); in ath9k_bss_info_changed()
1887 avp->aid = vif->cfg.aid; in ath9k_bss_info_changed()
1888 avp->assoc = vif->cfg.assoc; in ath9k_bss_info_changed()
1890 ath9k_calculate_summary_state(sc, avp->chanctx); in ath9k_bss_info_changed()
1895 memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); in ath9k_bss_info_changed()
1896 common->curaid = vif->cfg.aid; in ath9k_bss_info_changed()
1897 ath9k_hw_write_associd(sc->sc_ah); in ath9k_bss_info_changed()
1903 ath9k_calculate_summary_state(sc, avp->chanctx); in ath9k_bss_info_changed()
1906 if ((avp->chanctx == sc->cur_chan) && in ath9k_bss_info_changed()
1908 if (bss_conf->use_short_slot) in ath9k_bss_info_changed()
1913 if (vif->type == NL80211_IFTYPE_AP) { in ath9k_bss_info_changed()
1919 sc->beacon.slottime = slottime; in ath9k_bss_info_changed()
1920 sc->beacon.updateslot = UPDATE; in ath9k_bss_info_changed()
1922 ah->slottime = slottime; in ath9k_bss_info_changed()
1935 vif->addr, bss_conf->txpower, bss_conf->txpower_type); in ath9k_bss_info_changed()
1939 mutex_unlock(&sc->mutex); in ath9k_bss_info_changed()
1947 struct ath_softc *sc = hw->priv; in ath9k_get_tsf()
1948 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_get_tsf()
1951 mutex_lock(&sc->mutex); in ath9k_get_tsf()
1954 if (sc->cur_chan == avp->chanctx) { in ath9k_get_tsf()
1955 tsf = ath9k_hw_gettsf64(sc->sc_ah); in ath9k_get_tsf()
1957 tsf = sc->cur_chan->tsf_val + in ath9k_get_tsf()
1958 ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL); in ath9k_get_tsf()
1960 tsf += le64_to_cpu(avp->tsf_adjust); in ath9k_get_tsf()
1962 mutex_unlock(&sc->mutex); in ath9k_get_tsf()
1971 struct ath_softc *sc = hw->priv; in ath9k_set_tsf()
1972 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_set_tsf()
1974 mutex_lock(&sc->mutex); in ath9k_set_tsf()
1976 tsf -= le64_to_cpu(avp->tsf_adjust); in ath9k_set_tsf()
1977 ktime_get_raw_ts64(&avp->chanctx->tsf_ts); in ath9k_set_tsf()
1978 if (sc->cur_chan == avp->chanctx) in ath9k_set_tsf()
1979 ath9k_hw_settsf64(sc->sc_ah, tsf); in ath9k_set_tsf()
1980 avp->chanctx->tsf_val = tsf; in ath9k_set_tsf()
1982 mutex_unlock(&sc->mutex); in ath9k_set_tsf()
1987 struct ath_softc *sc = hw->priv; in ath9k_reset_tsf()
1988 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_reset_tsf()
1990 mutex_lock(&sc->mutex); in ath9k_reset_tsf()
1993 ktime_get_raw_ts64(&avp->chanctx->tsf_ts); in ath9k_reset_tsf()
1994 if (sc->cur_chan == avp->chanctx) in ath9k_reset_tsf()
1995 ath9k_hw_reset_tsf(sc->sc_ah); in ath9k_reset_tsf()
1996 avp->chanctx->tsf_val = 0; in ath9k_reset_tsf()
1999 mutex_unlock(&sc->mutex); in ath9k_reset_tsf()
2006 struct ath_softc *sc = hw->priv; in ath9k_ampdu_action()
2007 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_ampdu_action()
2010 struct ieee80211_sta *sta = params->sta; in ath9k_ampdu_action()
2011 struct ath_node *an = (struct ath_node *)sta->drv_priv; in ath9k_ampdu_action()
2012 enum ieee80211_ampdu_mlme_action action = params->action; in ath9k_ampdu_action()
2013 u16 tid = params->tid; in ath9k_ampdu_action()
2014 u16 *ssn = &params->ssn; in ath9k_ampdu_action()
2017 mutex_lock(&sc->mutex); in ath9k_ampdu_action()
2026 if (test_bit(ATH_OP_SCANNING, &common->op_flags)) { in ath9k_ampdu_action()
2027 ret = -EBUSY; in ath9k_ampdu_action()
2045 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); in ath9k_ampdu_action()
2050 atid->baw_size = IEEE80211_MIN_AMPDU_BUF << in ath9k_ampdu_action()
2051 sta->deflink.ht_cap.ampdu_factor; in ath9k_ampdu_action()
2054 ath_err(ath9k_hw_common(sc->sc_ah), "Unknown AMPDU action\n"); in ath9k_ampdu_action()
2057 mutex_unlock(&sc->mutex); in ath9k_ampdu_action()
2065 struct ath_softc *sc = hw->priv; in ath9k_get_survey()
2066 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_get_survey()
2073 return -EOPNOTSUPP; in ath9k_get_survey()
2075 spin_lock_irqsave(&common->cc_lock, flags); in ath9k_get_survey()
2079 sband = hw->wiphy->bands[NL80211_BAND_2GHZ]; in ath9k_get_survey()
2080 if (sband && idx >= sband->n_channels) { in ath9k_get_survey()
2081 idx -= sband->n_channels; in ath9k_get_survey()
2086 sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; in ath9k_get_survey()
2088 if (!sband || idx >= sband->n_channels) { in ath9k_get_survey()
2089 spin_unlock_irqrestore(&common->cc_lock, flags); in ath9k_get_survey()
2090 return -ENOENT; in ath9k_get_survey()
2093 chan = &sband->channels[idx]; in ath9k_get_survey()
2094 pos = chan->hw_value; in ath9k_get_survey()
2095 memcpy(survey, &sc->survey[pos], sizeof(*survey)); in ath9k_get_survey()
2096 survey->channel = chan; in ath9k_get_survey()
2097 spin_unlock_irqrestore(&common->cc_lock, flags); in ath9k_get_survey()
2106 struct ath_hw *ah = sc->sc_ah; in ath9k_enable_dynack()
2110 ah->dynack.enabled = true; in ath9k_enable_dynack()
2119 struct ath_softc *sc = hw->priv; in ath9k_set_coverage_class()
2120 struct ath_hw *ah = sc->sc_ah; in ath9k_set_coverage_class()
2125 mutex_lock(&sc->mutex); in ath9k_set_coverage_class()
2128 ah->coverage_class = coverage_class; in ath9k_set_coverage_class()
2129 if (ah->dynack.enabled) { in ath9k_set_coverage_class()
2132 ah->dynack.enabled = false; in ath9k_set_coverage_class()
2139 } else if (!ah->dynack.enabled) { in ath9k_set_coverage_class()
2143 mutex_unlock(&sc->mutex); in ath9k_set_coverage_class()
2155 npend = ath9k_has_pending_frames(sc, &sc->tx.txq[i], in ath9k_has_tx_pending()
2167 struct ath_softc *sc = hw->priv; in ath9k_flush()
2168 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_flush()
2171 if (!test_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags)) in ath9k_flush()
2178 * sc->mutex lock to allow the channel scheduler in ath9k_flush()
2179 * to switch channel contexts. in ath9k_flush()
2188 mutex_lock(&sc->mutex); in ath9k_flush()
2190 mutex_unlock(&sc->mutex); in ath9k_flush()
2196 struct ath_softc *sc = hw->priv; in __ath9k_flush()
2197 struct ath_hw *ah = sc->sc_ah; in __ath9k_flush()
2202 cancel_delayed_work_sync(&sc->hw_check_work); in __ath9k_flush()
2204 if (ah->ah_flags & AH_UNPLUGGED) { in __ath9k_flush()
2209 if (test_bit(ATH_OP_INVALID, &common->op_flags)) { in __ath9k_flush()
2214 spin_lock_bh(&sc->chan_lock); in __ath9k_flush()
2218 timeout = sc->cur_chan->flush_timeout; in __ath9k_flush()
2219 spin_unlock_bh(&sc->chan_lock); in __ath9k_flush()
2224 if (wait_event_timeout(sc->tx_wait, !ath9k_has_tx_pending(sc, sw_pending), in __ath9k_flush()
2230 spin_lock_bh(&sc->sc_pcu_lock); in __ath9k_flush()
2232 spin_unlock_bh(&sc->sc_pcu_lock); in __ath9k_flush()
2240 ieee80211_queue_delayed_work(hw, &sc->hw_check_work, in __ath9k_flush()
2246 struct ath_softc *sc = hw->priv; in ath9k_tx_frames_pending()
2253 struct ath_softc *sc = hw->priv; in ath9k_tx_last_beacon()
2254 struct ath_hw *ah = sc->sc_ah; in ath9k_tx_last_beacon()
2259 bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); in ath9k_tx_last_beacon()
2262 vif = sc->beacon.bslot[0]; in ath9k_tx_last_beacon()
2266 if (!vif->bss_conf.enable_beacon) in ath9k_tx_last_beacon()
2269 avp = (void *)vif->drv_priv; in ath9k_tx_last_beacon()
2271 if (!sc->beacon.tx_processed && !edma) { in ath9k_tx_last_beacon()
2272 tasklet_disable(&sc->bcon_tasklet); in ath9k_tx_last_beacon()
2274 bf = avp->av_bcbuf; in ath9k_tx_last_beacon()
2275 if (!bf || !bf->bf_mpdu) in ath9k_tx_last_beacon()
2278 status = ath9k_hw_txprocdesc(ah, bf->bf_desc, &ts); in ath9k_tx_last_beacon()
2279 if (status == -EINPROGRESS) in ath9k_tx_last_beacon()
2282 sc->beacon.tx_processed = true; in ath9k_tx_last_beacon()
2283 sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK); in ath9k_tx_last_beacon()
2286 tasklet_enable(&sc->bcon_tasklet); in ath9k_tx_last_beacon()
2289 return sc->beacon.tx_last; in ath9k_tx_last_beacon()
2295 struct ath_softc *sc = hw->priv; in ath9k_get_stats()
2296 struct ath_hw *ah = sc->sc_ah; in ath9k_get_stats()
2297 struct ath9k_mib_stats *mib_stats = &ah->ah_mibStats; in ath9k_get_stats()
2299 stats->dot11ACKFailureCount = mib_stats->ackrcv_bad; in ath9k_get_stats()
2300 stats->dot11RTSFailureCount = mib_stats->rts_bad; in ath9k_get_stats()
2301 stats->dot11FCSErrorCount = mib_stats->fcs_bad; in ath9k_get_stats()
2302 stats->dot11RTSSuccessCount = mib_stats->rts_good; in ath9k_get_stats()
2335 return (ah->caps.rx_chainmask == 1); in validate_antenna_mask()
2343 struct ath_softc *sc = hw->priv; in ath9k_set_antenna()
2344 struct ath_hw *ah = sc->sc_ah; in ath9k_set_antenna()
2346 if (ah->caps.rx_chainmask != 1) in ath9k_set_antenna()
2350 return -EINVAL; in ath9k_set_antenna()
2352 sc->ant_rx = rx_ant; in ath9k_set_antenna()
2353 sc->ant_tx = tx_ant; in ath9k_set_antenna()
2355 if (ah->caps.rx_chainmask == 1) in ath9k_set_antenna()
2360 ah->rxchainmask = 0x7; in ath9k_set_antenna()
2362 ah->rxchainmask = fill_chainmask(ah->caps.rx_chainmask, rx_ant); in ath9k_set_antenna()
2364 ah->txchainmask = fill_chainmask(ah->caps.tx_chainmask, tx_ant); in ath9k_set_antenna()
2372 struct ath_softc *sc = hw->priv; in ath9k_get_antenna()
2374 *tx_ant = sc->ant_tx; in ath9k_get_antenna()
2375 *rx_ant = sc->ant_rx; in ath9k_get_antenna()
2383 struct ath_softc *sc = hw->priv; in ath9k_sw_scan_start()
2384 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_sw_scan_start()
2385 struct cfg80211_chan_def *chandef = &sc->cur_chan->chandef; in ath9k_sw_scan_start()
2386 struct ieee80211_channel *chan = chandef->chan; in ath9k_sw_scan_start()
2387 int pos = chan->hw_value; in ath9k_sw_scan_start()
2388 set_bit(ATH_OP_SCANNING, &common->op_flags); in ath9k_sw_scan_start()
2391 if (!sc->cur_chan->offchannel) { in ath9k_sw_scan_start()
2392 if (sc->cur_survey != &sc->survey[pos]) { in ath9k_sw_scan_start()
2393 if (sc->cur_survey) in ath9k_sw_scan_start()
2394 sc->cur_survey->filled &= ~SURVEY_INFO_IN_USE; in ath9k_sw_scan_start()
2395 sc->cur_survey = &sc->survey[pos]; in ath9k_sw_scan_start()
2398 memset(sc->cur_survey, 0, sizeof(struct survey_info)); in ath9k_sw_scan_start()
2399 sc->cur_survey->filled |= SURVEY_INFO_IN_USE; in ath9k_sw_scan_start()
2406 struct ath_softc *sc = hw->priv; in ath9k_sw_scan_complete()
2407 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_sw_scan_complete()
2408 clear_bit(ATH_OP_SCANNING, &common->op_flags); in ath9k_sw_scan_complete()
2415 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_cancel_pending_offchannel()
2417 if (sc->offchannel.roc_vif) { in ath9k_cancel_pending_offchannel()
2421 del_timer_sync(&sc->offchannel.timer); in ath9k_cancel_pending_offchannel()
2422 if (sc->offchannel.state >= ATH_OFFCHANNEL_ROC_START) in ath9k_cancel_pending_offchannel()
2426 if (test_bit(ATH_OP_SCANNING, &common->op_flags)) { in ath9k_cancel_pending_offchannel()
2430 del_timer_sync(&sc->offchannel.timer); in ath9k_cancel_pending_offchannel()
2438 struct cfg80211_scan_request *req = &hw_req->req; in ath9k_hw_scan()
2439 struct ath_softc *sc = hw->priv; in ath9k_hw_scan()
2440 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_hw_scan()
2443 mutex_lock(&sc->mutex); in ath9k_hw_scan()
2445 if (WARN_ON(sc->offchannel.scan_req)) { in ath9k_hw_scan()
2446 ret = -EBUSY; in ath9k_hw_scan()
2451 set_bit(ATH_OP_SCANNING, &common->op_flags); in ath9k_hw_scan()
2452 sc->offchannel.scan_vif = vif; in ath9k_hw_scan()
2453 sc->offchannel.scan_req = req; in ath9k_hw_scan()
2454 sc->offchannel.scan_idx = 0; in ath9k_hw_scan()
2457 vif->addr); in ath9k_hw_scan()
2459 if (sc->offchannel.state == ATH_OFFCHANNEL_IDLE) { in ath9k_hw_scan()
2465 mutex_unlock(&sc->mutex); in ath9k_hw_scan()
2473 struct ath_softc *sc = hw->priv; in ath9k_cancel_hw_scan()
2474 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_cancel_hw_scan()
2476 ath_dbg(common, CHAN_CTX, "Cancel HW scan on vif: %pM\n", vif->addr); in ath9k_cancel_hw_scan()
2478 mutex_lock(&sc->mutex); in ath9k_cancel_hw_scan()
2479 del_timer_sync(&sc->offchannel.timer); in ath9k_cancel_hw_scan()
2481 mutex_unlock(&sc->mutex); in ath9k_cancel_hw_scan()
2489 struct ath_softc *sc = hw->priv; in ath9k_remain_on_channel()
2490 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_remain_on_channel()
2493 mutex_lock(&sc->mutex); in ath9k_remain_on_channel()
2495 if (WARN_ON(sc->offchannel.roc_vif)) { in ath9k_remain_on_channel()
2496 ret = -EBUSY; in ath9k_remain_on_channel()
2501 sc->offchannel.roc_vif = vif; in ath9k_remain_on_channel()
2502 sc->offchannel.roc_chan = chan; in ath9k_remain_on_channel()
2503 sc->offchannel.roc_duration = duration; in ath9k_remain_on_channel()
2507 vif->addr, type, duration); in ath9k_remain_on_channel()
2509 if (sc->offchannel.state == ATH_OFFCHANNEL_IDLE) { in ath9k_remain_on_channel()
2515 mutex_unlock(&sc->mutex); in ath9k_remain_on_channel()
2523 struct ath_softc *sc = hw->priv; in ath9k_cancel_remain_on_channel()
2524 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_cancel_remain_on_channel()
2526 mutex_lock(&sc->mutex); in ath9k_cancel_remain_on_channel()
2529 del_timer_sync(&sc->offchannel.timer); in ath9k_cancel_remain_on_channel()
2531 if (sc->offchannel.roc_vif) { in ath9k_cancel_remain_on_channel()
2532 if (sc->offchannel.state >= ATH_OFFCHANNEL_ROC_START) in ath9k_cancel_remain_on_channel()
2536 mutex_unlock(&sc->mutex); in ath9k_cancel_remain_on_channel()
2544 struct ath_softc *sc = hw->priv; in ath9k_add_chanctx()
2545 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_add_chanctx()
2549 mutex_lock(&sc->mutex); in ath9k_add_chanctx()
2552 if (ctx->assigned) in ath9k_add_chanctx()
2555 ptr = (void *) conf->drv_priv; in ath9k_add_chanctx()
2557 ctx->assigned = true; in ath9k_add_chanctx()
2558 pos = ctx - &sc->chanctx[0]; in ath9k_add_chanctx()
2559 ctx->hw_queue_base = pos * IEEE80211_NUM_ACS; in ath9k_add_chanctx()
2562 "Add channel context: %d MHz\n", in ath9k_add_chanctx()
2563 conf->def.chan->center_freq); in ath9k_add_chanctx()
2565 ath_chanctx_set_channel(sc, ctx, &conf->def); in ath9k_add_chanctx()
2567 mutex_unlock(&sc->mutex); in ath9k_add_chanctx()
2571 mutex_unlock(&sc->mutex); in ath9k_add_chanctx()
2572 return -ENOSPC; in ath9k_add_chanctx()
2579 struct ath_softc *sc = hw->priv; in ath9k_remove_chanctx()
2580 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_remove_chanctx()
2583 mutex_lock(&sc->mutex); in ath9k_remove_chanctx()
2586 "Remove channel context: %d MHz\n", in ath9k_remove_chanctx()
2587 conf->def.chan->center_freq); in ath9k_remove_chanctx()
2589 ctx->assigned = false; in ath9k_remove_chanctx()
2590 ctx->hw_queue_base = 0; in ath9k_remove_chanctx()
2593 mutex_unlock(&sc->mutex); in ath9k_remove_chanctx()
2600 struct ath_softc *sc = hw->priv; in ath9k_change_chanctx()
2601 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_change_chanctx()
2604 mutex_lock(&sc->mutex); in ath9k_change_chanctx()
2606 "Change channel context: %d MHz\n", in ath9k_change_chanctx()
2607 conf->def.chan->center_freq); in ath9k_change_chanctx()
2608 ath_chanctx_set_channel(sc, ctx, &conf->def); in ath9k_change_chanctx()
2609 mutex_unlock(&sc->mutex); in ath9k_change_chanctx()
2617 struct ath_softc *sc = hw->priv; in ath9k_assign_vif_chanctx()
2618 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_assign_vif_chanctx()
2619 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_assign_vif_chanctx()
2625 mutex_lock(&sc->mutex); in ath9k_assign_vif_chanctx()
2628 "Assign VIF (addr: %pM, type: %d, p2p: %d) to channel context: %d MHz\n", in ath9k_assign_vif_chanctx()
2629 vif->addr, vif->type, vif->p2p, in ath9k_assign_vif_chanctx()
2630 conf->def.chan->center_freq); in ath9k_assign_vif_chanctx()
2632 avp->chanctx = ctx; in ath9k_assign_vif_chanctx()
2633 ctx->nvifs_assigned++; in ath9k_assign_vif_chanctx()
2634 list_add_tail(&avp->list, &ctx->vifs); in ath9k_assign_vif_chanctx()
2637 vif->hw_queue[i] = ctx->hw_queue_base + i; in ath9k_assign_vif_chanctx()
2639 mutex_unlock(&sc->mutex); in ath9k_assign_vif_chanctx()
2649 struct ath_softc *sc = hw->priv; in ath9k_unassign_vif_chanctx()
2650 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_unassign_vif_chanctx()
2651 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_unassign_vif_chanctx()
2657 mutex_lock(&sc->mutex); in ath9k_unassign_vif_chanctx()
2660 "Remove VIF (addr: %pM, type: %d, p2p: %d) from channel context: %d MHz\n", in ath9k_unassign_vif_chanctx()
2661 vif->addr, vif->type, vif->p2p, in ath9k_unassign_vif_chanctx()
2662 conf->def.chan->center_freq); in ath9k_unassign_vif_chanctx()
2664 avp->chanctx = NULL; in ath9k_unassign_vif_chanctx()
2665 ctx->nvifs_assigned--; in ath9k_unassign_vif_chanctx()
2666 list_del(&avp->list); in ath9k_unassign_vif_chanctx()
2669 vif->hw_queue[ac] = IEEE80211_INVAL_HW_QUEUE; in ath9k_unassign_vif_chanctx()
2671 mutex_unlock(&sc->mutex); in ath9k_unassign_vif_chanctx()
2678 struct ath_softc *sc = hw->priv; in ath9k_mgd_prepare_tx()
2679 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_mgd_prepare_tx()
2680 struct ath_vif *avp = (struct ath_vif *) vif->drv_priv; in ath9k_mgd_prepare_tx()
2687 if (!test_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags)) in ath9k_mgd_prepare_tx()
2690 if (!avp->chanctx) in ath9k_mgd_prepare_tx()
2693 mutex_lock(&sc->mutex); in ath9k_mgd_prepare_tx()
2695 spin_lock_bh(&sc->chan_lock); in ath9k_mgd_prepare_tx()
2696 if (sc->next_chan || (sc->cur_chan != avp->chanctx)) in ath9k_mgd_prepare_tx()
2698 spin_unlock_bh(&sc->chan_lock); in ath9k_mgd_prepare_tx()
2712 spin_lock_bh(&sc->chan_lock); in ath9k_mgd_prepare_tx()
2713 sc->sched.mgd_prepare_tx = true; in ath9k_mgd_prepare_tx()
2714 cur_conf = &go_ctx->beacon; in ath9k_mgd_prepare_tx()
2715 beacon_int = TU_TO_USEC(cur_conf->beacon_interval); in ath9k_mgd_prepare_tx()
2716 spin_unlock_bh(&sc->chan_lock); in ath9k_mgd_prepare_tx()
2719 init_completion(&sc->go_beacon); in ath9k_mgd_prepare_tx()
2721 mutex_unlock(&sc->mutex); in ath9k_mgd_prepare_tx()
2723 if (wait_for_completion_timeout(&sc->go_beacon, in ath9k_mgd_prepare_tx()
2728 spin_lock_bh(&sc->chan_lock); in ath9k_mgd_prepare_tx()
2729 sc->sched.mgd_prepare_tx = false; in ath9k_mgd_prepare_tx()
2730 spin_unlock_bh(&sc->chan_lock); in ath9k_mgd_prepare_tx()
2733 mutex_lock(&sc->mutex); in ath9k_mgd_prepare_tx()
2738 __func__, vif->addr); in ath9k_mgd_prepare_tx()
2740 spin_lock_bh(&sc->chan_lock); in ath9k_mgd_prepare_tx()
2741 sc->next_chan = avp->chanctx; in ath9k_mgd_prepare_tx()
2742 sc->sched.state = ATH_CHANCTX_STATE_FORCE_ACTIVE; in ath9k_mgd_prepare_tx()
2743 spin_unlock_bh(&sc->chan_lock); in ath9k_mgd_prepare_tx()
2747 mutex_unlock(&sc->mutex); in ath9k_mgd_prepare_tx()
2772 struct ath_softc *sc = hw->priv; in ath9k_get_txpower()
2773 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_get_txpower()
2775 mutex_lock(&sc->mutex); in ath9k_get_txpower()
2776 if (avp->chanctx) in ath9k_get_txpower()
2777 *dbm = avp->chanctx->cur_txpower; in ath9k_get_txpower()
2779 *dbm = sc->cur_chan->cur_txpower; in ath9k_get_txpower()
2780 mutex_unlock(&sc->mutex); in ath9k_get_txpower()