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()
177 static int is_in_chanlist(struct hostapd_iface *iface, in is_in_chanlist() argument
180 if (!iface->conf->acs_ch_list.num) in is_in_chanlist()
183 return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan); in is_in_chanlist()
194 static int dfs_find_channel(struct hostapd_iface *iface, in dfs_find_channel() argument
202 mode = iface->current_mode; in dfs_find_channel()
203 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in dfs_find_channel()
210 if (iface->conf->ieee80211n && in dfs_find_channel()
211 iface->conf->secondary_channel && in dfs_find_channel()
220 if (!is_in_chanlist(iface, chan)) in dfs_find_channel()
235 static void dfs_adjust_vht_center_freq(struct hostapd_iface *iface, in dfs_adjust_vht_center_freq() argument
241 if (!iface->conf->ieee80211ac) in dfs_adjust_vht_center_freq()
249 switch (iface->conf->vht_oper_chwidth) { in dfs_adjust_vht_center_freq()
277 static int dfs_get_start_chan_idx(struct hostapd_iface *iface, int *seg1_start) in dfs_get_start_chan_idx() argument
281 int channel_no = iface->conf->channel; in dfs_get_start_chan_idx()
288 if (iface->conf->ieee80211n && iface->conf->secondary_channel == -1) in dfs_get_start_chan_idx()
292 if (iface->conf->ieee80211ac) { in dfs_get_start_chan_idx()
293 switch (iface->conf->vht_oper_chwidth) { in dfs_get_start_chan_idx()
298 iface->conf->vht_oper_centr_freq_seg0_idx - 6; in dfs_get_start_chan_idx()
302 iface->conf->vht_oper_centr_freq_seg0_idx - 14; in dfs_get_start_chan_idx()
306 iface->conf->vht_oper_centr_freq_seg0_idx - 6; in dfs_get_start_chan_idx()
308 iface->conf->vht_oper_centr_freq_seg1_idx - 6; in dfs_get_start_chan_idx()
319 mode = iface->current_mode; in dfs_get_start_chan_idx()
332 mode = iface->current_mode; in dfs_get_start_chan_idx()
348 mode->num_channels, channel_no, iface->conf->channel, in dfs_get_start_chan_idx()
349 iface->conf->ieee80211n, in dfs_get_start_chan_idx()
350 iface->conf->secondary_channel, in dfs_get_start_chan_idx()
351 iface->conf->vht_oper_chwidth); in dfs_get_start_chan_idx()
364 static int dfs_check_chans_radar(struct hostapd_iface *iface, in dfs_check_chans_radar() argument
371 mode = iface->current_mode; in dfs_check_chans_radar()
384 static int dfs_check_chans_available(struct hostapd_iface *iface, in dfs_check_chans_available() argument
391 mode = iface->current_mode; in dfs_check_chans_available()
412 static int dfs_check_chans_unavailable(struct hostapd_iface *iface, in dfs_check_chans_unavailable() argument
420 mode = iface->current_mode; in dfs_check_chans_unavailable()
436 dfs_get_valid_channel(struct hostapd_iface *iface, in dfs_get_valid_channel() argument
453 if (iface->current_mode == NULL) in dfs_get_valid_channel()
456 mode = iface->current_mode; in dfs_get_valid_channel()
461 num_available_chandefs = dfs_find_channel(iface, NULL, 0, skip_radar); in dfs_get_valid_channel()
468 dfs_find_channel(iface, &chan, chan_idx, skip_radar); in dfs_get_valid_channel()
471 if (iface->conf->secondary_channel) in dfs_get_valid_channel()
476 dfs_adjust_vht_center_freq(iface, chan, in dfs_get_valid_channel()
485 static int set_dfs_state_freq(struct hostapd_iface *iface, int freq, u32 state) in set_dfs_state_freq() argument
491 mode = iface->current_mode; in set_dfs_state_freq()
496 for (i = 0; i < iface->current_mode->num_channels; i++) { in set_dfs_state_freq()
497 chan = &iface->current_mode->channels[i]; in set_dfs_state_freq()
511 static int set_dfs_state(struct hostapd_iface *iface, int freq, int ht_enabled, in set_dfs_state() argument
520 mode = iface->current_mode; in set_dfs_state()
558 ret += set_dfs_state_freq(iface, frequency, state); in set_dfs_state()
566 static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq, in dfs_are_channels_overlapped() argument
577 mode = iface->current_mode; in dfs_are_channels_overlapped()
578 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1); in dfs_are_channels_overlapped()
579 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in dfs_are_channels_overlapped()
582 if (!dfs_check_chans_radar(iface, start_chan_idx, n_chans)) in dfs_are_channels_overlapped()
631 static unsigned int dfs_get_cac_time(struct hostapd_iface *iface, in dfs_get_cac_time() argument
639 mode = iface->current_mode; in dfs_get_cac_time()
659 int hostapd_handle_dfs(struct hostapd_iface *iface) in hostapd_handle_dfs() argument
665 if (!iface->current_mode) { in hostapd_handle_dfs()
675 iface->cac_started = 0; in hostapd_handle_dfs()
679 start_chan_idx = dfs_get_start_chan_idx(iface, in hostapd_handle_dfs()
685 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in hostapd_handle_dfs()
688 iface->dfs_cac_ms = dfs_get_cac_time(iface, start_chan_idx, in hostapd_handle_dfs()
692 res = dfs_check_chans_radar(iface, start_chan_idx, n_chans); in hostapd_handle_dfs()
700 res = dfs_check_chans_available(iface, start_chan_idx, n_chans); in hostapd_handle_dfs()
708 res = dfs_check_chans_unavailable(iface, start_chan_idx, in hostapd_handle_dfs()
716 channel = dfs_get_valid_channel(iface, &sec, &cf1, &cf2, in hostapd_handle_dfs()
720 hostapd_set_state(iface, HAPD_IFACE_DFS); in hostapd_handle_dfs()
724 iface->freq = channel->freq; in hostapd_handle_dfs()
725 iface->conf->channel = channel->chan; in hostapd_handle_dfs()
726 iface->conf->secondary_channel = sec; in hostapd_handle_dfs()
727 iface->conf->vht_oper_centr_freq_seg0_idx = cf1; in hostapd_handle_dfs()
728 iface->conf->vht_oper_centr_freq_seg1_idx = cf2; in hostapd_handle_dfs()
733 hostapd_set_state(iface, HAPD_IFACE_DFS); in hostapd_handle_dfs()
734 wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq); in hostapd_handle_dfs()
735 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START in hostapd_handle_dfs()
737 iface->freq, in hostapd_handle_dfs()
738 iface->conf->channel, iface->conf->secondary_channel, in hostapd_handle_dfs()
739 iface->conf->vht_oper_chwidth, in hostapd_handle_dfs()
740 iface->conf->vht_oper_centr_freq_seg0_idx, in hostapd_handle_dfs()
741 iface->conf->vht_oper_centr_freq_seg1_idx, in hostapd_handle_dfs()
742 iface->dfs_cac_ms / 1000); in hostapd_handle_dfs()
744 res = hostapd_start_dfs_cac(iface, iface->conf->hw_mode, in hostapd_handle_dfs()
745 iface->freq, in hostapd_handle_dfs()
746 iface->conf->channel, in hostapd_handle_dfs()
747 iface->conf->ieee80211n, in hostapd_handle_dfs()
748 iface->conf->ieee80211ac, in hostapd_handle_dfs()
749 iface->conf->secondary_channel, in hostapd_handle_dfs()
750 iface->conf->vht_oper_chwidth, in hostapd_handle_dfs()
751 iface->conf->vht_oper_centr_freq_seg0_idx, in hostapd_handle_dfs()
752 iface->conf->vht_oper_centr_freq_seg1_idx); in hostapd_handle_dfs()
763 static int hostapd_config_dfs_chan_available(struct hostapd_iface *iface) in hostapd_config_dfs_chan_available() argument
768 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1); in hostapd_config_dfs_chan_available()
773 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in hostapd_config_dfs_chan_available()
776 return dfs_check_chans_available(iface, start_chan_idx, n_chans); in hostapd_config_dfs_chan_available()
780 int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq, in hostapd_dfs_complete_cac() argument
784 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED in hostapd_dfs_complete_cac()
790 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) { in hostapd_dfs_complete_cac()
792 if (iface->state != HAPD_IFACE_ENABLED) in hostapd_dfs_complete_cac()
793 hostapd_setup_interface_complete(iface, 0); in hostapd_dfs_complete_cac()
795 iface->cac_started = 0; in hostapd_dfs_complete_cac()
797 set_dfs_state(iface, freq, ht_enabled, chan_offset, in hostapd_dfs_complete_cac()
810 if (iface->state != HAPD_IFACE_ENABLED && in hostapd_dfs_complete_cac()
811 hostapd_config_dfs_chan_available(iface)) { in hostapd_dfs_complete_cac()
812 hostapd_setup_interface_complete(iface, 0); in hostapd_dfs_complete_cac()
813 iface->cac_started = 0; in hostapd_dfs_complete_cac()
822 int hostapd_dfs_pre_cac_expired(struct hostapd_iface *iface, int freq, in hostapd_dfs_pre_cac_expired() argument
826 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED in hostapd_dfs_pre_cac_expired()
831 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) in hostapd_dfs_pre_cac_expired()
834 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width, in hostapd_dfs_pre_cac_expired()
841 static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) in hostapd_dfs_start_channel_switch_cac() argument
851 iface->cac_started = 0; in hostapd_dfs_start_channel_switch_cac()
852 channel = dfs_get_valid_channel(iface, &secondary_channel, in hostapd_dfs_start_channel_switch_cac()
864 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL in hostapd_dfs_start_channel_switch_cac()
868 iface->freq = channel->freq; in hostapd_dfs_start_channel_switch_cac()
869 iface->conf->channel = channel->chan; in hostapd_dfs_start_channel_switch_cac()
870 iface->conf->secondary_channel = secondary_channel; in hostapd_dfs_start_channel_switch_cac()
871 iface->conf->vht_oper_centr_freq_seg0_idx = in hostapd_dfs_start_channel_switch_cac()
873 iface->conf->vht_oper_centr_freq_seg1_idx = in hostapd_dfs_start_channel_switch_cac()
877 hostapd_setup_interface_complete(iface, err); in hostapd_dfs_start_channel_switch_cac()
882 static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) in hostapd_dfs_start_channel_switch() argument
894 __func__, iface->cac_started ? "yes" : "no", in hostapd_dfs_start_channel_switch()
895 hostapd_csa_in_progress(iface) ? "yes" : "no"); in hostapd_dfs_start_channel_switch()
898 if (hostapd_csa_in_progress(iface)) in hostapd_dfs_start_channel_switch()
902 if (iface->cac_started) in hostapd_dfs_start_channel_switch()
903 return hostapd_dfs_start_channel_switch_cac(iface); in hostapd_dfs_start_channel_switch()
909 if (iface->dfs_domain == HOSTAPD_DFS_REGION_ETSI) in hostapd_dfs_start_channel_switch()
913 channel = dfs_get_valid_channel(iface, &secondary_channel, in hostapd_dfs_start_channel_switch()
925 channel = dfs_get_valid_channel(iface, &secondary_channel, in hostapd_dfs_start_channel_switch()
936 iface->freq = channel->freq; in hostapd_dfs_start_channel_switch()
937 iface->conf->channel = channel->chan; in hostapd_dfs_start_channel_switch()
938 iface->conf->secondary_channel = secondary_channel; in hostapd_dfs_start_channel_switch()
939 iface->conf->vht_oper_centr_freq_seg0_idx = in hostapd_dfs_start_channel_switch()
941 iface->conf->vht_oper_centr_freq_seg1_idx = in hostapd_dfs_start_channel_switch()
944 hostapd_disable_iface(iface); in hostapd_dfs_start_channel_switch()
945 hostapd_enable_iface(iface); in hostapd_dfs_start_channel_switch()
951 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL in hostapd_dfs_start_channel_switch()
960 iface->conf->hw_mode, in hostapd_dfs_start_channel_switch()
963 iface->conf->ieee80211n, in hostapd_dfs_start_channel_switch()
964 iface->conf->ieee80211ac, in hostapd_dfs_start_channel_switch()
966 iface->conf->vht_oper_chwidth, in hostapd_dfs_start_channel_switch()
969 iface->current_mode->vht_capab); in hostapd_dfs_start_channel_switch()
973 hostapd_disable_iface(iface); in hostapd_dfs_start_channel_switch()
977 for (i = 0; i < iface->num_bss; i++) { in hostapd_dfs_start_channel_switch()
978 err = hostapd_switch_channel(iface->bss[i], &csa_settings); in hostapd_dfs_start_channel_switch()
986 iface->freq = channel->freq; in hostapd_dfs_start_channel_switch()
987 iface->conf->channel = channel->chan; in hostapd_dfs_start_channel_switch()
988 iface->conf->secondary_channel = secondary_channel; in hostapd_dfs_start_channel_switch()
989 iface->conf->vht_oper_centr_freq_seg0_idx = in hostapd_dfs_start_channel_switch()
991 iface->conf->vht_oper_centr_freq_seg1_idx = in hostapd_dfs_start_channel_switch()
994 hostapd_disable_iface(iface); in hostapd_dfs_start_channel_switch()
995 hostapd_enable_iface(iface); in hostapd_dfs_start_channel_switch()
1007 int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq, in hostapd_dfs_radar_detected() argument
1013 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED in hostapd_dfs_radar_detected()
1018 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) in hostapd_dfs_radar_detected()
1021 if (!iface->conf->ieee80211h) in hostapd_dfs_radar_detected()
1025 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width, in hostapd_dfs_radar_detected()
1029 res = dfs_are_channels_overlapped(iface, freq, chan_width, cf1, cf2); in hostapd_dfs_radar_detected()
1034 res = hostapd_dfs_start_channel_switch(iface); in hostapd_dfs_radar_detected()
1040 int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq, in hostapd_dfs_nop_finished() argument
1044 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED in hostapd_dfs_nop_finished()
1049 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) in hostapd_dfs_nop_finished()
1053 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width, in hostapd_dfs_nop_finished()
1057 if (iface->state == HAPD_IFACE_DFS && !iface->cac_started) in hostapd_dfs_nop_finished()
1058 hostapd_handle_dfs(iface); in hostapd_dfs_nop_finished()
1064 int hostapd_is_dfs_required(struct hostapd_iface *iface) in hostapd_is_dfs_required() argument
1068 if (!iface->conf->ieee80211h || !iface->current_mode || in hostapd_is_dfs_required()
1069 iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A) in hostapd_is_dfs_required()
1073 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1); in hostapd_is_dfs_required()
1078 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in hostapd_is_dfs_required()
1081 res = dfs_check_chans_radar(iface, start_chan_idx, n_chans); in hostapd_is_dfs_required()
1085 res = dfs_check_chans_radar(iface, start_chan_idx1, n_chans1); in hostapd_is_dfs_required()
1090 int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq, in hostapd_dfs_start_cac() argument
1094 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START in hostapd_dfs_start_cac()
1098 iface->cac_started = 1; in hostapd_dfs_start_cac()
1110 int hostapd_handle_dfs_offload(struct hostapd_iface *iface) in hostapd_handle_dfs_offload() argument
1113 __func__, iface->cac_started); in hostapd_handle_dfs_offload()
1120 if (iface->cac_started) { in hostapd_handle_dfs_offload()
1122 __func__, iface->cac_started); in hostapd_handle_dfs_offload()
1123 iface->cac_started = 0; in hostapd_handle_dfs_offload()
1127 if (ieee80211_is_dfs(iface->freq, iface->hw_features, in hostapd_handle_dfs_offload()
1128 iface->num_hw_features)) { in hostapd_handle_dfs_offload()
1130 __func__, iface->freq); in hostapd_handle_dfs_offload()
1136 __func__, iface->freq); in hostapd_handle_dfs_offload()