diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index 7475932ca7..e7c4b18ddb 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -1859,6 +1859,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 24938867aa..4aad3c5ead 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 426316d831..94121b856e 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -3068,4 +3068,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 4fd1ee681b..063ca28614 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -2156,6 +2156,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; @@ -2167,6 +2168,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 d0027a8f33..e54791f079 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -4695,3 +4695,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; +}