Lines Matching refs:iface

244 static int acs_request_scan(struct hostapd_iface *iface);
263 static void acs_cleanup(struct hostapd_iface *iface) in acs_cleanup() argument
268 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_cleanup()
269 chan = &iface->current_mode->channels[i]; in acs_cleanup()
279 iface->chans_surveyed = 0; in acs_cleanup()
280 iface->acs_num_completed_scans = 0; in acs_cleanup()
284 static void acs_fail(struct hostapd_iface *iface) in acs_fail() argument
287 acs_cleanup(iface); in acs_fail()
288 hostapd_disable_iface(iface); in acs_fail()
326 acs_survey_chan_interference_factor(struct hostapd_iface *iface, in acs_survey_chan_interference_factor() argument
353 iface->lowest_nf); in acs_survey_chan_interference_factor()
445 static int acs_surveys_are_sufficient(struct hostapd_iface *iface) in acs_surveys_are_sufficient() argument
451 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_surveys_are_sufficient()
452 chan = &iface->current_mode->channels[i]; in acs_surveys_are_sufficient()
479 static int is_in_chanlist(struct hostapd_iface *iface, in is_in_chanlist() argument
482 if (!iface->conf->acs_ch_list.num) in is_in_chanlist()
485 return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan); in is_in_chanlist()
490 struct hostapd_iface *iface) in acs_survey_all_chans_intereference_factor() argument
495 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_survey_all_chans_intereference_factor()
496 chan = &iface->current_mode->channels[i]; in acs_survey_all_chans_intereference_factor()
501 if (!is_in_chanlist(iface, chan)) in acs_survey_all_chans_intereference_factor()
507 acs_survey_chan_interference_factor(iface, chan); in acs_survey_all_chans_intereference_factor()
515 static struct hostapd_channel_data *acs_find_chan(struct hostapd_iface *iface, in acs_find_chan() argument
521 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_find_chan()
522 chan = &iface->current_mode->channels[i]; in acs_find_chan()
572 acs_find_ideal_chan(struct hostapd_iface *iface) in acs_find_ideal_chan() argument
583 if (iface->conf->ieee80211n && in acs_find_ideal_chan()
584 iface->conf->secondary_channel == -1) { in acs_find_ideal_chan()
589 if (iface->conf->ieee80211n && in acs_find_ideal_chan()
590 iface->conf->secondary_channel) in acs_find_ideal_chan()
593 if (iface->conf->ieee80211ac && in acs_find_ideal_chan()
594 iface->conf->vht_oper_chwidth == 1) in acs_find_ideal_chan()
605 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_find_ideal_chan()
609 chan = &iface->current_mode->channels[i]; in acs_find_ideal_chan()
614 if (!is_in_chanlist(iface, chan)) in acs_find_ideal_chan()
619 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && in acs_find_ideal_chan()
620 iface->conf->ieee80211n && in acs_find_ideal_chan()
621 iface->conf->secondary_channel && in acs_find_ideal_chan()
628 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && in acs_find_ideal_chan()
629 iface->conf->ieee80211ac && in acs_find_ideal_chan()
630 iface->conf->vht_oper_chwidth == 1 && in acs_find_ideal_chan()
643 adj_chan = acs_find_chan(iface, chan->freq + (j * 20)); in acs_find_ideal_chan()
661 if (is_24ghz_mode(iface->current_mode->mode)) { in acs_find_ideal_chan()
663 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
671 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
679 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
687 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan()
700 if (iface->conf->acs_chan_bias) { in acs_find_ideal_chan()
701 for (k = 0; k < iface->conf->num_acs_chan_bias; k++) { in acs_find_ideal_chan()
702 bias = &iface->conf->acs_chan_bias[k]; in acs_find_ideal_chan()
707 } else if (is_24ghz_mode(iface->current_mode->mode) && in acs_find_ideal_chan()
746 static void acs_adjust_vht_center_freq(struct hostapd_iface *iface) in acs_adjust_vht_center_freq() argument
752 switch (iface->conf->vht_oper_chwidth) { in acs_adjust_vht_center_freq()
754 offset = 2 * iface->conf->secondary_channel; in acs_adjust_vht_center_freq()
766 iface->conf->vht_oper_centr_freq_seg0_idx = in acs_adjust_vht_center_freq()
767 iface->conf->channel + offset; in acs_adjust_vht_center_freq()
771 static int acs_study_survey_based(struct hostapd_iface *iface) in acs_study_survey_based() argument
775 if (!iface->chans_surveyed) { in acs_study_survey_based()
780 if (!acs_surveys_are_sufficient(iface)) { in acs_study_survey_based()
785 acs_survey_all_chans_intereference_factor(iface); in acs_study_survey_based()
790 static int acs_study_options(struct hostapd_iface *iface) in acs_study_options() argument
794 err = acs_study_survey_based(iface); in acs_study_options()
805 static void acs_study(struct hostapd_iface *iface) in acs_study() argument
810 err = acs_study_options(iface); in acs_study()
816 ideal_chan = acs_find_ideal_chan(iface); in acs_study()
823 iface->conf->channel = ideal_chan->chan; in acs_study()
825 if (iface->conf->ieee80211ac) in acs_study()
826 acs_adjust_vht_center_freq(iface); in acs_study()
834 if (hostapd_acs_completed(iface, err) == HOSTAPD_CHAN_VALID) { in acs_study()
835 acs_cleanup(iface); in acs_study()
842 acs_fail(iface); in acs_study()
846 static void acs_scan_complete(struct hostapd_iface *iface) in acs_scan_complete() argument
850 iface->scan_cb = NULL; in acs_scan_complete()
853 iface->conf->acs_num_scans); in acs_scan_complete()
855 err = hostapd_drv_get_survey(iface->bss[0], 0); in acs_scan_complete()
861 if (++iface->acs_num_completed_scans < iface->conf->acs_num_scans) { in acs_scan_complete()
862 err = acs_request_scan(iface); in acs_scan_complete()
871 acs_study(iface); in acs_scan_complete()
874 hostapd_acs_completed(iface, 1); in acs_scan_complete()
875 acs_fail(iface); in acs_scan_complete()
879 static int acs_request_scan(struct hostapd_iface *iface) in acs_request_scan() argument
886 params.freqs = os_calloc(iface->current_mode->num_channels + 1, in acs_request_scan()
892 for (i = 0; i < iface->current_mode->num_channels; i++) { in acs_request_scan()
893 chan = &iface->current_mode->channels[i]; in acs_request_scan()
897 if (!is_in_chanlist(iface, chan)) in acs_request_scan()
904 iface->scan_cb = acs_scan_complete; in acs_request_scan()
907 iface->acs_num_completed_scans + 1, in acs_request_scan()
908 iface->conf->acs_num_scans); in acs_request_scan()
910 if (hostapd_driver_scan(iface->bss[0], &params) < 0) { in acs_request_scan()
912 acs_cleanup(iface); in acs_request_scan()
922 enum hostapd_chan_status acs_init(struct hostapd_iface *iface) in acs_init() argument
928 if (iface->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) { in acs_init()
930 err = hostapd_drv_do_acs(iface->bss[0]); in acs_init()
936 acs_cleanup(iface); in acs_init()
938 err = acs_request_scan(iface); in acs_init()
942 hostapd_set_state(iface, HAPD_IFACE_ACS); in acs_init()
943 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_STARTED); in acs_init()