• Home
  • Raw
  • Download

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