From ea4286f80845fe2a801169e0ea9f274090ab0558 Mon Sep 17 00:00:00 2001 From: Gururaj Pandurangi Date: Wed, 23 Jun 2021 14:07:51 -0700 Subject: [PATCH] qcacmn: Add new API to update ap power type for 6G roam Add a new API reg_get_6g_power_type_for_ctry to update ap power type when STA roams in/out of 6GHz channel. It is invoked during initial connection and sch beacon process during roaming. Change-Id: I994d912da79597cf71477fc632c8e678008271a5 CRs-Fixed: 2968243 --- umac/regulatory/core/src/reg_utils.c | 31 +++++++++++++++++++ umac/regulatory/core/src/reg_utils.h | 16 ++++++++++ .../dispatcher/inc/wlan_reg_services_api.h | 17 ++++++++++ .../dispatcher/src/wlan_reg_services_api.c | 11 +++++++ 4 files changed, 75 insertions(+) diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index cf4578f342..08b8c401c8 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -323,6 +323,37 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr, return QDF_STATUS_SUCCESS; } +#ifdef CONFIG_REG_CLIENT +QDF_STATUS +reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry, + enum reg_6g_ap_type *pwr_type_6g, + bool *ctry_code_match) +{ + *pwr_type_6g = REG_INDOOR_AP; + + if (qdf_mem_cmp(ap_ctry, sta_ctry, REG_ALPHA2_LEN)) { + reg_debug("Country IE:%c%c, STA country:%c%c", ap_ctry[0], + ap_ctry[1], sta_ctry[0], sta_ctry[1]); + *ctry_code_match = false; + + if (wlan_reg_is_us(sta_ctry)) { + reg_err("US VLP not in place yet, connection not allowed"); + return QDF_STATUS_E_NOSUPPORT; + } + + if (wlan_reg_is_etsi(sta_ctry)) { + reg_debug("STA ctry:%c%c, doesn't match with AP ctry, switch to VLP", + sta_ctry[0], sta_ctry[1]); + *pwr_type_6g = REG_VERY_LOW_POWER_AP; + } + } else { + *ctry_code_match = true; + } + + return QDF_STATUS_SUCCESS; +} +#endif + #ifdef CONFIG_CHAN_FREQ_API bool reg_is_passive_or_disable_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) diff --git a/umac/regulatory/core/src/reg_utils.h b/umac/regulatory/core/src/reg_utils.h index c3d13b6d7e..34f6343b92 100644 --- a/umac/regulatory/core/src/reg_utils.h +++ b/umac/regulatory/core/src/reg_utils.h @@ -264,6 +264,22 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr, const uint8_t *country_alpha2, enum country_src source); +#ifdef CONFIG_REG_CLIENT +/** + * reg_get_6g_power_type_for_ctry() - Return power type for 6G based on cntry IE + * @ap_ctry: ptr to country string in country IE + * @sta_ctry: ptr to sta programmed country + * @pwr_type_6g: ptr to 6G power type + * @ctry_code_match: Check for country IE and sta country code match + * + * Return: QDF_STATUS + */ +QDF_STATUS +reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry, + enum reg_6g_ap_type *pwr_type_6g, + bool *ctry_code_match); +#endif + /** * reg_set_config_vars () - set configration variables * @psoc: psoc ptr diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index dd022d8f11..267246139e 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -440,6 +440,23 @@ bool wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq); QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc, uint8_t *country); +#ifdef CONFIG_REG_CLIENT +/** + * wlan_reg_get_6g_power_type_for_ctry() - Return power type for 6G based + * on country IE + * @ap_ctry: ptr to country string in country IE + * @sta_ctry: ptr to sta programmed country + * @pwr_type_6g: ptr to 6G power type + * @ctry_code_match: Check for country IE and sta country code match + * + * Return: QDF_STATUS + */ +QDF_STATUS +wlan_reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry, + enum reg_6g_ap_type *pwr_type_6g, + bool *ctry_code_match); +#endif + #ifdef CONFIG_CHAN_FREQ_API /** * wlan_reg_is_etsi13_srd_chan_for_freq () - Checks if the ch is ETSI13 srd ch diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index af1665fe84..502baa14d5 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -84,6 +84,17 @@ QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(uint16_t regdmn, return reg_get_max_5g_bw_from_regdomain(regdmn, max_bw_5g); } +#ifdef CONFIG_REG_CLIENT +QDF_STATUS +wlan_reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry, + enum reg_6g_ap_type *pwr_type_6g, + bool *ctry_code_match) +{ + return reg_get_6g_power_type_for_ctry(ap_ctry, sta_ctry, pwr_type_6g, + ctry_code_match); +} +#endif + /** * wlan_reg_get_dfs_region () - Get the current dfs region * @dfs_reg: pointer to dfs region