Lines Matching refs:iface
244 static int acs_request_scan(struct hostapd_iface *iface);
262 static void acs_cleanup(struct hostapd_iface *iface) in acs_cleanup() argument
267 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_cleanup()
268 chan = &iface->current_mode->channels[i]; in acs_cleanup()
278 iface->chans_surveyed = 0; in acs_cleanup()
279 iface->acs_num_completed_scans = 0; in acs_cleanup()
283 static void acs_fail(struct hostapd_iface *iface) in acs_fail() argument
286 acs_cleanup(iface); in acs_fail()
287 hostapd_disable_iface(iface); in acs_fail()
325 acs_survey_chan_interference_factor(struct hostapd_iface *iface, in acs_survey_chan_interference_factor() argument
343 iface->lowest_nf); in acs_survey_chan_interference_factor()
424 static int acs_surveys_are_sufficient(struct hostapd_iface *iface) in acs_surveys_are_sufficient() argument
430 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_surveys_are_sufficient()
431 chan = &iface->current_mode->channels[i]; in acs_surveys_are_sufficient()
459 struct hostapd_iface *iface) in acs_survey_all_chans_intereference_factor() argument
464 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_survey_all_chans_intereference_factor()
465 chan = &iface->current_mode->channels[i]; in acs_survey_all_chans_intereference_factor()
473 acs_survey_chan_interference_factor(iface, chan); in acs_survey_all_chans_intereference_factor()
481 static struct hostapd_channel_data *acs_find_chan(struct hostapd_iface *iface, in acs_find_chan() argument
487 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_find_chan()
488 chan = &iface->current_mode->channels[i]; in acs_find_chan()
508 acs_find_ideal_chan(struct hostapd_iface *iface) in acs_find_ideal_chan() argument
518 if (iface->conf->ieee80211n && in acs_find_ideal_chan()
519 iface->conf->secondary_channel == -1) { in acs_find_ideal_chan()
524 if (iface->conf->ieee80211n && in acs_find_ideal_chan()
525 iface->conf->secondary_channel) in acs_find_ideal_chan()
528 if (iface->conf->ieee80211ac && in acs_find_ideal_chan()
529 iface->conf->vht_oper_chwidth == 1) in acs_find_ideal_chan()
540 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_find_ideal_chan()
541 chan = &iface->current_mode->channels[i]; in acs_find_ideal_chan()
549 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && in acs_find_ideal_chan()
550 iface->conf->ieee80211n && in acs_find_ideal_chan()
551 iface->conf->secondary_channel && in acs_find_ideal_chan()
558 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && in acs_find_ideal_chan()
559 iface->conf->ieee80211ac && in acs_find_ideal_chan()
560 iface->conf->vht_oper_chwidth == 1 && in acs_find_ideal_chan()
572 adj_chan = acs_find_chan(iface, chan->freq + (j * 20)); in acs_find_ideal_chan()
588 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211B || in acs_find_ideal_chan()
589 iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) { in acs_find_ideal_chan()
594 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
599 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
604 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
609 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
640 static void acs_adjust_vht_center_freq(struct hostapd_iface *iface) in acs_adjust_vht_center_freq() argument
646 switch (iface->conf->vht_oper_chwidth) { in acs_adjust_vht_center_freq()
648 offset = 2 * iface->conf->secondary_channel; in acs_adjust_vht_center_freq()
660 iface->conf->vht_oper_centr_freq_seg0_idx = in acs_adjust_vht_center_freq()
661 iface->conf->channel + offset; in acs_adjust_vht_center_freq()
665 static int acs_study_survey_based(struct hostapd_iface *iface) in acs_study_survey_based() argument
669 if (!iface->chans_surveyed) { in acs_study_survey_based()
674 if (!acs_surveys_are_sufficient(iface)) { in acs_study_survey_based()
679 acs_survey_all_chans_intereference_factor(iface); in acs_study_survey_based()
684 static int acs_study_options(struct hostapd_iface *iface) in acs_study_options() argument
688 err = acs_study_survey_based(iface); in acs_study_options()
699 static void acs_study(struct hostapd_iface *iface) in acs_study() argument
704 err = acs_study_options(iface); in acs_study()
710 ideal_chan = acs_find_ideal_chan(iface); in acs_study()
717 iface->conf->channel = ideal_chan->chan; in acs_study()
719 if (iface->conf->ieee80211ac) in acs_study()
720 acs_adjust_vht_center_freq(iface); in acs_study()
728 if (hostapd_acs_completed(iface, err) == HOSTAPD_CHAN_VALID) { in acs_study()
729 acs_cleanup(iface); in acs_study()
736 acs_fail(iface); in acs_study()
740 static void acs_scan_complete(struct hostapd_iface *iface) in acs_scan_complete() argument
744 iface->scan_cb = NULL; in acs_scan_complete()
747 iface->conf->acs_num_scans); in acs_scan_complete()
749 err = hostapd_drv_get_survey(iface->bss[0], 0); in acs_scan_complete()
755 if (++iface->acs_num_completed_scans < iface->conf->acs_num_scans) { in acs_scan_complete()
756 err = acs_request_scan(iface); in acs_scan_complete()
765 acs_study(iface); in acs_scan_complete()
768 hostapd_acs_completed(iface, 1); in acs_scan_complete()
769 acs_fail(iface); in acs_scan_complete()
773 static int acs_request_scan(struct hostapd_iface *iface) in acs_request_scan() argument
780 params.freqs = os_calloc(iface->current_mode->num_channels + 1, in acs_request_scan()
786 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_request_scan()
787 chan = &iface->current_mode->channels[i]; in acs_request_scan()
795 iface->scan_cb = acs_scan_complete; in acs_request_scan()
798 iface->acs_num_completed_scans + 1, in acs_request_scan()
799 iface->conf->acs_num_scans); in acs_request_scan()
801 if (hostapd_driver_scan(iface->bss[0], ¶ms) < 0) { in acs_request_scan()
803 acs_cleanup(iface); in acs_request_scan()
813 enum hostapd_chan_status acs_init(struct hostapd_iface *iface) in acs_init() argument
819 acs_cleanup(iface); in acs_init()
821 err = acs_request_scan(iface); in acs_init()
825 hostapd_set_state(iface, HAPD_IFACE_ACS); in acs_init()
826 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_STARTED); in acs_init()