Lines Matching refs:iface
245 static int acs_request_scan(struct hostapd_iface *iface);
264 void acs_cleanup(struct hostapd_iface *iface) in acs_cleanup() argument
269 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_cleanup()
270 chan = &iface->current_mode->channels[i]; in acs_cleanup()
280 iface->chans_surveyed = 0; in acs_cleanup()
281 iface->acs_num_completed_scans = 0; in acs_cleanup()
285 static void acs_fail(struct hostapd_iface *iface) in acs_fail() argument
288 acs_cleanup(iface); in acs_fail()
289 hostapd_disable_iface(iface); in acs_fail()
327 acs_survey_chan_interference_factor(struct hostapd_iface *iface, in acs_survey_chan_interference_factor() argument
352 iface->lowest_nf); in acs_survey_chan_interference_factor()
456 static int acs_surveys_are_sufficient(struct hostapd_iface *iface) in acs_surveys_are_sufficient() argument
462 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_surveys_are_sufficient()
463 chan = &iface->current_mode->channels[i]; in acs_surveys_are_sufficient()
482 static int is_in_chanlist(struct hostapd_iface *iface, in is_in_chanlist() argument
485 if (!iface->conf->acs_ch_list.num) in is_in_chanlist()
488 return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan); in is_in_chanlist()
493 struct hostapd_iface *iface) in acs_survey_all_chans_intereference_factor() argument
498 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_survey_all_chans_intereference_factor()
499 chan = &iface->current_mode->channels[i]; in acs_survey_all_chans_intereference_factor()
504 if (!is_in_chanlist(iface, chan)) in acs_survey_all_chans_intereference_factor()
510 acs_survey_chan_interference_factor(iface, chan); in acs_survey_all_chans_intereference_factor()
518 static struct hostapd_channel_data *acs_find_chan(struct hostapd_iface *iface, in acs_find_chan() argument
524 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_find_chan()
525 chan = &iface->current_mode->channels[i]; in acs_find_chan()
575 acs_find_ideal_chan(struct hostapd_iface *iface) in acs_find_ideal_chan() argument
587 if (iface->conf->ieee80211n && in acs_find_ideal_chan()
588 iface->conf->secondary_channel == -1) { in acs_find_ideal_chan()
593 if (iface->conf->ieee80211n && in acs_find_ideal_chan()
594 iface->conf->secondary_channel) in acs_find_ideal_chan()
597 if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) { in acs_find_ideal_chan()
598 switch (hostapd_get_oper_chwidth(iface->conf)) { in acs_find_ideal_chan()
615 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_find_ideal_chan()
619 chan = &iface->current_mode->channels[i]; in acs_find_ideal_chan()
628 if (!is_in_chanlist(iface, chan)) in acs_find_ideal_chan()
640 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && in acs_find_ideal_chan()
641 iface->conf->ieee80211n && in acs_find_ideal_chan()
642 iface->conf->secondary_channel && in acs_find_ideal_chan()
649 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && in acs_find_ideal_chan()
650 (iface->conf->ieee80211ac || iface->conf->ieee80211ax)) { in acs_find_ideal_chan()
651 if (hostapd_get_oper_chwidth(iface->conf) == in acs_find_ideal_chan()
660 if (hostapd_get_oper_chwidth(iface->conf) == in acs_find_ideal_chan()
676 adj_chan = acs_find_chan(iface, chan->freq + (j * 20)); in acs_find_ideal_chan()
701 if (is_24ghz_mode(iface->current_mode->mode)) { in acs_find_ideal_chan()
703 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
711 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
719 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
727 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
740 if (iface->conf->acs_chan_bias) { in acs_find_ideal_chan()
741 for (k = 0; k < iface->conf->num_acs_chan_bias; k++) { in acs_find_ideal_chan()
742 bias = &iface->conf->acs_chan_bias[k]; in acs_find_ideal_chan()
747 } else if (is_24ghz_mode(iface->current_mode->mode) && in acs_find_ideal_chan()
786 static void acs_adjust_center_freq(struct hostapd_iface *iface) in acs_adjust_center_freq() argument
792 switch (hostapd_get_oper_chwidth(iface->conf)) { in acs_adjust_center_freq()
794 offset = 2 * iface->conf->secondary_channel; in acs_adjust_center_freq()
810 hostapd_set_oper_centr_freq_seg0_idx(iface->conf, in acs_adjust_center_freq()
811 iface->conf->channel + offset); in acs_adjust_center_freq()
815 static int acs_study_survey_based(struct hostapd_iface *iface) in acs_study_survey_based() argument
819 if (!iface->chans_surveyed) { in acs_study_survey_based()
824 if (!acs_surveys_are_sufficient(iface)) { in acs_study_survey_based()
829 acs_survey_all_chans_intereference_factor(iface); in acs_study_survey_based()
834 static int acs_study_options(struct hostapd_iface *iface) in acs_study_options() argument
836 if (acs_study_survey_based(iface) == 0) in acs_study_options()
846 static void acs_study(struct hostapd_iface *iface) in acs_study() argument
851 err = acs_study_options(iface); in acs_study()
857 ideal_chan = acs_find_ideal_chan(iface); in acs_study()
864 iface->conf->channel = ideal_chan->chan; in acs_study()
866 if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) in acs_study()
867 acs_adjust_center_freq(iface); in acs_study()
875 if (hostapd_acs_completed(iface, err) == HOSTAPD_CHAN_VALID) { in acs_study()
876 acs_cleanup(iface); in acs_study()
883 acs_fail(iface); in acs_study()
887 static void acs_scan_complete(struct hostapd_iface *iface) in acs_scan_complete() argument
891 iface->scan_cb = NULL; in acs_scan_complete()
894 iface->conf->acs_num_scans); in acs_scan_complete()
896 err = hostapd_drv_get_survey(iface->bss[0], 0); in acs_scan_complete()
902 if (++iface->acs_num_completed_scans < iface->conf->acs_num_scans) { in acs_scan_complete()
903 err = acs_request_scan(iface); in acs_scan_complete()
912 acs_study(iface); in acs_scan_complete()
915 hostapd_acs_completed(iface, 1); in acs_scan_complete()
916 acs_fail(iface); in acs_scan_complete()
920 static int acs_request_scan(struct hostapd_iface *iface) in acs_request_scan() argument
927 params.freqs = os_calloc(iface->current_mode->num_channels + 1, in acs_request_scan()
933 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_request_scan()
934 chan = &iface->current_mode->channels[i]; in acs_request_scan()
938 if (!is_in_chanlist(iface, chan)) in acs_request_scan()
945 iface->scan_cb = acs_scan_complete; in acs_request_scan()
948 iface->acs_num_completed_scans + 1, in acs_request_scan()
949 iface->conf->acs_num_scans); in acs_request_scan()
951 if (hostapd_driver_scan(iface->bss[0], ¶ms) < 0) { in acs_request_scan()
953 acs_cleanup(iface); in acs_request_scan()
963 enum hostapd_chan_status acs_init(struct hostapd_iface *iface) in acs_init() argument
967 if (iface->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) { in acs_init()
969 if (hostapd_drv_do_acs(iface->bss[0])) in acs_init()
974 if (!iface->current_mode) in acs_init()
977 acs_cleanup(iface); in acs_init()
979 if (acs_request_scan(iface) < 0) in acs_init()
982 hostapd_set_state(iface, HAPD_IFACE_ACS); in acs_init()
983 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_STARTED); in acs_init()