• 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()
332 iface->conf->vht_oper_centr_freq_seg0_idx = 0; in ieee80211n_check_scan()
333 iface->conf->vht_oper_centr_freq_seg1_idx = 0; in ieee80211n_check_scan()
338 hostapd_setup_interface_complete(iface, !res); in ieee80211n_check_scan()
342 static void ieee80211n_scan_channels_2g4(struct hostapd_iface *iface, in ieee80211n_scan_channels_2g4() argument
351 if (iface->current_mode == NULL) in ieee80211n_scan_channels_2g4()
354 pri_freq = hostapd_hw_get_freq(iface->bss[0], iface->conf->channel); in ieee80211n_scan_channels_2g4()
355 if (iface->conf->secondary_channel > 0) in ieee80211n_scan_channels_2g4()
369 mode = iface->current_mode; in ieee80211n_scan_channels_2g4()
387 static void ieee80211n_scan_channels_5g(struct hostapd_iface *iface, in ieee80211n_scan_channels_5g() argument
396 if (iface->current_mode == NULL) in ieee80211n_scan_channels_5g()
399 pri_freq = hostapd_hw_get_freq(iface->bss[0], iface->conf->channel); in ieee80211n_scan_channels_5g()
400 if (iface->conf->secondary_channel > 0) { in ieee80211n_scan_channels_5g()
410 mode = iface->current_mode; in ieee80211n_scan_channels_5g()
431 struct hostapd_iface *iface = eloop_data; in ap_ht40_scan_retry() local
436 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in ap_ht40_scan_retry()
437 ieee80211n_scan_channels_2g4(iface, &params); in ap_ht40_scan_retry()
439 ieee80211n_scan_channels_5g(iface, &params); in ap_ht40_scan_retry()
441 ret = hostapd_driver_scan(iface->bss[0], &params); in ap_ht40_scan_retry()
442 iface->num_ht40_scan_tries++; in ap_ht40_scan_retry()
446 iface->num_ht40_scan_tries < HT2040_COEX_SCAN_RETRY) { in ap_ht40_scan_retry()
449 ret, strerror(-ret), iface->num_ht40_scan_tries); in ap_ht40_scan_retry()
450 eloop_register_timeout(1, 0, ap_ht40_scan_retry, iface, NULL); in ap_ht40_scan_retry()
455 iface->scan_cb = ieee80211n_check_scan; in ap_ht40_scan_retry()
461 iface->conf->secondary_channel = 0; in ap_ht40_scan_retry()
462 iface->conf->ht_capab &= ~HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET; in ap_ht40_scan_retry()
463 hostapd_setup_interface_complete(iface, 0); in ap_ht40_scan_retry()
467 void hostapd_stop_setup_timers(struct hostapd_iface *iface) in hostapd_stop_setup_timers() argument
469 eloop_cancel_timeout(ap_ht40_scan_retry, iface, NULL); in hostapd_stop_setup_timers()
473 static int ieee80211n_check_40mhz(struct hostapd_iface *iface) in ieee80211n_check_40mhz() argument
479 if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch) in ieee80211n_check_40mhz()
482 hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); in ieee80211n_check_40mhz()
486 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in ieee80211n_check_40mhz()
487 ieee80211n_scan_channels_2g4(iface, &params); in ieee80211n_check_40mhz()
489 ieee80211n_scan_channels_5g(iface, &params); in ieee80211n_check_40mhz()
491 ret = hostapd_driver_scan(iface->bss[0], &params); in ieee80211n_check_40mhz()
498 iface->num_ht40_scan_tries = 1; in ieee80211n_check_40mhz()
499 eloop_cancel_timeout(ap_ht40_scan_retry, iface, NULL); in ieee80211n_check_40mhz()
500 eloop_register_timeout(1, 0, ap_ht40_scan_retry, iface, NULL); in ieee80211n_check_40mhz()
511 iface->scan_cb = ieee80211n_check_scan; in ieee80211n_check_40mhz()
516 static int ieee80211n_supported_ht_capab(struct hostapd_iface *iface) in ieee80211n_supported_ht_capab() argument
518 u16 hw = iface->current_mode->ht_capab; in ieee80211n_supported_ht_capab()
519 u16 conf = iface->conf->ht_capab; in ieee80211n_supported_ht_capab()
532 if (!iface->conf->acs && (conf & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) && in ieee80211n_supported_ht_capab()
541 if (!(iface->smps_modes & WPA_DRIVER_SMPS_MODE_STATIC)) { in ieee80211n_supported_ht_capab()
548 if (!(iface->smps_modes & WPA_DRIVER_SMPS_MODE_DYNAMIC)) { in ieee80211n_supported_ht_capab()
626 static int ieee80211ac_supported_vht_capab(struct hostapd_iface *iface) in ieee80211ac_supported_vht_capab() argument
628 struct hostapd_hw_modes *mode = iface->current_mode; in ieee80211ac_supported_vht_capab()
630 u32 conf = iface->conf->vht_capab; in ieee80211ac_supported_vht_capab()
636 iface->conf->bss[0]->vendor_vht && in ieee80211ac_supported_vht_capab()
637 mode->vht_capab == 0 && iface->hw_features) { in ieee80211ac_supported_vht_capab()
640 for (i = 0; i < iface->num_hw_features; i++) { in ieee80211ac_supported_vht_capab()
641 if (iface->hw_features[i].mode == in ieee80211ac_supported_vht_capab()
643 mode = &iface->hw_features[i]; in ieee80211ac_supported_vht_capab()
660 int hostapd_check_ht_capab(struct hostapd_iface *iface) in hostapd_check_ht_capab() argument
664 if (!iface->conf->ieee80211n) in hostapd_check_ht_capab()
667 if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211B && in hostapd_check_ht_capab()
668 iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G && in hostapd_check_ht_capab()
669 (iface->conf->ht_capab & HT_CAP_INFO_DSSS_CCK40MHZ)) { in hostapd_check_ht_capab()
672 iface->conf->ht_capab &= ~HT_CAP_INFO_DSSS_CCK40MHZ; in hostapd_check_ht_capab()
675 if (!ieee80211n_supported_ht_capab(iface)) in hostapd_check_ht_capab()
678 if (!ieee80211ac_supported_vht_capab(iface)) in hostapd_check_ht_capab()
681 ret = ieee80211n_check_40mhz(iface); in hostapd_check_ht_capab()
684 if (!ieee80211n_allowed_ht40_channel_pair(iface)) in hostapd_check_ht_capab()
692 static int hostapd_is_usable_chan(struct hostapd_iface *iface, in hostapd_is_usable_chan() argument
698 if (!iface->current_mode) in hostapd_is_usable_chan()
701 for (i = 0; i < iface->current_mode->num_channels; i++) { in hostapd_is_usable_chan()
702 chan = &iface->current_mode->channels[i]; in hostapd_is_usable_chan()
723 static int hostapd_is_usable_chans(struct hostapd_iface *iface) in hostapd_is_usable_chans() argument
725 if (!hostapd_is_usable_chan(iface, iface->conf->channel, 1)) in hostapd_is_usable_chans()
728 if (!iface->conf->secondary_channel) in hostapd_is_usable_chans()
731 return hostapd_is_usable_chan(iface, iface->conf->channel + in hostapd_is_usable_chans()
732 iface->conf->secondary_channel * 4, 0); in hostapd_is_usable_chans()
737 hostapd_check_chans(struct hostapd_iface *iface) in hostapd_check_chans() argument
739 if (iface->conf->channel) { in hostapd_check_chans()
740 if (hostapd_is_usable_chans(iface)) in hostapd_check_chans()
751 switch (acs_init(iface)) { in hostapd_check_chans()
762 static void hostapd_notify_bad_chans(struct hostapd_iface *iface) in hostapd_notify_bad_chans() argument
764 if (!iface->current_mode) { in hostapd_notify_bad_chans()
765 hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211, in hostapd_notify_bad_chans()
770 hostapd_logger(iface->bss[0], NULL, in hostapd_notify_bad_chans()
775 iface->conf->channel, in hostapd_notify_bad_chans()
776 iface->current_mode->mode, in hostapd_notify_bad_chans()
777 hostapd_hw_mode_txt(iface->current_mode->mode)); in hostapd_notify_bad_chans()
778 hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211, in hostapd_notify_bad_chans()
784 int hostapd_acs_completed(struct hostapd_iface *iface, int err) in hostapd_acs_completed() argument
791 switch (hostapd_check_chans(iface)) { in hostapd_acs_completed()
793 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, in hostapd_acs_completed()
795 hostapd_hw_get_freq(iface->bss[0], in hostapd_acs_completed()
796 iface->conf->channel), in hostapd_acs_completed()
797 iface->conf->channel); in hostapd_acs_completed()
801 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED); in hostapd_acs_completed()
802 hostapd_notify_bad_chans(iface); in hostapd_acs_completed()
807 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED); in hostapd_acs_completed()
808 hostapd_notify_bad_chans(iface); in hostapd_acs_completed()
812 ret = hostapd_check_ht_capab(iface); in hostapd_acs_completed()
822 return hostapd_setup_interface_complete(iface, ret); in hostapd_acs_completed()
834 int hostapd_select_hw_mode(struct hostapd_iface *iface) in hostapd_select_hw_mode() argument
838 if (iface->num_hw_features < 1) in hostapd_select_hw_mode()
841 if ((iface->conf->hw_mode == HOSTAPD_MODE_IEEE80211G || in hostapd_select_hw_mode()
842 iface->conf->ieee80211n || iface->conf->ieee80211ac) && in hostapd_select_hw_mode()
843 iface->conf->channel == 14) { in hostapd_select_hw_mode()
845 iface->conf->hw_mode = HOSTAPD_MODE_IEEE80211B; in hostapd_select_hw_mode()
846 iface->conf->ieee80211n = 0; in hostapd_select_hw_mode()
847 iface->conf->ieee80211ac = 0; in hostapd_select_hw_mode()
850 iface->current_mode = NULL; in hostapd_select_hw_mode()
851 for (i = 0; i < iface->num_hw_features; i++) { in hostapd_select_hw_mode()
852 struct hostapd_hw_modes *mode = &iface->hw_features[i]; in hostapd_select_hw_mode()
853 if (mode->mode == iface->conf->hw_mode) { in hostapd_select_hw_mode()
854 iface->current_mode = mode; in hostapd_select_hw_mode()
859 if (iface->current_mode == NULL) { in hostapd_select_hw_mode()
860 if (!(iface->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) || in hostapd_select_hw_mode()
861 !(iface->drv_flags & WPA_DRIVER_FLAGS_SUPPORT_HW_MODE_ANY)) in hostapd_select_hw_mode()
865 hostapd_logger(iface->bss[0], NULL, in hostapd_select_hw_mode()
869 (int) iface->conf->hw_mode); in hostapd_select_hw_mode()
874 switch (hostapd_check_chans(iface)) { in hostapd_select_hw_mode()
881 hostapd_notify_bad_chans(iface); in hostapd_select_hw_mode()
906 return hw_get_freq(hapd->iface->current_mode, chan); in hostapd_hw_get_freq()
912 return hw_get_chan(hapd->iface->current_mode, freq); in hostapd_hw_get_channel()