Lines Matching +full:scan +full:- +full:interval +full:- +full:ms

25 	struct ath_hw *ah = sc->sc_ah;  in ath_set_channel()
27 struct ieee80211_hw *hw = sc->hw; in ath_set_channel()
29 struct cfg80211_chan_def *chandef = &sc->cur_chan->chandef; in ath_set_channel()
30 struct ieee80211_channel *chan = chandef->chan; in ath_set_channel()
31 int pos = chan->hw_value; in ath_set_channel()
33 int old_pos = -1; in ath_set_channel()
36 if (test_bit(ATH_OP_INVALID, &common->op_flags)) in ath_set_channel()
37 return -EIO; in ath_set_channel()
39 if (ah->curchan) in ath_set_channel()
40 old_pos = ah->curchan - &ah->channels[0]; in ath_set_channel()
43 chan->center_freq, chandef->width); in ath_set_channel()
46 spin_lock_irqsave(&common->cc_lock, flags); in ath_set_channel()
48 spin_unlock_irqrestore(&common->cc_lock, flags); in ath_set_channel()
52 /* If the operating channel changes, change the survey in-use flags in ath_set_channel()
55 * back to the operating channel from an off-channel operation. in ath_set_channel()
57 if (!sc->cur_chan->offchannel && sc->cur_survey != &sc->survey[pos]) { in ath_set_channel()
58 if (sc->cur_survey) in ath_set_channel()
59 sc->cur_survey->filled &= ~SURVEY_INFO_IN_USE; in ath_set_channel()
61 sc->cur_survey = &sc->survey[pos]; in ath_set_channel()
63 memset(sc->cur_survey, 0, sizeof(struct survey_info)); in ath_set_channel()
64 sc->cur_survey->filled |= SURVEY_INFO_IN_USE; in ath_set_channel()
65 } else if (!(sc->survey[pos].filled & SURVEY_INFO_IN_USE)) { in ath_set_channel()
66 memset(&sc->survey[pos], 0, sizeof(struct survey_info)); in ath_set_channel()
69 hchan = &sc->sc_ah->channels[pos]; in ath_set_channel()
74 /* The most recent snapshot of channel->noisefloor for the old in ath_set_channel()
84 if (hw->conf.radar_enabled) { in ath_set_channel()
92 chan->center_freq); in ath_set_channel()
94 /* perform spectral scan if requested. */ in ath_set_channel()
95 if (test_bit(ATH_OP_SCANNING, &common->op_flags) && in ath_set_channel()
96 sc->spec_priv.spectral_mode == SPECTRAL_CHANSCAN) in ath_set_channel()
97 ath9k_cmn_spectral_scan_trigger(common, &sc->spec_priv); in ath_set_channel()
106 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_init()
111 sband = &common->sbands[NL80211_BAND_2GHZ]; in ath_chanctx_init()
112 if (!sband->n_channels) in ath_chanctx_init()
113 sband = &common->sbands[NL80211_BAND_5GHZ]; in ath_chanctx_init()
115 chan = &sband->channels[0]; in ath_chanctx_init()
117 ctx = &sc->chanctx[i]; in ath_chanctx_init()
118 cfg80211_chandef_create(&ctx->chandef, chan, NL80211_CHAN_HT20); in ath_chanctx_init()
119 INIT_LIST_HEAD(&ctx->vifs); in ath_chanctx_init()
120 ctx->txpower = ATH_TXPOWER_MAX; in ath_chanctx_init()
121 ctx->flush_timeout = HZ / 5; /* 200ms */ in ath_chanctx_init()
122 for (j = 0; j < ARRAY_SIZE(ctx->acq); j++) { in ath_chanctx_init()
123 INIT_LIST_HEAD(&ctx->acq[j].acq_new); in ath_chanctx_init()
124 INIT_LIST_HEAD(&ctx->acq[j].acq_old); in ath_chanctx_init()
125 spin_lock_init(&ctx->acq[j].lock); in ath_chanctx_init()
133 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_set_channel()
136 spin_lock_bh(&sc->chan_lock); in ath_chanctx_set_channel()
138 memcpy(&ctx->chandef, chandef, sizeof(*chandef)); in ath_chanctx_set_channel()
139 cur_chan = sc->cur_chan == ctx; in ath_chanctx_set_channel()
140 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_set_channel()
163 spin_lock_bh(&sc->chan_lock); in ath_is_go_chanctx_present()
166 if (!ctx->active) in ath_is_go_chanctx_present()
169 list_for_each_entry(avp, &ctx->vifs, list) { in ath_is_go_chanctx_present()
170 vif = avp->vif; in ath_is_go_chanctx_present()
173 spin_unlock_bh(&sc->chan_lock); in ath_is_go_chanctx_present()
179 spin_unlock_bh(&sc->chan_lock); in ath_is_go_chanctx_present()
235 u64 ms; in chanctx_event_delta() local
239 old = &sc->last_event_time; in chanctx_event_delta()
240 ms = ts.tv_sec * 1000 + ts.tv_nsec / 1000000; in chanctx_event_delta()
241 ms -= old->tv_sec * 1000 + old->tv_nsec / 1000000; in chanctx_event_delta()
242 sc->last_event_time = ts; in chanctx_event_delta()
244 return (u32)ms; in chanctx_event_delta()
249 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_check_active()
258 if (ctx == &sc->offchannel.chan) { in ath_chanctx_check_active()
259 spin_lock_bh(&sc->chan_lock); in ath_chanctx_check_active()
261 if (likely(sc->sched.channel_switch_time)) in ath_chanctx_check_active()
262 ctx->flush_timeout = in ath_chanctx_check_active()
263 usecs_to_jiffies(sc->sched.channel_switch_time); in ath_chanctx_check_active()
265 ctx->flush_timeout = in ath_chanctx_check_active()
268 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_check_active()
280 list_for_each_entry(avp, &ctx->vifs, list) { in ath_chanctx_check_active()
281 struct ieee80211_vif *vif = avp->vif; in ath_chanctx_check_active()
283 switch (vif->type) { in ath_chanctx_check_active()
286 if (avp->assoc) in ath_chanctx_check_active()
294 ctx->active = active; in ath_chanctx_check_active()
297 if (!ctx->assigned || list_empty(&ctx->vifs)) in ath_chanctx_check_active()
302 spin_lock_bh(&sc->chan_lock); in ath_chanctx_check_active()
305 ictx->flush_timeout = HZ / 5; in ath_chanctx_check_active()
306 clear_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags); in ath_chanctx_check_active()
307 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_check_active()
311 ictx->flush_timeout = usecs_to_jiffies(sc->sched.channel_switch_time); in ath_chanctx_check_active()
313 if (test_and_set_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags)) { in ath_chanctx_check_active()
314 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_check_active()
318 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_check_active()
329 int idx = ctx - &sc->chanctx[0]; in ath_chanctx_get_next()
331 return &sc->chanctx[!idx]; in ath_chanctx_get_next()
341 beacon_int = TU_TO_USEC(sc->cur_chan->beacon.beacon_interval); in ath_chanctx_adjust_tbtt_delta()
343 cur = sc->cur_chan; in ath_chanctx_adjust_tbtt_delta()
346 if (!prev->switch_after_beacon) in ath_chanctx_adjust_tbtt_delta()
350 cur_tsf = (u32) cur->tsf_val + in ath_chanctx_adjust_tbtt_delta()
351 ath9k_hw_get_tsf_offset(&cur->tsf_ts, &ts); in ath_chanctx_adjust_tbtt_delta()
353 prev_tsf = prev->last_beacon - (u32) prev->tsf_val + cur_tsf; in ath_chanctx_adjust_tbtt_delta()
354 prev_tsf -= ath9k_hw_get_tsf_offset(&prev->tsf_ts, &ts); in ath_chanctx_adjust_tbtt_delta()
357 * at half beacon interval offset relative to the STA chanctx. in ath_chanctx_adjust_tbtt_delta()
359 offset = cur_tsf - prev_tsf; in ath_chanctx_adjust_tbtt_delta()
365 offset = beacon_int / 2 - (offset % beacon_int); in ath_chanctx_adjust_tbtt_delta()
366 prev->tsf_val += offset; in ath_chanctx_adjust_tbtt_delta()
375 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_setup_timer()
376 struct ath_hw *ah = sc->sc_ah; in ath_chanctx_setup_timer()
379 ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, tsf_time, 1000000); in ath_chanctx_setup_timer()
380 tsf_time -= ath9k_hw_gettsf32(ah); in ath_chanctx_setup_timer()
382 mod_timer(&sc->sched.timer, jiffies + timeout); in ath_chanctx_setup_timer()
385 "Setup chanctx timer with timeout: %d (%d) ms\n", in ath_chanctx_setup_timer()
399 if (ctx->active && sc->sched.extend_absence) { in ath_chanctx_handle_bmiss()
400 avp->noa_duration = 0; in ath_chanctx_handle_bmiss()
401 sc->sched.extend_absence = false; in ath_chanctx_handle_bmiss()
408 if (ctx->active && sc->sched.beacon_miss >= 2) { in ath_chanctx_handle_bmiss()
409 avp->noa_duration = 0; in ath_chanctx_handle_bmiss()
410 sc->sched.extend_absence = true; in ath_chanctx_handle_bmiss()
419 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_offchannel_noa()
421 avp->noa_index++; in ath_chanctx_offchannel_noa()
422 avp->offchannel_start = tsf_time; in ath_chanctx_offchannel_noa()
423 avp->offchannel_duration = sc->sched.offchannel_duration; in ath_chanctx_offchannel_noa()
427 avp->offchannel_duration, in ath_chanctx_offchannel_noa()
428 avp->offchannel_start, in ath_chanctx_offchannel_noa()
429 avp->noa_index); in ath_chanctx_offchannel_noa()
436 if (ctx->active && avp->noa_duration) in ath_chanctx_offchannel_noa()
437 avp->noa_duration = 0; in ath_chanctx_offchannel_noa()
446 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_set_periodic_noa()
448 avp->noa_index++; in ath_chanctx_set_periodic_noa()
449 avp->noa_start = tsf_time; in ath_chanctx_set_periodic_noa()
451 if (sc->sched.extend_absence) in ath_chanctx_set_periodic_noa()
452 avp->noa_duration = (3 * beacon_int / 2) + in ath_chanctx_set_periodic_noa()
453 sc->sched.channel_switch_time; in ath_chanctx_set_periodic_noa()
455 avp->noa_duration = in ath_chanctx_set_periodic_noa()
456 TU_TO_USEC(cur_conf->beacon_interval) / 2 + in ath_chanctx_set_periodic_noa()
457 sc->sched.channel_switch_time; in ath_chanctx_set_periodic_noa()
459 if (test_bit(ATH_OP_SCANNING, &common->op_flags) || in ath_chanctx_set_periodic_noa()
460 sc->sched.extend_absence) in ath_chanctx_set_periodic_noa()
461 avp->periodic_noa = false; in ath_chanctx_set_periodic_noa()
463 avp->periodic_noa = true; in ath_chanctx_set_periodic_noa()
467 avp->noa_duration, in ath_chanctx_set_periodic_noa()
468 avp->noa_start, in ath_chanctx_set_periodic_noa()
469 avp->noa_index, in ath_chanctx_set_periodic_noa()
470 avp->periodic_noa); in ath_chanctx_set_periodic_noa()
478 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_set_oneshot_noa()
480 avp->noa_index++; in ath_chanctx_set_oneshot_noa()
481 avp->noa_start = tsf_time; in ath_chanctx_set_oneshot_noa()
482 avp->periodic_noa = false; in ath_chanctx_set_oneshot_noa()
483 avp->oneshot_noa = true; in ath_chanctx_set_oneshot_noa()
484 avp->noa_duration = duration + sc->sched.channel_switch_time; in ath_chanctx_set_oneshot_noa()
488 avp->noa_duration, in ath_chanctx_set_oneshot_noa()
489 avp->noa_start, in ath_chanctx_set_oneshot_noa()
490 avp->noa_index, in ath_chanctx_set_oneshot_noa()
491 avp->periodic_noa); in ath_chanctx_set_oneshot_noa()
497 struct ath_hw *ah = sc->sc_ah; in ath_chanctx_event()
506 avp = (struct ath_vif *) vif->drv_priv; in ath_chanctx_event()
508 spin_lock_bh(&sc->chan_lock); in ath_chanctx_event()
510 ath_dbg(common, CHAN_CTX, "cur_chan: %d MHz, event: %s, state: %s, delta: %u ms\n", in ath_chanctx_event()
511 sc->cur_chan->chandef.center_freq1, in ath_chanctx_event()
513 chanctx_state_string(sc->sched.state), in ath_chanctx_event()
518 if (avp->offchannel_duration) in ath_chanctx_event()
519 avp->offchannel_duration = 0; in ath_chanctx_event()
521 if (avp->oneshot_noa) { in ath_chanctx_event()
522 avp->noa_duration = 0; in ath_chanctx_event()
523 avp->oneshot_noa = false; in ath_chanctx_event()
529 if (avp->chanctx != sc->cur_chan) { in ath_chanctx_event()
535 if (sc->sched.offchannel_pending && !sc->sched.wait_switch) { in ath_chanctx_event()
536 sc->sched.offchannel_pending = false; in ath_chanctx_event()
537 sc->next_chan = &sc->offchannel.chan; in ath_chanctx_event()
538 sc->sched.state = ATH_CHANCTX_STATE_WAIT_FOR_BEACON; in ath_chanctx_event()
543 ctx = ath_chanctx_get_next(sc, sc->cur_chan); in ath_chanctx_event()
544 if (ctx->active && sc->sched.state == ATH_CHANCTX_STATE_IDLE) { in ath_chanctx_event()
545 sc->next_chan = ctx; in ath_chanctx_event()
546 sc->sched.state = ATH_CHANCTX_STATE_WAIT_FOR_BEACON; in ath_chanctx_event()
551 /* if the timer missed its window, use the next interval */ in ath_chanctx_event()
552 if (sc->sched.state == ATH_CHANCTX_STATE_WAIT_FOR_TIMER) { in ath_chanctx_event()
553 sc->sched.state = ATH_CHANCTX_STATE_WAIT_FOR_BEACON; in ath_chanctx_event()
558 if (sc->sched.mgd_prepare_tx) in ath_chanctx_event()
559 sc->sched.state = ATH_CHANCTX_STATE_WAIT_FOR_BEACON; in ath_chanctx_event()
567 if (!ctx->active && avp->noa_duration && in ath_chanctx_event()
568 sc->sched.state != ATH_CHANCTX_STATE_WAIT_FOR_BEACON) { in ath_chanctx_event()
569 avp->noa_duration = 0; in ath_chanctx_event()
570 avp->periodic_noa = false; in ath_chanctx_event()
576 if (sc->sched.state != ATH_CHANCTX_STATE_WAIT_FOR_BEACON) in ath_chanctx_event()
579 ath_dbg(common, CHAN_CTX, "Preparing beacon for vif: %pM\n", vif->addr); in ath_chanctx_event()
581 sc->sched.beacon_pending = true; in ath_chanctx_event()
582 sc->sched.next_tbtt = REG_READ(ah, AR_NEXT_TBTT_TIMER); in ath_chanctx_event()
584 cur_conf = &sc->cur_chan->beacon; in ath_chanctx_event()
585 beacon_int = TU_TO_USEC(cur_conf->beacon_interval); in ath_chanctx_event()
587 /* defer channel switch by a quarter beacon interval */ in ath_chanctx_event()
588 tsf_time = sc->sched.next_tbtt + beacon_int / 4; in ath_chanctx_event()
589 sc->sched.switch_start_time = tsf_time; in ath_chanctx_event()
590 sc->cur_chan->last_beacon = sc->sched.next_tbtt; in ath_chanctx_event()
594 * a beacon transmission, update the NoA with one-shot in ath_chanctx_event()
597 if (sc->next_chan == &sc->offchannel.chan) { in ath_chanctx_event()
606 * a one-shot NoA needs to be sent. This can happen in ath_chanctx_event()
607 * with one or more active channel contexts - in both in ath_chanctx_event()
610 if (sc->sched.mgd_prepare_tx) { in ath_chanctx_event()
616 /* Prevent wrap-around issues */ in ath_chanctx_event()
617 if (avp->noa_duration && tsf_time - avp->noa_start > BIT(30)) in ath_chanctx_event()
618 avp->noa_duration = 0; in ath_chanctx_event()
625 if (ctx->active && in ath_chanctx_event()
626 (!avp->noa_duration || sc->sched.force_noa_update)) in ath_chanctx_event()
630 if (ctx->active && sc->sched.force_noa_update) in ath_chanctx_event()
631 sc->sched.force_noa_update = false; in ath_chanctx_event()
635 if (!sc->sched.beacon_pending) { in ath_chanctx_event()
641 sc->sched.beacon_pending = false; in ath_chanctx_event()
643 if (sc->sched.mgd_prepare_tx) { in ath_chanctx_event()
644 sc->sched.mgd_prepare_tx = false; in ath_chanctx_event()
645 complete(&sc->go_beacon); in ath_chanctx_event()
651 if (sc->sched.state != ATH_CHANCTX_STATE_WAIT_FOR_BEACON) in ath_chanctx_event()
657 sc->sched.state = ATH_CHANCTX_STATE_WAIT_FOR_TIMER; in ath_chanctx_event()
658 ath_chanctx_setup_timer(sc, sc->sched.switch_start_time); in ath_chanctx_event()
661 if (sc->sched.state != ATH_CHANCTX_STATE_WAIT_FOR_TIMER) in ath_chanctx_event()
664 if (!sc->cur_chan->switch_after_beacon && in ath_chanctx_event()
665 sc->sched.beacon_pending) in ath_chanctx_event()
666 sc->sched.beacon_miss++; in ath_chanctx_event()
671 sc->sched.state = ATH_CHANCTX_STATE_SWITCH; in ath_chanctx_event()
672 ieee80211_queue_work(sc->hw, &sc->chanctx_work); in ath_chanctx_event()
675 if (!test_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags) || in ath_chanctx_event()
676 sc->cur_chan == &sc->offchannel.chan) in ath_chanctx_event()
679 sc->sched.beacon_pending = false; in ath_chanctx_event()
680 sc->sched.beacon_miss = 0; in ath_chanctx_event()
682 if (sc->sched.state == ATH_CHANCTX_STATE_FORCE_ACTIVE || in ath_chanctx_event()
683 !sc->sched.beacon_adjust || in ath_chanctx_event()
684 !sc->cur_chan->tsf_val) in ath_chanctx_event()
692 tsf_time = sc->sched.switch_start_time; in ath_chanctx_event()
693 tsf_time -= (u32) sc->cur_chan->tsf_val + in ath_chanctx_event()
694 ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL); in ath_chanctx_event()
697 sc->sched.beacon_adjust = false; in ath_chanctx_event()
701 if (sc->sched.state != ATH_CHANCTX_STATE_FORCE_ACTIVE || in ath_chanctx_event()
702 avp->chanctx != sc->cur_chan) in ath_chanctx_event()
708 sc->sched.state = ATH_CHANCTX_STATE_IDLE; in ath_chanctx_event()
711 if (!test_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags) || in ath_chanctx_event()
712 sc->sched.state == ATH_CHANCTX_STATE_FORCE_ACTIVE || in ath_chanctx_event()
713 sc->cur_chan->switch_after_beacon || in ath_chanctx_event()
714 sc->cur_chan == &sc->offchannel.chan) in ath_chanctx_event()
720 sc->next_chan = ath_chanctx_get_next(sc, sc->cur_chan); in ath_chanctx_event()
721 cur_conf = &sc->cur_chan->beacon; in ath_chanctx_event()
726 sc->sched.state = ATH_CHANCTX_STATE_WAIT_FOR_TIMER; in ath_chanctx_event()
727 sc->sched.wait_switch = false; in ath_chanctx_event()
729 tsf_time = TU_TO_USEC(cur_conf->beacon_interval) / 2; in ath_chanctx_event()
731 if (sc->sched.extend_absence) { in ath_chanctx_event()
732 sc->sched.beacon_miss = 0; in ath_chanctx_event()
736 tsf_time -= sc->sched.channel_switch_time; in ath_chanctx_event()
737 tsf_time += ath9k_hw_gettsf32(sc->sc_ah); in ath_chanctx_event()
738 sc->sched.switch_start_time = tsf_time; in ath_chanctx_event()
741 sc->sched.beacon_pending = true; in ath_chanctx_event()
742 sc->sched.beacon_adjust = true; in ath_chanctx_event()
745 if (sc->cur_chan == &sc->offchannel.chan || in ath_chanctx_event()
746 sc->cur_chan->switch_after_beacon) in ath_chanctx_event()
749 sc->next_chan = ath_chanctx_get_next(sc, sc->cur_chan); in ath_chanctx_event()
750 ieee80211_queue_work(sc->hw, &sc->chanctx_work); in ath_chanctx_event()
753 if (sc->cur_chan->assigned) { in ath_chanctx_event()
754 if (sc->next_chan && !sc->next_chan->assigned && in ath_chanctx_event()
755 sc->next_chan != &sc->offchannel.chan) in ath_chanctx_event()
756 sc->sched.state = ATH_CHANCTX_STATE_IDLE; in ath_chanctx_event()
760 ctx = ath_chanctx_get_next(sc, sc->cur_chan); in ath_chanctx_event()
761 sc->sched.state = ATH_CHANCTX_STATE_IDLE; in ath_chanctx_event()
762 if (!ctx->assigned) in ath_chanctx_event()
765 sc->next_chan = ctx; in ath_chanctx_event()
766 ieee80211_queue_work(sc->hw, &sc->chanctx_work); in ath_chanctx_event()
774 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_event()
780 if (sc->sched.beacon_pending) in ath_chanctx_beacon_sent_ev()
793 struct cfg80211_scan_request *req = sc->offchannel.scan_req; in ath_scan_channel_duration()
795 if (!req->n_ssids || (chan->flags & IEEE80211_CHAN_NO_IR)) in ath_scan_channel_duration()
796 return (HZ / 9); /* ~110 ms */ in ath_scan_channel_duration()
798 return (HZ / 16); /* ~60 ms */ in ath_scan_channel_duration()
804 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_switch()
806 spin_lock_bh(&sc->chan_lock); in ath_chanctx_switch()
808 if (test_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags) && in ath_chanctx_switch()
809 (sc->cur_chan != ctx) && (ctx == &sc->offchannel.chan)) { in ath_chanctx_switch()
811 ctx->chandef = *chandef; in ath_chanctx_switch()
813 sc->sched.offchannel_pending = true; in ath_chanctx_switch()
814 sc->sched.wait_switch = true; in ath_chanctx_switch()
815 sc->sched.offchannel_duration = in ath_chanctx_switch()
816 jiffies_to_usecs(sc->offchannel.duration) + in ath_chanctx_switch()
817 sc->sched.channel_switch_time; in ath_chanctx_switch()
819 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_switch()
825 sc->next_chan = ctx; in ath_chanctx_switch()
827 ctx->chandef = *chandef; in ath_chanctx_switch()
829 "Assigned next_chan to %d MHz\n", chandef->center_freq1); in ath_chanctx_switch()
832 if (sc->next_chan == &sc->offchannel.chan) { in ath_chanctx_switch()
833 sc->sched.offchannel_duration = in ath_chanctx_switch()
834 jiffies_to_usecs(sc->offchannel.duration) + in ath_chanctx_switch()
835 sc->sched.channel_switch_time; in ath_chanctx_switch()
840 chandef->center_freq1, in ath_chanctx_switch()
841 sc->sched.offchannel_duration); in ath_chanctx_switch()
844 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_switch()
845 ieee80211_queue_work(sc->hw, &sc->chanctx_work); in ath_chanctx_switch()
851 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_offchan_switch()
858 ath_chanctx_switch(sc, &sc->offchannel.chan, &chandef); in ath_chanctx_offchan_switch()
867 if (!ctx->assigned || list_empty(&ctx->vifs)) in ath_chanctx_get_oper_chan()
869 if (active && !ctx->active) in ath_chanctx_get_oper_chan()
872 if (ctx->switch_after_beacon) in ath_chanctx_get_oper_chan()
876 return &sc->chanctx[0]; in ath_chanctx_get_oper_chan()
882 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_scan_next_channel()
883 struct cfg80211_scan_request *req = sc->offchannel.scan_req; in ath_scan_next_channel()
886 if (sc->offchannel.scan_idx >= req->n_channels) { in ath_scan_next_channel()
890 sc->offchannel.scan_idx, in ath_scan_next_channel()
891 req->n_channels); in ath_scan_next_channel()
893 sc->offchannel.state = ATH_OFFCHANNEL_IDLE; in ath_scan_next_channel()
901 sc->offchannel.scan_idx); in ath_scan_next_channel()
903 chan = req->channels[sc->offchannel.scan_idx++]; in ath_scan_next_channel()
904 sc->offchannel.duration = ath_scan_channel_duration(sc, chan); in ath_scan_next_channel()
905 sc->offchannel.state = ATH_OFFCHANNEL_PROBE_SEND; in ath_scan_next_channel()
914 if (sc->offchannel.scan_req) { in ath_offchannel_next()
915 vif = sc->offchannel.scan_vif; in ath_offchannel_next()
916 sc->offchannel.chan.txpower = vif->bss_conf.txpower; in ath_offchannel_next()
918 } else if (sc->offchannel.roc_vif) { in ath_offchannel_next()
919 vif = sc->offchannel.roc_vif; in ath_offchannel_next()
920 sc->offchannel.chan.txpower = vif->bss_conf.txpower; in ath_offchannel_next()
921 sc->offchannel.duration = in ath_offchannel_next()
922 msecs_to_jiffies(sc->offchannel.roc_duration); in ath_offchannel_next()
923 sc->offchannel.state = ATH_OFFCHANNEL_ROC_START; in ath_offchannel_next()
924 ath_chanctx_offchan_switch(sc, sc->offchannel.roc_chan); in ath_offchannel_next()
926 spin_lock_bh(&sc->chan_lock); in ath_offchannel_next()
927 sc->sched.offchannel_pending = false; in ath_offchannel_next()
928 sc->sched.wait_switch = false; in ath_offchannel_next()
929 spin_unlock_bh(&sc->chan_lock); in ath_offchannel_next()
933 sc->offchannel.state = ATH_OFFCHANNEL_IDLE; in ath_offchannel_next()
934 if (sc->ps_idle) in ath_offchannel_next()
941 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_roc_complete()
943 sc->offchannel.roc_vif = NULL; in ath_roc_complete()
944 sc->offchannel.roc_chan = NULL; in ath_roc_complete()
949 ieee80211_remain_on_channel_expired(sc->hw); in ath_roc_complete()
953 ieee80211_remain_on_channel_expired(sc->hw); in ath_roc_complete()
966 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_scan_complete()
972 ath_dbg(common, CHAN_CTX, "HW scan aborted\n"); in ath_scan_complete()
974 ath_dbg(common, CHAN_CTX, "HW scan complete\n"); in ath_scan_complete()
976 sc->offchannel.scan_req = NULL; in ath_scan_complete()
977 sc->offchannel.scan_vif = NULL; in ath_scan_complete()
978 sc->offchannel.state = ATH_OFFCHANNEL_IDLE; in ath_scan_complete()
979 ieee80211_scan_completed(sc->hw, &info); in ath_scan_complete()
980 clear_bit(ATH_OP_SCANNING, &common->op_flags); in ath_scan_complete()
981 spin_lock_bh(&sc->chan_lock); in ath_scan_complete()
982 if (test_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags)) in ath_scan_complete()
983 sc->sched.force_noa_update = true; in ath_scan_complete()
984 spin_unlock_bh(&sc->chan_lock); in ath_scan_complete()
992 struct cfg80211_scan_request *req = sc->offchannel.scan_req; in ath_scan_send_probe()
993 struct ieee80211_vif *vif = sc->offchannel.scan_vif; in ath_scan_send_probe()
997 int band = sc->offchannel.chan.chandef.chan->band; in ath_scan_send_probe()
999 skb = ieee80211_probereq_get(sc->hw, vif->addr, in ath_scan_send_probe()
1000 ssid->ssid, ssid->ssid_len, req->ie_len); in ath_scan_send_probe()
1005 if (req->no_cck) in ath_scan_send_probe()
1006 info->flags |= IEEE80211_TX_CTL_NO_CCK_RATE; in ath_scan_send_probe()
1008 if (req->ie_len) in ath_scan_send_probe()
1009 skb_put_data(skb, req->ie, req->ie_len); in ath_scan_send_probe()
1013 if (!ieee80211_tx_prepare_skb(sc->hw, vif, skb, band, NULL)) in ath_scan_send_probe()
1016 txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO]; in ath_scan_send_probe()
1017 if (ath_tx_start(sc->hw, skb, &txctl)) in ath_scan_send_probe()
1023 ieee80211_free_txskb(sc->hw, skb); in ath_scan_send_probe()
1028 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_scan_channel_start()
1029 struct cfg80211_scan_request *req = sc->offchannel.scan_req; in ath_scan_channel_start()
1032 if (!(sc->cur_chan->chandef.chan->flags & IEEE80211_CHAN_NO_IR) && in ath_scan_channel_start()
1033 req->n_ssids) { in ath_scan_channel_start()
1034 for (i = 0; i < req->n_ssids; i++) in ath_scan_channel_start()
1035 ath_scan_send_probe(sc, &req->ssids[i]); in ath_scan_channel_start()
1042 sc->offchannel.state = ATH_OFFCHANNEL_PROBE_WAIT; in ath_scan_channel_start()
1043 mod_timer(&sc->offchannel.timer, jiffies + sc->offchannel.duration); in ath_scan_channel_start()
1049 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_timer()
1061 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_offchannel_timer()
1064 __func__, offchannel_state_string(sc->offchannel.state)); in ath_offchannel_timer()
1066 switch (sc->offchannel.state) { in ath_offchannel_timer()
1068 if (!sc->offchannel.scan_req) in ath_offchannel_timer()
1073 if (ctx->active) { in ath_offchannel_timer()
1078 sc->offchannel.state = ATH_OFFCHANNEL_SUSPEND; in ath_offchannel_timer()
1080 mod_timer(&sc->offchannel.timer, jiffies + HZ / 10); in ath_offchannel_timer()
1085 if (!sc->offchannel.scan_req) in ath_offchannel_timer()
1092 sc->offchannel.state = ATH_OFFCHANNEL_ROC_DONE; in ath_offchannel_timer()
1104 struct ieee80211_vif *vif = avp->vif; in ath_chanctx_send_vif_ps_frame()
1109 int band = sc->cur_chan->chandef.chan->band; in ath_chanctx_send_vif_ps_frame()
1111 switch (vif->type) { in ath_chanctx_send_vif_ps_frame()
1113 if (!avp->assoc) in ath_chanctx_send_vif_ps_frame()
1116 skb = ieee80211_nullfunc_get(sc->hw, vif, -1, false); in ath_chanctx_send_vif_ps_frame()
1120 nullfunc = (struct ieee80211_hdr_3addr *) skb->data; in ath_chanctx_send_vif_ps_frame()
1122 nullfunc->frame_control |= in ath_chanctx_send_vif_ps_frame()
1125 skb->priority = 7; in ath_chanctx_send_vif_ps_frame()
1127 if (!ieee80211_tx_prepare_skb(sc->hw, vif, skb, band, &sta)) { in ath_chanctx_send_vif_ps_frame()
1137 txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO]; in ath_chanctx_send_vif_ps_frame()
1139 if (ath_tx_start(sc->hw, skb, &txctl)) { in ath_chanctx_send_vif_ps_frame()
1140 ieee80211_free_txskb(sc->hw, skb); in ath_chanctx_send_vif_ps_frame()
1154 list_for_each_entry(avp, &sc->cur_chan->vifs, list) { in ath_chanctx_send_ps_frame()
1165 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_defer_switch()
1167 if (sc->cur_chan == &sc->offchannel.chan) in ath_chanctx_defer_switch()
1170 switch (sc->sched.state) { in ath_chanctx_defer_switch()
1174 if (!sc->cur_chan->switch_after_beacon) in ath_chanctx_defer_switch()
1180 sc->sched.state = ATH_CHANCTX_STATE_WAIT_FOR_BEACON; in ath_chanctx_defer_switch()
1191 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_offchannel_channel_change()
1194 __func__, offchannel_state_string(sc->offchannel.state)); in ath_offchannel_channel_change()
1196 switch (sc->offchannel.state) { in ath_offchannel_channel_change()
1198 if (!sc->offchannel.scan_req) in ath_offchannel_channel_change()
1201 if (sc->cur_chan->chandef.chan != in ath_offchannel_channel_change()
1202 sc->offchannel.chan.chandef.chan) in ath_offchannel_channel_change()
1208 if (!sc->offchannel.scan_req) in ath_offchannel_channel_change()
1214 if (sc->cur_chan != &sc->offchannel.chan) in ath_offchannel_channel_change()
1217 sc->offchannel.state = ATH_OFFCHANNEL_ROC_WAIT; in ath_offchannel_channel_change()
1218 mod_timer(&sc->offchannel.timer, in ath_offchannel_channel_change()
1219 jiffies + sc->offchannel.duration); in ath_offchannel_channel_change()
1220 ieee80211_ready_on_channel(sc->hw); in ath_offchannel_channel_change()
1231 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_chanctx_set_next()
1238 spin_lock_bh(&sc->chan_lock); in ath_chanctx_set_next()
1239 if (!sc->next_chan) { in ath_chanctx_set_next()
1240 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_set_next()
1245 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_set_next()
1252 sc->cur_chan->chandef.center_freq1, in ath_chanctx_set_next()
1253 sc->next_chan->chandef.center_freq1); in ath_chanctx_set_next()
1255 if (sc->cur_chan != sc->next_chan) { in ath_chanctx_set_next()
1258 sc->cur_chan->chandef.center_freq1); in ath_chanctx_set_next()
1259 sc->cur_chan->stopped = true; in ath_chanctx_set_next()
1260 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_set_next()
1262 if (sc->next_chan == &sc->offchannel.chan) { in ath_chanctx_set_next()
1267 ath9k_chanctx_stop_queues(sc, sc->cur_chan); in ath_chanctx_set_next()
1270 __ath9k_flush(sc->hw, ~0, true, false, false); in ath_chanctx_set_next()
1273 __ath9k_flush(sc->hw, BIT(IEEE80211_AC_VO), in ath_chanctx_set_next()
1277 spin_lock_bh(&sc->chan_lock); in ath_chanctx_set_next()
1279 if (sc->cur_chan != &sc->offchannel.chan) { in ath_chanctx_set_next()
1280 ktime_get_raw_ts64(&sc->cur_chan->tsf_ts); in ath_chanctx_set_next()
1281 sc->cur_chan->tsf_val = ath9k_hw_gettsf64(sc->sc_ah); in ath_chanctx_set_next()
1284 old_ctx = sc->cur_chan; in ath_chanctx_set_next()
1285 sc->cur_chan = sc->next_chan; in ath_chanctx_set_next()
1286 sc->cur_chan->stopped = false; in ath_chanctx_set_next()
1287 sc->next_chan = NULL; in ath_chanctx_set_next()
1289 if (!sc->sched.offchannel_pending) in ath_chanctx_set_next()
1290 sc->sched.offchannel_duration = 0; in ath_chanctx_set_next()
1292 if (sc->sched.state != ATH_CHANCTX_STATE_FORCE_ACTIVE) in ath_chanctx_set_next()
1293 sc->sched.state = ATH_CHANCTX_STATE_IDLE; in ath_chanctx_set_next()
1295 spin_unlock_bh(&sc->chan_lock); in ath_chanctx_set_next()
1297 if (sc->sc_ah->chip_fullsleep || in ath_chanctx_set_next()
1298 memcmp(&sc->cur_chandef, &sc->cur_chan->chandef, in ath_chanctx_set_next()
1299 sizeof(sc->cur_chandef))) { in ath_chanctx_set_next()
1302 __func__, sc->cur_chan->chandef.center_freq1); in ath_chanctx_set_next()
1305 sc->sched.channel_switch_time = in ath_chanctx_set_next()
1328 mutex_lock(&sc->mutex); in ath_chanctx_work()
1330 mutex_unlock(&sc->mutex); in ath_chanctx_work()
1336 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_offchannel_init()
1341 sband = &common->sbands[NL80211_BAND_2GHZ]; in ath9k_offchannel_init()
1342 if (!sband->n_channels) in ath9k_offchannel_init()
1343 sband = &common->sbands[NL80211_BAND_5GHZ]; in ath9k_offchannel_init()
1345 chan = &sband->channels[0]; in ath9k_offchannel_init()
1347 ctx = &sc->offchannel.chan; in ath9k_offchannel_init()
1348 INIT_LIST_HEAD(&ctx->vifs); in ath9k_offchannel_init()
1349 ctx->txpower = ATH_TXPOWER_MAX; in ath9k_offchannel_init()
1350 cfg80211_chandef_create(&ctx->chandef, chan, NL80211_CHAN_HT20); in ath9k_offchannel_init()
1352 for (i = 0; i < ARRAY_SIZE(ctx->acq); i++) { in ath9k_offchannel_init()
1353 INIT_LIST_HEAD(&ctx->acq[i].acq_new); in ath9k_offchannel_init()
1354 INIT_LIST_HEAD(&ctx->acq[i].acq_old); in ath9k_offchannel_init()
1355 spin_lock_init(&ctx->acq[i].lock); in ath9k_offchannel_init()
1358 sc->offchannel.chan.offchannel = true; in ath9k_offchannel_init()
1363 INIT_WORK(&sc->chanctx_work, ath_chanctx_work); in ath9k_init_channel_context()
1365 timer_setup(&sc->offchannel.timer, ath_offchannel_timer, 0); in ath9k_init_channel_context()
1366 timer_setup(&sc->sched.timer, ath_chanctx_timer, 0); in ath9k_init_channel_context()
1368 init_completion(&sc->go_beacon); in ath9k_init_channel_context()
1373 cancel_work_sync(&sc->chanctx_work); in ath9k_deinit_channel_context()
1387 struct ath_hw *ah = sc->sc_ah; in ath9k_chanctx_stop_queues()
1390 if (ctx == &sc->offchannel.chan) { in ath9k_chanctx_stop_queues()
1391 ieee80211_stop_queue(sc->hw, in ath9k_chanctx_stop_queues()
1392 sc->hw->offchannel_tx_hw_queue); in ath9k_chanctx_stop_queues()
1395 ieee80211_stop_queue(sc->hw, in ath9k_chanctx_stop_queues()
1396 ctx->hw_queue_base + i); in ath9k_chanctx_stop_queues()
1399 if (ah->opmode == NL80211_IFTYPE_AP) in ath9k_chanctx_stop_queues()
1400 ieee80211_stop_queue(sc->hw, sc->hw->queues - 2); in ath9k_chanctx_stop_queues()
1406 struct ath_hw *ah = sc->sc_ah; in ath9k_chanctx_wake_queues()
1409 if (ctx == &sc->offchannel.chan) { in ath9k_chanctx_wake_queues()
1410 ieee80211_wake_queue(sc->hw, in ath9k_chanctx_wake_queues()
1411 sc->hw->offchannel_tx_hw_queue); in ath9k_chanctx_wake_queues()
1414 ieee80211_wake_queue(sc->hw, in ath9k_chanctx_wake_queues()
1415 ctx->hw_queue_base + i); in ath9k_chanctx_wake_queues()
1418 if (ah->opmode == NL80211_IFTYPE_AP) in ath9k_chanctx_wake_queues()
1419 ieee80211_wake_queue(sc->hw, sc->hw->queues - 2); in ath9k_chanctx_wake_queues()
1428 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_update_p2p_ps_timer()
1429 struct ath_hw *ah = sc->sc_ah; in ath9k_update_p2p_ps_timer()
1432 if (!avp || !avp->noa.has_next_tsf) in ath9k_update_p2p_ps_timer()
1435 ath9k_hw_gen_timer_stop(ah, sc->p2p_ps_timer); in ath9k_update_p2p_ps_timer()
1437 tsf = ath9k_hw_gettsf32(sc->sc_ah); in ath9k_update_p2p_ps_timer()
1439 target_tsf = avp->noa.next_tsf; in ath9k_update_p2p_ps_timer()
1440 if (!avp->noa.absent) in ath9k_update_p2p_ps_timer()
1441 target_tsf -= ATH_P2P_PS_STOP_TIME; in ath9k_update_p2p_ps_timer()
1445 if (target_tsf - tsf < ATH_P2P_PS_STOP_TIME) in ath9k_update_p2p_ps_timer()
1449 __func__, avp->noa.absent, tsf, target_tsf, in ath9k_update_p2p_ps_timer()
1450 (target_tsf - tsf) / 1000); in ath9k_update_p2p_ps_timer()
1452 ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, target_tsf, 1000000); in ath9k_update_p2p_ps_timer()
1457 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_update_p2p_ps()
1460 if (!sc->p2p_ps_timer) in ath9k_update_p2p_ps()
1463 if (vif->type != NL80211_IFTYPE_STATION) in ath9k_update_p2p_ps()
1466 sc->p2p_ps_vif = avp; in ath9k_update_p2p_ps()
1468 if (sc->ps_flags & PS_BEACON_SYNC) in ath9k_update_p2p_ps()
1471 tsf = ath9k_hw_gettsf32(sc->sc_ah); in ath9k_update_p2p_ps()
1472 ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf); in ath9k_update_p2p_ps()
1478 struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon; in ath9k_get_ctwin()
1482 * Channel switch in multi-channel mode is deferred in ath9k_get_ctwin()
1483 * by a quarter beacon interval when handling in ath9k_get_ctwin()
1484 * ATH_CHANCTX_EVENT_BEACON_PREPARE, so the P2P-GO in ath9k_get_ctwin()
1488 switch_time = cur_conf->beacon_interval / 4; in ath9k_get_ctwin()
1490 ctwin = avp->vif->bss_conf.p2p_noa_attr.oppps_ctwindow; in ath9k_get_ctwin()
1509 0x00, /* LSB of little-endian len */ in ath9k_beacon_add_noa()
1510 0x00, /* MSB of little-endian len */ in ath9k_beacon_add_noa()
1517 if (!avp->offchannel_duration && !avp->noa_duration) in ath9k_beacon_add_noa()
1520 noa_desc = !!avp->offchannel_duration + !!avp->noa_duration; in ath9k_beacon_add_noa()
1524 hdr[1] = sizeof(noa_ie_hdr) + noa_len - 2; in ath9k_beacon_add_noa()
1529 noa->index = avp->noa_index; in ath9k_beacon_add_noa()
1530 noa->oppps_ctwindow = ath9k_get_ctwin(sc, avp); in ath9k_beacon_add_noa()
1531 if (noa->oppps_ctwindow) in ath9k_beacon_add_noa()
1532 noa->oppps_ctwindow |= BIT(7); in ath9k_beacon_add_noa()
1534 if (avp->noa_duration) { in ath9k_beacon_add_noa()
1535 if (avp->periodic_noa) { in ath9k_beacon_add_noa()
1536 u32 interval = TU_TO_USEC(sc->cur_chan->beacon.beacon_interval); in ath9k_beacon_add_noa() local
1537 noa->desc[i].count = 255; in ath9k_beacon_add_noa()
1538 noa->desc[i].interval = cpu_to_le32(interval); in ath9k_beacon_add_noa()
1540 noa->desc[i].count = 1; in ath9k_beacon_add_noa()
1543 noa->desc[i].start_time = cpu_to_le32(avp->noa_start); in ath9k_beacon_add_noa()
1544 noa->desc[i].duration = cpu_to_le32(avp->noa_duration); in ath9k_beacon_add_noa()
1548 if (avp->offchannel_duration) { in ath9k_beacon_add_noa()
1549 noa->desc[i].count = 1; in ath9k_beacon_add_noa()
1550 noa->desc[i].start_time = cpu_to_le32(avp->offchannel_start); in ath9k_beacon_add_noa()
1551 noa->desc[i].duration = cpu_to_le32(avp->offchannel_duration); in ath9k_beacon_add_noa()
1558 struct ath_vif *avp = sc->p2p_ps_vif; in ath9k_p2p_ps_timer()
1564 del_timer_sync(&sc->sched.timer); in ath9k_p2p_ps_timer()
1565 ath9k_hw_gen_timer_stop(sc->sc_ah, sc->p2p_ps_timer); in ath9k_p2p_ps_timer()
1568 if (!avp || avp->chanctx != sc->cur_chan) in ath9k_p2p_ps_timer()
1571 tsf = ath9k_hw_gettsf32(sc->sc_ah); in ath9k_p2p_ps_timer()
1572 if (!avp->noa.absent) in ath9k_p2p_ps_timer()
1575 tsf -= ATH_P2P_PS_STOP_TIME; in ath9k_p2p_ps_timer()
1577 if (!avp->noa.has_next_tsf || in ath9k_p2p_ps_timer()
1578 avp->noa.next_tsf - tsf > BIT(31)) in ath9k_p2p_ps_timer()
1579 ieee80211_update_p2p_noa(&avp->noa, tsf); in ath9k_p2p_ps_timer()
1585 vif = avp->vif; in ath9k_p2p_ps_timer()
1586 sta = ieee80211_find_sta(vif, avp->bssid); in ath9k_p2p_ps_timer()
1590 an = (void *) sta->drv_priv; in ath9k_p2p_ps_timer()
1591 if (an->sleeping == !!avp->noa.absent) in ath9k_p2p_ps_timer()
1594 an->sleeping = avp->noa.absent; in ath9k_p2p_ps_timer()
1595 if (an->sleeping) in ath9k_p2p_ps_timer()
1609 spin_lock_bh(&sc->sc_pcu_lock); in ath9k_p2p_bss_info_changed()
1610 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath9k_p2p_bss_info_changed()
1612 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath9k_p2p_bss_info_changed()
1613 spin_unlock_bh(&sc->sc_pcu_lock); in ath9k_p2p_bss_info_changed()
1618 if (sc->p2p_ps_vif) in ath9k_p2p_beacon_sync()
1619 ath9k_update_p2p_ps(sc, sc->p2p_ps_vif->vif); in ath9k_p2p_beacon_sync()
1625 struct ath_vif *avp = (void *)vif->drv_priv; in ath9k_p2p_remove_vif()
1627 spin_lock_bh(&sc->sc_pcu_lock); in ath9k_p2p_remove_vif()
1628 if (avp == sc->p2p_ps_vif) { in ath9k_p2p_remove_vif()
1629 sc->p2p_ps_vif = NULL; in ath9k_p2p_remove_vif()
1632 spin_unlock_bh(&sc->sc_pcu_lock); in ath9k_p2p_remove_vif()
1637 sc->p2p_ps_timer = ath_gen_timer_alloc(sc->sc_ah, ath9k_p2p_ps_timer, in ath9k_init_p2p()
1639 if (!sc->p2p_ps_timer) in ath9k_init_p2p()
1640 return -ENOMEM; in ath9k_init_p2p()
1647 if (sc->p2p_ps_timer) in ath9k_deinit_p2p()
1648 ath_gen_timer_free(sc->sc_ah, sc->p2p_ps_timer); in ath9k_deinit_p2p()