diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c
index cbfd47f595..4fbd51ecae 100644
--- a/components/mlme/core/src/wlan_mlme_main.c
+++ b/components/mlme/core/src/wlan_mlme_main.c
@@ -3056,7 +3056,6 @@ 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);
power->skip_tpe = cfg_get(psoc, CFG_SKIP_TPE_CONSIDERATION);
}
diff --git a/components/mlme/dispatcher/inc/cfg_mlme_power.h b/components/mlme/dispatcher/inc/cfg_mlme_power.h
index 888b59eaad..14f06d4a91 100644
--- a/components/mlme/dispatcher/inc/cfg_mlme_power.h
+++ b/components/mlme/dispatcher/inc/cfg_mlme_power.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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,27 +147,6 @@
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")
-
/*
*
* skip_tpe_consideration - Skip TPE IE value in tx power calculation for
@@ -200,7 +180,6 @@
CFG(CFG_SET_TXPOWER_LIMIT5G) \
CFG(CFG_CURRENT_TX_POWER_LEVEL) \
CFG(CFG_LOCAL_POWER_CONSTRAINT) \
- CFG(CFG_USE_LOCAL_TPE) \
CFG(CFG_SKIP_TPE_CONSIDERATION)
#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 79fd682e08..d9b74ef8d2 100644
--- a/components/mlme/dispatcher/inc/wlan_mlme_api.h
+++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h
@@ -4022,16 +4022,6 @@ mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc)
}
#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);
-
/**
* wlan_mlme_skip_tpe() - Get preference to not consider TPE in 2G/5G case
*
diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h
index efd3e3face..6088db2139 100644
--- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h
+++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h
@@ -2461,7 +2461,6 @@ 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
* @skip_tpe: option to not consider TPE values in 2.4G/5G bands
*/
struct wlan_mlme_power {
@@ -2474,7 +2473,6 @@ struct wlan_mlme_power {
uint8_t tx_power_5g;
uint8_t current_tx_power_level;
uint8_t local_power_constraint;
- bool use_local_tpe;
bool skip_tpe;
};
diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c
index c40d5a7123..ad01059b20 100644
--- a/components/mlme/dispatcher/src/wlan_mlme_api.c
+++ b/components/mlme/dispatcher/src/wlan_mlme_api.c
@@ -6197,17 +6197,6 @@ 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;
-}
-
bool wlan_mlme_skip_tpe(struct wlan_objmgr_psoc *psoc)
{
struct wlan_mlme_psoc_ext_obj *mlme_obj;
diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
index 60f05e5f22..0651cfe80e 100644
--- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c
+++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
@@ -5589,12 +5589,18 @@ void lim_parse_tpe_ie(struct mac_context *mac, struct pe_session *session,
qdf_freq_t curr_op_freq, curr_freq;
enum reg_6g_client_type client_mobility_type;
struct ch_params ch_params = {0};
- tDot11fIEtransmit_power_env single_tpe;
+ tDot11fIEtransmit_power_env single_tpe, local_tpe, reg_tpe;
/*
* PSD is power spectral density, incoming TPE could contain
* non PSD info, or PSD info, or both, so need to keep track of them
*/
bool use_local_tpe, non_psd_set = false, psd_set = false;
+ bool both_tpe_present = false;
+ bool local_eirp_set = false, local_psd_set = false;
+ bool reg_eirp_set = false, reg_psd_set = false;
+ uint8_t local_eirp_idx = 0, local_psd_idx = 0;
+ uint8_t reg_eirp_idx = 0, reg_psd_idx = 0;
+ uint8_t min_count = 0;
vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(session->vdev);
if (!vdev_mlme)
@@ -5632,34 +5638,35 @@ void lim_parse_tpe_ie(struct mac_context *mac, struct pe_session *session,
else if (!local_tpe_count)
use_local_tpe = false;
else
- use_local_tpe = wlan_mlme_is_local_tpe_pref(mac->psoc);
+ both_tpe_present = true;
for (i = 0; i < num_tpe_ies; i++) {
single_tpe = tpe_ies[i];
if (single_tpe.present &&
(single_tpe.max_tx_pwr_category == client_mobility_type)) {
- if (use_local_tpe) {
- if (single_tpe.max_tx_pwr_interpret ==
- LOCAL_EIRP) {
- non_psd_index = i;
- non_psd_set = true;
- }
- if (single_tpe.max_tx_pwr_interpret ==
- LOCAL_EIRP_PSD) {
- psd_index = i;
- psd_set = true;
- }
- } else {
- if (single_tpe.max_tx_pwr_interpret ==
- REGULATORY_CLIENT_EIRP) {
- non_psd_index = i;
- non_psd_set = true;
- }
- if (single_tpe.max_tx_pwr_interpret ==
- REGULATORY_CLIENT_EIRP_PSD) {
- psd_index = i;
- psd_set = true;
- }
+ if (single_tpe.max_tx_pwr_interpret == LOCAL_EIRP) {
+ non_psd_index = i;
+ non_psd_set = true;
+ local_eirp_idx = non_psd_index;
+ local_eirp_set = non_psd_set;
+ } else if (single_tpe.max_tx_pwr_interpret ==
+ LOCAL_EIRP_PSD) {
+ psd_index = i;
+ psd_set = true;
+ local_psd_idx = psd_index;
+ local_psd_set = psd_set;
+ } else if (single_tpe.max_tx_pwr_interpret ==
+ REGULATORY_CLIENT_EIRP) {
+ non_psd_index = i;
+ non_psd_set = true;
+ reg_eirp_idx = non_psd_index;
+ reg_eirp_set = non_psd_set;
+ } else if (single_tpe.max_tx_pwr_interpret ==
+ REGULATORY_CLIENT_EIRP_PSD) {
+ psd_index = i;
+ psd_set = true;
+ reg_psd_idx = psd_index;
+ reg_psd_set = psd_set;
}
}
}
@@ -5761,6 +5768,35 @@ void lim_parse_tpe_ie(struct mac_context *mac, struct pe_session *session,
single_tpe.tx_power[single_tpe.max_tx_pwr_count];
vdev_mlme->reg_tpc_obj.is_psd_power = false;
}
+
+ if (both_tpe_present) {
+ pe_debug("Local: eirp: %d psd: %d, Regulatory: eirp: %d psd %d",
+ local_eirp_set, local_psd_set, reg_eirp_set,
+ reg_psd_set);
+ if (local_eirp_set && reg_eirp_set) {
+ local_tpe = tpe_ies[local_eirp_idx];
+ reg_tpe = tpe_ies[reg_eirp_idx];
+ } else if (local_psd_set && reg_psd_set) {
+ local_tpe = tpe_ies[local_psd_idx];
+ reg_tpe = tpe_ies[reg_psd_idx];
+ } else {
+ return;
+ }
+
+ min_count = QDF_MIN(local_tpe.max_tx_pwr_count,
+ reg_tpe.max_tx_pwr_count);
+ for (i = 0; i < min_count + 1; i++) {
+ if (vdev_mlme->reg_tpc_obj.tpe[i] !=
+ QDF_MIN(local_tpe.tx_power[i], reg_tpe.tx_power[i]))
+ *has_tpe_updated = true;
+ vdev_mlme->reg_tpc_obj.tpe[i] =
+ QDF_MIN(local_tpe.tx_power[i],
+ reg_tpe.tx_power[i]);
+ pe_debug("TPE: Local: %d, Reg: %d, power updated: %d",
+ local_tpe.tx_power[i], reg_tpe.tx_power[i],
+ *has_tpe_updated);
+ }
+ }
}
void lim_process_tpe_ie_from_beacon(struct mac_context *mac,