diff --git a/umac/dfs/core/src/dfs_misc.h b/umac/dfs/core/src/dfs_misc.h index efc8108ad4..c60c1a2ee1 100644 --- a/umac/dfs/core/src/dfs_misc.h +++ b/umac/dfs/core/src/dfs_misc.h @@ -23,6 +23,9 @@ e* copyright notice and this permission notice appear in all copies. #include "dfs.h" #include "wlan_dfs_ucfg_api.h" #include "wlan_lmac_if_def.h" +#ifdef CONFIG_HOST_FIND_CHAN +#include +#endif #ifdef QCA_SUPPORT_DFS_CHAN_POSTNOL /** diff --git a/umac/dfs/core/src/misc/dfs_misc.c b/umac/dfs/core/src/misc/dfs_misc.c index b308276ebd..117416f4f8 100644 --- a/umac/dfs/core/src/misc/dfs_misc.c +++ b/umac/dfs/core/src/misc/dfs_misc.c @@ -208,7 +208,7 @@ bool dfs_switch_to_postnol_chan_if_nol_expired(struct wlan_dfs *dfs) dfs->dfs_chan_postnol_cfreq2); return false; } - if (WLAN_IS_CHAN_RADAR(&chan)) + if (WLAN_IS_CHAN_RADAR(dfs, &chan)) return false; if (global_dfs_to_mlme.mlme_postnol_chan_switch) @@ -388,3 +388,47 @@ void dfs_set_nol(struct wlan_dfs *dfs, } #endif #endif + +#ifdef CONFIG_HOST_FIND_CHAN +bool wlan_is_chan_radar(struct wlan_dfs *dfs, struct dfs_channel *chan) +{ + qdf_freq_t sub_freq_list[NUM_CHANNELS_160MHZ]; + uint8_t n_subchans, i; + + if (!chan || !WLAN_IS_PRIMARY_OR_SECONDARY_CHAN_DFS(chan)) + return false; + + n_subchans = dfs_get_bonding_channel_without_seg_info_for_freq( + chan, + sub_freq_list); + + for (i = 0; i < n_subchans; i++) { + if (wlan_reg_is_nol_for_freq(dfs->dfs_pdev_obj, + sub_freq_list[i])) + return true; + } + + return false; +} + +bool wlan_is_chan_history_radar(struct wlan_dfs *dfs, struct dfs_channel *chan) +{ + qdf_freq_t sub_freq_list[NUM_CHANNELS_160MHZ]; + uint8_t n_subchans, i; + + if (!chan || !WLAN_IS_PRIMARY_OR_SECONDARY_CHAN_DFS(chan)) + return false; + + n_subchans = dfs_get_bonding_channel_without_seg_info_for_freq( + chan, + sub_freq_list); + + for (i = 0; i < n_subchans; i++) { + if (wlan_reg_is_nol_hist_for_freq(dfs->dfs_pdev_obj, + sub_freq_list[i])) + return true; + } + + return false; +} +#endif /* CONFIG_HOST_FIND_CHAN */ diff --git a/umac/regulatory/core/reg_channel.c b/umac/regulatory/core/reg_channel.c index 26cf58c1cb..612d3447ab 100644 --- a/umac/regulatory/core/reg_channel.c +++ b/umac/regulatory/core/reg_channel.c @@ -336,4 +336,46 @@ bool reg_is_band_present(struct wlan_objmgr_pdev *pdev, return reg_is_band_found_internal(min_chan_idx, max_chan_idx, cur_chan_list); } -#endif +#endif /* CONFIG_HOST_FIND_CHAN */ + +bool reg_is_nol_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) +{ + enum channel_enum chan_enum; + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; + + chan_enum = reg_get_chan_enum_for_freq(freq); + if (chan_enum == INVALID_CHANNEL) { + reg_err("chan freq is not valid"); + return false; + } + + pdev_priv_obj = reg_get_pdev_obj(pdev); + + if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { + reg_err("pdev reg obj is NULL"); + return false; + } + + return pdev_priv_obj->cur_chan_list[chan_enum].nol_chan; +} + +bool reg_is_nol_hist_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) +{ + enum channel_enum chan_enum; + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; + + chan_enum = reg_get_chan_enum_for_freq(freq); + if (chan_enum == INVALID_CHANNEL) { + reg_err("chan freq is not valid"); + return false; + } + + pdev_priv_obj = reg_get_pdev_obj(pdev); + + if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { + reg_err("pdev reg obj is NULL"); + return false; + } + + return pdev_priv_obj->cur_chan_list[chan_enum].nol_history; +} diff --git a/umac/regulatory/core/reg_channel.h b/umac/regulatory/core/reg_channel.h index 8c17d77b06..fcb3644036 100644 --- a/umac/regulatory/core/reg_channel.h +++ b/umac/regulatory/core/reg_channel.h @@ -252,4 +252,22 @@ reg_is_band_present(struct wlan_objmgr_pdev *pdev, enum reg_wifi_band reg_band) } #endif /* CONFIG_HOST_FIND_CHAN */ +/** + * reg_is_nol_for_freq () - Checks the channel is a nol channel or not + * @pdev: pdev ptr + * @freq: Channel center frequency + * + * Return: true if nol channel else false. + */ +bool reg_is_nol_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); + +/** + * reg_is_nol_hist_for_freq () - Checks the channel is a nol hist channel or not + * @pdev: pdev ptr + * @freq: Channel center frequency + * + * Return: true if nol channel else false. + */ +bool reg_is_nol_hist_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); + #endif /* __REG_CHANNEL_H_ */ diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_channel_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_channel_api.h index a33b4479e4..85310791f9 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_channel_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_channel_api.h @@ -190,4 +190,22 @@ bool wlan_reg_is_band_present(struct wlan_objmgr_pdev *pdev, } #endif /* CONFIG_HOST_FIND_CHAN */ +/** + * wlan_reg_is_nol_freq() - Checks the channel is a nol chan or not + * @freq: Channel center frequency + * + * Return: true if channel is nol else false + */ +bool wlan_reg_is_nol_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); + +/** + * wlan_reg_is_nol_hist_for_freq() - Checks the channel is a nol history channel + * or not. + * @freq: Channel center frequency + * + * Return: true if channel is nol else false + */ +bool wlan_reg_is_nol_hist_for_freq(struct wlan_objmgr_pdev *pdev, + qdf_freq_t freq); + #endif /* __WLAN_REG_CHANNEL_API_H */ diff --git a/umac/regulatory/dispatcher/src/wlan_reg_channel_api.c b/umac/regulatory/dispatcher/src/wlan_reg_channel_api.c index 2d986c7311..238f4f74aa 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_channel_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_channel_api.c @@ -165,3 +165,14 @@ bool wlan_reg_is_band_present(struct wlan_objmgr_pdev *pdev, qdf_export_symbol(wlan_reg_is_band_present); #endif /* CONFIG_HOST_FIND_CHAN */ + +bool wlan_reg_is_nol_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) +{ + return reg_is_nol_for_freq(pdev, freq); +} + +bool wlan_reg_is_nol_hist_for_freq(struct wlan_objmgr_pdev *pdev, + qdf_freq_t freq) +{ + return reg_is_nol_hist_for_freq(pdev, freq); +}