Lines Matching refs:iface

75 int hostapd_get_hw_features(struct hostapd_iface *iface)  in hostapd_get_hw_features()  argument
77 struct hostapd_data *hapd = iface->bss[0]; in hostapd_get_hw_features()
98 iface->hw_flags = flags; in hostapd_get_hw_features()
99 iface->dfs_domain = dfs_domain; in hostapd_get_hw_features()
101 if (iface->current_mode) { in hostapd_get_hw_features()
109 mode = iface->current_mode->mode; in hostapd_get_hw_features()
110 is_6ghz = iface->current_mode->is_6ghz; in hostapd_get_hw_features()
111 iface->current_mode = NULL; in hostapd_get_hw_features()
113 hostapd_free_hw_features(iface->hw_features, iface->num_hw_features); in hostapd_get_hw_features()
114 iface->hw_features = modes; in hostapd_get_hw_features()
115 iface->num_hw_features = num_modes; in hostapd_get_hw_features()
120 (iface->drv_flags & WPA_DRIVER_FLAGS_RADAR); in hostapd_get_hw_features()
126 iface->current_mode = feature; in hostapd_get_hw_features()
144 !(iface->drv_flags & in hostapd_get_hw_features()
165 if (orig_mode_valid && !iface->current_mode) { in hostapd_get_hw_features()
175 int hostapd_prepare_rates(struct hostapd_iface *iface, in hostapd_prepare_rates() argument
184 if (iface->conf->basic_rates) in hostapd_prepare_rates()
185 basic_rates = iface->conf->basic_rates; in hostapd_prepare_rates()
207 os_free(iface->basic_rates); in hostapd_prepare_rates()
208 iface->basic_rates = os_malloc(i * sizeof(int)); in hostapd_prepare_rates()
209 if (iface->basic_rates) in hostapd_prepare_rates()
210 os_memcpy(iface->basic_rates, basic_rates, i * sizeof(int)); in hostapd_prepare_rates()
212 os_free(iface->current_rates); in hostapd_prepare_rates()
213 iface->num_rates = 0; in hostapd_prepare_rates()
215 iface->current_rates = in hostapd_prepare_rates()
217 if (!iface->current_rates) { in hostapd_prepare_rates()
226 if (iface->conf->supported_rates && in hostapd_prepare_rates()
227 !hostapd_rate_found(iface->conf->supported_rates, in hostapd_prepare_rates()
231 rate = &iface->current_rates[iface->num_rates]; in hostapd_prepare_rates()
238 iface->num_rates, rate->rate, rate->flags); in hostapd_prepare_rates()
239 iface->num_rates++; in hostapd_prepare_rates()
242 if ((iface->num_rates == 0 || num_basic_rates == 0) && in hostapd_prepare_rates()
243 (!iface->conf->ieee80211n || !iface->conf->require_ht)) { in hostapd_prepare_rates()
246 iface->num_rates, num_basic_rates); in hostapd_prepare_rates()
254 static int ieee80211n_allowed_ht40_channel_pair(struct hostapd_iface *iface) in ieee80211n_allowed_ht40_channel_pair() argument
259 pri_freq = iface->freq; in ieee80211n_allowed_ht40_channel_pair()
260 sec_freq = pri_freq + iface->conf->secondary_channel * 20; in ieee80211n_allowed_ht40_channel_pair()
262 if (!iface->current_mode) in ieee80211n_allowed_ht40_channel_pair()
265 p_chan = hw_get_channel_freq(iface->current_mode->mode, pri_freq, NULL, in ieee80211n_allowed_ht40_channel_pair()
266 iface->hw_features, in ieee80211n_allowed_ht40_channel_pair()
267 iface->num_hw_features); in ieee80211n_allowed_ht40_channel_pair()
269 s_chan = hw_get_channel_freq(iface->current_mode->mode, sec_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 return allowed_ht40_channel_pair(iface->current_mode->mode, in ieee80211n_allowed_ht40_channel_pair()
278 static void ieee80211n_switch_pri_sec(struct hostapd_iface *iface) in ieee80211n_switch_pri_sec() argument
280 if (iface->conf->secondary_channel > 0) { in ieee80211n_switch_pri_sec()
281 iface->conf->channel += 4; in ieee80211n_switch_pri_sec()
282 iface->freq += 20; in ieee80211n_switch_pri_sec()
283 iface->conf->secondary_channel = -1; 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()
292 static int ieee80211n_check_40mhz_5g(struct hostapd_iface *iface, in ieee80211n_check_40mhz_5g() argument
299 pri_freq = iface->freq; in ieee80211n_check_40mhz_5g()
300 sec_freq = pri_freq + iface->conf->secondary_channel * 20; in ieee80211n_check_40mhz_5g()
302 if (!iface->current_mode) in ieee80211n_check_40mhz_5g()
304 pri_chan = hw_get_channel_freq(iface->current_mode->mode, pri_freq, in ieee80211n_check_40mhz_5g()
305 NULL, iface->hw_features, in ieee80211n_check_40mhz_5g()
306 iface->num_hw_features); in ieee80211n_check_40mhz_5g()
307 sec_chan = hw_get_channel_freq(iface->current_mode->mode, sec_freq, in ieee80211n_check_40mhz_5g()
308 NULL, iface->hw_features, in ieee80211n_check_40mhz_5g()
309 iface->num_hw_features); in ieee80211n_check_40mhz_5g()
314 if (iface->conf->no_pri_sec_switch) { in ieee80211n_check_40mhz_5g()
318 ieee80211n_switch_pri_sec(iface); in ieee80211n_check_40mhz_5g()
326 static int ieee80211n_check_40mhz_2g4(struct hostapd_iface *iface, in ieee80211n_check_40mhz_2g4() argument
331 pri_chan = iface->conf->channel; in ieee80211n_check_40mhz_2g4()
332 sec_chan = pri_chan + iface->conf->secondary_channel * 4; in ieee80211n_check_40mhz_2g4()
334 return check_40mhz_2g4(iface->current_mode, scan_res, pri_chan, in ieee80211n_check_40mhz_2g4()
339 static void ieee80211n_check_scan(struct hostapd_iface *iface) in ieee80211n_check_scan() argument
348 iface->scan_cb = NULL; in ieee80211n_check_scan()
350 scan_res = hostapd_driver_get_scan_results(iface->bss[0]); in ieee80211n_check_scan()
352 hostapd_setup_interface_complete(iface, 1); in ieee80211n_check_scan()
356 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A) in ieee80211n_check_scan()
357 oper40 = ieee80211n_check_40mhz_5g(iface, scan_res); in ieee80211n_check_scan()
359 oper40 = ieee80211n_check_40mhz_2g4(iface, scan_res); in ieee80211n_check_scan()
362 iface->secondary_ch = iface->conf->secondary_channel; in ieee80211n_check_scan()
366 iface->conf->channel, in ieee80211n_check_scan()
367 iface->conf->channel + in ieee80211n_check_scan()
368 iface->conf->secondary_channel * 4); in ieee80211n_check_scan()
369 iface->conf->secondary_channel = 0; in ieee80211n_check_scan()
370 if (iface->drv_flags & WPA_DRIVER_FLAGS_HT_2040_COEX) { in ieee80211n_check_scan()
380 if (iface->conf->secondary_channel && in ieee80211n_check_scan()
381 iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G && in ieee80211n_check_scan()
382 iface->conf->ieee80211ax) { in ieee80211n_check_scan()
385 he_cap = &iface->current_mode->he_capab[IEEE80211_MODE_AP]; in ieee80211n_check_scan()
390 iface->conf->secondary_channel = 0; in ieee80211n_check_scan()
395 if (iface->conf->secondary_channel) in ieee80211n_check_scan()
396 res = ieee80211n_allowed_ht40_channel_pair(iface); in ieee80211n_check_scan()
398 iface->conf->secondary_channel = 0; in ieee80211n_check_scan()
399 hostapd_set_oper_centr_freq_seg0_idx(iface->conf, 0); in ieee80211n_check_scan()
400 hostapd_set_oper_centr_freq_seg1_idx(iface->conf, 0); in ieee80211n_check_scan()
401 hostapd_set_oper_chwidth(iface->conf, CONF_OPER_CHWIDTH_USE_HT); in ieee80211n_check_scan()
406 hostapd_setup_interface_complete(iface, !res); in ieee80211n_check_scan()
410 static void ieee80211n_scan_channels_2g4(struct hostapd_iface *iface, in ieee80211n_scan_channels_2g4() argument
419 if (iface->current_mode == NULL) in ieee80211n_scan_channels_2g4()
422 pri_freq = iface->freq; in ieee80211n_scan_channels_2g4()
423 if (iface->conf->secondary_channel > 0) in ieee80211n_scan_channels_2g4()
437 mode = iface->current_mode; in ieee80211n_scan_channels_2g4()
455 static void ieee80211n_scan_channels_5g(struct hostapd_iface *iface, in ieee80211n_scan_channels_5g() argument
464 if (iface->current_mode == NULL) in ieee80211n_scan_channels_5g()
467 pri_freq = iface->freq; in ieee80211n_scan_channels_5g()
468 if (iface->conf->secondary_channel > 0) { in ieee80211n_scan_channels_5g()
478 mode = iface->current_mode; in ieee80211n_scan_channels_5g()
499 struct hostapd_iface *iface = eloop_data; in ap_ht40_scan_retry() local
504 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in ap_ht40_scan_retry()
505 ieee80211n_scan_channels_2g4(iface, &params); in ap_ht40_scan_retry()
507 ieee80211n_scan_channels_5g(iface, &params); in ap_ht40_scan_retry()
511 if (iface->bss[0]->conf->mld_ap) in ap_ht40_scan_retry()
512 params.link_id = iface->bss[0]->mld_link_id; in ap_ht40_scan_retry()
515 ret = hostapd_driver_scan(iface->bss[0], &params); in ap_ht40_scan_retry()
516 iface->num_ht40_scan_tries++; in ap_ht40_scan_retry()
520 iface->num_ht40_scan_tries < HT2040_COEX_SCAN_RETRY) { in ap_ht40_scan_retry()
523 ret, strerror(-ret), iface->num_ht40_scan_tries); in ap_ht40_scan_retry()
524 eloop_register_timeout(1, 0, ap_ht40_scan_retry, iface, NULL); in ap_ht40_scan_retry()
529 iface->scan_cb = ieee80211n_check_scan; in ap_ht40_scan_retry()
530 iface->bss[0]->scan_cookie = params.scan_cookie; in ap_ht40_scan_retry()
536 iface->conf->secondary_channel = 0; in ap_ht40_scan_retry()
537 iface->conf->ht_capab &= ~HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET; in ap_ht40_scan_retry()
538 hostapd_setup_interface_complete(iface, 0); in ap_ht40_scan_retry()
542 void hostapd_stop_setup_timers(struct hostapd_iface *iface) in hostapd_stop_setup_timers() argument
544 eloop_cancel_timeout(ap_ht40_scan_retry, iface, NULL); in hostapd_stop_setup_timers()
548 static int ieee80211n_check_40mhz(struct hostapd_iface *iface) in ieee80211n_check_40mhz() argument
554 if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch) in ieee80211n_check_40mhz()
557 hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); in ieee80211n_check_40mhz()
561 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in ieee80211n_check_40mhz()
562 ieee80211n_scan_channels_2g4(iface, &params); in ieee80211n_check_40mhz()
564 ieee80211n_scan_channels_5g(iface, &params); in ieee80211n_check_40mhz()
568 if (iface->bss[0]->conf->mld_ap) in ieee80211n_check_40mhz()
569 params.link_id = iface->bss[0]->mld_link_id; in ieee80211n_check_40mhz()
571 ret = hostapd_driver_scan(iface->bss[0], &params); in ieee80211n_check_40mhz()
578 iface->num_ht40_scan_tries = 1; in ieee80211n_check_40mhz()
579 eloop_cancel_timeout(ap_ht40_scan_retry, iface, NULL); in ieee80211n_check_40mhz()
580 eloop_register_timeout(1, 0, ap_ht40_scan_retry, iface, NULL); in ieee80211n_check_40mhz()
591 iface->scan_cb = ieee80211n_check_scan; in ieee80211n_check_40mhz()
592 iface->bss[0]->scan_cookie = params.scan_cookie; in ieee80211n_check_40mhz()
597 static int ieee80211n_supported_ht_capab(struct hostapd_iface *iface) in ieee80211n_supported_ht_capab() argument
599 u16 hw = iface->current_mode->ht_capab; in ieee80211n_supported_ht_capab()
600 u16 conf = iface->conf->ht_capab; in ieee80211n_supported_ht_capab()
613 if (!iface->conf->acs && (conf & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) && in ieee80211n_supported_ht_capab()
687 static int ieee80211ac_supported_vht_capab(struct hostapd_iface *iface) in ieee80211ac_supported_vht_capab() argument
689 struct hostapd_hw_modes *mode = iface->current_mode; in ieee80211ac_supported_vht_capab()
691 u32 conf = iface->conf->vht_capab; in ieee80211ac_supported_vht_capab()
697 iface->conf->bss[0]->vendor_vht && in ieee80211ac_supported_vht_capab()
698 mode->vht_capab == 0 && iface->hw_features) { in ieee80211ac_supported_vht_capab()
701 for (i = 0; i < iface->num_hw_features; i++) { in ieee80211ac_supported_vht_capab()
702 if (iface->hw_features[i].mode == in ieee80211ac_supported_vht_capab()
704 mode = &iface->hw_features[i]; in ieee80211ac_supported_vht_capab()
720 static int ieee80211ax_supported_he_capab(struct hostapd_iface *iface) in ieee80211ax_supported_he_capab() argument
727 int hostapd_check_ht_capab(struct hostapd_iface *iface) in hostapd_check_ht_capab() argument
731 if (is_6ghz_freq(iface->freq)) in hostapd_check_ht_capab()
733 if (!iface->conf->ieee80211n) in hostapd_check_ht_capab()
736 if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211B && in hostapd_check_ht_capab()
737 iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G && in hostapd_check_ht_capab()
738 (iface->conf->ht_capab & HT_CAP_INFO_DSSS_CCK40MHZ)) { in hostapd_check_ht_capab()
741 iface->conf->ht_capab &= ~HT_CAP_INFO_DSSS_CCK40MHZ; in hostapd_check_ht_capab()
744 if (!ieee80211n_supported_ht_capab(iface)) in hostapd_check_ht_capab()
747 if (iface->conf->ieee80211ax && in hostapd_check_ht_capab()
748 !ieee80211ax_supported_he_capab(iface)) in hostapd_check_ht_capab()
752 if (iface->conf->ieee80211ac && in hostapd_check_ht_capab()
753 !ieee80211ac_supported_vht_capab(iface)) in hostapd_check_ht_capab()
756 ret = ieee80211n_check_40mhz(iface); in hostapd_check_ht_capab()
759 if (!ieee80211n_allowed_ht40_channel_pair(iface)) in hostapd_check_ht_capab()
766 int hostapd_check_edmg_capab(struct hostapd_iface *iface) in hostapd_check_edmg_capab() argument
768 struct hostapd_hw_modes *mode = iface->hw_features; in hostapd_check_edmg_capab()
771 if (!iface->conf->enable_edmg) in hostapd_check_edmg_capab()
774 hostapd_encode_edmg_chan(iface->conf->enable_edmg, in hostapd_check_edmg_capab()
775 iface->conf->edmg_channel, in hostapd_check_edmg_capab()
776 iface->conf->channel, in hostapd_check_edmg_capab()
792 int hostapd_check_he_6ghz_capab(struct hostapd_iface *iface) in hostapd_check_he_6ghz_capab() argument
798 if (!iface->current_mode || !is_6ghz_freq(iface->freq)) in hostapd_check_he_6ghz_capab()
801 he_cap = &iface->current_mode->he_capab[IEEE80211_MODE_AP]; in hostapd_check_he_6ghz_capab()
803 if (iface->conf->he_6ghz_max_mpdu > in hostapd_check_he_6ghz_capab()
811 if (iface->conf->he_6ghz_max_ampdu_len_exp > in hostapd_check_he_6ghz_capab()
819 if (iface->conf->he_6ghz_rx_ant_pat && in hostapd_check_he_6ghz_capab()
826 if (iface->conf->he_6ghz_tx_ant_pat && in hostapd_check_he_6ghz_capab()
842 static int hostapd_is_usable_chan(struct hostapd_iface *iface, in hostapd_is_usable_chan() argument
847 if (!iface->current_mode) in hostapd_is_usable_chan()
850 chan = hw_get_channel_freq(iface->current_mode->mode, frequency, NULL, in hostapd_is_usable_chan()
851 iface->hw_features, iface->num_hw_features); in hostapd_is_usable_chan()
873 static int hostapd_is_usable_edmg(struct hostapd_iface *iface) in hostapd_is_usable_edmg() argument
882 if (!iface->conf->enable_edmg) in hostapd_is_usable_edmg()
885 if (!iface->current_mode) in hostapd_is_usable_edmg()
887 pri_chan = hw_get_channel_freq(iface->current_mode->mode, in hostapd_is_usable_edmg()
888 iface->freq, NULL, in hostapd_is_usable_edmg()
889 iface->hw_features, in hostapd_is_usable_edmg()
890 iface->num_hw_features); in hostapd_is_usable_edmg()
893 hostapd_encode_edmg_chan(iface->conf->enable_edmg, in hostapd_is_usable_edmg()
894 iface->conf->edmg_channel, in hostapd_is_usable_edmg()
918 err = hostapd_is_usable_chan(iface, freq, 1); in hostapd_is_usable_edmg()
947 static bool hostapd_is_usable_punct_bitmap(struct hostapd_iface *iface) in hostapd_is_usable_punct_bitmap() argument
950 struct hostapd_config *conf = iface->conf; in hostapd_is_usable_punct_bitmap()
963 if (iface->freq >= 2412 && iface->freq <= 2484) { in hostapd_is_usable_punct_bitmap()
1011 static int hostapd_is_usable_chans(struct hostapd_iface *iface) in hostapd_is_usable_chans() argument
1017 if (!iface->current_mode) in hostapd_is_usable_chans()
1019 pri_chan = hw_get_channel_freq(iface->current_mode->mode, in hostapd_is_usable_chans()
1020 iface->freq, NULL, in hostapd_is_usable_chans()
1021 iface->hw_features, in hostapd_is_usable_chans()
1022 iface->num_hw_features); in hostapd_is_usable_chans()
1028 err = hostapd_is_usable_chan(iface, pri_chan->freq, 1); in hostapd_is_usable_chans()
1033 err = hostapd_is_usable_edmg(iface); in hostapd_is_usable_chans()
1037 if (!hostapd_is_usable_punct_bitmap(iface)) in hostapd_is_usable_chans()
1040 if (!iface->conf->secondary_channel) in hostapd_is_usable_chans()
1043 err = hostapd_is_usable_chan(iface, iface->freq + in hostapd_is_usable_chans()
1044 iface->conf->secondary_channel * 20, 0); in hostapd_is_usable_chans()
1046 if (iface->conf->secondary_channel == 1 && in hostapd_is_usable_chans()
1049 if (iface->conf->secondary_channel == -1 && in hostapd_is_usable_chans()
1053 if (!iface->conf->ht40_plus_minus_allowed) in hostapd_is_usable_chans()
1057 secondary_freq = iface->freq + 20; in hostapd_is_usable_chans()
1058 err2 = hostapd_is_usable_chan(iface, secondary_freq, 0); in hostapd_is_usable_chans()
1060 iface->conf->secondary_channel = 1; in hostapd_is_usable_chans()
1064 secondary_freq = iface->freq - 20; in hostapd_is_usable_chans()
1065 err2 = hostapd_is_usable_chan(iface, secondary_freq, 0); in hostapd_is_usable_chans()
1067 iface->conf->secondary_channel = -1; in hostapd_is_usable_chans()
1075 static bool skip_mode(struct hostapd_iface *iface, in skip_mode() argument
1080 if (iface->freq > 0 && !hw_mode_get_channel(mode, iface->freq, &chan)) in skip_mode()
1083 if (is_6ghz_op_class(iface->conf->op_class) && iface->freq == 0 && in skip_mode()
1091 int hostapd_determine_mode(struct hostapd_iface *iface) in hostapd_determine_mode() argument
1096 if (iface->current_mode || in hostapd_determine_mode()
1097 iface->conf->hw_mode != HOSTAPD_MODE_IEEE80211ANY) in hostapd_determine_mode()
1100 if (iface->freq < 4000) in hostapd_determine_mode()
1102 else if (iface->freq > 50000) in hostapd_determine_mode()
1107 for (i = 0; i < iface->num_hw_features; i++) { in hostapd_determine_mode()
1110 mode = &iface->hw_features[i]; in hostapd_determine_mode()
1112 if (skip_mode(iface, mode)) in hostapd_determine_mode()
1115 iface->current_mode = mode; in hostapd_determine_mode()
1116 iface->conf->hw_mode = mode->mode; in hostapd_determine_mode()
1121 if (!iface->current_mode) { in hostapd_determine_mode()
1130 hostapd_check_chans(struct hostapd_iface *iface) in hostapd_check_chans() argument
1132 if (iface->freq) { in hostapd_check_chans()
1135 hostapd_determine_mode(iface); in hostapd_check_chans()
1137 err = hostapd_is_usable_chans(iface); in hostapd_check_chans()
1151 switch (acs_init(iface)) { in hostapd_check_chans()
1164 static void hostapd_notify_bad_chans(struct hostapd_iface *iface) in hostapd_notify_bad_chans() argument
1166 if (!iface->current_mode) { in hostapd_notify_bad_chans()
1167 hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211, in hostapd_notify_bad_chans()
1172 hostapd_logger(iface->bss[0], NULL, in hostapd_notify_bad_chans()
1176 iface->conf->channel, in hostapd_notify_bad_chans()
1177 iface->freq, iface->conf->secondary_channel, in hostapd_notify_bad_chans()
1178 iface->current_mode->mode, in hostapd_notify_bad_chans()
1179 hostapd_hw_mode_txt(iface->current_mode->mode)); in hostapd_notify_bad_chans()
1180 hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211, in hostapd_notify_bad_chans()
1186 int hostapd_acs_completed(struct hostapd_iface *iface, int err) in hostapd_acs_completed() argument
1193 switch (hostapd_check_chans(iface)) { in hostapd_acs_completed()
1195 iface->is_no_ir = false; in hostapd_acs_completed()
1196 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, in hostapd_acs_completed()
1198 iface->freq, iface->conf->channel); in hostapd_acs_completed()
1202 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED); in hostapd_acs_completed()
1203 hostapd_notify_bad_chans(iface); in hostapd_acs_completed()
1206 iface->is_no_ir = true; in hostapd_acs_completed()
1211 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED); in hostapd_acs_completed()
1212 hostapd_notify_bad_chans(iface); in hostapd_acs_completed()
1216 ret = hostapd_check_ht_capab(iface); in hostapd_acs_completed()
1226 return hostapd_setup_interface_complete(iface, ret); in hostapd_acs_completed()
1237 int hostapd_csa_update_hwmode(struct hostapd_iface *iface) in hostapd_csa_update_hwmode() argument
1239 if (!iface || !iface->conf) in hostapd_csa_update_hwmode()
1242 iface->current_mode = NULL; in hostapd_csa_update_hwmode()
1243 iface->conf->hw_mode = HOSTAPD_MODE_IEEE80211ANY; in hostapd_csa_update_hwmode()
1245 return hostapd_determine_mode(iface); in hostapd_csa_update_hwmode()
1257 int hostapd_select_hw_mode(struct hostapd_iface *iface) in hostapd_select_hw_mode() argument
1261 if (iface->num_hw_features < 1) in hostapd_select_hw_mode()
1264 if ((iface->conf->hw_mode == HOSTAPD_MODE_IEEE80211G || in hostapd_select_hw_mode()
1265 iface->conf->ieee80211n || iface->conf->ieee80211ac || in hostapd_select_hw_mode()
1266 iface->conf->ieee80211ax || iface->conf->ieee80211be) && in hostapd_select_hw_mode()
1267 iface->conf->channel == 14) { in hostapd_select_hw_mode()
1269 iface->conf->hw_mode = HOSTAPD_MODE_IEEE80211B; in hostapd_select_hw_mode()
1270 iface->conf->ieee80211n = 0; in hostapd_select_hw_mode()
1271 iface->conf->ieee80211ac = 0; in hostapd_select_hw_mode()
1272 iface->conf->ieee80211ax = 0; in hostapd_select_hw_mode()
1273 iface->conf->ieee80211be = 0; in hostapd_select_hw_mode()
1276 iface->current_mode = NULL; in hostapd_select_hw_mode()
1277 for (i = 0; i < iface->num_hw_features; i++) { in hostapd_select_hw_mode()
1278 struct hostapd_hw_modes *mode = &iface->hw_features[i]; in hostapd_select_hw_mode()
1280 if (mode->mode == iface->conf->hw_mode) { in hostapd_select_hw_mode()
1281 if (skip_mode(iface, mode)) in hostapd_select_hw_mode()
1284 iface->current_mode = mode; in hostapd_select_hw_mode()
1289 if (iface->current_mode == NULL) { in hostapd_select_hw_mode()
1290 if ((iface->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) && in hostapd_select_hw_mode()
1291 (iface->drv_flags & WPA_DRIVER_FLAGS_SUPPORT_HW_MODE_ANY)) { in hostapd_select_hw_mode()
1294 } else if (!(iface->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) && in hostapd_select_hw_mode()
1295 iface->conf->hw_mode == HOSTAPD_MODE_IEEE80211ANY) { in hostapd_select_hw_mode()
1301 hostapd_logger(iface->bss[0], NULL, in hostapd_select_hw_mode()
1305 (int) iface->conf->hw_mode); in hostapd_select_hw_mode()
1310 switch (hostapd_check_chans(iface)) { in hostapd_select_hw_mode()
1312 iface->is_no_ir = false; in hostapd_select_hw_mode()
1317 iface->is_no_ir = true; in hostapd_select_hw_mode()
1321 hostapd_notify_bad_chans(iface); in hostapd_select_hw_mode()
1346 return hw_get_freq(hapd->iface->current_mode, chan); in hostapd_hw_get_freq()
1355 if (hapd->iface->current_mode) { in hostapd_hw_get_channel()
1356 channel = hw_get_chan(hapd->iface->current_mode->mode, freq, in hostapd_hw_get_channel()
1357 hapd->iface->hw_features, in hostapd_hw_get_channel()
1358 hapd->iface->num_hw_features); in hostapd_hw_get_channel()
1365 if (!hapd->iface->hw_features) in hostapd_hw_get_channel()
1367 for (i = 0; i < hapd->iface->num_hw_features; i++) { in hostapd_hw_get_channel()
1368 mode = &hapd->iface->hw_features[i]; in hostapd_hw_get_channel()
1370 hapd->iface->hw_features, in hostapd_hw_get_channel()
1371 hapd->iface->num_hw_features); in hostapd_hw_get_channel()
1379 int hostapd_hw_skip_mode(struct hostapd_iface *iface, in hostapd_hw_skip_mode() argument
1384 if (iface->current_mode) in hostapd_hw_skip_mode()
1385 return mode != iface->current_mode; in hostapd_hw_skip_mode()
1388 for (i = 0; i < iface->num_hw_features; i++) { in hostapd_hw_skip_mode()
1389 if (iface->hw_features[i].mode == HOSTAPD_MODE_IEEE80211G) in hostapd_hw_skip_mode()