Lines Matching full:iface
75 int hostapd_get_hw_features(struct hostapd_iface *iface)
77 struct hostapd_data *hapd = iface->bss[0];
93 iface->hw_flags = flags;
95 hostapd_free_hw_features(iface->hw_features, iface->num_hw_features);
96 iface->hw_features = modes;
97 iface->num_hw_features = num_modes;
102 (iface->drv_flags & WPA_DRIVER_FLAGS_RADAR);
120 !(iface->drv_flags &
145 int hostapd_prepare_rates(struct hostapd_iface *iface,
154 if (iface->conf->basic_rates)
155 basic_rates = iface->conf->basic_rates;
177 os_free(iface->basic_rates);
178 iface->basic_rates = os_malloc(i * sizeof(int));
179 if (iface->basic_rates)
180 os_memcpy(iface->basic_rates, basic_rates, i * sizeof(int));
182 os_free(iface->current_rates);
183 iface->num_rates = 0;
185 iface->current_rates =
187 if (!iface->current_rates) {
196 if (iface->conf->supported_rates &&
197 !hostapd_rate_found(iface->conf->supported_rates,
201 rate = &iface->current_rates[iface->num_rates];
208 iface->num_rates, rate->rate, rate->flags);
209 iface->num_rates++;
212 if ((iface->num_rates == 0 || num_basic_rates == 0) &&
213 (!iface->conf->ieee80211n || !iface->conf->require_ht)) {
216 iface->num_rates, num_basic_rates);
225 static int ieee80211n_allowed_ht40_channel_pair(struct hostapd_iface *iface)
229 if (!iface->conf->secondary_channel)
232 pri_chan = iface->conf->channel;
233 sec_chan = pri_chan + iface->conf->secondary_channel * 4;
235 return allowed_ht40_channel_pair(iface->current_mode, pri_chan,
240 static void ieee80211n_switch_pri_sec(struct hostapd_iface *iface)
242 if (iface->conf->secondary_channel > 0) {
243 iface->conf->channel += 4;
244 iface->conf->secondary_channel = -1;
246 iface->conf->channel -= 4;
247 iface->conf->secondary_channel = 1;
252 static int ieee80211n_check_40mhz_5g(struct hostapd_iface *iface,
258 pri_chan = iface->conf->channel;
259 sec_chan = pri_chan + iface->conf->secondary_channel * 4;
261 res = check_40mhz_5g(iface->current_mode, scan_res, pri_chan, sec_chan);
264 if (iface->conf->no_pri_sec_switch) {
268 ieee80211n_switch_pri_sec(iface);
276 static int ieee80211n_check_40mhz_2g4(struct hostapd_iface *iface,
281 pri_chan = iface->conf->channel;
282 sec_chan = pri_chan + iface->conf->secondary_channel * 4;
284 return check_40mhz_2g4(iface->current_mode, scan_res, pri_chan,
289 static void ieee80211n_check_scan(struct hostapd_iface *iface)
298 iface->scan_cb = NULL;
300 scan_res = hostapd_driver_get_scan_results(iface->bss[0]);
302 hostapd_setup_interface_complete(iface, 1);
306 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A)
307 oper40 = ieee80211n_check_40mhz_5g(iface, scan_res);
309 oper40 = ieee80211n_check_40mhz_2g4(iface, scan_res);
312 iface->secondary_ch = iface->conf->secondary_channel;
316 iface->conf->channel,
317 iface->conf->channel +
318 iface->conf->secondary_channel * 4);
319 iface->conf->secondary_channel = 0;
320 if (iface->drv_flags & WPA_DRIVER_FLAGS_HT_2040_COEX) {
329 res = ieee80211n_allowed_ht40_channel_pair(iface);
331 iface->conf->secondary_channel = 0;
336 hostapd_setup_interface_complete(iface, !res);
340 static void ieee80211n_scan_channels_2g4(struct hostapd_iface *iface,
349 if (iface->current_mode == NULL)
352 pri_freq = hostapd_hw_get_freq(iface->bss[0], iface->conf->channel);
353 if (iface->conf->secondary_channel > 0)
367 mode = iface->current_mode;
385 static void ieee80211n_scan_channels_5g(struct hostapd_iface *iface,
394 if (iface->current_mode == NULL)
397 pri_freq = hostapd_hw_get_freq(iface->bss[0], iface->conf->channel);
398 if (iface->conf->secondary_channel > 0) {
408 mode = iface->current_mode;
429 struct hostapd_iface *iface = eloop_data;
434 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G)
435 ieee80211n_scan_channels_2g4(iface, ¶ms);
437 ieee80211n_scan_channels_5g(iface, ¶ms);
439 ret = hostapd_driver_scan(iface->bss[0], ¶ms);
440 iface->num_ht40_scan_tries++;
444 iface->num_ht40_scan_tries < HT2040_COEX_SCAN_RETRY) {
447 ret, strerror(-ret), iface->num_ht40_scan_tries);
448 eloop_register_timeout(1, 0, ap_ht40_scan_retry, iface, NULL);
453 iface->scan_cb = ieee80211n_check_scan;
459 iface->conf->secondary_channel = 0;
460 iface->conf->ht_capab &= ~HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
461 hostapd_setup_interface_complete(iface, 0);
465 void hostapd_stop_setup_timers(struct hostapd_iface *iface)
467 eloop_cancel_timeout(ap_ht40_scan_retry, iface, NULL);
471 static int ieee80211n_check_40mhz(struct hostapd_iface *iface)
477 if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
480 hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
484 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G)
485 ieee80211n_scan_channels_2g4(iface, ¶ms);
487 ieee80211n_scan_channels_5g(iface, ¶ms);
489 ret = hostapd_driver_scan(iface->bss[0], ¶ms);
496 iface->num_ht40_scan_tries = 1;
497 eloop_cancel_timeout(ap_ht40_scan_retry, iface, NULL);
498 eloop_register_timeout(1, 0, ap_ht40_scan_retry, iface, NULL);
509 iface->scan_cb = ieee80211n_check_scan;
514 static int ieee80211n_supported_ht_capab(struct hostapd_iface *iface)
516 u16 hw = iface->current_mode->ht_capab;
517 u16 conf = iface->conf->ht_capab;
530 if (!iface->conf->acs && (conf & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) &&
539 if (!(iface->smps_modes & WPA_DRIVER_SMPS_MODE_STATIC)) {
546 if (!(iface->smps_modes & WPA_DRIVER_SMPS_MODE_DYNAMIC)) {
659 static int ieee80211ac_supported_vht_capab(struct hostapd_iface *iface)
661 struct hostapd_hw_modes *mode = iface->current_mode;
663 u32 conf = iface->conf->vht_capab;
669 iface->conf->bss[0]->vendor_vht &&
670 mode->vht_capab == 0 && iface->hw_features) {
673 for (i = 0; i < iface->num_hw_features; i++) {
674 if (iface->hw_features[i].mode ==
676 mode = &iface->hw_features[i];
731 int hostapd_check_ht_capab(struct hostapd_iface *iface)
735 if (!iface->conf->ieee80211n)
738 if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211B &&
739 iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G &&
740 (iface->conf->ht_capab & HT_CAP_INFO_DSSS_CCK40MHZ)) {
743 iface->conf->ht_capab &= ~HT_CAP_INFO_DSSS_CCK40MHZ;
746 if (!ieee80211n_supported_ht_capab(iface))
749 if (!ieee80211ac_supported_vht_capab(iface))
752 ret = ieee80211n_check_40mhz(iface);
755 if (!ieee80211n_allowed_ht40_channel_pair(iface))
763 static int hostapd_is_usable_chan(struct hostapd_iface *iface,
769 if (!iface->current_mode)
772 for (i = 0; i < iface->current_mode->num_channels; i++) {
773 chan = &iface->current_mode->channels[i];
792 static int hostapd_is_usable_chans(struct hostapd_iface *iface)
794 if (!hostapd_is_usable_chan(iface, iface->conf->channel, 1))
797 if (!iface->conf->secondary_channel)
800 return hostapd_is_usable_chan(iface, iface->conf->channel +
801 iface->conf->secondary_channel * 4, 0);
806 hostapd_check_chans(struct hostapd_iface *iface)
808 if (iface->conf->channel) {
809 if (hostapd_is_usable_chans(iface))
820 switch (acs_init(iface)) {
831 static void hostapd_notify_bad_chans(struct hostapd_iface *iface)
833 if (!iface->current_mode) {
834 hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211,
839 hostapd_logger(iface->bss[0], NULL,
844 iface->conf->channel,
845 iface->current_mode->mode,
846 hostapd_hw_mode_txt(iface->current_mode->mode));
847 hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211,
853 int hostapd_acs_completed(struct hostapd_iface *iface, int err)
860 switch (hostapd_check_chans(iface)) {
862 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO,
864 hostapd_hw_get_freq(iface->bss[0],
865 iface->conf->channel),
866 iface->conf->channel);
870 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED);
871 hostapd_notify_bad_chans(iface);
876 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED);
877 hostapd_notify_bad_chans(iface);
881 ret = hostapd_check_ht_capab(iface);
891 return hostapd_setup_interface_complete(iface, ret);
897 * @iface: Pointer to interface data.
903 int hostapd_select_hw_mode(struct hostapd_iface *iface)
907 if (iface->num_hw_features < 1)
910 if ((iface->conf->hw_mode == HOSTAPD_MODE_IEEE80211G ||
911 iface->conf->ieee80211n || iface->conf->ieee80211ac) &&
912 iface->conf->channel == 14) {
914 iface->conf->hw_mode = HOSTAPD_MODE_IEEE80211B;
915 iface->conf->ieee80211n = 0;
916 iface->conf->ieee80211ac = 0;
919 iface->current_mode = NULL;
920 for (i = 0; i < iface->num_hw_features; i++) {
921 struct hostapd_hw_modes *mode = &iface->hw_features[i];
922 if (mode->mode == iface->conf->hw_mode) {
923 iface->current_mode = mode;
928 if (iface->current_mode == NULL) {
929 if (!(iface->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) ||
930 !(iface->drv_flags & WPA_DRIVER_FLAGS_SUPPORT_HW_MODE_ANY))
934 hostapd_logger(iface->bss[0], NULL,
938 (int) iface->conf->hw_mode);
943 switch (hostapd_check_chans(iface)) {
950 hostapd_notify_bad_chans(iface);
975 return hw_get_freq(hapd->iface->current_mode, chan);
981 return hw_get_chan(hapd->iface->current_mode, freq);