qcacld-3.0: Add backward compatibility for old TPC event

Host will send TPC power to FW via new WMI cmd
WMI_VDEV_SET_TPC_POWER_CMDID going forward instead of
WMI_VDEV_PARAM_TX_PWRLIMIT to accommodate even 6GHz channels.
But, to support backward compatiiblity for New Host+old FW
the TPC power will be sent to FW via old WMI cmd with the
help of a service bit.

Change-Id: I9324299ca4f92f2adce92983385b66c04368fe55
CRs-Fixed: 2872238
This commit is contained in:
Gururaj Pandurangi 2021-02-03 20:26:29 -08:00 • committed by snandini
commit 3c26aa49a5
6 changed files with 183 additions and 55 deletions

View file

@ -249,7 +249,6 @@ lim_mlm_add_bss(struct mac_context *mac_ctx,
return eSIR_SME_INVALID_PARAMETERS;
}
tx_ops = wlan_reg_get_tx_ops(mac_ctx->psoc);
qdf_mem_copy(mlme_obj->mgmt.generic.bssid, mlm_start_req->bssId,
QDF_MAC_ADDR_SIZE);
if (lim_is_session_he_capable(session)) {
@ -295,12 +294,15 @@ lim_mlm_add_bss(struct mac_context *mac_ctx,
goto peer_cleanup;
wma_post_vdev_start_setup(vdev_id);
lim_calculate_tpc(mac_ctx, session, false);
if (wlan_reg_is_ext_tpc_supported(mac_ctx->psoc)) {
tx_ops = wlan_reg_get_tx_ops(mac_ctx->psoc);
if (tx_ops->set_tpc_power)
tx_ops->set_tpc_power(mac_ctx->psoc, session->vdev_id,
&mlme_obj->reg_tpc_obj);
lim_calculate_tpc(mac_ctx, session, false);
if (tx_ops->set_tpc_power)
tx_ops->set_tpc_power(mac_ctx->psoc, session->vdev_id,
&mlme_obj->reg_tpc_obj);
}
return eSIR_SME_SUCCESS;
peer_cleanup:

View file

@ -2678,8 +2678,6 @@ static void lim_process_switch_channel_join_req(
goto error;
}
tx_ops = wlan_reg_get_tx_ops(mac_ctx->psoc);
bss = &session_entry->lim_join_req->bssDescription;
nontx_bss_id = bss->mbssid_info.profile_num;
@ -2768,22 +2766,25 @@ static void lim_process_switch_channel_join_req(
goto error;
}
lim_process_tpe_ie_from_beacon(mac_ctx, session_entry, bss,
&tpe_change);
if (wlan_reg_is_ext_tpc_supported(mac_ctx->psoc)) {
tx_ops = wlan_reg_get_tx_ops(mac_ctx->psoc);
mlme_obj = wlan_vdev_mlme_get_cmpt_obj(session_entry->vdev);
if (!mlme_obj) {
pe_err("vdev component object is NULL");
goto error;
lim_process_tpe_ie_from_beacon(mac_ctx, session_entry, bss,
&tpe_change);
mlme_obj = wlan_vdev_mlme_get_cmpt_obj(session_entry->vdev);
if (!mlme_obj) {
pe_err("vdev component object is NULL");
goto error;
}
lim_calculate_tpc(mac_ctx, session_entry, false);
if (tx_ops->set_tpc_power)
tx_ops->set_tpc_power(mac_ctx->psoc,
session_entry->vdev_id,
&mlme_obj->reg_tpc_obj);
}
lim_calculate_tpc(mac_ctx, session_entry, false);
if (tx_ops->set_tpc_power)
tx_ops->set_tpc_power(mac_ctx->psoc,
session_entry->vdev_id,
&mlme_obj->reg_tpc_obj);
/* include additional IE if there is */
lim_send_probe_req_mgmt_frame(mac_ctx, &ssId,
session_entry->pLimMlmJoinReq->bssDescription.bssId,

View file

@ -1214,6 +1214,7 @@ __lim_process_sme_join_req(struct mac_context *mac_ctx, void *msg_buf)
const uint8_t *vendor_ie;
struct bss_description *bss_desc;
QDF_STATUS status;
int8_t reg_max = 0;
if (!mac_ctx || !msg_buf) {
QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
@ -1553,10 +1554,28 @@ __lim_process_sme_join_req(struct mac_context *mac_ctx, void *msg_buf)
&session->gLimCurrentBssUapsd,
&local_power_constraint, session, &is_pwr_constraint);
mlme_obj->reg_tpc_obj.ap_constraint_power = local_power_constraint;
if (wlan_reg_is_ext_tpc_supported(mac_ctx->psoc)) {
mlme_obj->reg_tpc_obj.ap_constraint_power =
local_power_constraint;
} else {
reg_max = wlan_reg_get_channel_reg_power_for_freq(
mac_ctx->pdev, session->curr_op_freq);
if (is_pwr_constraint)
local_power_constraint = reg_max -
local_power_constraint;
if (!local_power_constraint)
local_power_constraint = reg_max;
session->maxTxPower = lim_get_max_tx_power(mac_ctx, mlme_obj);
session->def_max_tx_pwr = session->maxTxPower;
mlme_obj->reg_tpc_obj.reg_max[0] = reg_max;
mlme_obj->reg_tpc_obj.ap_constraint_power =
local_power_constraint;
mlme_obj->reg_tpc_obj.frequency[0] =
session->curr_op_freq;
session->maxTxPower = lim_get_max_tx_power(mac_ctx,
mlme_obj);
session->def_max_tx_pwr = session->maxTxPower;
}
pe_debug("Reg %d local %d session %d join req %d",
reg_max, local_power_constraint, session->maxTxPower,

View file

@ -265,20 +265,49 @@ rrm_process_link_measurement_request(struct mac_context *mac,
return QDF_STATUS_E_INVAL;
}
if (pLinkReq->MaxTxPower.maxTxPower !=
mlme_obj->reg_tpc_obj.ap_constraint_power) {
if (wlan_reg_is_ext_tpc_supported(mac->psoc)) {
if (pLinkReq->MaxTxPower.maxTxPower !=
mlme_obj->reg_tpc_obj.ap_constraint_power) {
tx_ops = wlan_reg_get_tx_ops(mac->psoc);
tx_ops = wlan_reg_get_tx_ops(mac->psoc);
mlme_obj->reg_tpc_obj.ap_constraint_power =
mlme_obj->reg_tpc_obj.ap_constraint_power =
pLinkReq->MaxTxPower.maxTxPower;
lim_calculate_tpc(mac, pe_session, true);
lim_calculate_tpc(mac, pe_session, true);
if (tx_ops->set_tpc_power)
tx_ops->set_tpc_power(mac->psoc, pe_session->vdev_id,
&mlme_obj->reg_tpc_obj);
if (tx_ops->set_tpc_power)
tx_ops->set_tpc_power(mac->psoc,
pe_session->vdev_id,
&mlme_obj->reg_tpc_obj);
}
} else {
mlme_obj->reg_tpc_obj.reg_max[0] =
pe_session->def_max_tx_pwr;
mlme_obj->reg_tpc_obj.ap_constraint_power =
pLinkReq->MaxTxPower.maxTxPower;
LinkReport.txPower = lim_get_max_tx_power(mac, mlme_obj);
/** If firmware updated max tx power is non zero, respond to
* rrm link measurement request with min of firmware updated
* ap tx power and max power derived from lim_get_max_tx_power
* API.
*/
if (mlme_obj && mlme_obj->mgmt.generic.tx_pwrlimit)
LinkReport.txPower = QDF_MIN(LinkReport.txPower,
mlme_obj->mgmt.generic.tx_pwrlimit);
if ((LinkReport.txPower != (uint8_t)pe_session->maxTxPower) &&
(QDF_STATUS_SUCCESS ==
rrm_send_set_max_tx_power_req(mac, LinkReport.txPower,
pe_session))) {
pe_warn("Local: %d", pe_session->maxTxPower);
pe_warn("Link Request TxPwr: %d Link Report TxPwr: %d",
LinkReport.txPower,
pLinkReq->MaxTxPower.maxTxPower);
pe_session->maxTxPower = LinkReport.txPower;
}
}
LinkReport.dialogToken = pLinkReq->DialogToken.token;
LinkReport.rxAntenna = 0;
LinkReport.txAntenna = 0;

View file

@ -710,6 +710,8 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
struct vdev_mlme_obj *mlme_obj;
struct wlan_lmac_if_reg_tx_ops *tx_ops;
bool ap_constraint_change = false, tpe_change = false;
int8_t regMax = 0, maxTxPower = 0;
QDF_STATUS status;
qdf_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
beaconParams.paramChangeBitmap = 0;
@ -721,7 +723,6 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
return;
}
tx_ops = wlan_reg_get_tx_ops(mac_ctx->psoc);
/*
* For vht session, if opermode ie or vht oper IE is present
* bandwidth change will be taken care using these vht IEs.
@ -736,36 +737,79 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
sch_bcn_process_sta_opmode(mac_ctx, bcn, rx_pkt_info, session,
&beaconParams, &sendProbeReq, pMh);
lim_parse_tpe_ie(mac_ctx, session, bcn->transmit_power_env,
bcn->num_transmit_power_env, &bcn->he_op,
&tpe_change);
mlme_obj = wlan_vdev_mlme_get_cmpt_obj(session->vdev);
if (!mlme_obj) {
pe_err("vdev component object is NULL");
return;
}
if (mac_ctx->mlme_cfg->sta.allow_tpc_from_ap) {
get_local_power_constraint_beacon(bcn, &local_constraint);
if (wlan_reg_is_ext_tpc_supported(mac_ctx->psoc)) {
tx_ops = wlan_reg_get_tx_ops(mac_ctx->psoc);
if (mac_ctx->rrm.rrmPEContext.rrmEnable &&
bcn->powerConstraintPresent)
local_constraint =
lim_parse_tpe_ie(mac_ctx, session, bcn->transmit_power_env,
bcn->num_transmit_power_env, &bcn->he_op,
&tpe_change);
if (mac_ctx->mlme_cfg->sta.allow_tpc_from_ap) {
get_local_power_constraint_beacon(bcn,
&local_constraint);
if (mac_ctx->rrm.rrmPEContext.rrmEnable &&
bcn->powerConstraintPresent)
local_constraint =
bcn->localPowerConstraint.localPowerConstraints;
}
}
if (local_constraint != mlme_obj->reg_tpc_obj.ap_constraint_power) {
if (local_constraint !=
mlme_obj->reg_tpc_obj.ap_constraint_power) {
mlme_obj->reg_tpc_obj.ap_constraint_power =
local_constraint;
ap_constraint_change = true;
}
if (ap_constraint_change || tpe_change) {
lim_calculate_tpc(mac_ctx, session, false);
if (tx_ops->set_tpc_power)
tx_ops->set_tpc_power(mac_ctx->psoc,
session->vdev_id,
&mlme_obj->reg_tpc_obj);
}
} else {
/* Obtain the Max Tx power for the current regulatory */
regMax = wlan_reg_get_channel_reg_power_for_freq(
mac_ctx->pdev, session->curr_op_freq);
local_constraint = regMax;
if (mac_ctx->mlme_cfg->sta.allow_tpc_from_ap) {
get_local_power_constraint_beacon(bcn,
&local_constraint);
if (mac_ctx->rrm.rrmPEContext.rrmEnable &&
bcn->powerConstraintPresent) {
local_constraint = regMax;
local_constraint -=
bcn->localPowerConstraint.localPowerConstraints;
}
}
mlme_obj->reg_tpc_obj.reg_max[0] = regMax;
mlme_obj->reg_tpc_obj.ap_constraint_power = local_constraint;
ap_constraint_change = true;
}
mlme_obj->reg_tpc_obj.frequency[0] = session->curr_op_freq;
if (ap_constraint_change || tpe_change) {
lim_calculate_tpc(mac_ctx, session, false);
maxTxPower = lim_get_max_tx_power(mac_ctx, mlme_obj);
if (tx_ops->set_tpc_power)
tx_ops->set_tpc_power(mac_ctx->psoc, session->vdev_id,
&mlme_obj->reg_tpc_obj);
/* If maxTxPower is increased or decreased */
if (maxTxPower != session->maxTxPower) {
pe_debug("New maxTx power %d, old pwr %d",
maxTxPower, session->maxTxPower);
pe_debug("regMax %d, local %d", regMax,
local_constraint);
status = lim_send_set_max_tx_power_req(mac_ctx,
maxTxPower,
session);
if (status == QDF_STATUS_SUCCESS)
session->maxTxPower = maxTxPower;
}
}
/* Indicate to LIM that Beacon is received */
if (bcn->HTInfo.present) {

View file

@ -3385,6 +3385,25 @@ wma_vdev_set_bss_params(tp_wma_handle wma, int vdev_id,
if (QDF_IS_STATUS_ERROR(ret))
wma_err("failed to set WMI_VDEV_PARAM_DTIM_PERIOD");
if (!wlan_reg_is_ext_tpc_supported(wma->psoc)) {
if (!maxTxPower)
wma_warn("Setting Tx power limit to 0");
wma_nofl_debug("TXP[W][set_bss_params]: %d", maxTxPower);
if (maxTxPower != INVALID_TXPOWER) {
ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
WMI_VDEV_PARAM_TX_PWRLIMIT,
maxTxPower);
if (QDF_IS_STATUS_ERROR(ret))
wma_err("failed to set VDEV_PARAM_TX_PWRLMT");
else
mlme_set_max_reg_power(intr[vdev_id].vdev,
maxTxPower);
} else {
wma_err("Invalid max Tx power");
}
}
/* Slot time */
if (shortSlotTimeSupported)
slot_time = WMI_VDEV_SLOT_TIME_SHORT;
@ -3525,6 +3544,7 @@ QDF_STATUS wma_post_vdev_start_setup(uint8_t vdev_id)
struct wma_txrx_node *intr;
struct vdev_mlme_obj *mlme_obj;
struct wlan_objmgr_vdev *vdev;
uint8_t bss_power = 0;
if (!wma) {
wma_err("Invalid wma handle");
@ -3559,11 +3579,16 @@ QDF_STATUS wma_post_vdev_start_setup(uint8_t vdev_id)
vdev->vdev_mlme.des_chan,
sizeof(struct wlan_channel));
if (!wlan_reg_is_ext_tpc_supported(wma->psoc))
bss_power = wlan_reg_get_channel_reg_power_for_freq(
wma->pdev, vdev->vdev_mlme.bss_chan->ch_freq);
wma_vdev_set_bss_params(wma, vdev_id,
mlme_obj->proto.generic.beacon_interval,
mlme_obj->proto.generic.dtim_period,
mlme_obj->proto.generic.slot_time,
mlme_obj->proto.generic.protection_mode, 0);
mlme_obj->proto.generic.protection_mode,
bss_power);
wma_vdev_set_he_bss_params(wma, vdev_id,
&mlme_obj->proto.he_ops_info);
@ -3857,11 +3882,15 @@ QDF_STATUS wma_send_peer_assoc_req(struct bss_params *add_bss)
if (add_bss->rmfEnabled)
wma_set_mgmt_frame_protection(wma);
if (wlan_reg_is_ext_tpc_supported(wma->psoc))
add_bss->maxTxPower = 0;
wma_vdev_set_bss_params(wma, add_bss->staContext.smesessionId,
add_bss->beaconInterval,
add_bss->dtimPeriod,
add_bss->shortSlotTimeSupported,
add_bss->llbCoexist, 0);
add_bss->llbCoexist,
add_bss->maxTxPower);
mlme_obj = wlan_vdev_mlme_get_cmpt_obj(iface->vdev);
if (!mlme_obj) {
@ -4257,6 +4286,7 @@ static void wma_add_sta_req_sta_mode(tp_wma_handle wma, tpAddStaParams params)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct wma_txrx_node *iface;
int8_t maxTxPower = 0;
int ret = 0;
struct wma_target_req *msg;
bool peer_assoc_cnf = false;
@ -4379,10 +4409,13 @@ static void wma_add_sta_req_sta_mode(tp_wma_handle wma, tpAddStaParams params)
}
}
if (!wlan_reg_is_ext_tpc_supported(wma->psoc))
maxTxPower = params->maxTxPower;
wma_vdev_set_bss_params(wma, params->smesessionId,
iface->beaconInterval, iface->dtimPeriod,
iface->shortSlotTimeSupported,
iface->llbCoexist);
iface->llbCoexist, maxTxPower);
params->csaOffloadEnable = 0;
if (wmi_service_enabled(wma->wmi_handle,