diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index e027fd1bb6..eab114051b 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -2481,13 +2481,6 @@ static inline bool BAND_5G_PRESENT(uint8_t band_mask) return !!(band_mask & (BIT(REG_BAND_5G))); } -#ifdef CONFIG_BAND_6GHZ -bool reg_is_6ghz_chan_freq(uint16_t freq) -{ - return REG_IS_6GHZ_FREQ(freq); -} - -#ifdef CONFIG_6G_FREQ_OVERLAP /** * reg_is_freq_in_between() - Check whether freq falls within low_freq and * high_freq, inclusively. @@ -2521,20 +2514,32 @@ static bool reg_is_ranges_overlap(qdf_freq_t low_freq, qdf_freq_t high_freq, end_edge_freq)); } -static bool reg_is_range_overlap_6g(qdf_freq_t low_freq, - qdf_freq_t high_freq) +bool reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq) { return reg_is_ranges_overlap(low_freq, high_freq, - SIXG_STARTING_EDGE_FREQ, - SIXG_ENDING_EDGE_FREQ); + TWO_GIG_STARTING_EDGE_FREQ, + TWO_GIG_ENDING_EDGE_FREQ); } -static bool reg_is_range_overlap_5g(qdf_freq_t low_freq, - qdf_freq_t high_freq) +bool reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq) { return reg_is_ranges_overlap(low_freq, high_freq, - FIVEG_STARTING_EDGE_FREQ, - FIVEG_ENDING_EDGE_FREQ); + FIVE_GIG_STARTING_EDGE_FREQ, + FIVE_GIG_ENDING_EDGE_FREQ); +} + +#ifdef CONFIG_BAND_6GHZ +bool reg_is_6ghz_chan_freq(uint16_t freq) +{ + return REG_IS_6GHZ_FREQ(freq); +} + +#ifdef CONFIG_6G_FREQ_OVERLAP +bool reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq) +{ + return reg_is_ranges_overlap(low_freq, high_freq, + SIX_GIG_STARTING_EDGE_FREQ, + SIX_GIG_ENDING_EDGE_FREQ); } bool reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq) diff --git a/umac/regulatory/core/src/reg_services_common.h b/umac/regulatory/core/src/reg_services_common.h index 910a96f701..1f7b2649dd 100644 --- a/umac/regulatory/core/src/reg_services_common.h +++ b/umac/regulatory/core/src/reg_services_common.h @@ -81,15 +81,19 @@ #define HALF_5MHZ_BW 2 #define HALF_20MHZ_BW 10 -#define FIVEG_STARTING_EDGE_FREQ (channel_map_global[MIN_49GHZ_CHANNEL]. \ +#define TWO_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_24GHZ_CHANNEL]. \ + center_freq - HALF_20MHZ_BW) +#define TWO_GIG_ENDING_EDGE_FREQ (channel_map_global[MAX_24GHZ_CHANNEL]. \ + center_freq + HALF_20MHZ_BW) +#define FIVE_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_49GHZ_CHANNEL]. \ center_freq - HALF_5MHZ_BW) -#define FIVEG_ENDING_EDGE_FREQ (channel_map_global[MAX_5GHZ_CHANNEL]. \ +#define FIVE_GIG_ENDING_EDGE_FREQ (channel_map_global[MAX_5GHZ_CHANNEL]. \ center_freq + HALF_20MHZ_BW) #ifdef CONFIG_BAND_6GHZ -#define SIXG_STARTING_EDGE_FREQ (channel_map_global[MIN_6GHZ_CHANNEL]. \ +#define SIX_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_6GHZ_CHANNEL]. \ center_freq - HALF_20MHZ_BW) -#define SIXG_ENDING_EDGE_FREQ (channel_map_global[MAX_6GHZ_CHANNEL]. \ +#define SIX_GIG_ENDING_EDGE_FREQ (channel_map_global[MAX_6GHZ_CHANNEL]. \ center_freq + HALF_20MHZ_BW) #define FREQ_LEFT_SHIFT 55 @@ -553,6 +557,30 @@ bool reg_is_24ghz_ch_freq(uint32_t freq); */ bool reg_is_5ghz_ch_freq(uint32_t freq); +/** + * reg_is_range_overlap_2g() - Check if the given low_freq and high_freq + * is in the 2G range. + * + * @low_freq - Low frequency. + * @high_freq - High frequency. + * + * Return: Return true if given low_freq and high_freq overlaps 2G range, + * else false. + */ +bool reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq); + +/** + * reg_is_range_overlap_5g() - Check if the given low_freq and high_freq + * is in the 5G range. + * + * @low_freq - Low frequency. + * @high_freq - High frequency. + * + * Return: Return true if given low_freq and high_freq overlaps 5G range, + * else false. + */ +bool reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq); + #ifdef CONFIG_BAND_6GHZ /** * reg_is_6ghz_chan_freq() - Check if the given channel frequency is 6GHz @@ -564,16 +592,28 @@ bool reg_is_6ghz_chan_freq(uint16_t freq); #ifdef CONFIG_6G_FREQ_OVERLAP /** - * reg_is_range_only6g() - Check if the given low_freq and high_freq is in + * reg_is_range_only6g() - Check if the given low_freq and high_freq is only in * the 6G range. * * @low_freq - Low frequency. * @high_freq - High frequency. * + * Return: Return true if given low_freq and high_freq overlaps only the 6G + * range, else false. + */ +bool reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq); + +/** + * reg_is_range_overlap_6g() - Check if the given low_freq and high_freq + * is in the 6G range. + * + * @low_freq - Low frequency. + * @high_freq - High frequency. + * * Return: Return true if given low_freq and high_freq overlaps 6G range, * else false. */ -bool reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq); +bool reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq); #endif /** @@ -633,6 +673,12 @@ reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) } #ifdef CONFIG_6G_FREQ_OVERLAP +static inline bool reg_is_range_overlap_6g(qdf_freq_t low_freq, + qdf_freq_t high_freq) +{ + return false; +} + static inline bool reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq) { diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index 84f35fcb74..a2073aae4c 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -134,6 +134,30 @@ bool wlan_reg_is_24ghz_ch_freq(qdf_freq_t freq); #define WLAN_REG_IS_5GHZ_CH_FREQ(freq) wlan_reg_is_5ghz_ch_freq(freq) bool wlan_reg_is_5ghz_ch_freq(qdf_freq_t freq); +/** + * wlan_reg_is_range_overlap_2g() - Check if the given low_freq and high_freq + * is in the 2G range. + * + * @low_freq - Low frequency. + * @high_freq - High frequency. + * + * Return: Return true if given low_freq and high_freq overlaps 2G range, + * else false. + */ +bool wlan_reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq); + +/** + * wlan_reg_is_range_overlap_5g() - Check if the given low_freq and high_freq + * is in the 5G range. + * + * @low_freq - Low frequency. + * @high_freq - High frequency. + * + * Return: Return true if given low_freq and high_freq overlaps 5G range, + * else false. + */ +bool wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq); + #ifdef CONFIG_BAND_6GHZ /** * wlan_reg_is_6ghz_chan_freq() - Check if the given channel frequency is 6GHz @@ -155,12 +179,30 @@ bool wlan_reg_is_6ghz_chan_freq(uint16_t freq); * else false. */ bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq); + +/** + * wlan_reg_is_range_overlap_6g() - Check if the given low_freq and high_freq + * is in the 6G range. + * + * @low_freq - Low frequency. + * @high_freq - High frequency. + * + * Return: Return true if given low_freq and high_freq overlaps 6G range, + * else false. + */ +bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq); #else static inline bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq) { return false; } + +static inline bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq, + qdf_freq_t high_freq) +{ + return false; +} #endif /** diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index ce884a729c..d9678d1eab 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -789,6 +789,16 @@ bool wlan_reg_is_5ghz_ch_freq(qdf_freq_t freq) return reg_is_5ghz_ch_freq(freq); } +bool wlan_reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq) +{ + return reg_is_range_overlap_2g(low_freq, high_freq); +} + +bool wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq) +{ + return reg_is_range_overlap_5g(low_freq, high_freq); +} + #ifdef CONFIG_BAND_6GHZ bool wlan_reg_is_6ghz_chan_freq(uint16_t freq) { @@ -800,6 +810,11 @@ bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq) { return reg_is_range_only6g(low_freq, high_freq); } + +bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq) +{ + return reg_is_range_overlap_6g(low_freq, high_freq); +} #endif uint16_t wlan_reg_min_6ghz_chan_freq(void)