From b8894c96e24ddd4c578eaa59acdb9b04aef53173 Mon Sep 17 00:00:00 2001 From: Gururaj Pandurangi Date: Thu, 2 Dec 2021 04:04:34 -0800 Subject: [PATCH] qcacmn: Allow STA in LPI mode if AP ctry US and advertises LPI The existing logic is if STA and AP have different ctry code, and STA is in ETSI, then it operates in VLP mode irrespective of AP ctry. New logic would be if AP ctry is US and if it advertises LPI power type in HE ops IE via beacon, then STA can advance to LPI mode. Change-Id: Ifbee7052854277c3d21ccd21b65b79edb5e89f46 CRs-Fixed: 3084589 --- umac/regulatory/core/src/reg_utils.c | 9 ++++++++- umac/regulatory/core/src/reg_utils.h | 5 +++-- umac/regulatory/dispatcher/inc/wlan_reg_services_api.h | 5 +++-- umac/regulatory/dispatcher/src/wlan_reg_services_api.c | 6 ++++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index 5c87c16c43d3..06103a2d2c3b 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -328,7 +328,8 @@ QDF_STATUS reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, - bool *ctry_code_match) + bool *ctry_code_match, + enum reg_6g_ap_type ap_pwr_type) { *pwr_type_6g = REG_INDOOR_AP; @@ -354,6 +355,12 @@ reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, sta_ctry[0], sta_ctry[1]); *pwr_type_6g = REG_VERY_LOW_POWER_AP; } + + if (wlan_reg_is_us(ap_ctry) && ap_pwr_type == REG_INDOOR_AP) { + reg_debug("AP ctry:%c%c, AP power type:%d, allow STA IN LPI", + ap_ctry[0], ap_ctry[1], ap_pwr_type); + *pwr_type_6g = REG_INDOOR_AP; + } } else { *ctry_code_match = true; } diff --git a/umac/regulatory/core/src/reg_utils.h b/umac/regulatory/core/src/reg_utils.h index 8a60819446f8..fdb8a834a28d 100644 --- a/umac/regulatory/core/src/reg_utils.h +++ b/umac/regulatory/core/src/reg_utils.h @@ -317,14 +317,15 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr, * @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 - * + * @ap_pwr_type: AP's power type as advertised in HE ops IE * Return: QDF_STATUS */ QDF_STATUS reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, - bool *ctry_code_match); + bool *ctry_code_match, + enum reg_6g_ap_type ap_pwr_type); #endif /** diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index 5f8ec7e2fa18..99a67981c385 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -547,14 +547,15 @@ QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc, * @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 - * + * @ap_pwr_type: AP's power type for 6G as advertised in HE ops IE * Return: QDF_STATUS */ QDF_STATUS wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, - bool *ctry_code_match); + bool *ctry_code_match, + enum reg_6g_ap_type ap_pwr_type); #endif #ifdef CONFIG_CHAN_NUM_API diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index 962888ad3813..b9bec25b2e6d 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -90,10 +90,12 @@ QDF_STATUS wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, uint8_t *ap_ctry, uint8_t *sta_ctry, enum reg_6g_ap_type *pwr_type_6g, - bool *ctry_code_match) + bool *ctry_code_match, + enum reg_6g_ap_type ap_pwr_type) { return reg_get_6g_power_type_for_ctry(psoc, ap_ctry, sta_ctry, - pwr_type_6g, ctry_code_match); + pwr_type_6g, ctry_code_match, + ap_pwr_type); } #endif