From 06043e1d003df7aa74f62af3e9c3ac97e39a62d9 Mon Sep 17 00:00:00 2001 From: Gururaj Pandurangi Date: Thu, 10 Jun 2021 19:54:38 -0700 Subject: [PATCH] qcacmn: Add new API to update ap power type for 6G roam Add a new API reg_get_6g_power_type to update ap power type when STA roams in/out of 6GHz channel. It is invoked from CSR during initial connection and sch beacon process during roaming. Change-Id: I0d20d4d7f291ec608b27a1611c8877c33f4b45b1 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 c8bfb519b391..2596fbbe3300 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -321,6 +321,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_NUM_API bool reg_is_passive_or_disable_ch(struct wlan_objmgr_pdev *pdev, uint8_t chan) diff --git a/umac/regulatory/core/src/reg_utils.h b/umac/regulatory/core/src/reg_utils.h index d69ba76ffab6..8bcbd4628e10 100644 --- a/umac/regulatory/core/src/reg_utils.h +++ b/umac/regulatory/core/src/reg_utils.h @@ -309,6 +309,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 3b4ef9990fc0..e45fc4290395 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -517,6 +517,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_NUM_API /** * wlan_reg_chan_has_dfs_attribute() - check channel has dfs attribute flag diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index e8da56f269ef..ddd2f93b61c8 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 + #ifdef CONFIG_CHAN_NUM_API /** * wlan_reg_get_channel_state() - Get channel state from regulatory