Lines Matching refs:iface
309 static int acs_request_scan(struct hostapd_iface *iface);
348 void acs_cleanup(struct hostapd_iface *iface) in acs_cleanup() argument
352 for (i = 0; i < iface->num_hw_features; i++) in acs_cleanup()
353 acs_cleanup_mode(&iface->hw_features[i]); in acs_cleanup()
355 iface->chans_surveyed = 0; in acs_cleanup()
356 iface->acs_num_completed_scans = 0; in acs_cleanup()
357 iface->acs_num_retries = 0; in acs_cleanup()
358 eloop_cancel_timeout(acs_scan_retry, iface, NULL); in acs_cleanup()
362 static void acs_fail(struct hostapd_iface *iface) in acs_fail() argument
365 acs_cleanup(iface); in acs_fail()
366 hostapd_disable_iface(iface); in acs_fail()
402 acs_survey_chan_interference_factor(struct hostapd_iface *iface, in acs_survey_chan_interference_factor() argument
427 iface->lowest_nf); in acs_survey_chan_interference_factor()
542 static int acs_surveys_are_sufficient(struct hostapd_iface *iface) in acs_surveys_are_sufficient() argument
547 for (i = 0; i < iface->num_hw_features; i++) { in acs_surveys_are_sufficient()
548 mode = &iface->hw_features[i]; in acs_surveys_are_sufficient()
549 if (!hostapd_hw_skip_mode(iface, mode) && in acs_surveys_are_sufficient()
566 static int is_in_chanlist(struct hostapd_iface *iface, in is_in_chanlist() argument
569 if (!iface->conf->acs_ch_list.num) in is_in_chanlist()
572 return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan); in is_in_chanlist()
576 static int is_in_freqlist(struct hostapd_iface *iface, in is_in_freqlist() argument
579 if (!iface->conf->acs_freq_list.num) in is_in_freqlist()
582 return freq_range_list_includes(&iface->conf->acs_freq_list, in is_in_freqlist()
588 struct hostapd_iface *iface, struct hostapd_hw_modes *mode) in acs_survey_mode_interference_factor() argument
600 iface->conf->acs_exclude_dfs) in acs_survey_mode_interference_factor()
603 if (!is_in_chanlist(iface, chan)) in acs_survey_mode_interference_factor()
606 if (!is_in_freqlist(iface, chan)) in acs_survey_mode_interference_factor()
609 if (chan->max_tx_power < iface->conf->min_tx_power) in acs_survey_mode_interference_factor()
613 iface->conf->country[2] == 0x4f) in acs_survey_mode_interference_factor()
619 acs_survey_chan_interference_factor(iface, chan); in acs_survey_mode_interference_factor()
628 struct hostapd_iface *iface) in acs_survey_all_chans_interference_factor() argument
633 for (i = 0; i < iface->num_hw_features; i++) { in acs_survey_all_chans_interference_factor()
634 mode = &iface->hw_features[i]; in acs_survey_all_chans_interference_factor()
635 if (!hostapd_hw_skip_mode(iface, mode)) in acs_survey_all_chans_interference_factor()
636 acs_survey_mode_interference_factor(iface, mode); in acs_survey_all_chans_interference_factor()
662 acs_find_mode(struct hostapd_iface *iface, int freq) in acs_find_mode() argument
668 for (i = 0; i < iface->num_hw_features; i++) { in acs_find_mode()
669 mode = &iface->hw_features[i]; in acs_find_mode()
670 if (!hostapd_hw_skip_mode(iface, mode)) { in acs_find_mode()
682 acs_find_chan(struct hostapd_iface *iface, int freq) in acs_find_chan() argument
688 for (i = 0; i < iface->num_hw_features; i++) { in acs_find_chan()
689 mode = &iface->hw_features[i]; in acs_find_chan()
690 if (!hostapd_hw_skip_mode(iface, mode)) { in acs_find_chan()
733 static void acs_update_puncturing_bitmap(struct hostapd_iface *iface, in acs_update_puncturing_bitmap() argument
740 struct hostapd_config *conf = iface->conf; in acs_update_puncturing_bitmap()
767 adj_chan = acs_find_chan(iface, adj_freq); in acs_update_puncturing_bitmap()
788 acs_usable_bw320_chan(struct hostapd_iface *iface, in acs_usable_bw320_chan() argument
792 int conf_bw320_offset = hostapd_get_bw320_offset(iface->conf); in acs_usable_bw320_chan()
824 acs_find_ideal_chan_mode(struct hostapd_iface *iface, in acs_find_ideal_chan_mode() argument
842 secondary_channel = iface->conf->secondary_channel; in acs_find_ideal_chan_mode()
864 iface->conf->acs_exclude_dfs) in acs_find_ideal_chan_mode()
867 if (!is_in_chanlist(iface, chan)) in acs_find_ideal_chan_mode()
870 if (!is_in_freqlist(iface, chan)) in acs_find_ideal_chan_mode()
873 if (chan->max_tx_power < iface->conf->min_tx_power) in acs_find_ideal_chan_mode()
877 iface->conf->country[2] == 0x4f) in acs_find_ideal_chan_mode()
890 ((iface->conf->ieee80211n && in acs_find_ideal_chan_mode()
891 iface->conf->secondary_channel) || in acs_find_ideal_chan_mode()
901 (iface->conf->ieee80211ac || iface->conf->ieee80211ax || in acs_find_ideal_chan_mode()
902 iface->conf->ieee80211be)) { in acs_find_ideal_chan_mode()
903 if (hostapd_get_oper_chwidth(iface->conf) == in acs_find_ideal_chan_mode()
912 if (hostapd_get_oper_chwidth(iface->conf) == in acs_find_ideal_chan_mode()
923 iface->conf->ieee80211be) { in acs_find_ideal_chan_mode()
924 if (hostapd_get_oper_chwidth(iface->conf) == in acs_find_ideal_chan_mode()
926 !acs_usable_bw320_chan(iface, chan, &bw320_offset)) in acs_find_ideal_chan_mode()
939 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan_mode()
971 if (iface->current_mode && in acs_find_ideal_chan_mode()
972 iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && in acs_find_ideal_chan_mode()
990 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan_mode()
998 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan_mode()
1006 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan_mode()
1014 adj_chan = acs_find_chan(iface, chan->freq + in acs_find_ideal_chan_mode()
1030 if (iface->conf->acs_chan_bias) { in acs_find_ideal_chan_mode()
1031 for (k = 0; k < iface->conf->num_acs_chan_bias; k++) { in acs_find_ideal_chan_mode()
1032 bias = &iface->conf->acs_chan_bias[k]; in acs_find_ideal_chan_mode()
1067 if (iface->conf->ieee80211be) in acs_find_ideal_chan_mode()
1068 acs_update_puncturing_bitmap(iface, mode, bw, in acs_find_ideal_chan_mode()
1082 hostapd_set_and_check_bw320_offset(iface->conf, ideal_bw320_offset); in acs_find_ideal_chan_mode()
1093 acs_find_ideal_chan(struct hostapd_iface *iface) in acs_find_ideal_chan() argument
1103 if (is_6ghz_op_class(iface->conf->op_class)) { in acs_find_ideal_chan()
1104 bw = op_class_to_bandwidth(iface->conf->op_class); in acs_find_ideal_chan()
1109 if (iface->conf->ieee80211n && in acs_find_ideal_chan()
1110 iface->conf->secondary_channel) in acs_find_ideal_chan()
1113 if (iface->conf->ieee80211ac || iface->conf->ieee80211ax || in acs_find_ideal_chan()
1114 iface->conf->ieee80211be) { in acs_find_ideal_chan()
1115 switch (hostapd_get_oper_chwidth(iface->conf)) { in acs_find_ideal_chan()
1138 for (i = 0; i < iface->num_hw_features; i++) { in acs_find_ideal_chan()
1139 mode = &iface->hw_features[i]; in acs_find_ideal_chan()
1140 if (!hostapd_hw_skip_mode(iface, mode)) in acs_find_ideal_chan()
1141 acs_find_ideal_chan_mode(iface, mode, n_chans, bw, in acs_find_ideal_chan()
1151 if (iface->conf->punct_acs_threshold) in acs_find_ideal_chan()
1163 static void acs_adjust_secondary(struct hostapd_iface *iface) in acs_adjust_secondary() argument
1170 if (!iface->conf->secondary_channel || in acs_adjust_secondary()
1171 acs_find_mode(iface, iface->freq) != HOSTAPD_MODE_IEEE80211A) in acs_adjust_secondary()
1178 if (iface->freq == bw_desc[ACS_BW40][i].first) in acs_adjust_secondary()
1179 iface->conf->secondary_channel = 1; in acs_adjust_secondary()
1180 else if (iface->freq == bw_desc[ACS_BW40][i].last) in acs_adjust_secondary()
1181 iface->conf->secondary_channel = -1; in acs_adjust_secondary()
1186 static void acs_adjust_center_freq(struct hostapd_iface *iface) in acs_adjust_center_freq() argument
1192 switch (hostapd_get_oper_chwidth(iface->conf)) { in acs_adjust_center_freq()
1194 if (iface->conf->secondary_channel && in acs_adjust_center_freq()
1195 iface->freq >= 2400 && iface->freq < 2500) in acs_adjust_center_freq()
1196 center = iface->conf->channel + in acs_adjust_center_freq()
1197 2 * iface->conf->secondary_channel; in acs_adjust_center_freq()
1198 else if (iface->conf->secondary_channel) in acs_adjust_center_freq()
1199 center = acs_get_bw_center_chan(iface->freq, ACS_BW40); in acs_adjust_center_freq()
1201 center = iface->conf->channel; in acs_adjust_center_freq()
1204 center = acs_get_bw_center_chan(iface->freq, ACS_BW80); in acs_adjust_center_freq()
1207 center = acs_get_bw_center_chan(iface->freq, ACS_BW160); in acs_adjust_center_freq()
1210 switch (hostapd_get_bw320_offset(iface->conf)) { in acs_adjust_center_freq()
1212 center = acs_get_bw_center_chan(iface->freq, in acs_adjust_center_freq()
1216 center = acs_get_bw_center_chan(iface->freq, in acs_adjust_center_freq()
1234 hostapd_set_oper_centr_freq_seg0_idx(iface->conf, center); in acs_adjust_center_freq()
1238 static int acs_study_survey_based(struct hostapd_iface *iface) in acs_study_survey_based() argument
1242 if (!iface->chans_surveyed) { in acs_study_survey_based()
1247 if (!acs_surveys_are_sufficient(iface)) { in acs_study_survey_based()
1252 acs_survey_all_chans_interference_factor(iface); in acs_study_survey_based()
1257 static int acs_study_options(struct hostapd_iface *iface) in acs_study_options() argument
1259 if (acs_study_survey_based(iface) == 0) in acs_study_options()
1269 static void acs_study(struct hostapd_iface *iface) in acs_study() argument
1274 err = acs_study_options(iface); in acs_study()
1280 ideal_chan = acs_find_ideal_chan(iface); in acs_study()
1287 iface->conf->channel = ideal_chan->chan; in acs_study()
1288 iface->freq = ideal_chan->freq; in acs_study()
1290 iface->conf->punct_bitmap = ideal_chan->punct_bitmap; in acs_study()
1293 if (iface->conf->ieee80211ac || iface->conf->ieee80211ax || in acs_study()
1294 iface->conf->ieee80211be) { in acs_study()
1295 acs_adjust_secondary(iface); in acs_study()
1296 acs_adjust_center_freq(iface); in acs_study()
1299 err = hostapd_select_hw_mode(iface); in acs_study()
1303 err, iface->freq, iface->conf->channel); in acs_study()
1314 if (hostapd_acs_completed(iface, err) == HOSTAPD_CHAN_VALID) { in acs_study()
1315 acs_cleanup(iface); in acs_study()
1322 acs_fail(iface); in acs_study()
1326 static void acs_scan_complete(struct hostapd_iface *iface) in acs_scan_complete() argument
1330 iface->scan_cb = NULL; in acs_scan_complete()
1331 iface->acs_num_retries = 0; in acs_scan_complete()
1334 iface->conf->acs_num_scans); in acs_scan_complete()
1336 err = hostapd_drv_get_survey(iface->bss[0], 0); in acs_scan_complete()
1342 if (++iface->acs_num_completed_scans < iface->conf->acs_num_scans) { in acs_scan_complete()
1343 err = acs_request_scan(iface); in acs_scan_complete()
1352 acs_study(iface); in acs_scan_complete()
1355 hostapd_acs_completed(iface, 1); in acs_scan_complete()
1356 acs_fail(iface); in acs_scan_complete()
1360 static int * acs_request_scan_add_freqs(struct hostapd_iface *iface, in acs_request_scan_add_freqs() argument
1371 iface->conf->acs_exclude_dfs)) in acs_request_scan_add_freqs()
1374 if (!is_in_chanlist(iface, chan)) in acs_request_scan_add_freqs()
1377 if (!is_in_freqlist(iface, chan)) in acs_request_scan_add_freqs()
1380 if (chan->max_tx_power < iface->conf->min_tx_power) in acs_request_scan_add_freqs()
1384 iface->conf->country[2] == 0x4f) in acs_request_scan_add_freqs()
1394 static int acs_request_scan(struct hostapd_iface *iface) in acs_request_scan() argument
1404 for (i = 0; i < iface->num_hw_features; i++) { in acs_request_scan()
1405 mode = &iface->hw_features[i]; in acs_request_scan()
1406 if (!hostapd_hw_skip_mode(iface, mode)) in acs_request_scan()
1416 for (i = 0; i < iface->num_hw_features; i++) { in acs_request_scan()
1417 mode = &iface->hw_features[i]; in acs_request_scan()
1418 if (!hostapd_hw_skip_mode(iface, mode)) in acs_request_scan()
1419 freq = acs_request_scan_add_freqs(iface, mode, freq); in acs_request_scan()
1430 if (!iface->acs_num_retries) in acs_request_scan()
1432 iface->acs_num_completed_scans + 1, in acs_request_scan()
1433 iface->conf->acs_num_scans); in acs_request_scan()
1437 iface->acs_num_retries, in acs_request_scan()
1438 iface->acs_num_completed_scans + 1, in acs_request_scan()
1439 iface->conf->acs_num_scans); in acs_request_scan()
1441 ret = hostapd_driver_scan(iface->bss[0], ¶ms); in acs_request_scan()
1445 iface->acs_num_retries++; in acs_request_scan()
1446 if (iface->acs_num_retries >= ACS_SCAN_RETRY_MAX_COUNT) { in acs_request_scan()
1449 acs_fail(iface); in acs_request_scan()
1456 eloop_cancel_timeout(acs_scan_retry, iface, NULL); in acs_request_scan()
1458 acs_scan_retry, iface, NULL); in acs_request_scan()
1464 acs_cleanup(iface); in acs_request_scan()
1468 iface->scan_cb = acs_scan_complete; in acs_request_scan()
1476 struct hostapd_iface *iface = eloop_data; in acs_scan_retry() local
1478 if (acs_request_scan(iface)) { in acs_scan_retry()
1481 acs_fail(iface); in acs_scan_retry()
1486 enum hostapd_chan_status acs_init(struct hostapd_iface *iface) in acs_init() argument
1492 if (iface->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) { in acs_init()
1495 err = hostapd_drv_do_acs(iface->bss[0]); in acs_init()
1505 if (!iface->current_mode && in acs_init()
1506 iface->conf->hw_mode != HOSTAPD_MODE_IEEE80211ANY) in acs_init()
1509 acs_cleanup(iface); in acs_init()
1511 if (acs_request_scan(iface) < 0) in acs_init()
1514 hostapd_set_state(iface, HAPD_IFACE_ACS); in acs_init()
1515 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_STARTED); in acs_init()