Lines Matching refs:iface

22 static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)
28 if (iface->conf->ieee80211n && iface->conf->secondary_channel)
31 if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) {
32 switch (hostapd_get_oper_chwidth(iface->conf)) {
177 static int is_in_chanlist(struct hostapd_iface *iface,
180 if (!iface->conf->acs_ch_list.num)
183 return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan);
194 static int dfs_find_channel(struct hostapd_iface *iface,
202 mode = iface->current_mode;
203 n_chans = dfs_get_used_n_chans(iface, &n_chans1);
210 if (iface->conf->ieee80211n &&
211 iface->conf->secondary_channel &&
220 if (!is_in_chanlist(iface, chan))
235 static void dfs_adjust_center_freq(struct hostapd_iface *iface,
241 if (!iface->conf->ieee80211ac && !iface->conf->ieee80211ax)
249 switch (hostapd_get_oper_chwidth(iface->conf)) {
277 static int dfs_get_start_chan_idx(struct hostapd_iface *iface, int *seg1_start)
281 int channel_no = iface->conf->channel;
288 if (iface->conf->ieee80211n && iface->conf->secondary_channel == -1)
292 if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) {
293 switch (hostapd_get_oper_chwidth(iface->conf)) {
298 iface->conf) - 6;
302 iface->conf) - 14;
306 iface->conf) - 6;
308 iface->conf) - 6;
319 mode = iface->current_mode;
332 mode = iface->current_mode;
348 mode->num_channels, channel_no, iface->conf->channel,
349 iface->conf->ieee80211n,
350 iface->conf->secondary_channel,
351 hostapd_get_oper_chwidth(iface->conf));
364 static int dfs_check_chans_radar(struct hostapd_iface *iface,
371 mode = iface->current_mode;
384 static int dfs_check_chans_available(struct hostapd_iface *iface,
391 mode = iface->current_mode;
412 static int dfs_check_chans_unavailable(struct hostapd_iface *iface,
420 mode = iface->current_mode;
436 dfs_get_valid_channel(struct hostapd_iface *iface,
453 if (iface->current_mode == NULL)
456 mode = iface->current_mode;
461 num_available_chandefs = dfs_find_channel(iface, NULL, 0, skip_radar);
468 dfs_find_channel(iface, &chan, chan_idx, skip_radar);
471 if (iface->conf->secondary_channel)
476 dfs_adjust_center_freq(iface, chan,
485 static int set_dfs_state_freq(struct hostapd_iface *iface, int freq, u32 state)
491 mode = iface->current_mode;
496 for (i = 0; i < iface->current_mode->num_channels; i++) {
497 chan = &iface->current_mode->channels[i];
511 static int set_dfs_state(struct hostapd_iface *iface, int freq, int ht_enabled,
520 mode = iface->current_mode;
558 ret += set_dfs_state_freq(iface, frequency, state);
566 static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq,
577 mode = iface->current_mode;
578 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1);
579 n_chans = dfs_get_used_n_chans(iface, &n_chans1);
582 if (!dfs_check_chans_radar(iface, start_chan_idx, n_chans))
631 static unsigned int dfs_get_cac_time(struct hostapd_iface *iface,
639 mode = iface->current_mode;
659 int hostapd_handle_dfs(struct hostapd_iface *iface)
665 if (!iface->current_mode) {
675 iface->cac_started = 0;
679 start_chan_idx = dfs_get_start_chan_idx(iface,
685 n_chans = dfs_get_used_n_chans(iface, &n_chans1);
688 iface->dfs_cac_ms = dfs_get_cac_time(iface, start_chan_idx,
692 res = dfs_check_chans_radar(iface, start_chan_idx, n_chans);
700 res = dfs_check_chans_available(iface, start_chan_idx, n_chans);
708 res = dfs_check_chans_unavailable(iface, start_chan_idx,
716 channel = dfs_get_valid_channel(iface, &sec, &cf1, &cf2,
720 hostapd_set_state(iface, HAPD_IFACE_DFS);
724 iface->freq = channel->freq;
725 iface->conf->channel = channel->chan;
726 iface->conf->secondary_channel = sec;
727 hostapd_set_oper_centr_freq_seg0_idx(iface->conf, cf1);
728 hostapd_set_oper_centr_freq_seg1_idx(iface->conf, cf2);
733 hostapd_set_state(iface, HAPD_IFACE_DFS);
734 wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq);
735 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
737 iface->freq,
738 iface->conf->channel, iface->conf->secondary_channel,
739 hostapd_get_oper_chwidth(iface->conf),
740 hostapd_get_oper_centr_freq_seg0_idx(iface->conf),
741 hostapd_get_oper_centr_freq_seg1_idx(iface->conf),
742 iface->dfs_cac_ms / 1000);
745 iface, iface->conf->hw_mode, iface->freq, iface->conf->channel,
746 iface->conf->ieee80211n, iface->conf->ieee80211ac,
747 iface->conf->ieee80211ax,
748 iface->conf->secondary_channel,
749 hostapd_get_oper_chwidth(iface->conf),
750 hostapd_get_oper_centr_freq_seg0_idx(iface->conf),
751 hostapd_get_oper_centr_freq_seg1_idx(iface->conf));
762 static int hostapd_config_dfs_chan_available(struct hostapd_iface *iface)
767 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1);
772 n_chans = dfs_get_used_n_chans(iface, &n_chans1);
775 return dfs_check_chans_available(iface, start_chan_idx, n_chans);
779 int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,
783 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED
788 /* Complete iface/ap configuration */
789 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) {
791 if (iface->state != HAPD_IFACE_ENABLED)
792 hostapd_setup_interface_complete(iface, 0);
794 iface->cac_started = 0;
796 set_dfs_state(iface, freq, ht_enabled, chan_offset,
809 if (iface->state != HAPD_IFACE_ENABLED &&
810 hostapd_config_dfs_chan_available(iface)) {
811 hostapd_setup_interface_complete(iface, 0);
812 iface->cac_started = 0;
821 int hostapd_dfs_pre_cac_expired(struct hostapd_iface *iface, int freq,
825 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED
830 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
833 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width,
840 static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
850 iface->cac_started = 0;
851 channel = dfs_get_valid_channel(iface, &secondary_channel,
863 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
867 iface->freq = channel->freq;
868 iface->conf->channel = channel->chan;
869 iface->conf->secondary_channel = secondary_channel;
870 hostapd_set_oper_centr_freq_seg0_idx(iface->conf,
872 hostapd_set_oper_centr_freq_seg1_idx(iface->conf,
876 hostapd_setup_interface_complete(iface, err);
881 static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
891 struct hostapd_hw_modes *cmode = iface->current_mode;
894 __func__, iface->cac_started ? "yes" : "no",
895 hostapd_csa_in_progress(iface) ? "yes" : "no");
898 if (hostapd_csa_in_progress(iface))
902 if (iface->cac_started)
903 return hostapd_dfs_start_channel_switch_cac(iface);
909 if (iface->dfs_domain == HOSTAPD_DFS_REGION_ETSI)
913 channel = dfs_get_valid_channel(iface, &secondary_channel,
925 channel = dfs_get_valid_channel(iface, &secondary_channel,
936 iface->freq = channel->freq;
937 iface->conf->channel = channel->chan;
938 iface->conf->secondary_channel = secondary_channel;
939 hostapd_set_oper_centr_freq_seg0_idx(iface->conf,
941 hostapd_set_oper_centr_freq_seg1_idx(iface->conf,
944 hostapd_disable_iface(iface);
945 hostapd_enable_iface(iface);
951 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
960 iface->conf->hw_mode,
963 iface->conf->ieee80211n,
964 iface->conf->ieee80211ac,
965 iface->conf->ieee80211ax,
967 hostapd_get_oper_chwidth(iface->conf),
975 hostapd_disable_iface(iface);
979 for (i = 0; i < iface->num_bss; i++) {
980 err = hostapd_switch_channel(iface->bss[i], &csa_settings);
988 iface->freq = channel->freq;
989 iface->conf->channel = channel->chan;
990 iface->conf->secondary_channel = secondary_channel;
991 hostapd_set_oper_centr_freq_seg0_idx(iface->conf,
993 hostapd_set_oper_centr_freq_seg1_idx(iface->conf,
996 hostapd_disable_iface(iface);
997 hostapd_enable_iface(iface);
1009 int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq,
1015 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED
1020 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
1023 if (!iface->conf->ieee80211h)
1027 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width,
1031 res = dfs_are_channels_overlapped(iface, freq, chan_width, cf1, cf2);
1036 res = hostapd_dfs_start_channel_switch(iface);
1042 int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
1046 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED
1051 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
1055 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width,
1059 if (iface->state == HAPD_IFACE_DFS && !iface->cac_started)
1060 hostapd_handle_dfs(iface);
1066 int hostapd_is_dfs_required(struct hostapd_iface *iface)
1070 if (!iface->conf->ieee80211h || !iface->current_mode ||
1071 iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A)
1075 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1);
1080 n_chans = dfs_get_used_n_chans(iface, &n_chans1);
1083 res = dfs_check_chans_radar(iface, start_chan_idx, n_chans);
1087 res = dfs_check_chans_radar(iface, start_chan_idx1, n_chans1);
1092 int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
1096 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
1100 iface->cac_started = 1;
1112 int hostapd_handle_dfs_offload(struct hostapd_iface *iface)
1114 wpa_printf(MSG_DEBUG, "%s: iface->cac_started: %d",
1115 __func__, iface->cac_started);
1122 if (iface->cac_started) {
1123 wpa_printf(MSG_DEBUG, "%s: iface->cac_started: %d",
1124 __func__, iface->cac_started);
1125 iface->cac_started = 0;
1129 if (ieee80211_is_dfs(iface->freq, iface->hw_features,
1130 iface->num_hw_features)) {
1132 __func__, iface->freq);
1138 __func__, iface->freq);