Lines Matching refs:iface
30 dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel,
36 static bool dfs_use_radar_background(struct hostapd_iface *iface) in dfs_use_radar_background() argument
38 return (iface->drv_flags2 & WPA_DRIVER_FLAGS2_RADAR_BACKGROUND) && in dfs_use_radar_background()
39 iface->conf->enable_background_radar; in dfs_use_radar_background()
43 static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1) in dfs_get_used_n_chans() argument
49 if (iface->conf->ieee80211n && iface->conf->secondary_channel) in dfs_get_used_n_chans()
52 if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) { in dfs_get_used_n_chans()
53 switch (hostapd_get_oper_chwidth(iface->conf)) { in dfs_get_used_n_chans()
224 static int is_in_chanlist(struct hostapd_iface *iface, in is_in_chanlist() argument
227 if (!iface->conf->acs_ch_list.num) in is_in_chanlist()
230 return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan); in is_in_chanlist()
241 static int dfs_find_channel(struct hostapd_iface *iface, in dfs_find_channel() argument
249 mode = iface->current_mode; in dfs_find_channel()
250 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in dfs_find_channel()
257 if (iface->conf->ieee80211n && in dfs_find_channel()
258 iface->conf->secondary_channel && in dfs_find_channel()
275 if (!is_in_chanlist(iface, chan)) { in dfs_find_channel()
282 if (chan->max_tx_power < iface->conf->min_tx_power) in dfs_find_channel()
286 iface->conf->country[2] == 0x4f) in dfs_find_channel()
303 static void dfs_adjust_center_freq(struct hostapd_iface *iface, in dfs_adjust_center_freq() argument
310 if (!iface->conf->ieee80211ac && !iface->conf->ieee80211ax) in dfs_adjust_center_freq()
318 switch (hostapd_get_oper_chwidth(iface->conf)) { in dfs_adjust_center_freq()
352 static int dfs_get_start_chan_idx(struct hostapd_iface *iface, int *seg1_start) in dfs_get_start_chan_idx() argument
356 int channel_no = iface->conf->channel; in dfs_get_start_chan_idx()
363 if (iface->conf->ieee80211n && iface->conf->secondary_channel == -1) in dfs_get_start_chan_idx()
367 if (iface->conf->ieee80211ac || iface->conf->ieee80211ax || in dfs_get_start_chan_idx()
368 iface->conf->ieee80211be) { in dfs_get_start_chan_idx()
369 switch (hostapd_get_oper_chwidth(iface->conf)) { in dfs_get_start_chan_idx()
374 iface->conf) - 6; in dfs_get_start_chan_idx()
378 iface->conf) - 14; in dfs_get_start_chan_idx()
382 iface->conf) - 6; in dfs_get_start_chan_idx()
384 iface->conf) - 6; in dfs_get_start_chan_idx()
388 iface->conf) - 30; in dfs_get_start_chan_idx()
399 mode = iface->current_mode; in dfs_get_start_chan_idx()
412 mode = iface->current_mode; in dfs_get_start_chan_idx()
428 mode->num_channels, channel_no, iface->conf->channel, in dfs_get_start_chan_idx()
429 iface->conf->ieee80211n, in dfs_get_start_chan_idx()
430 iface->conf->secondary_channel, in dfs_get_start_chan_idx()
431 hostapd_get_oper_chwidth(iface->conf)); in dfs_get_start_chan_idx()
444 static int dfs_check_chans_radar(struct hostapd_iface *iface, in dfs_check_chans_radar() argument
451 mode = iface->current_mode; in dfs_check_chans_radar()
466 static int dfs_check_chans_available(struct hostapd_iface *iface, in dfs_check_chans_available() argument
473 mode = iface->current_mode; in dfs_check_chans_available()
494 static int dfs_check_chans_unavailable(struct hostapd_iface *iface, in dfs_check_chans_unavailable() argument
502 mode = iface->current_mode; in dfs_check_chans_unavailable()
518 dfs_get_valid_channel(struct hostapd_iface *iface, in dfs_get_valid_channel() argument
538 if (iface->current_mode == NULL) in dfs_get_valid_channel()
541 mode = iface->current_mode; in dfs_get_valid_channel()
546 num_available_chandefs = dfs_find_channel(iface, NULL, 0, type); in dfs_get_valid_channel()
557 dfs_find_channel(iface, &chan, chan_idx, type); in dfs_get_valid_channel()
566 if (iface->conf->secondary_channel) in dfs_get_valid_channel()
572 if (hostapd_get_oper_chwidth(iface->conf) == in dfs_get_valid_channel()
587 dfs_find_channel(iface, &chan2, chan_idx2, type); in dfs_get_valid_channel()
608 dfs_adjust_center_freq(iface, chan, in dfs_get_valid_channel()
618 static int dfs_set_valid_channel(struct hostapd_iface *iface, int skip_radar) in dfs_set_valid_channel() argument
624 channel = dfs_get_valid_channel(iface, &sec, &cf1, &cf2, in dfs_set_valid_channel()
632 iface->freq = channel->freq; in dfs_set_valid_channel()
633 iface->conf->channel = channel->chan; in dfs_set_valid_channel()
634 iface->conf->secondary_channel = sec; in dfs_set_valid_channel()
635 hostapd_set_oper_centr_freq_seg0_idx(iface->conf, cf1); in dfs_set_valid_channel()
636 hostapd_set_oper_centr_freq_seg1_idx(iface->conf, cf2); in dfs_set_valid_channel()
642 static int set_dfs_state_freq(struct hostapd_iface *iface, int freq, u32 state) in set_dfs_state_freq() argument
648 mode = iface->current_mode; in set_dfs_state_freq()
653 for (i = 0; i < iface->current_mode->num_channels; i++) { in set_dfs_state_freq()
654 chan = &iface->current_mode->channels[i]; in set_dfs_state_freq()
668 static int set_dfs_state(struct hostapd_iface *iface, int freq, int ht_enabled, in set_dfs_state() argument
678 mode = iface->current_mode; in set_dfs_state()
721 ret += set_dfs_state_freq(iface, frequency, state); in set_dfs_state()
725 ret += set_dfs_state_freq(iface, frequency2, state); in set_dfs_state()
734 static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq, in dfs_are_channels_overlapped() argument
745 mode = iface->current_mode; in dfs_are_channels_overlapped()
746 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1); in dfs_are_channels_overlapped()
747 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in dfs_are_channels_overlapped()
750 if (!dfs_check_chans_radar(iface, start_chan_idx, n_chans)) in dfs_are_channels_overlapped()
799 static unsigned int dfs_get_cac_time(struct hostapd_iface *iface, in dfs_get_cac_time() argument
807 mode = iface->current_mode; in dfs_get_cac_time()
829 int hostapd_handle_dfs(struct hostapd_iface *iface) in hostapd_handle_dfs() argument
834 if (is_6ghz_freq(iface->freq)) in hostapd_handle_dfs()
837 if (!iface->current_mode) { in hostapd_handle_dfs()
847 iface->cac_started = 0; in hostapd_handle_dfs()
851 start_chan_idx = dfs_get_start_chan_idx(iface, in hostapd_handle_dfs()
857 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in hostapd_handle_dfs()
860 iface->dfs_cac_ms = dfs_get_cac_time(iface, start_chan_idx, in hostapd_handle_dfs()
864 res = dfs_check_chans_radar(iface, start_chan_idx, n_chans); in hostapd_handle_dfs()
872 res = dfs_check_chans_available(iface, start_chan_idx, n_chans); in hostapd_handle_dfs()
880 res = dfs_check_chans_unavailable(iface, start_chan_idx, in hostapd_handle_dfs()
885 if (dfs_set_valid_channel(iface, skip_radar) < 0) { in hostapd_handle_dfs()
886 hostapd_set_state(iface, HAPD_IFACE_DFS); in hostapd_handle_dfs()
893 hostapd_set_state(iface, HAPD_IFACE_DFS); in hostapd_handle_dfs()
894 wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz%s", iface->freq, in hostapd_handle_dfs()
895 dfs_use_radar_background(iface) ? " (background)" : ""); in hostapd_handle_dfs()
896 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START in hostapd_handle_dfs()
898 iface->freq, in hostapd_handle_dfs()
899 iface->conf->channel, iface->conf->secondary_channel, in hostapd_handle_dfs()
900 hostapd_get_oper_chwidth(iface->conf), in hostapd_handle_dfs()
901 hostapd_get_oper_centr_freq_seg0_idx(iface->conf), in hostapd_handle_dfs()
902 hostapd_get_oper_centr_freq_seg1_idx(iface->conf), in hostapd_handle_dfs()
903 iface->dfs_cac_ms / 1000); in hostapd_handle_dfs()
906 iface, iface->conf->hw_mode, iface->freq, iface->conf->channel, in hostapd_handle_dfs()
907 iface->conf->ieee80211n, iface->conf->ieee80211ac, in hostapd_handle_dfs()
908 iface->conf->ieee80211ax, iface->conf->ieee80211be, in hostapd_handle_dfs()
909 iface->conf->secondary_channel, in hostapd_handle_dfs()
910 hostapd_get_oper_chwidth(iface->conf), in hostapd_handle_dfs()
911 hostapd_get_oper_centr_freq_seg0_idx(iface->conf), in hostapd_handle_dfs()
912 hostapd_get_oper_centr_freq_seg1_idx(iface->conf), in hostapd_handle_dfs()
913 dfs_use_radar_background(iface)); in hostapd_handle_dfs()
920 if (dfs_use_radar_background(iface)) { in hostapd_handle_dfs()
922 iface->radar_background.channel = iface->conf->channel; in hostapd_handle_dfs()
923 iface->radar_background.secondary_channel = in hostapd_handle_dfs()
924 iface->conf->secondary_channel; in hostapd_handle_dfs()
925 iface->radar_background.freq = iface->freq; in hostapd_handle_dfs()
926 iface->radar_background.centr_freq_seg0_idx = in hostapd_handle_dfs()
927 hostapd_get_oper_centr_freq_seg0_idx(iface->conf); in hostapd_handle_dfs()
928 iface->radar_background.centr_freq_seg1_idx = in hostapd_handle_dfs()
929 hostapd_get_oper_centr_freq_seg1_idx(iface->conf); in hostapd_handle_dfs()
935 res = dfs_set_valid_channel(iface, 1); in hostapd_handle_dfs()
939 iface->radar_background.temp_ch = 1; in hostapd_handle_dfs()
947 int hostapd_is_dfs_chan_available(struct hostapd_iface *iface) in hostapd_is_dfs_chan_available() argument
952 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1); in hostapd_is_dfs_chan_available()
957 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in hostapd_is_dfs_chan_available()
960 return dfs_check_chans_available(iface, start_chan_idx, n_chans); in hostapd_is_dfs_chan_available()
964 static int hostapd_dfs_request_channel_switch(struct hostapd_iface *iface, in hostapd_dfs_request_channel_switch() argument
971 struct hostapd_hw_modes *cmode = iface->current_mode; in hostapd_dfs_request_channel_switch()
979 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL in hostapd_dfs_request_channel_switch()
983 new_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf); in hostapd_dfs_request_channel_switch()
984 hostapd_set_oper_chwidth(iface->conf, current_vht_oper_chwidth); in hostapd_dfs_request_channel_switch()
992 if (iface->bss[0]->conf->mld_ap) in hostapd_dfs_request_channel_switch()
993 csa_settings.link_id = iface->bss[0]->mld_link_id; in hostapd_dfs_request_channel_switch()
996 if (iface->mconf) in hostapd_dfs_request_channel_switch()
1000 iface->conf->hw_mode, in hostapd_dfs_request_channel_switch()
1002 iface->conf->enable_edmg, in hostapd_dfs_request_channel_switch()
1003 iface->conf->edmg_channel, in hostapd_dfs_request_channel_switch()
1004 iface->conf->ieee80211n, in hostapd_dfs_request_channel_switch()
1005 iface->conf->ieee80211ac, in hostapd_dfs_request_channel_switch()
1006 iface->conf->ieee80211ax, in hostapd_dfs_request_channel_switch()
1007 iface->conf->ieee80211be, in hostapd_dfs_request_channel_switch()
1015 hostapd_get_punct_bitmap(iface->bss[0])); in hostapd_dfs_request_channel_switch()
1020 hostapd_disable_iface(iface); in hostapd_dfs_request_channel_switch()
1024 for (i = 0; i < iface->num_bss; i++) { in hostapd_dfs_request_channel_switch()
1025 err = hostapd_switch_channel(iface->bss[i], &csa_settings); in hostapd_dfs_request_channel_switch()
1030 if (num_err == iface->num_bss) { in hostapd_dfs_request_channel_switch()
1034 iface->freq = freq; in hostapd_dfs_request_channel_switch()
1035 iface->conf->channel = channel; in hostapd_dfs_request_channel_switch()
1036 iface->conf->secondary_channel = secondary_channel; in hostapd_dfs_request_channel_switch()
1037 hostapd_set_oper_chwidth(iface->conf, new_vht_oper_chwidth); in hostapd_dfs_request_channel_switch()
1038 hostapd_set_oper_centr_freq_seg0_idx(iface->conf, in hostapd_dfs_request_channel_switch()
1040 hostapd_set_oper_centr_freq_seg1_idx(iface->conf, in hostapd_dfs_request_channel_switch()
1043 hostapd_disable_iface(iface); in hostapd_dfs_request_channel_switch()
1044 hostapd_enable_iface(iface); in hostapd_dfs_request_channel_switch()
1057 static void hostapd_dfs_update_background_chain(struct hostapd_iface *iface) in hostapd_dfs_update_background_chain() argument
1069 if (iface->dfs_domain == HOSTAPD_DFS_REGION_ETSI) in hostapd_dfs_update_background_chain()
1072 channel = dfs_get_valid_channel(iface, &sec, &oper_centr_freq_seg0_idx, in hostapd_dfs_update_background_chain()
1076 channel->chan == iface->conf->channel || in hostapd_dfs_update_background_chain()
1077 channel->chan == iface->radar_background.channel) in hostapd_dfs_update_background_chain()
1078 channel = dfs_downgrade_bandwidth(iface, &sec, in hostapd_dfs_update_background_chain()
1083 hostapd_start_dfs_cac(iface, iface->conf->hw_mode, in hostapd_dfs_update_background_chain()
1085 iface->conf->ieee80211n, in hostapd_dfs_update_background_chain()
1086 iface->conf->ieee80211ac, in hostapd_dfs_update_background_chain()
1087 iface->conf->ieee80211ax, in hostapd_dfs_update_background_chain()
1088 iface->conf->ieee80211be, in hostapd_dfs_update_background_chain()
1089 sec, hostapd_get_oper_chwidth(iface->conf), in hostapd_dfs_update_background_chain()
1093 iface->radar_background.channel = -1; in hostapd_dfs_update_background_chain()
1097 iface->radar_background.channel = channel->chan; in hostapd_dfs_update_background_chain()
1098 iface->radar_background.freq = channel->freq; in hostapd_dfs_update_background_chain()
1099 iface->radar_background.secondary_channel = sec; in hostapd_dfs_update_background_chain()
1100 iface->radar_background.centr_freq_seg0_idx = oper_centr_freq_seg0_idx; in hostapd_dfs_update_background_chain()
1101 iface->radar_background.centr_freq_seg1_idx = oper_centr_freq_seg1_idx; in hostapd_dfs_update_background_chain()
1110 hostapd_dfs_is_background_event(struct hostapd_iface *iface, int freq) in hostapd_dfs_is_background_event() argument
1112 return dfs_use_radar_background(iface) && in hostapd_dfs_is_background_event()
1113 iface->radar_background.channel != -1 && in hostapd_dfs_is_background_event()
1114 iface->radar_background.freq == freq; in hostapd_dfs_is_background_event()
1119 hostapd_dfs_start_channel_switch_background(struct hostapd_iface *iface) in hostapd_dfs_start_channel_switch_background() argument
1121 u8 current_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf); in hostapd_dfs_start_channel_switch_background()
1123 iface->conf->channel = iface->radar_background.channel; in hostapd_dfs_start_channel_switch_background()
1124 iface->freq = iface->radar_background.freq; in hostapd_dfs_start_channel_switch_background()
1125 iface->conf->secondary_channel = in hostapd_dfs_start_channel_switch_background()
1126 iface->radar_background.secondary_channel; in hostapd_dfs_start_channel_switch_background()
1128 iface->conf, iface->radar_background.centr_freq_seg0_idx); in hostapd_dfs_start_channel_switch_background()
1130 iface->conf, iface->radar_background.centr_freq_seg1_idx); in hostapd_dfs_start_channel_switch_background()
1132 hostapd_dfs_update_background_chain(iface); in hostapd_dfs_start_channel_switch_background()
1135 iface, iface->conf->channel, iface->freq, in hostapd_dfs_start_channel_switch_background()
1136 iface->conf->secondary_channel, current_vht_oper_chwidth, in hostapd_dfs_start_channel_switch_background()
1137 hostapd_get_oper_centr_freq_seg0_idx(iface->conf), in hostapd_dfs_start_channel_switch_background()
1138 hostapd_get_oper_centr_freq_seg1_idx(iface->conf)); in hostapd_dfs_start_channel_switch_background()
1142 int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq, in hostapd_dfs_complete_cac() argument
1146 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED in hostapd_dfs_complete_cac()
1149 iface->radar_detected); in hostapd_dfs_complete_cac()
1153 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) { in hostapd_dfs_complete_cac()
1162 if (iface->state != HAPD_IFACE_ENABLED && in hostapd_dfs_complete_cac()
1163 !iface->radar_detected) in hostapd_dfs_complete_cac()
1164 hostapd_setup_interface_complete(iface, 0); in hostapd_dfs_complete_cac()
1166 iface->cac_started = 0; in hostapd_dfs_complete_cac()
1168 set_dfs_state(iface, freq, ht_enabled, chan_offset, in hostapd_dfs_complete_cac()
1178 if (hostapd_dfs_is_background_event(iface, freq)) { in hostapd_dfs_complete_cac()
1179 iface->radar_background.cac_started = 0; in hostapd_dfs_complete_cac()
1180 if (!iface->radar_background.temp_ch) in hostapd_dfs_complete_cac()
1183 iface->radar_background.temp_ch = 0; in hostapd_dfs_complete_cac()
1184 return hostapd_dfs_start_channel_switch_background(iface); in hostapd_dfs_complete_cac()
1197 if (iface->state != HAPD_IFACE_ENABLED && in hostapd_dfs_complete_cac()
1198 hostapd_is_dfs_chan_available(iface)) { in hostapd_dfs_complete_cac()
1199 hostapd_setup_interface_complete(iface, 0); in hostapd_dfs_complete_cac()
1200 iface->cac_started = 0; in hostapd_dfs_complete_cac()
1203 } else if (hostapd_dfs_is_background_event(iface, freq)) { in hostapd_dfs_complete_cac()
1204 iface->radar_background.cac_started = 0; in hostapd_dfs_complete_cac()
1205 hostapd_dfs_update_background_chain(iface); in hostapd_dfs_complete_cac()
1208 iface->radar_detected = false; in hostapd_dfs_complete_cac()
1213 int hostapd_dfs_pre_cac_expired(struct hostapd_iface *iface, int freq, in hostapd_dfs_pre_cac_expired() argument
1217 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED in hostapd_dfs_pre_cac_expired()
1222 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) in hostapd_dfs_pre_cac_expired()
1225 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width, in hostapd_dfs_pre_cac_expired()
1233 dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel, in dfs_downgrade_bandwidth() argument
1241 channel = dfs_get_valid_channel(iface, secondary_channel, in dfs_downgrade_bandwidth()
1256 oper_chwidth = hostapd_get_oper_chwidth(iface->conf); in dfs_downgrade_bandwidth()
1260 hostapd_set_oper_chwidth(iface->conf, oper_chwidth - 1); in dfs_downgrade_bandwidth()
1271 static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) in hostapd_dfs_start_channel_switch_cac() argument
1281 iface->cac_started = 0; in hostapd_dfs_start_channel_switch_cac()
1282 channel = dfs_get_valid_channel(iface, &secondary_channel, in hostapd_dfs_start_channel_switch_cac()
1288 channel = dfs_downgrade_bandwidth(iface, &secondary_channel, in hostapd_dfs_start_channel_switch_cac()
1300 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL in hostapd_dfs_start_channel_switch_cac()
1304 iface->freq = channel->freq; in hostapd_dfs_start_channel_switch_cac()
1305 iface->conf->channel = channel->chan; in hostapd_dfs_start_channel_switch_cac()
1306 iface->conf->secondary_channel = secondary_channel; in hostapd_dfs_start_channel_switch_cac()
1307 hostapd_set_oper_centr_freq_seg0_idx(iface->conf, in hostapd_dfs_start_channel_switch_cac()
1309 hostapd_set_oper_centr_freq_seg1_idx(iface->conf, in hostapd_dfs_start_channel_switch_cac()
1313 hostapd_setup_interface_complete(iface, err); in hostapd_dfs_start_channel_switch_cac()
1319 hostapd_dfs_background_start_channel_switch(struct hostapd_iface *iface, in hostapd_dfs_background_start_channel_switch() argument
1322 if (!dfs_use_radar_background(iface)) in hostapd_dfs_background_start_channel_switch()
1327 __func__, iface->radar_background.cac_started ? "yes" : "no", in hostapd_dfs_background_start_channel_switch()
1328 hostapd_csa_in_progress(iface) ? "yes" : "no"); in hostapd_dfs_background_start_channel_switch()
1331 if (hostapd_csa_in_progress(iface)) in hostapd_dfs_background_start_channel_switch()
1334 if (hostapd_dfs_is_background_event(iface, freq)) { in hostapd_dfs_background_start_channel_switch()
1340 hostapd_dfs_update_background_chain(iface); in hostapd_dfs_background_start_channel_switch()
1349 if (iface->radar_background.channel == -1) in hostapd_dfs_background_start_channel_switch()
1352 if (iface->radar_background.cac_started) { in hostapd_dfs_background_start_channel_switch()
1357 iface->radar_background.temp_ch = 1; in hostapd_dfs_background_start_channel_switch()
1361 return hostapd_dfs_start_channel_switch_background(iface); in hostapd_dfs_background_start_channel_switch()
1365 static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) in hostapd_dfs_start_channel_switch() argument
1372 u8 current_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf); in hostapd_dfs_start_channel_switch()
1375 __func__, iface->cac_started ? "yes" : "no", in hostapd_dfs_start_channel_switch()
1376 hostapd_csa_in_progress(iface) ? "yes" : "no"); in hostapd_dfs_start_channel_switch()
1379 if (hostapd_csa_in_progress(iface)) in hostapd_dfs_start_channel_switch()
1383 if (iface->cac_started) in hostapd_dfs_start_channel_switch()
1384 return hostapd_dfs_start_channel_switch_cac(iface); in hostapd_dfs_start_channel_switch()
1390 if (iface->dfs_domain == HOSTAPD_DFS_REGION_ETSI) in hostapd_dfs_start_channel_switch()
1394 channel = dfs_get_valid_channel(iface, &secondary_channel, in hostapd_dfs_start_channel_switch()
1406 channel = dfs_downgrade_bandwidth(iface, &secondary_channel, in hostapd_dfs_start_channel_switch()
1415 hostapd_disable_iface(iface); in hostapd_dfs_start_channel_switch()
1416 hostapd_enable_iface(iface); in hostapd_dfs_start_channel_switch()
1421 iface->freq = channel->freq; in hostapd_dfs_start_channel_switch()
1422 iface->conf->channel = channel->chan; in hostapd_dfs_start_channel_switch()
1423 iface->conf->secondary_channel = secondary_channel; in hostapd_dfs_start_channel_switch()
1425 iface->conf, oper_centr_freq_seg0_idx); in hostapd_dfs_start_channel_switch()
1427 iface->conf, oper_centr_freq_seg1_idx); in hostapd_dfs_start_channel_switch()
1429 hostapd_disable_iface(iface); in hostapd_dfs_start_channel_switch()
1430 hostapd_enable_iface(iface); in hostapd_dfs_start_channel_switch()
1435 return hostapd_dfs_request_channel_switch(iface, channel->chan, in hostapd_dfs_start_channel_switch()
1444 int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq, in hostapd_dfs_radar_detected() argument
1448 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED in hostapd_dfs_radar_detected()
1452 iface->radar_detected = true; in hostapd_dfs_radar_detected()
1455 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) in hostapd_dfs_radar_detected()
1458 if (!iface->conf->ieee80211h) in hostapd_dfs_radar_detected()
1462 if (!set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width, in hostapd_dfs_radar_detected()
1466 if (!hostapd_dfs_is_background_event(iface, freq)) { in hostapd_dfs_radar_detected()
1468 if (!dfs_are_channels_overlapped(iface, freq, chan_width, in hostapd_dfs_radar_detected()
1473 if (hostapd_dfs_background_start_channel_switch(iface, freq)) { in hostapd_dfs_radar_detected()
1475 return hostapd_dfs_start_channel_switch(iface); in hostapd_dfs_radar_detected()
1482 int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq, in hostapd_dfs_nop_finished() argument
1486 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED in hostapd_dfs_nop_finished()
1491 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) in hostapd_dfs_nop_finished()
1495 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width, in hostapd_dfs_nop_finished()
1498 if (iface->state == HAPD_IFACE_DFS && !iface->cac_started) { in hostapd_dfs_nop_finished()
1500 hostapd_handle_dfs(iface); in hostapd_dfs_nop_finished()
1501 } else if (dfs_use_radar_background(iface) && in hostapd_dfs_nop_finished()
1502 iface->radar_background.channel == -1) { in hostapd_dfs_nop_finished()
1504 hostapd_dfs_update_background_chain(iface); in hostapd_dfs_nop_finished()
1511 int hostapd_is_dfs_required(struct hostapd_iface *iface) in hostapd_is_dfs_required() argument
1515 if ((!(iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) && in hostapd_is_dfs_required()
1516 !iface->conf->ieee80211h) || in hostapd_is_dfs_required()
1517 !iface->current_mode || in hostapd_is_dfs_required()
1518 iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A) in hostapd_is_dfs_required()
1522 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1); in hostapd_is_dfs_required()
1527 n_chans = dfs_get_used_n_chans(iface, &n_chans1); in hostapd_is_dfs_required()
1530 res = dfs_check_chans_radar(iface, start_chan_idx, n_chans); in hostapd_is_dfs_required()
1534 res = dfs_check_chans_radar(iface, start_chan_idx1, n_chans1); in hostapd_is_dfs_required()
1539 int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq, in hostapd_dfs_start_cac() argument
1543 if (hostapd_dfs_is_background_event(iface, freq)) { in hostapd_dfs_start_cac()
1544 iface->radar_background.cac_started = 1; in hostapd_dfs_start_cac()
1549 hostapd_set_state(iface, HAPD_IFACE_DFS); in hostapd_dfs_start_cac()
1550 iface->cac_started = 1; in hostapd_dfs_start_cac()
1555 iface->radar_detected = false; in hostapd_dfs_start_cac()
1556 if (iface->interfaces && iface->interfaces->count > 1) in hostapd_dfs_start_cac()
1557 ieee802_11_set_beacons(iface); in hostapd_dfs_start_cac()
1560 iface->dfs_cac_ms = 60000; in hostapd_dfs_start_cac()
1561 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START in hostapd_dfs_start_cac()
1565 iface->dfs_cac_ms / 1000, in hostapd_dfs_start_cac()
1566 hostapd_dfs_is_background_event(iface, freq) ? in hostapd_dfs_start_cac()
1569 os_get_reltime(&iface->dfs_cac_start); in hostapd_dfs_start_cac()
1581 int hostapd_handle_dfs_offload(struct hostapd_iface *iface) in hostapd_handle_dfs_offload() argument
1586 __func__, iface->cac_started); in hostapd_handle_dfs_offload()
1593 if (iface->cac_started) { in hostapd_handle_dfs_offload()
1595 __func__, iface->cac_started); in hostapd_handle_dfs_offload()
1596 iface->cac_started = 0; in hostapd_handle_dfs_offload()
1600 dfs_res = hostapd_is_dfs_required(iface); in hostapd_handle_dfs_offload()
1604 __func__, iface->freq, dfs_res); in hostapd_handle_dfs_offload()
1610 __func__, iface->freq); in hostapd_handle_dfs_offload()
1615 int hostapd_is_dfs_overlap(struct hostapd_iface *iface, enum chan_width width, in hostapd_is_dfs_overlap() argument
1619 struct hostapd_hw_modes *mode = iface->current_mode; in hostapd_is_dfs_overlap()
1624 if (!iface->conf->ieee80211h || !mode || in hostapd_is_dfs_overlap()