From 46d53fb73915a23f45e4e627f10a3ef459439cc0 Mon Sep 17 00:00:00 2001 From: Lincoln Tran Date: Wed, 13 Jan 2021 15:18:39 -0800 Subject: [PATCH] qcacld-3.0: Add INI for TPE preference When the TPE IE comes to driver, there could be information for both local and regulatory. Add an INI for preference in the case that both sets are present. Change-Id: I4b37123569f422863fc805063974c65878a9baea CRs-fixed: 2854774 --- components/mlme/core/src/wlan_mlme_main.c | 1 + .../mlme/dispatcher/inc/cfg_mlme_power.h | 26 +++++++++++++++++-- .../mlme/dispatcher/inc/wlan_mlme_api.h | 11 ++++++++ .../dispatcher/inc/wlan_mlme_public_struct.h | 2 ++ .../mlme/dispatcher/src/wlan_mlme_api.c | 11 ++++++++ 5 files changed, 49 insertions(+), 2 deletions(-) diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index 151e87350341..b5821914711e 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -1860,6 +1860,7 @@ static void mlme_init_power_cfg(struct wlan_objmgr_psoc *psoc, (uint8_t)cfg_default(CFG_CURRENT_TX_POWER_LEVEL); power->local_power_constraint = (uint8_t)cfg_default(CFG_LOCAL_POWER_CONSTRAINT); + power->use_local_tpe = cfg_get(psoc, CFG_USE_LOCAL_TPE); } static void mlme_init_roam_scoring_cfg(struct wlan_objmgr_psoc *psoc, diff --git a/components/mlme/dispatcher/inc/cfg_mlme_power.h b/components/mlme/dispatcher/inc/cfg_mlme_power.h index 24938867aa3b..4aad3c5eadcb 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_power.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_power.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -146,6 +146,27 @@ CFG_VALUE_OR_DEFAULT, \ "local power constraint") +/* + * + * use_local_tpe - use local or regulatory TPE + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini is used to set the preference of local or regulatory TPE. If the + * preferred choice is not available, it will fall back on the other choice. + * + * Related: None + * + * Supported Feature: 6GHz channel transmit power + * + * Usage: External + * + * + */ +#define CFG_USE_LOCAL_TPE CFG_INI_BOOL("use_local_tpe", false, \ + "use local or regulatory TPE") + #define CFG_MLME_POWER_ALL \ CFG(CFG_MAX_TX_POWER_2_4) \ CFG(CFG_MAX_TX_POWER_5) \ @@ -153,6 +174,7 @@ CFG(CFG_SET_TXPOWER_LIMIT2G) \ CFG(CFG_SET_TXPOWER_LIMIT5G) \ CFG(CFG_CURRENT_TX_POWER_LEVEL) \ - CFG(CFG_LOCAL_POWER_CONSTRAINT) + CFG(CFG_LOCAL_POWER_CONSTRAINT) \ + CFG(CFG_USE_LOCAL_TPE) #endif /* __CFG_MLME_POWER_H */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index 3277a92b1fcc..90cfa97468a3 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -3056,4 +3056,15 @@ mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc) return false; } #endif /* WLAN_SUPPORT_TWT */ + +/** + * wlan_mlme_is_local_tpe_pref() - Get preference to use local TPE or + * regulatory TPE values + * @psoc: pointer to psoc object + * + * Return: True if there is local preference, false if there is regulatory + * preference + */ +bool wlan_mlme_is_local_tpe_pref(struct wlan_objmgr_psoc *psoc); + #endif /* _WLAN_MLME_API_H_ */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index e7dbdeb6ee66..014420575ae7 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -2076,6 +2076,7 @@ struct mlme_power_usage { * @tx_power_5g: limit tx power in 5 ghz * @current_tx_power_level: current tx power level * @local_power_constraint: local power constraint + * @use_local_tpe: preference to use local or regulatory TPE */ struct wlan_mlme_power { struct mlme_max_tx_power_24 max_tx_power_24; @@ -2087,6 +2088,7 @@ struct wlan_mlme_power { uint8_t tx_power_5g; uint8_t current_tx_power_level; uint8_t local_power_constraint; + bool use_local_tpe; }; /* diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index 465a1fcfa7da..99a71c5b33c2 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -4701,3 +4701,14 @@ bool wlan_mlme_is_sta_mon_conc_supported(struct wlan_objmgr_psoc *psoc) return false; } + +bool wlan_mlme_is_local_tpe_pref(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) + return false; + + return mlme_obj->cfg.power.use_local_tpe; +}