Lines Matching defs: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,
710 iface->freq = channel->freq;
711 iface->conf->channel = channel->chan;
712 iface->conf->secondary_channel = sec;
713 iface->conf->vht_oper_centr_freq_seg0_idx = cf1;
714 iface->conf->vht_oper_centr_freq_seg1_idx = cf2;
719 hostapd_set_state(iface, HAPD_IFACE_DFS);
720 wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq);
721 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
723 iface->freq,
724 iface->conf->channel, iface->conf->secondary_channel,
725 iface->conf->vht_oper_chwidth,
726 iface->conf->vht_oper_centr_freq_seg0_idx,
727 iface->conf->vht_oper_centr_freq_seg1_idx,
728 iface->dfs_cac_ms / 1000);
730 res = hostapd_start_dfs_cac(iface, iface->conf->hw_mode,
731 iface->freq,
732 iface->conf->channel,
733 iface->conf->ieee80211n,
734 iface->conf->ieee80211ac,
735 iface->conf->secondary_channel,
736 iface->conf->vht_oper_chwidth,
737 iface->conf->vht_oper_centr_freq_seg0_idx,
738 iface->conf->vht_oper_centr_freq_seg1_idx);
749 int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,
753 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED
758 /* Complete iface/ap configuration */
759 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) {
761 if (iface->state != HAPD_IFACE_ENABLED)
762 hostapd_setup_interface_complete(iface, 0);
764 iface->cac_started = 0;
766 set_dfs_state(iface, freq, ht_enabled, chan_offset,
769 iface->cac_started = 0;
770 hostapd_setup_interface_complete(iface, 0);
778 static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
788 iface->cac_started = 0;
789 channel = dfs_get_valid_channel(iface, &secondary_channel,
796 hostapd_setup_interface_complete(iface, err);
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_csa_in_progress(struct hostapd_iface *iface)
823 for (i = 0; i < iface->num_bss; i++)
824 if (iface->bss[i]->csa_in_progress)
830 static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
842 __func__, iface->cac_started ? "yes" : "no",
843 hostapd_csa_in_progress(iface) ? "yes" : "no");
846 if (hostapd_csa_in_progress(iface))
850 if (iface->cac_started)
851 return hostapd_dfs_start_channel_switch_cac(iface);
854 channel = dfs_get_valid_channel(iface, &secondary_channel,
866 channel = dfs_get_valid_channel(iface, &secondary_channel,
872 hostapd_disable_iface(iface);
876 iface->freq = channel->freq;
877 iface->conf->channel = channel->chan;
878 iface->conf->secondary_channel = secondary_channel;
879 iface->conf->vht_oper_centr_freq_seg0_idx =
881 iface->conf->vht_oper_centr_freq_seg1_idx =
884 hostapd_disable_iface(iface);
885 hostapd_enable_iface(iface);
891 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
900 iface->conf->hw_mode,
903 iface->conf->ieee80211n,
904 iface->conf->ieee80211ac,
906 iface->conf->vht_oper_chwidth,
909 iface->current_mode->vht_capab);
913 hostapd_disable_iface(iface);
917 for (i = 0; i < iface->num_bss; i++) {
918 err = hostapd_switch_channel(iface->bss[i], &csa_settings);
926 iface->freq = channel->freq;
927 iface->conf->channel = channel->chan;
928 iface->conf->secondary_channel = secondary_channel;
929 iface->conf->vht_oper_centr_freq_seg0_idx =
931 iface->conf->vht_oper_centr_freq_seg1_idx =
934 hostapd_disable_iface(iface);
935 hostapd_enable_iface(iface);
947 int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq,
953 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED
958 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
961 if (!iface->conf->ieee80211h)
965 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width,
969 res = dfs_are_channels_overlapped(iface, freq, chan_width, cf1, cf2);
974 res = hostapd_dfs_start_channel_switch(iface);
980 int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
984 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED
989 if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
993 set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width,
999 int hostapd_is_dfs_required(struct hostapd_iface *iface)
1003 if (!iface->conf->ieee80211h || !iface->current_mode ||
1004 iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A)
1008 start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1);
1013 n_chans = dfs_get_used_n_chans(iface, &n_chans1);
1016 res = dfs_check_chans_radar(iface, start_chan_idx, n_chans);
1020 res = dfs_check_chans_radar(iface, start_chan_idx1, n_chans1);
1025 int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
1029 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
1033 iface->cac_started = 1;
1045 int hostapd_handle_dfs_offload(struct hostapd_iface *iface)
1047 wpa_printf(MSG_DEBUG, "%s: iface->cac_started: %d",
1048 __func__, iface->cac_started);
1055 if (iface->cac_started) {
1056 wpa_printf(MSG_DEBUG, "%s: iface->cac_started: %d",
1057 __func__, iface->cac_started);
1058 iface->cac_started = 0;
1062 if (ieee80211_is_dfs(iface->freq)) {
1064 __func__, iface->freq);
1070 __func__, iface->freq);