Lines Matching defs:sc

22 static void ath9k_reset_beacon_status(struct ath_softc *sc)
24 sc->beacon.tx_processed = false;
25 sc->beacon.tx_last = false;
33 static void ath9k_beaconq_config(struct ath_softc *sc)
35 struct ath_hw *ah = sc->sc_ah;
40 ath9k_hw_get_txq_props(ah, sc->beacon.beaconq, &qi);
42 if (sc->sc_ah->opmode == NL80211_IFTYPE_AP ||
43 sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) {
50 txq = sc->tx.txq_map[IEEE80211_AC_BE];
60 if (!ath9k_hw_set_txq_props(ah, sc->beacon.beaconq, &qi)) {
63 ath9k_hw_resettxqueue(ah, sc->beacon.beaconq);
72 static void ath9k_beacon_setup(struct ath_softc *sc, struct ieee80211_vif *vif,
76 struct ath_hw *ah = sc->sc_ah;
83 sband = &common->sbands[sc->cur_chandef.chan->band];
103 info.qcu = sc->beacon.beaconq;
107 info.rates[0].ChSel = ath_txchainmask_reduction(sc, chainmask, rate);
115 struct ath_softc *sc = hw->priv;
116 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
120 struct ath_txq *cabq = sc->beacon.cabq;
131 dma_unmap_single(sc->dev, bf->bf_buf_addr,
153 ath9k_beacon_add_noa(sc, avp, skb);
155 bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
157 if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) {
180 if (sc->cur_chan->nvifs > 1) {
183 ath_draintxq(sc, cabq);
187 ath9k_beacon_setup(sc, vif, bf, info->control.rates[0].idx);
195 void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif)
197 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
201 avp->av_bcbuf = list_first_entry(&sc->beacon.bbuf, struct ath_buf, list);
205 if (sc->beacon.bslot[slot] == NULL) {
211 sc->beacon.bslot[avp->av_bslot] = vif;
217 void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif)
219 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
226 tasklet_disable(&sc->bcon_tasklet);
230 dma_unmap_single(sc->dev, bf->bf_buf_addr,
238 sc->beacon.bslot[avp->av_bslot] = NULL;
239 list_add_tail(&bf->list, &sc->beacon.bbuf);
241 tasklet_enable(&sc->bcon_tasklet);
244 void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc)
246 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
254 tasklet_disable_in_atomic(&sc->bcon_tasklet);
258 if (sc->beacon.bslot[slot]) {
269 vif = sc->beacon.bslot[slot + first_slot];
270 sc->beacon.bslot[slot] = vif;
277 sc->beacon.bslot[slot] = NULL;
281 vif = sc->beacon.bslot[0];
295 if (sc->cur_chan == avp->chanctx) {
297 ath9k_hw_settsf64(sc->sc_ah, avp->chanctx->tsf_val + offset);
303 tasklet_enable(&sc->bcon_tasklet);
306 static int ath9k_beacon_choose_slot(struct ath_softc *sc)
308 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
309 struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
315 if (sc->sc_ah->opmode != NL80211_IFTYPE_AP &&
316 sc->sc_ah->opmode != NL80211_IFTYPE_MESH_POINT) {
318 ath9k_hw_gettsf64(sc->sc_ah));
323 tsf = ath9k_hw_gettsf64(sc->sc_ah);
324 tsf += TU_TO_USEC(sc->sc_ah->config.sw_beacon_response_time);
334 static void ath9k_set_tsfadjust(struct ath_softc *sc,
337 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
344 if (!sc->beacon.bslot[slot])
347 avp = (void *)sc->beacon.bslot[slot]->drv_priv;
363 bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
377 struct ath_softc *sc = data;
378 ath9k_csa_is_finished(sc, vif);
381 void ath9k_csa_update(struct ath_softc *sc)
383 ieee80211_iterate_active_interfaces_atomic(sc->hw,
385 ath9k_csa_update_vif, sc);
390 struct ath_softc *sc = from_tasklet(sc, t, bcon_tasklet);
391 struct ath_hw *ah = sc->sc_ah;
411 if (ath9k_hw_numtxpending(ah, sc->beacon.beaconq) != 0) {
412 sc->beacon.bmisscnt++;
422 if (!ath_hw_check(sc))
425 if (sc->beacon.bmisscnt < BSTUCK_THRESH * sc->nbcnvifs) {
428 sc->beacon.bmisscnt);
429 ath9k_hw_stop_dma_queue(ah, sc->beacon.beaconq);
430 if (sc->beacon.bmisscnt > 3)
432 } else if (sc->beacon.bmisscnt >= BSTUCK_THRESH) {
434 sc->beacon.bmisscnt = 0;
435 ath9k_queue_reset(sc, RESET_TYPE_BEACON_STUCK);
441 slot = ath9k_beacon_choose_slot(sc);
442 vif = sc->beacon.bslot[slot];
447 ath_chanctx_beacon_sent_ev(sc,
451 if (ath9k_csa_is_finished(sc, vif))
459 ath_chanctx_event(sc, vif, ATH_CHANCTX_EVENT_BEACON_PREPARE);
462 bf = ath9k_beacon_generate(sc->hw, vif);
464 if (sc->beacon.bmisscnt != 0) {
466 sc->beacon.bmisscnt);
467 sc->beacon.bmisscnt = 0;
486 if (sc->beacon.updateslot == UPDATE) {
487 sc->beacon.updateslot = COMMIT;
488 sc->beacon.slotupdate = slot;
489 } else if (sc->beacon.updateslot == COMMIT &&
490 sc->beacon.slotupdate == slot) {
491 ah->slottime = sc->beacon.slottime;
493 sc->beacon.updateslot = OK;
497 ath9k_reset_beacon_status(sc);
503 ath9k_hw_puttxbuf(ah, sc->beacon.beaconq, bf->bf_daddr);
506 ath9k_hw_txstart(ah, sc->beacon.beaconq);
513 static void ath9k_beacon_init(struct ath_softc *sc, u32 nexttbtt,
516 struct ath_hw *ah = sc->sc_ah;
519 ath9k_beaconq_config(sc);
522 sc->beacon.bmisscnt = 0;
527 static void ath9k_beacon_stop(struct ath_softc *sc)
529 ath9k_hw_disable_interrupts(sc->sc_ah);
530 sc->sc_ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
531 sc->beacon.bmisscnt = 0;
532 ath9k_hw_set_interrupts(sc->sc_ah);
533 ath9k_hw_enable_interrupts(sc->sc_ah);
541 static void ath9k_beacon_config_ap(struct ath_softc *sc,
544 struct ath_hw *ah = sc->sc_ah;
547 ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
566 static void ath9k_beacon_config_adhoc(struct ath_softc *sc,
569 struct ath_hw *ah = sc->sc_ah;
572 ath9k_reset_beacon_status(sc);
576 ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
586 static void ath9k_cache_beacon_config(struct ath_softc *sc,
591 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
622 ath9k_set_tsfadjust(sc, cur_conf);
625 void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
628 struct ath_hw *ah = sc->sc_ah;
639 ath9k_beacon_stop(sc);
652 if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
653 ath9k_cache_beacon_config(sc, ctx, main_vif);
655 ath9k_set_beacon(sc);
661 ath9k_cache_beacon_config(sc, ctx, main_vif);
673 if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
675 spin_lock_irqsave(&sc->sc_pm_lock, flags);
676 sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON;
677 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
687 ath9k_set_beacon(sc);
690 ath9k_beacon_stop(sc);
694 ath9k_beacon_stop(sc);
698 void ath9k_set_beacon(struct ath_softc *sc)
700 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
701 struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
703 switch (sc->sc_ah->opmode) {
706 ath9k_beacon_config_ap(sc, cur_conf);
709 ath9k_beacon_config_adhoc(sc, cur_conf);
712 ath9k_beacon_config_sta(sc->sc_ah, cur_conf);