From 5a2d88df87dcd53d6c009d057f2bd6c73d19a8d8 Mon Sep 17 00:00:00 2001 From: Gururaj Pandurangi Date: Thu, 22 Apr 2021 15:46:38 -0700 Subject: [PATCH] qcacmn: Add country code check for ETSI dmn Add country code check for ETSI domain, in other words UK, since only UK supports 6G in EU as of today. The TPC power calculation API calls this function to check if programmed ctry is GB to allow STA to use VLP mode. As and when more EU countries support 6G, the checks will be appended to this API. Change-Id: If985f3f64fc806cf1875f798ff3a86667a0861b8 CRs-Fixed: 2933678 --- umac/regulatory/core/src/reg_utils.c | 8 ++++++++ umac/regulatory/core/src/reg_utils.h | 13 +++++++++++++ .../dispatcher/inc/wlan_reg_services_api.h | 8 ++++++++ .../dispatcher/src/wlan_reg_services_api.c | 5 +++++ 4 files changed, 34 insertions(+) diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index 12b0ad9b0c53..0295b5b85e2e 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -169,6 +169,14 @@ bool reg_is_us_alpha2(uint8_t *alpha2) return false; } +bool reg_is_etsi_alpha2(uint8_t *alpha2) +{ + if ((alpha2[0] == 'G') && (alpha2[1] == 'B')) + return true; + + return false; +} + QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev, uint8_t *country) { diff --git a/umac/regulatory/core/src/reg_utils.h b/umac/regulatory/core/src/reg_utils.h index 4cfbd8c68a28..70dfdbea5881 100644 --- a/umac/regulatory/core/src/reg_utils.h +++ b/umac/regulatory/core/src/reg_utils.h @@ -272,6 +272,14 @@ bool reg_is_world_alpha2(uint8_t *alpha2); */ bool reg_is_us_alpha2(uint8_t *alpha2); +/** + * reg_is_etsi_alpha2 - is country code in EU + * @alpha2: country code pointer + * + * Return: true or false + */ +bool reg_is_etsi_alpha2(uint8_t *alpha2); + /** * reg_set_country() - Set the current regulatory country * @pdev: pdev device for country information @@ -423,6 +431,11 @@ static inline bool reg_is_us_alpha2(uint8_t *alpha2) return false; } +static inline bool reg_is_etsi_alpha2(uint8_t *alpha2) +{ + return false; +} + static inline QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev, uint8_t *country) { diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index b1e4c352bce9..1e6ab72b7b92 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -954,6 +954,14 @@ qdf_freq_t wlan_reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev, */ bool wlan_reg_is_us(uint8_t *country); +/** + * wlan_reg_is_etsi() - reg is a country in EU + * @country: The country information + * + * Return: true or false + */ +bool wlan_reg_is_etsi(uint8_t *country); + #ifdef CONFIG_CHAN_NUM_API /** * wlan_reg_chan_is_49ghz() - Check if the input channel number is 4.9GHz diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index 75932e22a602..afda53de5244 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -628,6 +628,11 @@ bool wlan_reg_is_us(uint8_t *country) return reg_is_us_alpha2(country); } +bool wlan_reg_is_etsi(uint8_t *country) +{ + return reg_is_etsi_alpha2(country); +} + void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc, void *cbk, void *arg) {