From 504e0726c7eb69bf0158322874f81c8c8f264aac Mon Sep 17 00:00:00 2001 From: Hariharan Basuthkar Date: Tue, 30 Jun 2020 22:29:15 +0530 Subject: [PATCH] qcacmn: Add a new API wlan_reg_is_6g_freq_indoor Add a new API wlan_reg_is_6g_freq_indoor, to check if a 6G channel frequency is indoor. Change-Id: I2ccdcc2760b6aeade0409346a315b004014525c7 CRs-Fixed: 2731637 --- .../regulatory/core/src/reg_services_common.c | 38 +++++++++++++++++++ .../regulatory/core/src/reg_services_common.h | 15 ++++++++ .../dispatcher/inc/wlan_reg_services_api.h | 18 +++++++++ .../dispatcher/src/wlan_reg_services_api.c | 4 ++ 4 files changed, 75 insertions(+) diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index 6ad5c78ab099..c298375bbaef 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -2582,6 +2582,44 @@ bool reg_is_6ghz_psc_chan_freq(uint16_t freq) return false; } +/** + * reg_is_freq_indoor() - Check if the input frequency is an indoor frequency. + * @pdev: Pointer to pdev. + * @freq: Channel frequency. + * + * Return: Return true if the input frequency is indoor, else false. + */ +static bool reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) +{ + struct regulatory_channel *cur_chan_list; + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; + enum channel_enum chan_enum; + + pdev_priv_obj = reg_get_pdev_obj(pdev); + + if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { + reg_err("reg pdev priv obj is NULL"); + return false; + } + + chan_enum = reg_get_chan_enum_for_freq(freq); + + if (chan_enum == INVALID_CHANNEL) { + reg_err_rl("Invalid chan enum %d", chan_enum); + return false; + } + + cur_chan_list = pdev_priv_obj->cur_chan_list; + + return (cur_chan_list[chan_enum].chan_flags & + REGULATORY_CHAN_INDOOR_ONLY); +} + +bool reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) +{ + return (REG_IS_6GHZ_FREQ(freq) && reg_is_freq_indoor(pdev, freq)); +} + /** * BAND_6G_PRESENT() - Check if REG_BAND_6G is set in the band_mask * @band_mask: Bitmask for bands diff --git a/umac/regulatory/core/src/reg_services_common.h b/umac/regulatory/core/src/reg_services_common.h index 527d84afc5e9..910a96f70165 100644 --- a/umac/regulatory/core/src/reg_services_common.h +++ b/umac/regulatory/core/src/reg_services_common.h @@ -598,6 +598,15 @@ static inline bool REG_IS_6GHZ_FREQ(uint16_t freq) */ bool reg_is_6ghz_psc_chan_freq(uint16_t freq); +/** + * reg_is_6g_freq_indoor() - Check if a 6GHz frequency is indoor. + * @pdev: Pointer to pdev. + * @freq: Channel frequency. + * + * Return: Return true if a 6GHz frequency is indoor, else false. + */ +bool reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); + /** * reg_min_6ghz_chan_freq() - Get minimum 6GHz channel center frequency * @@ -617,6 +626,12 @@ static inline bool reg_is_6ghz_chan_freq(uint16_t freq) return false; } +static inline bool +reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) +{ + return false; +} + #ifdef CONFIG_6G_FREQ_OVERLAP 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 3592c7176399..b19a52487543 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -191,6 +191,17 @@ uint16_t wlan_reg_min_6ghz_chan_freq(void); #define WLAN_REG_MAX_6GHZ_CHAN_FREQ wlan_reg_max_6ghz_chan_freq() uint16_t wlan_reg_max_6ghz_chan_freq(void); +/** + * wlan_reg_is_6g_freq_indoor() - Check if a 6GHz frequency is indoor. + * @pdev: Pointer to pdev. + * @freq: Channel frequency. + * + * Return: Return true if a 6GHz frequency is indoor, else false. + */ +#define WLAN_REG_IS_6GHZ_FREQ_INDOOR(pdev, freq) \ + wlan_reg_is_6g_freq_indoor(pdev, freq) +bool wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); + #else #define WLAN_REG_IS_6GHZ_CHAN_FREQ(freq) (false) @@ -222,6 +233,13 @@ static inline uint16_t wlan_reg_max_6ghz_chan_freq(void) { return 0; } + +#define WLAN_REG_IS_6GHZ_FREQ_INDOOR(pdev, freq) (false) +static inline bool +wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) +{ + return false; +} #endif /* CONFIG_BAND_6GHZ */ /** diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index 1fd34b1d101b..91cf76785d7a 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -817,6 +817,10 @@ bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq) return reg_is_6ghz_psc_chan_freq(freq); } +bool wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) +{ + return reg_is_6g_freq_indoor(pdev, freq); +} #endif /* CONFIG_BAND_6GHZ */ uint16_t