Lines Matching refs:iface

22 static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)  in dfs_get_used_n_chans()  argument
28 if (iface->conf->ieee80211n && iface->conf->secondary_channel) in dfs_get_used_n_chans()
31 if (iface->conf->ieee80211ac) { in dfs_get_used_n_chans()
32 switch (iface->conf->vht_oper_chwidth) { in dfs_get_used_n_chans()
165 static int is_in_chanlist(struct hostapd_iface *iface, in is_in_chanlist() argument
168 if (!iface->conf->acs_ch_list.num) in is_in_chanlist()
171 return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan); in is_in_chanlist()
182 static int dfs_find_channel(struct hostapd_iface *iface, in dfs_find_channel() argument
190 mode = iface->current_mode; in dfs_find_channel()
191 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in dfs_find_channel()
198 if (iface->conf->ieee80211n && in dfs_find_channel()
199 iface->conf->secondary_channel && in dfs_find_channel()
207 if (!is_in_chanlist(iface, chan)) in dfs_find_channel()
222 static void dfs_adjust_vht_center_freq(struct hostapd_iface *iface, in dfs_adjust_vht_center_freq() argument
228 if (!iface->conf->ieee80211ac) in dfs_adjust_vht_center_freq()
236 switch (iface->conf->vht_oper_chwidth) { in dfs_adjust_vht_center_freq()
264 static int dfs_get_start_chan_idx(struct hostapd_iface *iface, int *seg1_start) in dfs_get_start_chan_idx() argument
268 int channel_no = iface->conf->channel; in dfs_get_start_chan_idx()
275 if (iface->conf->ieee80211n && iface->conf->secondary_channel == -1) in dfs_get_start_chan_idx()
279 if (iface->conf->ieee80211ac) { in dfs_get_start_chan_idx()
280 switch (iface->conf->vht_oper_chwidth) { in dfs_get_start_chan_idx()
285 iface->conf->vht_oper_centr_freq_seg0_idx - 6; in dfs_get_start_chan_idx()
289 iface->conf->vht_oper_centr_freq_seg0_idx - 14; in dfs_get_start_chan_idx()
293 iface->conf->vht_oper_centr_freq_seg0_idx - 6; in dfs_get_start_chan_idx()
295 iface->conf->vht_oper_centr_freq_seg1_idx - 6; in dfs_get_start_chan_idx()
306 mode = iface->current_mode; in dfs_get_start_chan_idx()
319 mode = iface->current_mode; in dfs_get_start_chan_idx()
335 mode->num_channels, channel_no, iface->conf->channel, in dfs_get_start_chan_idx()
336 iface->conf->ieee80211n, in dfs_get_start_chan_idx()
337 iface->conf->secondary_channel, in dfs_get_start_chan_idx()
338 iface->conf->vht_oper_chwidth); in dfs_get_start_chan_idx()
351 static int dfs_check_chans_radar(struct hostapd_iface *iface, in dfs_check_chans_radar() argument
358 mode = iface->current_mode; in dfs_check_chans_radar()
371 static int dfs_check_chans_available(struct hostapd_iface *iface, in dfs_check_chans_available() argument
378 mode = iface->current_mode; in dfs_check_chans_available()
399 static int dfs_check_chans_unavailable(struct hostapd_iface *iface, in dfs_check_chans_unavailable() argument
407 mode = iface->current_mode; in dfs_check_chans_unavailable()
423 dfs_get_valid_channel(struct hostapd_iface *iface, in dfs_get_valid_channel() argument
440 if (iface->current_mode == NULL) in dfs_get_valid_channel()
443 mode = iface->current_mode; in dfs_get_valid_channel()
448 num_available_chandefs = dfs_find_channel(iface, NULL, 0, skip_radar); in dfs_get_valid_channel()
455 dfs_find_channel(iface, &chan, chan_idx, skip_radar); in dfs_get_valid_channel()
458 if (iface->conf->secondary_channel) in dfs_get_valid_channel()
463 dfs_adjust_vht_center_freq(iface, chan, in dfs_get_valid_channel()
472 static int set_dfs_state_freq(struct hostapd_iface *iface, int freq, u32 state) in set_dfs_state_freq() argument
478 mode = iface->current_mode; in set_dfs_state_freq()
483 for (i = 0; i < iface->current_mode->num_channels; i++) { in set_dfs_state_freq()
484 chan = &iface->current_mode->channels[i]; in set_dfs_state_freq()
498 static int set_dfs_state(struct hostapd_iface *iface, int freq, int ht_enabled, in set_dfs_state() argument
507 mode = iface->current_mode; in set_dfs_state()
545 ret += set_dfs_state_freq(iface, frequency, state); in set_dfs_state()
553 static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq, in dfs_are_channels_overlapped() argument
564 mode = iface->current_mode; in dfs_are_channels_overlapped()
565 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1); in dfs_are_channels_overlapped()
566 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in dfs_are_channels_overlapped()
569 if (!dfs_check_chans_radar(iface, start_chan_idx, n_chans)) in dfs_are_channels_overlapped()
618 static unsigned int dfs_get_cac_time(struct hostapd_iface *iface, in dfs_get_cac_time() argument
626 mode = iface->current_mode; in dfs_get_cac_time()
646 int hostapd_handle_dfs(struct hostapd_iface *iface) in hostapd_handle_dfs() argument
652 if (!iface->current_mode) { in hostapd_handle_dfs()
662 iface->cac_started = 0; in hostapd_handle_dfs()
666 start_chan_idx = dfs_get_start_chan_idx(iface, in hostapd_handle_dfs()
672 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in hostapd_handle_dfs()
675 iface->dfs_cac_ms = dfs_get_cac_time(iface, start_chan_idx, in hostapd_handle_dfs()
679 res = dfs_check_chans_radar(iface, start_chan_idx, n_chans); in hostapd_handle_dfs()
687 res = dfs_check_chans_available(iface, start_chan_idx, n_chans); in hostapd_handle_dfs()
695 res = dfs_check_chans_unavailable(iface, start_chan_idx, in hostapd_handle_dfs()
703 channel = dfs_get_valid_channel(iface, &sec, &cf1, &cf2, in hostapd_handle_dfs()
710 iface->freq = channel->freq; in hostapd_handle_dfs()
711 iface->conf->channel = channel->chan; in hostapd_handle_dfs()
712 iface->conf->secondary_channel = sec; in hostapd_handle_dfs()
713 iface->conf->vht_oper_centr_freq_seg0_idx = cf1; in hostapd_handle_dfs()
714 iface->conf->vht_oper_centr_freq_seg1_idx = cf2; in hostapd_handle_dfs()
719 hostapd_set_state(iface, HAPD_IFACE_DFS); in hostapd_handle_dfs()
720 wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq); in hostapd_handle_dfs()
721 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START in hostapd_handle_dfs()
723 iface->freq, in hostapd_handle_dfs()
724 iface->conf->channel, iface->conf->secondary_channel, in hostapd_handle_dfs()
725 iface->conf->vht_oper_chwidth, in hostapd_handle_dfs()
726 iface->conf->vht_oper_centr_freq_seg0_idx, in hostapd_handle_dfs()
727 iface->conf->vht_oper_centr_freq_seg1_idx, in hostapd_handle_dfs()
728 iface->dfs_cac_ms / 1000); in hostapd_handle_dfs()
730 res = hostapd_start_dfs_cac(iface, iface->conf->hw_mode, in hostapd_handle_dfs()
731 iface->freq, in hostapd_handle_dfs()
732 iface->conf->channel, in hostapd_handle_dfs()
733 iface->conf->ieee80211n, in hostapd_handle_dfs()
734 iface->conf->ieee80211ac, in hostapd_handle_dfs()
735 iface->conf->secondary_channel, in hostapd_handle_dfs()
736 iface->conf->vht_oper_chwidth, in hostapd_handle_dfs()
737 iface->conf->vht_oper_centr_freq_seg0_idx, in hostapd_handle_dfs()
738 iface->conf->vht_oper_centr_freq_seg1_idx); in hostapd_handle_dfs()
749 int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq, in hostapd_dfs_complete_cac() argument
753 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED in hostapd_dfs_complete_cac()
759 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) { in hostapd_dfs_complete_cac()
761 if (iface->state != HAPD_IFACE_ENABLED) in hostapd_dfs_complete_cac()
762 hostapd_setup_interface_complete(iface, 0); in hostapd_dfs_complete_cac()
764 iface->cac_started = 0; in hostapd_dfs_complete_cac()
766 set_dfs_state(iface, freq, ht_enabled, chan_offset, in hostapd_dfs_complete_cac()
769 iface->cac_started = 0; in hostapd_dfs_complete_cac()
770 hostapd_setup_interface_complete(iface, 0); in hostapd_dfs_complete_cac()
778 static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) in hostapd_dfs_start_channel_switch_cac() argument
788 iface->cac_started = 0; in hostapd_dfs_start_channel_switch_cac()
789 channel = dfs_get_valid_channel(iface, &secondary_channel, in hostapd_dfs_start_channel_switch_cac()
796 hostapd_setup_interface_complete(iface, err); in hostapd_dfs_start_channel_switch_cac()
802 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL in hostapd_dfs_start_channel_switch_cac()
806 iface->freq = channel->freq; in hostapd_dfs_start_channel_switch_cac()
807 iface->conf->channel = channel->chan; in hostapd_dfs_start_channel_switch_cac()
808 iface->conf->secondary_channel = secondary_channel; in hostapd_dfs_start_channel_switch_cac()
809 iface->conf->vht_oper_centr_freq_seg0_idx = in hostapd_dfs_start_channel_switch_cac()
811 iface->conf->vht_oper_centr_freq_seg1_idx = in hostapd_dfs_start_channel_switch_cac()
815 hostapd_setup_interface_complete(iface, err); in hostapd_dfs_start_channel_switch_cac()
820 static int hostapd_csa_in_progress(struct hostapd_iface *iface) in hostapd_csa_in_progress() argument
823 for (i = 0; i < iface->num_bss; i++) in hostapd_csa_in_progress()
824 if (iface->bss[i]->csa_in_progress) in hostapd_csa_in_progress()
830 static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) in hostapd_dfs_start_channel_switch() argument
842 __func__, iface->cac_started ? "yes" : "no", in hostapd_dfs_start_channel_switch()
843 hostapd_csa_in_progress(iface) ? "yes" : "no"); in hostapd_dfs_start_channel_switch()
846 if (hostapd_csa_in_progress(iface)) in hostapd_dfs_start_channel_switch()
850 if (iface->cac_started) in hostapd_dfs_start_channel_switch()
851 return hostapd_dfs_start_channel_switch_cac(iface); in hostapd_dfs_start_channel_switch()
854 channel = dfs_get_valid_channel(iface, &secondary_channel, in hostapd_dfs_start_channel_switch()
866 channel = dfs_get_valid_channel(iface, &secondary_channel, in hostapd_dfs_start_channel_switch()
872 hostapd_disable_iface(iface); in hostapd_dfs_start_channel_switch()
876 iface->freq = channel->freq; in hostapd_dfs_start_channel_switch()
877 iface->conf->channel = channel->chan; in hostapd_dfs_start_channel_switch()
878 iface->conf->secondary_channel = secondary_channel; in hostapd_dfs_start_channel_switch()
879 iface->conf->vht_oper_centr_freq_seg0_idx = in hostapd_dfs_start_channel_switch()
881 iface->conf->vht_oper_centr_freq_seg1_idx = in hostapd_dfs_start_channel_switch()
884 hostapd_disable_iface(iface); in hostapd_dfs_start_channel_switch()
885 hostapd_enable_iface(iface); in hostapd_dfs_start_channel_switch()
891 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL in hostapd_dfs_start_channel_switch()
900 iface->conf->hw_mode, in hostapd_dfs_start_channel_switch()
903 iface->conf->ieee80211n, in hostapd_dfs_start_channel_switch()
904 iface->conf->ieee80211ac, in hostapd_dfs_start_channel_switch()
906 iface->conf->vht_oper_chwidth, in hostapd_dfs_start_channel_switch()
909 iface->current_mode->vht_capab); in hostapd_dfs_start_channel_switch()
913 hostapd_disable_iface(iface); in hostapd_dfs_start_channel_switch()
917 for (i = 0; i < iface->num_bss; i++) { in hostapd_dfs_start_channel_switch()
918 err = hostapd_switch_channel(iface->bss[i], &csa_settings); in hostapd_dfs_start_channel_switch()
926 iface->freq = channel->freq; in hostapd_dfs_start_channel_switch()
927 iface->conf->channel = channel->chan; in hostapd_dfs_start_channel_switch()
928 iface->conf->secondary_channel = secondary_channel; in hostapd_dfs_start_channel_switch()
929 iface->conf->vht_oper_centr_freq_seg0_idx = in hostapd_dfs_start_channel_switch()
931 iface->conf->vht_oper_centr_freq_seg1_idx = in hostapd_dfs_start_channel_switch()
934 hostapd_disable_iface(iface); in hostapd_dfs_start_channel_switch()
935 hostapd_enable_iface(iface); in hostapd_dfs_start_channel_switch()
947 int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq, in hostapd_dfs_radar_detected() argument
953 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED in hostapd_dfs_radar_detected()
958 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) in hostapd_dfs_radar_detected()
961 if (!iface->conf->ieee80211h) in hostapd_dfs_radar_detected()
965 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width, in hostapd_dfs_radar_detected()
969 res = dfs_are_channels_overlapped(iface, freq, chan_width, cf1, cf2); in hostapd_dfs_radar_detected()
974 res = hostapd_dfs_start_channel_switch(iface); in hostapd_dfs_radar_detected()
980 int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq, in hostapd_dfs_nop_finished() argument
984 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED in hostapd_dfs_nop_finished()
989 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) in hostapd_dfs_nop_finished()
993 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width, in hostapd_dfs_nop_finished()
999 int hostapd_is_dfs_required(struct hostapd_iface *iface) in hostapd_is_dfs_required() argument
1003 if (!iface->conf->ieee80211h || !iface->current_mode || in hostapd_is_dfs_required()
1004 iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A) in hostapd_is_dfs_required()
1008 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1); in hostapd_is_dfs_required()
1013 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in hostapd_is_dfs_required()
1016 res = dfs_check_chans_radar(iface, start_chan_idx, n_chans); in hostapd_is_dfs_required()
1020 res = dfs_check_chans_radar(iface, start_chan_idx1, n_chans1); in hostapd_is_dfs_required()
1025 int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq, in hostapd_dfs_start_cac() argument
1029 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START in hostapd_dfs_start_cac()
1033 iface->cac_started = 1; in hostapd_dfs_start_cac()
1045 int hostapd_handle_dfs_offload(struct hostapd_iface *iface) in hostapd_handle_dfs_offload() argument
1048 __func__, iface->cac_started); in hostapd_handle_dfs_offload()
1055 if (iface->cac_started) { in hostapd_handle_dfs_offload()
1057 __func__, iface->cac_started); in hostapd_handle_dfs_offload()
1058 iface->cac_started = 0; in hostapd_handle_dfs_offload()
1062 if (ieee80211_is_dfs(iface->freq)) { in hostapd_handle_dfs_offload()
1064 __func__, iface->freq); in hostapd_handle_dfs_offload()
1070 __func__, iface->freq); in hostapd_handle_dfs_offload()