Lines Matching refs:iface
79 int hostapd_get_hw_features(struct hostapd_iface *iface) in hostapd_get_hw_features() argument
81 struct hostapd_data *hapd = iface->bss[0]; in hostapd_get_hw_features()
102 iface->hw_flags = flags; in hostapd_get_hw_features()
103 iface->dfs_domain = dfs_domain; in hostapd_get_hw_features()
105 if (iface->current_mode) { in hostapd_get_hw_features()
113 mode = iface->current_mode->mode; in hostapd_get_hw_features()
114 is_6ghz = iface->current_mode->is_6ghz; in hostapd_get_hw_features()
115 iface->current_mode = NULL; in hostapd_get_hw_features()
117 hostapd_free_hw_features(iface->hw_features, iface->num_hw_features); in hostapd_get_hw_features()
118 iface->hw_features = modes; in hostapd_get_hw_features()
119 iface->num_hw_features = num_modes; in hostapd_get_hw_features()
124 (iface->drv_flags & WPA_DRIVER_FLAGS_RADAR); in hostapd_get_hw_features()
130 iface->current_mode = feature; in hostapd_get_hw_features()
148 !(iface->drv_flags & in hostapd_get_hw_features()
169 if (orig_mode_valid && !iface->current_mode) { in hostapd_get_hw_features()
179 int hostapd_prepare_rates(struct hostapd_iface *iface, in hostapd_prepare_rates() argument
188 if (iface->conf->basic_rates) in hostapd_prepare_rates()
189 basic_rates = iface->conf->basic_rates; in hostapd_prepare_rates()
211 os_free(iface->basic_rates); in hostapd_prepare_rates()
212 iface->basic_rates = os_malloc(i * sizeof(int)); in hostapd_prepare_rates()
213 if (iface->basic_rates) in hostapd_prepare_rates()
214 os_memcpy(iface->basic_rates, basic_rates, i * sizeof(int)); in hostapd_prepare_rates()
216 os_free(iface->current_rates); in hostapd_prepare_rates()
217 iface->num_rates = 0; in hostapd_prepare_rates()
219 iface->current_rates = in hostapd_prepare_rates()
221 if (!iface->current_rates) { in hostapd_prepare_rates()
230 if (iface->conf->supported_rates && in hostapd_prepare_rates()
231 !hostapd_rate_found(iface->conf->supported_rates, in hostapd_prepare_rates()
235 rate = &iface->current_rates[iface->num_rates]; in hostapd_prepare_rates()
242 iface->num_rates, rate->rate, rate->flags); in hostapd_prepare_rates()
243 iface->num_rates++; in hostapd_prepare_rates()
246 if ((iface->num_rates == 0 || num_basic_rates == 0) && in hostapd_prepare_rates()
247 (!iface->conf->ieee80211n || !iface->conf->require_ht)) { in hostapd_prepare_rates()
250 iface->num_rates, num_basic_rates); in hostapd_prepare_rates()
258 static int ieee80211n_allowed_ht40_channel_pair(struct hostapd_iface *iface) in ieee80211n_allowed_ht40_channel_pair() argument
263 pri_freq = iface->freq; in ieee80211n_allowed_ht40_channel_pair()
264 sec_freq = pri_freq + iface->conf->secondary_channel * 20; in ieee80211n_allowed_ht40_channel_pair()
266 if (!iface->current_mode) in ieee80211n_allowed_ht40_channel_pair()
269 p_chan = hw_get_channel_freq(iface->current_mode->mode, pri_freq, NULL, in ieee80211n_allowed_ht40_channel_pair()
270 iface->hw_features, in ieee80211n_allowed_ht40_channel_pair()
271 iface->num_hw_features); in ieee80211n_allowed_ht40_channel_pair()
273 s_chan = hw_get_channel_freq(iface->current_mode->mode, sec_freq, NULL, in ieee80211n_allowed_ht40_channel_pair()
274 iface->hw_features, in ieee80211n_allowed_ht40_channel_pair()
275 iface->num_hw_features); in ieee80211n_allowed_ht40_channel_pair()
277 return allowed_ht40_channel_pair(iface->current_mode->mode, in ieee80211n_allowed_ht40_channel_pair()
282 static void ieee80211n_switch_pri_sec(struct hostapd_iface *iface) in ieee80211n_switch_pri_sec() argument
284 if (iface->conf->secondary_channel > 0) { in ieee80211n_switch_pri_sec()
285 iface->conf->channel += 4; in ieee80211n_switch_pri_sec()
286 iface->freq += 20; in ieee80211n_switch_pri_sec()
287 iface->conf->secondary_channel = -1; in ieee80211n_switch_pri_sec()
289 iface->conf->channel -= 4; in ieee80211n_switch_pri_sec()
290 iface->freq -= 20; in ieee80211n_switch_pri_sec()
291 iface->conf->secondary_channel = 1; in ieee80211n_switch_pri_sec()
296 static int ieee80211n_check_40mhz_5g(struct hostapd_iface *iface, in ieee80211n_check_40mhz_5g() argument
303 pri_freq = iface->freq; in ieee80211n_check_40mhz_5g()
304 sec_freq = pri_freq + iface->conf->secondary_channel * 20; in ieee80211n_check_40mhz_5g()
306 if (!iface->current_mode) in ieee80211n_check_40mhz_5g()
308 pri_chan = hw_get_channel_freq(iface->current_mode->mode, pri_freq, in ieee80211n_check_40mhz_5g()
309 NULL, iface->hw_features, in ieee80211n_check_40mhz_5g()
310 iface->num_hw_features); in ieee80211n_check_40mhz_5g()
311 sec_chan = hw_get_channel_freq(iface->current_mode->mode, sec_freq, in ieee80211n_check_40mhz_5g()
312 NULL, iface->hw_features, in ieee80211n_check_40mhz_5g()
313 iface->num_hw_features); in ieee80211n_check_40mhz_5g()
318 if (iface->conf->no_pri_sec_switch) { in ieee80211n_check_40mhz_5g()
322 ieee80211n_switch_pri_sec(iface); in ieee80211n_check_40mhz_5g()
330 static int ieee80211n_check_40mhz_2g4(struct hostapd_iface *iface, in ieee80211n_check_40mhz_2g4() argument
335 pri_chan = iface->conf->channel; in ieee80211n_check_40mhz_2g4()
336 sec_chan = pri_chan + iface->conf->secondary_channel * 4; in ieee80211n_check_40mhz_2g4()
338 return check_40mhz_2g4(iface->current_mode, scan_res, pri_chan, in ieee80211n_check_40mhz_2g4()
343 static void ieee80211n_check_scan(struct hostapd_iface *iface) in ieee80211n_check_scan() argument
352 iface->scan_cb = NULL; in ieee80211n_check_scan()
354 scan_res = hostapd_driver_get_scan_results(iface->bss[0]); in ieee80211n_check_scan()
356 hostapd_setup_interface_complete(iface, 1); in ieee80211n_check_scan()
360 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A) in ieee80211n_check_scan()
361 oper40 = ieee80211n_check_40mhz_5g(iface, scan_res); in ieee80211n_check_scan()
363 oper40 = ieee80211n_check_40mhz_2g4(iface, scan_res); in ieee80211n_check_scan()
366 iface->secondary_ch = iface->conf->secondary_channel; in ieee80211n_check_scan()
370 iface->conf->channel, in ieee80211n_check_scan()
371 iface->conf->channel + in ieee80211n_check_scan()
372 iface->conf->secondary_channel * 4); in ieee80211n_check_scan()
373 iface->conf->secondary_channel = 0; in ieee80211n_check_scan()
374 if (iface->drv_flags & WPA_DRIVER_FLAGS_HT_2040_COEX) { in ieee80211n_check_scan()
384 if (iface->conf->secondary_channel && in ieee80211n_check_scan()
385 iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G && in ieee80211n_check_scan()
386 iface->conf->ieee80211ax) { in ieee80211n_check_scan()
389 he_cap = &iface->current_mode->he_capab[IEEE80211_MODE_AP]; in ieee80211n_check_scan()
394 iface->conf->secondary_channel = 0; in ieee80211n_check_scan()
399 if (iface->conf->secondary_channel) in ieee80211n_check_scan()
400 res = ieee80211n_allowed_ht40_channel_pair(iface); in ieee80211n_check_scan()
402 iface->conf->secondary_channel = 0; in ieee80211n_check_scan()
403 hostapd_set_oper_centr_freq_seg0_idx(iface->conf, 0); in ieee80211n_check_scan()
404 hostapd_set_oper_centr_freq_seg1_idx(iface->conf, 0); in ieee80211n_check_scan()
405 hostapd_set_oper_chwidth(iface->conf, CONF_OPER_CHWIDTH_USE_HT); in ieee80211n_check_scan()
410 hostapd_setup_interface_complete(iface, !res); in ieee80211n_check_scan()
414 static void ieee80211n_scan_channels_2g4(struct hostapd_iface *iface, in ieee80211n_scan_channels_2g4() argument
423 if (iface->current_mode == NULL) in ieee80211n_scan_channels_2g4()
426 pri_freq = iface->freq; in ieee80211n_scan_channels_2g4()
427 if (iface->conf->secondary_channel > 0) in ieee80211n_scan_channels_2g4()
441 mode = iface->current_mode; in ieee80211n_scan_channels_2g4()
459 static void ieee80211n_scan_channels_5g(struct hostapd_iface *iface, in ieee80211n_scan_channels_5g() argument
468 if (iface->current_mode == NULL) in ieee80211n_scan_channels_5g()
471 pri_freq = iface->freq; in ieee80211n_scan_channels_5g()
472 if (iface->conf->secondary_channel > 0) { in ieee80211n_scan_channels_5g()
482 mode = iface->current_mode; in ieee80211n_scan_channels_5g()
503 struct hostapd_iface *iface = eloop_data; in ap_ht40_scan_retry() local
508 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in ap_ht40_scan_retry()
509 ieee80211n_scan_channels_2g4(iface, ¶ms); in ap_ht40_scan_retry()
511 ieee80211n_scan_channels_5g(iface, ¶ms); in ap_ht40_scan_retry()
515 if (iface->bss[0]->conf->mld_ap) in ap_ht40_scan_retry()
516 params.link_id = iface->bss[0]->mld_link_id; in ap_ht40_scan_retry()
519 ret = hostapd_driver_scan(iface->bss[0], ¶ms); in ap_ht40_scan_retry()
520 iface->num_ht40_scan_tries++; in ap_ht40_scan_retry()
524 iface->num_ht40_scan_tries < HT2040_COEX_SCAN_RETRY) { in ap_ht40_scan_retry()
527 ret, strerror(-ret), iface->num_ht40_scan_tries); in ap_ht40_scan_retry()
528 eloop_register_timeout(1, 0, ap_ht40_scan_retry, iface, NULL); in ap_ht40_scan_retry()
533 iface->scan_cb = ieee80211n_check_scan; in ap_ht40_scan_retry()
534 iface->bss[0]->scan_cookie = params.scan_cookie; in ap_ht40_scan_retry()
540 iface->conf->secondary_channel = 0; in ap_ht40_scan_retry()
541 iface->conf->ht_capab &= ~HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET; in ap_ht40_scan_retry()
542 hostapd_setup_interface_complete(iface, 0); in ap_ht40_scan_retry()
546 void hostapd_stop_setup_timers(struct hostapd_iface *iface) in hostapd_stop_setup_timers() argument
548 eloop_cancel_timeout(ap_ht40_scan_retry, iface, NULL); in hostapd_stop_setup_timers()
552 static int ieee80211n_check_40mhz(struct hostapd_iface *iface) in ieee80211n_check_40mhz() argument
558 if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch) in ieee80211n_check_40mhz()
561 hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); in ieee80211n_check_40mhz()
565 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in ieee80211n_check_40mhz()
566 ieee80211n_scan_channels_2g4(iface, ¶ms); in ieee80211n_check_40mhz()
568 ieee80211n_scan_channels_5g(iface, ¶ms); in ieee80211n_check_40mhz()
572 if (iface->bss[0]->conf->mld_ap) in ieee80211n_check_40mhz()
573 params.link_id = iface->bss[0]->mld_link_id; in ieee80211n_check_40mhz()
575 ret = hostapd_driver_scan(iface->bss[0], ¶ms); in ieee80211n_check_40mhz()
582 iface->num_ht40_scan_tries = 1; in ieee80211n_check_40mhz()
583 eloop_cancel_timeout(ap_ht40_scan_retry, iface, NULL); in ieee80211n_check_40mhz()
584 eloop_register_timeout(1, 0, ap_ht40_scan_retry, iface, NULL); in ieee80211n_check_40mhz()
595 iface->scan_cb = ieee80211n_check_scan; in ieee80211n_check_40mhz()
596 iface->bss[0]->scan_cookie = params.scan_cookie; in ieee80211n_check_40mhz()
601 static int ieee80211n_supported_ht_capab(struct hostapd_iface *iface) in ieee80211n_supported_ht_capab() argument
603 u16 hw = iface->current_mode->ht_capab; in ieee80211n_supported_ht_capab()
604 u16 conf = iface->conf->ht_capab; in ieee80211n_supported_ht_capab()
617 if (!iface->conf->acs && (conf & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) && in ieee80211n_supported_ht_capab()
691 static int ieee80211ac_supported_vht_capab(struct hostapd_iface *iface) in ieee80211ac_supported_vht_capab() argument
693 struct hostapd_hw_modes *mode = iface->current_mode; in ieee80211ac_supported_vht_capab()
695 u32 conf = iface->conf->vht_capab; in ieee80211ac_supported_vht_capab()
701 iface->conf->bss[0]->vendor_vht && in ieee80211ac_supported_vht_capab()
702 mode->vht_capab == 0 && iface->hw_features) { in ieee80211ac_supported_vht_capab()
705 for (i = 0; i < iface->num_hw_features; i++) { in ieee80211ac_supported_vht_capab()
706 if (iface->hw_features[i].mode == in ieee80211ac_supported_vht_capab()
708 mode = &iface->hw_features[i]; in ieee80211ac_supported_vht_capab()
724 static int ieee80211ax_supported_he_capab(struct hostapd_iface *iface) in ieee80211ax_supported_he_capab() argument
731 int hostapd_check_ht_capab(struct hostapd_iface *iface) in hostapd_check_ht_capab() argument
735 if (is_6ghz_freq(iface->freq)) in hostapd_check_ht_capab()
737 if (!iface->conf->ieee80211n) in hostapd_check_ht_capab()
740 if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211B && in hostapd_check_ht_capab()
741 iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G && in hostapd_check_ht_capab()
742 (iface->conf->ht_capab & HT_CAP_INFO_DSSS_CCK40MHZ)) { in hostapd_check_ht_capab()
745 iface->conf->ht_capab &= ~HT_CAP_INFO_DSSS_CCK40MHZ; in hostapd_check_ht_capab()
748 if (!ieee80211n_supported_ht_capab(iface)) in hostapd_check_ht_capab()
751 if (iface->conf->ieee80211ax && in hostapd_check_ht_capab()
752 !ieee80211ax_supported_he_capab(iface)) in hostapd_check_ht_capab()
756 if (iface->conf->ieee80211ac && in hostapd_check_ht_capab()
757 !ieee80211ac_supported_vht_capab(iface)) in hostapd_check_ht_capab()
760 ret = ieee80211n_check_40mhz(iface); in hostapd_check_ht_capab()
763 if (!ieee80211n_allowed_ht40_channel_pair(iface)) in hostapd_check_ht_capab()
770 int hostapd_check_edmg_capab(struct hostapd_iface *iface) in hostapd_check_edmg_capab() argument
772 struct hostapd_hw_modes *mode = iface->hw_features; in hostapd_check_edmg_capab()
775 if (!iface->conf->enable_edmg) in hostapd_check_edmg_capab()
778 hostapd_encode_edmg_chan(iface->conf->enable_edmg, in hostapd_check_edmg_capab()
779 iface->conf->edmg_channel, in hostapd_check_edmg_capab()
780 iface->conf->channel, in hostapd_check_edmg_capab()
796 int hostapd_check_he_6ghz_capab(struct hostapd_iface *iface) in hostapd_check_he_6ghz_capab() argument
802 if (!iface->current_mode || !is_6ghz_freq(iface->freq)) in hostapd_check_he_6ghz_capab()
805 he_cap = &iface->current_mode->he_capab[IEEE80211_MODE_AP]; in hostapd_check_he_6ghz_capab()
807 if (iface->conf->he_6ghz_max_mpdu > in hostapd_check_he_6ghz_capab()
815 if (iface->conf->he_6ghz_max_ampdu_len_exp > in hostapd_check_he_6ghz_capab()
823 if (iface->conf->he_6ghz_rx_ant_pat && in hostapd_check_he_6ghz_capab()
830 if (iface->conf->he_6ghz_tx_ant_pat && in hostapd_check_he_6ghz_capab()
846 static int hostapd_is_usable_chan(struct hostapd_iface *iface, in hostapd_is_usable_chan() argument
851 if (!iface->current_mode) in hostapd_is_usable_chan()
854 chan = hw_get_channel_freq(iface->current_mode->mode, frequency, NULL, in hostapd_is_usable_chan()
855 iface->hw_features, iface->num_hw_features); in hostapd_is_usable_chan()
877 static int hostapd_is_usable_edmg(struct hostapd_iface *iface) in hostapd_is_usable_edmg() argument
886 if (!iface->conf->enable_edmg) in hostapd_is_usable_edmg()
889 if (!iface->current_mode) in hostapd_is_usable_edmg()
891 pri_chan = hw_get_channel_freq(iface->current_mode->mode, in hostapd_is_usable_edmg()
892 iface->freq, NULL, in hostapd_is_usable_edmg()
893 iface->hw_features, in hostapd_is_usable_edmg()
894 iface->num_hw_features); in hostapd_is_usable_edmg()
897 hostapd_encode_edmg_chan(iface->conf->enable_edmg, in hostapd_is_usable_edmg()
898 iface->conf->edmg_channel, in hostapd_is_usable_edmg()
922 err = hostapd_is_usable_chan(iface, freq, 1); in hostapd_is_usable_edmg()
951 static bool hostapd_is_usable_punct_bitmap(struct hostapd_iface *iface) in hostapd_is_usable_punct_bitmap() argument
954 struct hostapd_config *conf = iface->conf; in hostapd_is_usable_punct_bitmap()
967 if (iface->freq >= 2412 && iface->freq <= 2484) { in hostapd_is_usable_punct_bitmap()
1015 static int hostapd_is_usable_chans(struct hostapd_iface *iface) in hostapd_is_usable_chans() argument
1021 if (!iface->current_mode) in hostapd_is_usable_chans()
1023 pri_chan = hw_get_channel_freq(iface->current_mode->mode, in hostapd_is_usable_chans()
1024 iface->freq, NULL, in hostapd_is_usable_chans()
1025 iface->hw_features, in hostapd_is_usable_chans()
1026 iface->num_hw_features); in hostapd_is_usable_chans()
1032 err = hostapd_is_usable_chan(iface, pri_chan->freq, 1); in hostapd_is_usable_chans()
1037 err = hostapd_is_usable_edmg(iface); in hostapd_is_usable_chans()
1041 if (!hostapd_is_usable_punct_bitmap(iface)) in hostapd_is_usable_chans()
1044 if (!iface->conf->secondary_channel) in hostapd_is_usable_chans()
1047 err = hostapd_is_usable_chan(iface, iface->freq + in hostapd_is_usable_chans()
1048 iface->conf->secondary_channel * 20, 0); in hostapd_is_usable_chans()
1050 if (iface->conf->secondary_channel == 1 && in hostapd_is_usable_chans()
1053 if (iface->conf->secondary_channel == -1 && in hostapd_is_usable_chans()
1057 if (!iface->conf->ht40_plus_minus_allowed) in hostapd_is_usable_chans()
1061 secondary_freq = iface->freq + 20; in hostapd_is_usable_chans()
1062 err2 = hostapd_is_usable_chan(iface, secondary_freq, 0); in hostapd_is_usable_chans()
1064 iface->conf->secondary_channel = 1; in hostapd_is_usable_chans()
1068 secondary_freq = iface->freq - 20; in hostapd_is_usable_chans()
1069 err2 = hostapd_is_usable_chan(iface, secondary_freq, 0); in hostapd_is_usable_chans()
1071 iface->conf->secondary_channel = -1; in hostapd_is_usable_chans()
1079 static bool skip_mode(struct hostapd_iface *iface, in skip_mode() argument
1084 if (iface->freq > 0 && !hw_mode_get_channel(mode, iface->freq, &chan)) in skip_mode()
1087 if (is_6ghz_op_class(iface->conf->op_class) && iface->freq == 0 && in skip_mode()
1095 int hostapd_determine_mode(struct hostapd_iface *iface) in hostapd_determine_mode() argument
1100 if (iface->current_mode || in hostapd_determine_mode()
1101 iface->conf->hw_mode != HOSTAPD_MODE_IEEE80211ANY) in hostapd_determine_mode()
1104 if (iface->freq < 4000) in hostapd_determine_mode()
1106 else if (iface->freq > 50000) in hostapd_determine_mode()
1111 for (i = 0; i < iface->num_hw_features; i++) { in hostapd_determine_mode()
1114 mode = &iface->hw_features[i]; in hostapd_determine_mode()
1116 if (skip_mode(iface, mode)) in hostapd_determine_mode()
1119 iface->current_mode = mode; in hostapd_determine_mode()
1120 iface->conf->hw_mode = mode->mode; in hostapd_determine_mode()
1125 if (!iface->current_mode) { in hostapd_determine_mode()
1134 hostapd_check_chans(struct hostapd_iface *iface) in hostapd_check_chans() argument
1136 if (iface->freq) { in hostapd_check_chans()
1139 hostapd_determine_mode(iface); in hostapd_check_chans()
1141 err = hostapd_is_usable_chans(iface); in hostapd_check_chans()
1144 supplicant_send_wifi_mgmt_ap_status(iface->owner, in hostapd_check_chans()
1160 switch (acs_init(iface)) { in hostapd_check_chans()
1169 supplicant_send_wifi_mgmt_ap_status(iface->owner, in hostapd_check_chans()
1178 static void hostapd_notify_bad_chans(struct hostapd_iface *iface) in hostapd_notify_bad_chans() argument
1180 if (!iface->current_mode) { in hostapd_notify_bad_chans()
1181 hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211, in hostapd_notify_bad_chans()
1186 hostapd_logger(iface->bss[0], NULL, in hostapd_notify_bad_chans()
1190 iface->conf->channel, in hostapd_notify_bad_chans()
1191 iface->freq, iface->conf->secondary_channel, in hostapd_notify_bad_chans()
1192 iface->current_mode->mode, in hostapd_notify_bad_chans()
1193 hostapd_hw_mode_txt(iface->current_mode->mode)); in hostapd_notify_bad_chans()
1194 hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211, in hostapd_notify_bad_chans()
1200 int hostapd_acs_completed(struct hostapd_iface *iface, int err) in hostapd_acs_completed() argument
1207 switch (hostapd_check_chans(iface)) { in hostapd_acs_completed()
1209 iface->is_no_ir = false; in hostapd_acs_completed()
1210 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, in hostapd_acs_completed()
1212 iface->freq, iface->conf->channel); in hostapd_acs_completed()
1216 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED); in hostapd_acs_completed()
1217 hostapd_notify_bad_chans(iface); in hostapd_acs_completed()
1220 iface->is_no_ir = true; in hostapd_acs_completed()
1225 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED); in hostapd_acs_completed()
1226 hostapd_notify_bad_chans(iface); in hostapd_acs_completed()
1230 ret = hostapd_check_ht_capab(iface); in hostapd_acs_completed()
1240 return hostapd_setup_interface_complete(iface, ret); in hostapd_acs_completed()
1251 int hostapd_csa_update_hwmode(struct hostapd_iface *iface) in hostapd_csa_update_hwmode() argument
1253 if (!iface || !iface->conf) in hostapd_csa_update_hwmode()
1256 iface->current_mode = NULL; in hostapd_csa_update_hwmode()
1257 iface->conf->hw_mode = HOSTAPD_MODE_IEEE80211ANY; in hostapd_csa_update_hwmode()
1259 return hostapd_determine_mode(iface); in hostapd_csa_update_hwmode()
1271 int hostapd_select_hw_mode(struct hostapd_iface *iface) in hostapd_select_hw_mode() argument
1275 if (iface->num_hw_features < 1) in hostapd_select_hw_mode()
1278 if ((iface->conf->hw_mode == HOSTAPD_MODE_IEEE80211G || in hostapd_select_hw_mode()
1279 iface->conf->ieee80211n || iface->conf->ieee80211ac || in hostapd_select_hw_mode()
1280 iface->conf->ieee80211ax || iface->conf->ieee80211be) && in hostapd_select_hw_mode()
1281 iface->conf->channel == 14) { in hostapd_select_hw_mode()
1283 iface->conf->hw_mode = HOSTAPD_MODE_IEEE80211B; in hostapd_select_hw_mode()
1284 iface->conf->ieee80211n = 0; in hostapd_select_hw_mode()
1285 iface->conf->ieee80211ac = 0; in hostapd_select_hw_mode()
1286 iface->conf->ieee80211ax = 0; in hostapd_select_hw_mode()
1287 iface->conf->ieee80211be = 0; in hostapd_select_hw_mode()
1290 iface->current_mode = NULL; in hostapd_select_hw_mode()
1291 for (i = 0; i < iface->num_hw_features; i++) { in hostapd_select_hw_mode()
1292 struct hostapd_hw_modes *mode = &iface->hw_features[i]; in hostapd_select_hw_mode()
1294 if (mode->mode == iface->conf->hw_mode) { in hostapd_select_hw_mode()
1295 if (skip_mode(iface, mode)) in hostapd_select_hw_mode()
1298 iface->current_mode = mode; in hostapd_select_hw_mode()
1303 if (iface->current_mode == NULL) { in hostapd_select_hw_mode()
1304 if ((iface->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) && in hostapd_select_hw_mode()
1305 (iface->drv_flags & WPA_DRIVER_FLAGS_SUPPORT_HW_MODE_ANY)) { in hostapd_select_hw_mode()
1308 } else if (!(iface->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) && in hostapd_select_hw_mode()
1309 iface->conf->hw_mode == HOSTAPD_MODE_IEEE80211ANY) { in hostapd_select_hw_mode()
1315 hostapd_logger(iface->bss[0], NULL, in hostapd_select_hw_mode()
1319 (int) iface->conf->hw_mode); in hostapd_select_hw_mode()
1321 supplicant_send_wifi_mgmt_ap_status(iface->owner, in hostapd_select_hw_mode()
1329 switch (hostapd_check_chans(iface)) { in hostapd_select_hw_mode()
1331 iface->is_no_ir = false; in hostapd_select_hw_mode()
1336 iface->is_no_ir = true; in hostapd_select_hw_mode()
1340 hostapd_notify_bad_chans(iface); in hostapd_select_hw_mode()
1365 return hw_get_freq(hapd->iface->current_mode, chan); in hostapd_hw_get_freq()
1374 if (hapd->iface->current_mode) { in hostapd_hw_get_channel()
1375 channel = hw_get_chan(hapd->iface->current_mode->mode, freq, in hostapd_hw_get_channel()
1376 hapd->iface->hw_features, in hostapd_hw_get_channel()
1377 hapd->iface->num_hw_features); in hostapd_hw_get_channel()
1384 if (!hapd->iface->hw_features) in hostapd_hw_get_channel()
1386 for (i = 0; i < hapd->iface->num_hw_features; i++) { in hostapd_hw_get_channel()
1387 mode = &hapd->iface->hw_features[i]; in hostapd_hw_get_channel()
1389 hapd->iface->hw_features, in hostapd_hw_get_channel()
1390 hapd->iface->num_hw_features); in hostapd_hw_get_channel()
1398 int hostapd_hw_skip_mode(struct hostapd_iface *iface, in hostapd_hw_skip_mode() argument
1403 if (iface->current_mode) in hostapd_hw_skip_mode()
1404 return mode != iface->current_mode; in hostapd_hw_skip_mode()
1407 for (i = 0; i < iface->num_hw_features; i++) { in hostapd_hw_skip_mode()
1408 if (iface->hw_features[i].mode == HOSTAPD_MODE_IEEE80211G) in hostapd_hw_skip_mode()