Lines Matching +full:re +full:- +full:clocked
2 * Copyright (c) 2008-2011 Atheros Communications Inc.
17 #include <linux/dma-mapping.h>
24 sc->beacon.tx_processed = false; in ath9k_reset_beacon_status()
25 sc->beacon.tx_last = false; in ath9k_reset_beacon_status()
35 struct ath_hw *ah = sc->sc_ah; in ath9k_beaconq_config()
40 ath9k_hw_get_txq_props(ah, sc->beacon.beaconq, &qi); in ath9k_beaconq_config()
42 if (sc->sc_ah->opmode == NL80211_IFTYPE_AP || in ath9k_beaconq_config()
43 sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) { in ath9k_beaconq_config()
50 txq = sc->tx.txq_map[IEEE80211_AC_BE]; in ath9k_beaconq_config()
51 ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be); in ath9k_beaconq_config()
53 if (ah->slottime == 20) in ath9k_beaconq_config()
60 if (!ath9k_hw_set_txq_props(ah, sc->beacon.beaconq, &qi)) { in ath9k_beaconq_config()
63 ath9k_hw_resettxqueue(ah, sc->beacon.beaconq); in ath9k_beaconq_config()
75 struct sk_buff *skb = bf->bf_mpdu; in ath9k_beacon_setup()
76 struct ath_hw *ah = sc->sc_ah; in ath9k_beacon_setup()
80 u8 chainmask = ah->txchainmask; in ath9k_beacon_setup()
83 sband = &common->sbands[sc->cur_chandef.chan->band]; in ath9k_beacon_setup()
84 rate = sband->bitrates[rateidx].hw_value; in ath9k_beacon_setup()
85 if (vif->bss_conf.use_short_preamble) in ath9k_beacon_setup()
86 rate |= sband->bitrates[rateidx].hw_value_short; in ath9k_beacon_setup()
89 info.pkt_len = skb->len + FCS_LEN; in ath9k_beacon_setup()
97 info.buf_addr[0] = bf->bf_buf_addr; in ath9k_beacon_setup()
98 info.buf_len[0] = roundup(skb->len, 4); in ath9k_beacon_setup()
103 info.qcu = sc->beacon.beaconq; in ath9k_beacon_setup()
109 ath9k_hw_set_txdesc(ah, bf->bf_desc, &info); in ath9k_beacon_setup()
115 struct ath_softc *sc = hw->priv; in ath9k_beacon_generate()
116 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_beacon_generate()
118 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_beacon_generate()
120 struct ath_txq *cabq = sc->beacon.cabq; in ath9k_beacon_generate()
125 if (avp->av_bcbuf == NULL) in ath9k_beacon_generate()
128 bf = avp->av_bcbuf; in ath9k_beacon_generate()
129 skb = bf->bf_mpdu; in ath9k_beacon_generate()
131 dma_unmap_single(sc->dev, bf->bf_buf_addr, in ath9k_beacon_generate()
132 skb->len, DMA_TO_DEVICE); in ath9k_beacon_generate()
134 bf->bf_buf_addr = 0; in ath9k_beacon_generate()
135 bf->bf_mpdu = NULL; in ath9k_beacon_generate()
142 bf->bf_mpdu = skb; in ath9k_beacon_generate()
144 mgmt_hdr = (struct ieee80211_mgmt *)skb->data; in ath9k_beacon_generate()
145 mgmt_hdr->u.beacon.timestamp = avp->tsf_adjust; in ath9k_beacon_generate()
155 bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, in ath9k_beacon_generate()
156 skb->len, DMA_TO_DEVICE); in ath9k_beacon_generate()
157 if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) { in ath9k_beacon_generate()
159 bf->bf_mpdu = NULL; in ath9k_beacon_generate()
160 bf->bf_buf_addr = 0; in ath9k_beacon_generate()
175 spin_lock_bh(&cabq->axq_lock); in ath9k_beacon_generate()
176 cabq_depth = cabq->axq_depth; in ath9k_beacon_generate()
177 spin_unlock_bh(&cabq->axq_lock); in ath9k_beacon_generate()
180 if (sc->cur_chan->nvifs > 1) { in ath9k_beacon_generate()
187 ath9k_beacon_setup(sc, vif, bf, info->control.rates[0].idx); in ath9k_beacon_generate()
197 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_beacon_assign_slot()
198 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_beacon_assign_slot()
201 avp->av_bcbuf = list_first_entry(&sc->beacon.bbuf, struct ath_buf, list); in ath9k_beacon_assign_slot()
202 list_del(&avp->av_bcbuf->list); in ath9k_beacon_assign_slot()
205 if (sc->beacon.bslot[slot] == NULL) { in ath9k_beacon_assign_slot()
206 avp->av_bslot = slot; in ath9k_beacon_assign_slot()
211 sc->beacon.bslot[avp->av_bslot] = vif; in ath9k_beacon_assign_slot()
214 avp->av_bslot); in ath9k_beacon_assign_slot()
219 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_beacon_remove_slot()
220 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_beacon_remove_slot()
221 struct ath_buf *bf = avp->av_bcbuf; in ath9k_beacon_remove_slot()
224 avp->av_bslot); in ath9k_beacon_remove_slot()
226 tasklet_disable(&sc->bcon_tasklet); in ath9k_beacon_remove_slot()
228 if (bf && bf->bf_mpdu) { in ath9k_beacon_remove_slot()
229 struct sk_buff *skb = bf->bf_mpdu; in ath9k_beacon_remove_slot()
230 dma_unmap_single(sc->dev, bf->bf_buf_addr, in ath9k_beacon_remove_slot()
231 skb->len, DMA_TO_DEVICE); in ath9k_beacon_remove_slot()
233 bf->bf_mpdu = NULL; in ath9k_beacon_remove_slot()
234 bf->bf_buf_addr = 0; in ath9k_beacon_remove_slot()
237 avp->av_bcbuf = NULL; in ath9k_beacon_remove_slot()
238 sc->beacon.bslot[avp->av_bslot] = NULL; in ath9k_beacon_remove_slot()
239 list_add_tail(&bf->list, &sc->beacon.bbuf); in ath9k_beacon_remove_slot()
241 tasklet_enable(&sc->bcon_tasklet); in ath9k_beacon_remove_slot()
246 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_beacon_ensure_primary_slot()
254 tasklet_disable_in_atomic(&sc->bcon_tasklet); in ath9k_beacon_ensure_primary_slot()
258 if (sc->beacon.bslot[slot]) { in ath9k_beacon_ensure_primary_slot()
266 /* Re-enumarate all slots, moving them forward. */ in ath9k_beacon_ensure_primary_slot()
269 vif = sc->beacon.bslot[slot + first_slot]; in ath9k_beacon_ensure_primary_slot()
270 sc->beacon.bslot[slot] = vif; in ath9k_beacon_ensure_primary_slot()
273 avp = (void *)vif->drv_priv; in ath9k_beacon_ensure_primary_slot()
274 avp->av_bslot = slot; in ath9k_beacon_ensure_primary_slot()
277 sc->beacon.bslot[slot] = NULL; in ath9k_beacon_ensure_primary_slot()
281 vif = sc->beacon.bslot[0]; in ath9k_beacon_ensure_primary_slot()
286 avp = (void *)vif->drv_priv; in ath9k_beacon_ensure_primary_slot()
287 tsfadjust = le64_to_cpu(avp->tsf_adjust); in ath9k_beacon_ensure_primary_slot()
294 avp->chanctx->tsf_val += tsfadjust; in ath9k_beacon_ensure_primary_slot()
295 if (sc->cur_chan == avp->chanctx) { in ath9k_beacon_ensure_primary_slot()
296 offset = ath9k_hw_get_tsf_offset(&avp->chanctx->tsf_ts, NULL); in ath9k_beacon_ensure_primary_slot()
297 ath9k_hw_settsf64(sc->sc_ah, avp->chanctx->tsf_val + offset); in ath9k_beacon_ensure_primary_slot()
303 tasklet_enable(&sc->bcon_tasklet); in ath9k_beacon_ensure_primary_slot()
308 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_beacon_choose_slot()
309 struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon; in ath9k_beacon_choose_slot()
315 if (sc->sc_ah->opmode != NL80211_IFTYPE_AP && in ath9k_beacon_choose_slot()
316 sc->sc_ah->opmode != NL80211_IFTYPE_MESH_POINT) { in ath9k_beacon_choose_slot()
318 ath9k_hw_gettsf64(sc->sc_ah)); in ath9k_beacon_choose_slot()
322 intval = cur_conf->beacon_interval ? : ATH_DEFAULT_BINTVAL; in ath9k_beacon_choose_slot()
323 tsf = ath9k_hw_gettsf64(sc->sc_ah); in ath9k_beacon_choose_slot()
324 tsf += TU_TO_USEC(sc->sc_ah->config.sw_beacon_response_time); in ath9k_beacon_choose_slot()
337 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_set_tsfadjust()
344 if (!sc->beacon.bslot[slot]) in ath9k_set_tsfadjust()
347 avp = (void *)sc->beacon.bslot[slot]->drv_priv; in ath9k_set_tsfadjust()
354 tsfadjust = cur_conf->beacon_interval * avp->av_bslot; in ath9k_set_tsfadjust()
355 tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF; in ath9k_set_tsfadjust()
356 avp->tsf_adjust = cpu_to_le64(tsfadjust); in ath9k_set_tsfadjust()
359 (signed long long)tsfadjust, avp->av_bslot); in ath9k_set_tsfadjust()
365 if (!vif || !vif->bss_conf.csa_active) in ath9k_csa_is_finished()
383 ieee80211_iterate_active_interfaces_atomic(sc->hw, in ath9k_csa_update()
391 struct ath_hw *ah = sc->sc_ah; in ath9k_beacon_tasklet()
395 bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); in ath9k_beacon_tasklet()
398 if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) { in ath9k_beacon_tasklet()
411 if (ath9k_hw_numtxpending(ah, sc->beacon.beaconq) != 0) { in ath9k_beacon_tasklet()
412 sc->beacon.bmisscnt++; in ath9k_beacon_tasklet()
425 if (sc->beacon.bmisscnt < BSTUCK_THRESH * sc->nbcnvifs) { in ath9k_beacon_tasklet()
428 sc->beacon.bmisscnt); in ath9k_beacon_tasklet()
429 ath9k_hw_stop_dma_queue(ah, sc->beacon.beaconq); in ath9k_beacon_tasklet()
430 if (sc->beacon.bmisscnt > 3) in ath9k_beacon_tasklet()
432 } else if (sc->beacon.bmisscnt >= BSTUCK_THRESH) { in ath9k_beacon_tasklet()
434 sc->beacon.bmisscnt = 0; in ath9k_beacon_tasklet()
442 vif = sc->beacon.bslot[slot]; in ath9k_beacon_tasklet()
455 if (!vif || !vif->bss_conf.enable_beacon) in ath9k_beacon_tasklet()
462 bf = ath9k_beacon_generate(sc->hw, vif); in ath9k_beacon_tasklet()
464 if (sc->beacon.bmisscnt != 0) { in ath9k_beacon_tasklet()
466 sc->beacon.bmisscnt); in ath9k_beacon_tasklet()
467 sc->beacon.bmisscnt = 0; in ath9k_beacon_tasklet()
471 * Handle slot time change when a non-ERP station joins/leaves in ath9k_beacon_tasklet()
477 * NB: The slot time change state machine is clocked according in ath9k_beacon_tasklet()
486 if (sc->beacon.updateslot == UPDATE) { in ath9k_beacon_tasklet()
487 sc->beacon.updateslot = COMMIT; in ath9k_beacon_tasklet()
488 sc->beacon.slotupdate = slot; in ath9k_beacon_tasklet()
489 } else if (sc->beacon.updateslot == COMMIT && in ath9k_beacon_tasklet()
490 sc->beacon.slotupdate == slot) { in ath9k_beacon_tasklet()
491 ah->slottime = sc->beacon.slottime; in ath9k_beacon_tasklet()
493 sc->beacon.updateslot = OK; in ath9k_beacon_tasklet()
503 ath9k_hw_puttxbuf(ah, sc->beacon.beaconq, bf->bf_daddr); in ath9k_beacon_tasklet()
506 ath9k_hw_txstart(ah, sc->beacon.beaconq); in ath9k_beacon_tasklet()
516 struct ath_hw *ah = sc->sc_ah; in ath9k_beacon_init()
521 ah->imask |= ATH9K_INT_SWBA; in ath9k_beacon_init()
522 sc->beacon.bmisscnt = 0; in ath9k_beacon_init()
529 ath9k_hw_disable_interrupts(sc->sc_ah); in ath9k_beacon_stop()
530 sc->sc_ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); in ath9k_beacon_stop()
531 sc->beacon.bmisscnt = 0; in ath9k_beacon_stop()
532 ath9k_hw_set_interrupts(sc->sc_ah); in ath9k_beacon_stop()
533 ath9k_hw_enable_interrupts(sc->sc_ah); in ath9k_beacon_stop()
537 * For multi-bss ap support beacons are either staggered evenly over N slots or
544 struct ath_hw *ah = sc->sc_ah; in ath9k_beacon_config_ap()
547 ath9k_beacon_init(sc, conf->nexttbtt, conf->intval); in ath9k_beacon_config_ap()
555 if (ath9k_cmn_beacon_config_sta(ah, conf, &bs) == -EPERM) in ath9k_beacon_config_sta()
560 ah->imask |= ATH9K_INT_BMISS; in ath9k_beacon_config_sta()
569 struct ath_hw *ah = sc->sc_ah; in ath9k_beacon_config_adhoc()
576 ath9k_beacon_init(sc, conf->nexttbtt, conf->intval); in ath9k_beacon_config_adhoc()
582 if (!conf->ibss_creator && conf->enable_beacon) in ath9k_beacon_config_adhoc()
583 set_bit(ATH_OP_BEACONS, &common->op_flags); in ath9k_beacon_config_adhoc()
590 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; in ath9k_cache_beacon_config()
591 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_cache_beacon_config()
592 struct ath_beacon_config *cur_conf = &ctx->beacon; in ath9k_cache_beacon_config()
595 "Caching beacon data for BSS: %pM\n", bss_conf->bssid); in ath9k_cache_beacon_config()
597 cur_conf->beacon_interval = bss_conf->beacon_int; in ath9k_cache_beacon_config()
598 cur_conf->dtim_period = bss_conf->dtim_period; in ath9k_cache_beacon_config()
599 cur_conf->dtim_count = 1; in ath9k_cache_beacon_config()
600 cur_conf->ibss_creator = vif->cfg.ibss_creator; in ath9k_cache_beacon_config()
608 if (cur_conf->beacon_interval == 0) in ath9k_cache_beacon_config()
609 cur_conf->beacon_interval = 100; in ath9k_cache_beacon_config()
611 cur_conf->bmiss_timeout = in ath9k_cache_beacon_config()
612 ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval; in ath9k_cache_beacon_config()
616 * initialization as it breaks association with hidden-ssid in ath9k_cache_beacon_config()
619 if (cur_conf->dtim_period == 0) in ath9k_cache_beacon_config()
620 cur_conf->dtim_period = 1; in ath9k_cache_beacon_config()
628 struct ath_hw *ah = sc->sc_ah; in ath9k_beacon_config()
638 clear_bit(ATH_OP_BEACONS, &common->op_flags); in ath9k_beacon_config()
646 avp = (void *)main_vif->drv_priv; in ath9k_beacon_config()
647 ctx = avp->chanctx; in ath9k_beacon_config()
648 cur_conf = &ctx->beacon; in ath9k_beacon_config()
649 enabled = cur_conf->enable_beacon; in ath9k_beacon_config()
650 cur_conf->enable_beacon = beacons; in ath9k_beacon_config()
652 if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) { in ath9k_beacon_config()
656 set_bit(ATH_OP_BEACONS, &common->op_flags); in ath9k_beacon_config()
667 if (cur_conf->beacon_interval) { in ath9k_beacon_config()
673 if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC && in ath9k_beacon_config()
674 !enabled && beacons && !main_vif->cfg.ibss_creator) { in ath9k_beacon_config()
675 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath9k_beacon_config()
676 sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; in ath9k_beacon_config()
677 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath9k_beacon_config()
686 set_bit(ATH_OP_BEACONS, &common->op_flags); in ath9k_beacon_config()
689 clear_bit(ATH_OP_BEACONS, &common->op_flags); in ath9k_beacon_config()
693 clear_bit(ATH_OP_BEACONS, &common->op_flags); in ath9k_beacon_config()
700 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_set_beacon()
701 struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon; in ath9k_set_beacon()
703 switch (sc->sc_ah->opmode) { in ath9k_set_beacon()
712 ath9k_beacon_config_sta(sc->sc_ah, cur_conf); in ath9k_set_beacon()