Lines Matching +full:hw +full:- +full:channels
3 * Copyright 2002-2003, Instant802 Networks, Inc.
4 * Copyright 2005-2006, Devicescape Software, Inc.
5 * Copyright (c) 2008-2012, Jouni Malinen <j@w1.fi>
37 os_free(hw_features[i].channels); in hostapd_free_hw_features()
51 switch (chan->flag & HOSTAPD_CHAN_DFS_MASK) { in dfs_info()
68 info[sizeof(info) - 1] = '\0'; in dfs_info()
77 struct hostapd_data *hapd = iface->bss[0]; in hostapd_get_hw_features()
87 return -1; in hostapd_get_hw_features()
95 return -1; 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()
104 * hw mode is valid. Clear iface->current_mode temporarily as 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()
119 int dfs_enabled = hapd->iconf->ieee80211h && in hostapd_get_hw_features()
120 (iface->drv_flags & WPA_DRIVER_FLAGS_RADAR); in hostapd_get_hw_features()
123 if (orig_mode_valid && feature->mode == mode && in hostapd_get_hw_features()
124 feature->num_channels > 0 && in hostapd_get_hw_features()
125 is_6ghz == is_6ghz_freq(feature->channels[0].freq)) in hostapd_get_hw_features()
126 iface->current_mode = feature; in hostapd_get_hw_features()
128 /* set flag for channels we can use in current regulatory in hostapd_get_hw_features()
130 for (j = 0; j < feature->num_channels; j++) { in hostapd_get_hw_features()
134 * Disable all channels that are marked not to allow in hostapd_get_hw_features()
137 * Use radar channels only if the driver supports DFS. in hostapd_get_hw_features()
139 if ((feature->channels[j].flag & in hostapd_get_hw_features()
142 } else if (((feature->channels[j].flag & in hostapd_get_hw_features()
144 !(iface->drv_flags & in hostapd_get_hw_features()
146 (feature->channels[j].flag & in hostapd_get_hw_features()
148 feature->channels[j].flag |= in hostapd_get_hw_features()
152 if (feature->channels[j].flag & HOSTAPD_CHAN_DISABLED) in hostapd_get_hw_features()
157 feature->mode, in hostapd_get_hw_features()
158 feature->channels[j].chan, in hostapd_get_hw_features()
159 feature->channels[j].freq, in hostapd_get_hw_features()
160 feature->channels[j].max_tx_power, in hostapd_get_hw_features()
161 dfs ? dfs_info(&feature->channels[j]) : ""); in hostapd_get_hw_features()
165 if (orig_mode_valid && !iface->current_mode) { in hostapd_get_hw_features()
167 "%s: Could not update iface->current_mode", in hostapd_get_hw_features()
179 int basic_rates_a[] = { 60, 120, 240, -1 }; in hostapd_prepare_rates()
180 int basic_rates_b[] = { 10, 20, -1 }; in hostapd_prepare_rates()
181 int basic_rates_g[] = { 10, 20, 55, 110, -1 }; in hostapd_prepare_rates()
184 if (iface->conf->basic_rates) in hostapd_prepare_rates()
185 basic_rates = iface->conf->basic_rates; in hostapd_prepare_rates()
186 else switch (mode->mode) { in hostapd_prepare_rates()
199 return -1; in hostapd_prepare_rates()
206 i++; /* -1 termination */ 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()
216 os_calloc(mode->num_rates, sizeof(struct hostapd_rate_data)); in hostapd_prepare_rates()
217 if (!iface->current_rates) { in hostapd_prepare_rates()
220 return -1; in hostapd_prepare_rates()
223 for (i = 0; i < mode->num_rates; i++) { 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()
228 mode->rates[i])) in hostapd_prepare_rates()
231 rate = &iface->current_rates[iface->num_rates]; in hostapd_prepare_rates()
232 rate->rate = mode->rates[i]; in hostapd_prepare_rates()
233 if (hostapd_rate_found(basic_rates, rate->rate)) { in hostapd_prepare_rates()
234 rate->flags |= HOSTAPD_RATE_BASIC; 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()
247 return -1; in hostapd_prepare_rates()
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()
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()
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()
316 "Cannot switch PRI/SEC channels due to local constraint"); in ieee80211n_check_40mhz_5g()
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()
346 * allowed per IEEE Std 802.11-2012, 10.15.3.2 */ in ieee80211n_check_scan()
348 iface->scan_cb = NULL; in ieee80211n_check_scan()
350 scan_res = hostapd_driver_get_scan_results(iface->bss[0]); in ieee80211n_check_scan()
356 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A) 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()
386 if (!(he_cap->phy_cap[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] & in ieee80211n_check_scan()
390 iface->conf->secondary_channel = 0; in ieee80211n_check_scan()
395 if (iface->conf->secondary_channel) 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()
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()
426 sec_freq = pri_freq - 20; in ieee80211n_scan_channels_2g4()
432 affected_start = (pri_freq + sec_freq) / 2 - 40; in ieee80211n_scan_channels_2g4()
437 mode = iface->current_mode; in ieee80211n_scan_channels_2g4()
438 params->freqs = os_calloc(mode->num_channels + 1, sizeof(int)); in ieee80211n_scan_channels_2g4()
439 if (params->freqs == NULL) in ieee80211n_scan_channels_2g4()
443 for (i = 0; i < mode->num_channels; i++) { in ieee80211n_scan_channels_2g4()
444 struct hostapd_channel_data *chan = &mode->channels[i]; in ieee80211n_scan_channels_2g4()
445 if (chan->flag & HOSTAPD_CHAN_DISABLED) in ieee80211n_scan_channels_2g4()
447 if (chan->freq < affected_start || in ieee80211n_scan_channels_2g4()
448 chan->freq > affected_end) in ieee80211n_scan_channels_2g4()
450 params->freqs[pos++] = chan->freq; in ieee80211n_scan_channels_2g4()
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()
469 affected_start = pri_freq - 10; in ieee80211n_scan_channels_5g()
472 affected_start = pri_freq - 30; in ieee80211n_scan_channels_5g()
478 mode = iface->current_mode; in ieee80211n_scan_channels_5g()
479 params->freqs = os_calloc(mode->num_channels + 1, sizeof(int)); in ieee80211n_scan_channels_5g()
480 if (params->freqs == NULL) in ieee80211n_scan_channels_5g()
484 for (i = 0; i < mode->num_channels; i++) { in ieee80211n_scan_channels_5g()
485 struct hostapd_channel_data *chan = &mode->channels[i]; in ieee80211n_scan_channels_5g()
486 if (chan->flag & HOSTAPD_CHAN_DISABLED) in ieee80211n_scan_channels_5g()
488 if (chan->freq < affected_start || in ieee80211n_scan_channels_5g()
489 chan->freq > affected_end) in ieee80211n_scan_channels_5g()
491 params->freqs[pos++] = chan->freq; in ieee80211n_scan_channels_5g()
504 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in ap_ht40_scan_retry()
509 params.link_id = -1; 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], ¶ms); in ap_ht40_scan_retry()
516 iface->num_ht40_scan_tries++; in ap_ht40_scan_retry()
519 if (ret == -EBUSY && in ap_ht40_scan_retry()
520 iface->num_ht40_scan_tries < HT2040_COEX_SCAN_RETRY) { in ap_ht40_scan_retry()
522 "Failed to request a scan of neighboring BSSes ret=%d (%s) - try to scan again (attempt %d)", in ap_ht40_scan_retry()
523 ret, strerror(-ret), iface->num_ht40_scan_tries); 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()
554 if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch) in ieee80211n_check_40mhz()
561 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in ieee80211n_check_40mhz()
566 params.link_id = -1; 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], ¶ms); in ieee80211n_check_40mhz()
574 if (ret == -EBUSY) { in ieee80211n_check_40mhz()
576 "Failed to request a scan of neighboring BSSes ret=%d (%s) - try to scan again", in ieee80211n_check_40mhz()
577 ret, strerror(-ret)); in ieee80211n_check_40mhz()
578 iface->num_ht40_scan_tries = 1; in ieee80211n_check_40mhz()
587 ret, strerror(-ret)); in ieee80211n_check_40mhz()
588 return -1; 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()
599 u16 hw = iface->current_mode->ht_capab; in ieee80211n_supported_ht_capab() local
600 u16 conf = iface->conf->ht_capab; in ieee80211n_supported_ht_capab()
603 !(hw & HT_CAP_INFO_LDPC_CODING_CAP)) { in ieee80211n_supported_ht_capab()
613 if (!iface->conf->acs && (conf & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) && in ieee80211n_supported_ht_capab()
614 !(hw & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET)) { in ieee80211n_supported_ht_capab()
621 !(hw & HT_CAP_INFO_GREEN_FIELD)) { in ieee80211n_supported_ht_capab()
628 !(hw & HT_CAP_INFO_SHORT_GI20MHZ)) { in ieee80211n_supported_ht_capab()
630 "HT capability [SHORT-GI-20]"); in ieee80211n_supported_ht_capab()
635 !(hw & HT_CAP_INFO_SHORT_GI40MHZ)) { in ieee80211n_supported_ht_capab()
637 "HT capability [SHORT-GI-40]"); in ieee80211n_supported_ht_capab()
641 if ((conf & HT_CAP_INFO_TX_STBC) && !(hw & HT_CAP_INFO_TX_STBC)) { in ieee80211n_supported_ht_capab()
643 "HT capability [TX-STBC]"); in ieee80211n_supported_ht_capab()
648 (hw & HT_CAP_INFO_RX_STBC_MASK)) { in ieee80211n_supported_ht_capab()
650 "HT capability [RX-STBC*]"); in ieee80211n_supported_ht_capab()
655 !(hw & HT_CAP_INFO_DELAYED_BA)) { in ieee80211n_supported_ht_capab()
657 "HT capability [DELAYED-BA]"); in ieee80211n_supported_ht_capab()
662 !(hw & HT_CAP_INFO_MAX_AMSDU_SIZE)) { in ieee80211n_supported_ht_capab()
664 "HT capability [MAX-AMSDU-7935]"); in ieee80211n_supported_ht_capab()
669 !(hw & HT_CAP_INFO_DSSS_CCK40MHZ)) { in ieee80211n_supported_ht_capab()
671 "HT capability [DSSS_CCK-40]"); in ieee80211n_supported_ht_capab()
676 !(hw & HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT)) { in ieee80211n_supported_ht_capab()
678 "HT capability [LSIG-TXOP-PROT]"); in ieee80211n_supported_ht_capab()
689 struct hostapd_hw_modes *mode = iface->current_mode; in ieee80211ac_supported_vht_capab()
690 u32 hw = mode->vht_capab; in ieee80211ac_supported_vht_capab() local
691 u32 conf = iface->conf->vht_capab; in ieee80211ac_supported_vht_capab()
693 wpa_printf(MSG_DEBUG, "hw vht capab: 0x%x, conf vht capab: 0x%x", in ieee80211ac_supported_vht_capab()
694 hw, conf); in ieee80211ac_supported_vht_capab()
696 if (mode->mode == HOSTAPD_MODE_IEEE80211G && 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()
705 hw = mode->vht_capab; in ieee80211ac_supported_vht_capab()
707 "update hw vht capab based on 5 GHz band: 0x%x", in ieee80211ac_supported_vht_capab()
708 hw); in ieee80211ac_supported_vht_capab()
714 return ieee80211ac_cap_check(hw, conf); in ieee80211ac_supported_vht_capab()
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()
740 "Disable HT capability [DSSS_CCK-40] on 5 GHz band"); in hostapd_check_ht_capab()
741 iface->conf->ht_capab &= ~HT_CAP_INFO_DSSS_CCK40MHZ; in hostapd_check_ht_capab()
745 return -1; in hostapd_check_ht_capab()
747 if (iface->conf->ieee80211ax && in hostapd_check_ht_capab()
749 return -1; in hostapd_check_ht_capab()
752 if (iface->conf->ieee80211ac && in hostapd_check_ht_capab()
754 return -1; in hostapd_check_ht_capab()
760 return -1; in hostapd_check_ht_capab()
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()
779 if (mode->edmg.channels && ieee802_edmg_is_allowed(mode->edmg, edmg)) in hostapd_check_edmg_capab()
783 wpa_printf(MSG_INFO, "EDMG capab: channels 0x%x, bw_config %d", in hostapd_check_edmg_capab()
784 mode->edmg.channels, mode->edmg.bw_config); in hostapd_check_edmg_capab()
786 "Requested EDMG configuration: channels 0x%x, bw_config %d", in hostapd_check_edmg_capab()
787 edmg.channels, edmg.bw_config); in hostapd_check_edmg_capab()
788 return -1; in hostapd_check_edmg_capab()
796 u16 hw; in hostapd_check_he_6ghz_capab() local
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()
802 hw = he_cap->he_6ghz_capa; in hostapd_check_he_6ghz_capab()
803 if (iface->conf->he_6ghz_max_mpdu > in hostapd_check_he_6ghz_capab()
804 ((hw & HE_6GHZ_BAND_CAP_MAX_MPDU_LEN_MASK) >> in hostapd_check_he_6ghz_capab()
808 return -1; in hostapd_check_he_6ghz_capab()
811 if (iface->conf->he_6ghz_max_ampdu_len_exp > in hostapd_check_he_6ghz_capab()
812 ((hw & HE_6GHZ_BAND_CAP_MAX_AMPDU_LEN_EXP_MASK) >> in hostapd_check_he_6ghz_capab()
816 return -1; in hostapd_check_he_6ghz_capab()
819 if (iface->conf->he_6ghz_rx_ant_pat && in hostapd_check_he_6ghz_capab()
820 !(hw & HE_6GHZ_BAND_CAP_RX_ANTPAT_CONS)) { in hostapd_check_he_6ghz_capab()
823 return -1; in hostapd_check_he_6ghz_capab()
826 if (iface->conf->he_6ghz_tx_ant_pat && in hostapd_check_he_6ghz_capab()
827 !(hw & HE_6GHZ_BAND_CAP_TX_ANTPAT_CONS)) { in hostapd_check_he_6ghz_capab()
830 return -1; in hostapd_check_he_6ghz_capab()
840 * -1 = not currently usable due to 6 GHz NO-IR
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()
856 (!primary && !(chan->flag & HOSTAPD_CHAN_DISABLED))) in hostapd_is_usable_chan()
862 chan->flag, in hostapd_is_usable_chan()
863 chan->flag & HOSTAPD_CHAN_NO_IR ? " NO-IR" : "", in hostapd_is_usable_chan()
864 chan->flag & HOSTAPD_CHAN_RADAR ? " RADAR" : ""); in hostapd_is_usable_chan()
866 if (is_6ghz_freq(chan->freq) && (chan->flag & HOSTAPD_CHAN_NO_IR)) in hostapd_is_usable_chan()
867 return -1; in hostapd_is_usable_chan()
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()
895 pri_chan->chan, in hostapd_is_usable_edmg()
897 if (!(edmg.channels & BIT(pri_chan->chan - 1))) in hostapd_is_usable_edmg()
900 /* 60 GHz channels 1..6 */ in hostapd_is_usable_edmg()
904 if (edmg.channels & BIT(i)) { in hostapd_is_usable_edmg()
929 /* check bw_config against contiguous EDMG channels */ in hostapd_is_usable_edmg()
950 struct hostapd_config *conf = iface->conf; in hostapd_is_usable_punct_bitmap()
954 if (!conf->punct_bitmap) in hostapd_is_usable_punct_bitmap()
957 if (!conf->ieee80211be) { in hostapd_is_usable_punct_bitmap()
963 if (iface->freq >= 2412 && iface->freq <= 2484) { in hostapd_is_usable_punct_bitmap()
973 if (conf->op_class == 137) { in hostapd_is_usable_punct_bitmap()
975 start_chan = conf->eht_oper_centr_freq_seg0_idx - 30; in hostapd_is_usable_punct_bitmap()
977 switch (conf->eht_oper_chwidth) { in hostapd_is_usable_punct_bitmap()
984 start_chan = conf->eht_oper_centr_freq_seg0_idx - 6; in hostapd_is_usable_punct_bitmap()
988 start_chan = conf->eht_oper_centr_freq_seg0_idx - 14; in hostapd_is_usable_punct_bitmap()
995 if (!is_punct_bitmap_valid(bw, (conf->channel - start_chan) / 4, in hostapd_is_usable_punct_bitmap()
996 conf->punct_bitmap)) { in hostapd_is_usable_punct_bitmap()
1009 * -1 = not currently usable due to 6 GHz NO-IR
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()
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()
1047 (pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40P)) in hostapd_is_usable_chans()
1049 if (iface->conf->secondary_channel == -1 && in hostapd_is_usable_chans()
1050 (pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40M)) in hostapd_is_usable_chans()
1053 if (!iface->conf->ht40_plus_minus_allowed) in hostapd_is_usable_chans()
1056 /* Both HT40+ and HT40- are set, pick a valid secondary channel */ in hostapd_is_usable_chans()
1057 secondary_freq = iface->freq + 20; in hostapd_is_usable_chans()
1059 if (err2 > 0 && (pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40P)) { 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()
1066 if (err2 > 0 && (pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40M)) { in hostapd_is_usable_chans()
1067 iface->conf->secondary_channel = -1; in hostapd_is_usable_chans()
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()
1084 !mode->is_6ghz) in skip_mode()
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()
1111 if (mode->mode == target_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()
1123 return -1; in hostapd_determine_mode()
1132 if (iface->freq) { in hostapd_check_chans()
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()
1188 int ret = -1; 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()
1201 wpa_printf(MSG_ERROR, "ACS error - reported complete, but no result available"); in hostapd_acs_completed()
1202 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED); in hostapd_acs_completed()
1206 iface->is_no_ir = true; in hostapd_acs_completed()
1210 wpa_printf(MSG_ERROR, "ACS picked unusable channels"); in hostapd_acs_completed()
1211 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED); in hostapd_acs_completed()
1231 * hostapd_csa_update_hwmode - Update hardware mode
1239 if (!iface || !iface->conf) in hostapd_csa_update_hwmode()
1240 return -1; 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()
1250 * hostapd_select_hw_mode - Select the hardware mode
1261 if (iface->num_hw_features < 1) in hostapd_select_hw_mode()
1262 return -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()
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()
1306 return -2; 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()
1322 return -3; 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()
1369 channel = hw_get_chan(mode->mode, freq, 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()
1384 if (iface->current_mode) in hostapd_hw_skip_mode()
1385 return mode != iface->current_mode; in hostapd_hw_skip_mode()
1386 if (mode->mode != HOSTAPD_MODE_IEEE80211B) 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()