Home | History | Annotate | Download | only in ap

Lines Matching full: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) {
32 switch (iface->conf->vht_oper_chwidth) {
165 static int is_in_chanlist(struct hostapd_iface *iface,
168 if (!iface->conf->acs_ch_list.num)
171 return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan);
182 static int dfs_find_channel(struct hostapd_iface *iface,
190 mode = iface->current_mode;
191 n_chans = dfs_get_used_n_chans(iface, &n_chans1);
198 if (iface->conf->ieee80211n &&
199 iface->conf->secondary_channel &&
207 if (!is_in_chanlist(iface, chan))
222 static void dfs_adjust_vht_center_freq(struct hostapd_iface *iface,
228 if (!iface->conf->ieee80211ac)
236 switch (iface->conf->vht_oper_chwidth) {
264 static int dfs_get_start_chan_idx(struct hostapd_iface *iface, int *seg1_start)
268 int channel_no = iface->conf->channel;
275 if (iface->conf->ieee80211n && iface->conf->secondary_channel == -1)
279 if (iface->conf->ieee80211ac) {
280 switch (iface->conf->vht_oper_chwidth) {
285 iface->conf->vht_oper_centr_freq_seg0_idx - 6;
289 iface->conf->vht_oper_centr_freq_seg0_idx - 14;
293 iface->conf->vht_oper_centr_freq_seg0_idx - 6;
295 iface->conf->vht_oper_centr_freq_seg1_idx - 6;
306 mode = iface->current_mode;
319 mode = iface->current_mode;
335 mode->num_channels, channel_no, iface->conf->channel,
336 iface->conf->ieee80211n,
337 iface->conf->secondary_channel,
338 iface->conf->vht_oper_chwidth);
351 static int dfs_check_chans_radar(struct hostapd_iface *iface,
358 mode = iface->current_mode;
371 static int dfs_check_chans_available(struct hostapd_iface *iface,
378 mode = iface->current_mode;
399 static int dfs_check_chans_unavailable(struct hostapd_iface *iface,
407 mode = iface->current_mode;
423 dfs_get_valid_channel(struct hostapd_iface *iface,
440 if (iface->current_mode == NULL)
443 mode = iface->current_mode;
448 num_available_chandefs = dfs_find_channel(iface, NULL, 0, skip_radar);
455 dfs_find_channel(iface, &chan, chan_idx, skip_radar);
458 if (iface->conf->secondary_channel)
463 dfs_adjust_vht_center_freq(iface, chan,
472 static int set_dfs_state_freq(struct hostapd_iface *iface, int freq, u32 state)
478 mode = iface->current_mode;
483 for (i = 0; i < iface->current_mode->num_channels; i++) {
484 chan = &iface->current_mode->channels[i];
498 static int set_dfs_state(struct hostapd_iface *iface, int freq, int ht_enabled,
507 mode = iface->current_mode;
545 ret += set_dfs_state_freq(iface, frequency, state);
553 static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq,
564 mode = iface->current_mode;
565 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1);
566 n_chans = dfs_get_used_n_chans(iface, &n_chans1);
569 if (!dfs_check_chans_radar(iface, start_chan_idx, n_chans))
618 static unsigned int dfs_get_cac_time(struct hostapd_iface *iface,
626 mode = iface->current_mode;
646 int hostapd_handle_dfs(struct hostapd_iface *iface)
652 if (!iface->current_mode) {
662 iface->cac_started = 0;
666 start_chan_idx = dfs_get_start_chan_idx(iface,
672 n_chans = dfs_get_used_n_chans(iface, &n_chans1);
675 iface->dfs_cac_ms = dfs_get_cac_time(iface, start_chan_idx,
679 res = dfs_check_chans_radar(iface, start_chan_idx, n_chans);
687 res = dfs_check_chans_available(iface, start_chan_idx, n_chans);
695 res = dfs_check_chans_unavailable(iface, start_chan_idx,
703 channel = dfs_get_valid_channel(iface, &sec, &cf1, &cf2,
707 hostapd_set_state(iface, HAPD_IFACE_DFS);
711 iface->freq = channel->freq;
712 iface->conf->channel = channel->chan;
713 iface->conf->secondary_channel = sec;
714 iface->conf->vht_oper_centr_freq_seg0_idx = cf1;
715 iface->conf->vht_oper_centr_freq_seg1_idx = cf2;
720 hostapd_set_state(iface, HAPD_IFACE_DFS);
721 wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq);
722 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
724 iface->freq,
725 iface->conf->channel, iface->conf->secondary_channel,
726 iface->conf->vht_oper_chwidth,
727 iface->conf->vht_oper_centr_freq_seg0_idx,
728 iface->conf->vht_oper_centr_freq_seg1_idx,
729 iface->dfs_cac_ms / 1000);
731 res = hostapd_start_dfs_cac(iface, iface->conf->hw_mode,
732 iface->freq,
733 iface->conf->channel,
734 iface->conf->ieee80211n,
735 iface->conf->ieee80211ac,
736 iface->conf->secondary_channel,
737 iface->conf->vht_oper_chwidth,
738 iface->conf->vht_oper_centr_freq_seg0_idx,
739 iface->conf->vht_oper_centr_freq_seg1_idx);
750 int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,
754 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED
759 /* Complete iface/ap configuration */
760 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) {
762 if (iface->state != HAPD_IFACE_ENABLED)
763 hostapd_setup_interface_complete(iface, 0);
765 iface->cac_started = 0;
767 set_dfs_state(iface, freq, ht_enabled, chan_offset,
770 iface->cac_started = 0;
771 hostapd_setup_interface_complete(iface, 0);
779 static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
789 iface->cac_started = 0;
790 channel = dfs_get_valid_channel(iface, &secondary_channel,
802 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
806 iface->freq = channel->freq;
807 iface->conf->channel = channel->chan;
808 iface->conf->secondary_channel = secondary_channel;
809 iface->conf->vht_oper_centr_freq_seg0_idx =
811 iface->conf->vht_oper_centr_freq_seg1_idx =
815 hostapd_setup_interface_complete(iface, err);
820 static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
832 __func__, iface->cac_started ? "yes" : "no",
833 hostapd_csa_in_progress(iface) ? "yes" : "no");
836 if (hostapd_csa_in_progress(iface))
840 if (iface->cac_started)
841 return hostapd_dfs_start_channel_switch_cac(iface);
844 channel = dfs_get_valid_channel(iface, &secondary_channel,
856 channel = dfs_get_valid_channel(iface, &secondary_channel,
867 iface->freq = channel->freq;
868 iface->conf->channel = channel->chan;
869 iface->conf->secondary_channel = secondary_channel;
870 iface->conf->vht_oper_centr_freq_seg0_idx =
872 iface->conf->vht_oper_centr_freq_seg1_idx =
875 hostapd_disable_iface(iface);
876 hostapd_enable_iface(iface);
882 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
891 iface->conf->hw_mode,
894 iface->conf->ieee80211n,
895 iface->conf->ieee80211ac,
897 iface->conf->vht_oper_chwidth,
900 iface->current_mode->vht_capab);
904 hostapd_disable_iface(iface);
908 for (i = 0; i < iface->num_bss; i++) {
909 err = hostapd_switch_channel(iface->bss[i], &csa_settings);
917 iface->freq = channel->freq;
918 iface->conf->channel = channel->chan;
919 iface->conf->secondary_channel = secondary_channel;
920 iface->conf->vht_oper_centr_freq_seg0_idx =
922 iface->conf->vht_oper_centr_freq_seg1_idx =
925 hostapd_disable_iface(iface);
926 hostapd_enable_iface(iface);
938 int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq,
944 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED
949 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
952 if (!iface->conf->ieee80211h)
956 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width,
960 res = dfs_are_channels_overlapped(iface, freq, chan_width, cf1, cf2);
965 res = hostapd_dfs_start_channel_switch(iface);
971 int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
975 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED
980 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
984 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width,
988 if (iface->state == HAPD_IFACE_DFS && !iface->cac_started)
989 hostapd_handle_dfs(iface);
995 int hostapd_is_dfs_required(struct hostapd_iface *iface)
999 if (!iface->conf->ieee80211h || !iface->current_mode ||
1000 iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A)
1004 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1);
1009 n_chans = dfs_get_used_n_chans(iface, &n_chans1);
1012 res = dfs_check_chans_radar(iface, start_chan_idx, n_chans);
1016 res = dfs_check_chans_radar(iface, start_chan_idx1, n_chans1);
1021 int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
1025 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
1029 iface->cac_started = 1;
1041 int hostapd_handle_dfs_offload(struct hostapd_iface *iface)
1043 wpa_printf(MSG_DEBUG, "%s: iface->cac_started: %d",
1044 __func__, iface->cac_started);
1051 if (iface->cac_started) {
1052 wpa_printf(MSG_DEBUG, "%s: iface->cac_started: %d",
1053 __func__, iface->cac_started);
1054 iface->cac_started = 0;
1058 if (ieee80211_is_dfs(iface->freq)) {
1060 __func__, iface->freq);
1066 __func__, iface->freq);