qcacld-3.0: Add ini control to honor power constraint

qcacld-2.0 to qcacld-3.0 propagation

Add changes to honor power constraint based on ini. Also, enhance
logging for power sent to fw.

Change-Id: Iefd497d76076527ca4c388cade46644a88a51932
CRs-Fixed: 1016876
This commit is contained in:
Padma, Santhosh Kumar
2016-08-16 19:15:16 +05:30
committed by qcabuildsw
parent eefe348b69
commit 29df362726
11 changed files with 123 additions and 48 deletions

View File

@@ -515,6 +515,12 @@ typedef enum {
/* Not to use CFG default because if no registry setting, this is ignored by SME. */ /* Not to use CFG default because if no registry setting, this is ignored by SME. */
#define CFG_MAX_TX_POWER_DEFAULT WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX #define CFG_MAX_TX_POWER_DEFAULT WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX
/* This ini controls driver to honor/dishonor power constraint from AP */
#define CFG_TX_POWER_CTRL_NAME "gAllowTPCfromAP"
#define CFG_TX_POWER_CTRL_DEFAULT (1)
#define CFG_TX_POWER_CTRL_MIN (0)
#define CFG_TX_POWER_CTRL_MAX (1)
#define CFG_LOW_GAIN_OVERRIDE_NAME "gLowGainOverride" #define CFG_LOW_GAIN_OVERRIDE_NAME "gLowGainOverride"
#define CFG_LOW_GAIN_OVERRIDE_MIN WNI_CFG_LOW_GAIN_OVERRIDE_STAMIN #define CFG_LOW_GAIN_OVERRIDE_MIN WNI_CFG_LOW_GAIN_OVERRIDE_STAMIN
#define CFG_LOW_GAIN_OVERRIDE_MAX WNI_CFG_LOW_GAIN_OVERRIDE_STAMAX #define CFG_LOW_GAIN_OVERRIDE_MAX WNI_CFG_LOW_GAIN_OVERRIDE_STAMAX
@@ -3550,6 +3556,7 @@ struct hdd_config {
uint32_t goLinkMonitorPeriod; uint32_t goLinkMonitorPeriod;
uint32_t nBeaconInterval; uint32_t nBeaconInterval;
uint8_t nTxPowerCap; /* In dBm */ uint8_t nTxPowerCap; /* In dBm */
bool allow_tpc_from_ap;
bool fIsLowGainOverride; bool fIsLowGainOverride;
uint8_t disablePacketFilter; uint8_t disablePacketFilter;
bool fRrmEnable; bool fRrmEnable;

View File

@@ -836,6 +836,13 @@ REG_TABLE_ENTRY g_registry_table[] = {
CFG_MAX_TX_POWER_MIN, CFG_MAX_TX_POWER_MIN,
CFG_MAX_TX_POWER_MAX), CFG_MAX_TX_POWER_MAX),
REG_VARIABLE(CFG_TX_POWER_CTRL_NAME, WLAN_PARAM_Integer,
struct hdd_config, allow_tpc_from_ap,
VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
CFG_TX_POWER_CTRL_DEFAULT,
CFG_TX_POWER_CTRL_MIN,
CFG_TX_POWER_CTRL_MAX),
REG_VARIABLE(CFG_LOW_GAIN_OVERRIDE_NAME, WLAN_PARAM_Integer, REG_VARIABLE(CFG_LOW_GAIN_OVERRIDE_NAME, WLAN_PARAM_Integer,
struct hdd_config, fIsLowGainOverride, struct hdd_config, fIsLowGainOverride,
VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -4951,6 +4958,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx)
"Name = [gTxPowerCap] Value = [%u] dBm ", "Name = [gTxPowerCap] Value = [%u] dBm ",
pHddCtx->config->nTxPowerCap); pHddCtx->config->nTxPowerCap);
#endif #endif
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH,
"Name = [gAllowTPCfromAP] Value = [%u] ",
pHddCtx->config->allow_tpc_from_ap);
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH, QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH,
"Name = [FastRoamEnabled] Value = [%u] ", "Name = [FastRoamEnabled] Value = [%u] ",
pHddCtx->config->isFastRoamIniFeatureEnabled); pHddCtx->config->isFastRoamIniFeatureEnabled);
@@ -6921,6 +6931,7 @@ QDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx)
smeConfig->csrConfig.cbChoice = 0; smeConfig->csrConfig.cbChoice = 0;
smeConfig->csrConfig.eBand = pConfig->nBandCapability; smeConfig->csrConfig.eBand = pConfig->nBandCapability;
smeConfig->csrConfig.nTxPowerCap = pConfig->nTxPowerCap; smeConfig->csrConfig.nTxPowerCap = pConfig->nTxPowerCap;
smeConfig->csrConfig.allow_tpc_from_ap = pConfig->allow_tpc_from_ap;
smeConfig->csrConfig.fEnableBypass11d = pConfig->enableBypass11d; smeConfig->csrConfig.fEnableBypass11d = pConfig->enableBypass11d;
smeConfig->csrConfig.fEnableDFSChnlScan = pConfig->enableDFSChnlScan; smeConfig->csrConfig.fEnableDFSChnlScan = pConfig->enableDFSChnlScan;
smeConfig->csrConfig.nRoamPrefer5GHz = pConfig->nRoamPrefer5GHz; smeConfig->csrConfig.nRoamPrefer5GHz = pConfig->nRoamPrefer5GHz;

View File

@@ -1934,16 +1934,12 @@ __lim_process_sme_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
session->htConfig.ht_tx_stbc = 0; session->htConfig.ht_tx_stbc = 0;
} }
#ifdef FEATURE_WLAN_ESE
session->maxTxPower = lim_get_max_tx_power(reg_max, session->maxTxPower = lim_get_max_tx_power(reg_max,
local_power_constraint, local_power_constraint,
mac_ctx->roam.configParam.nTxPowerCap); mac_ctx->roam.configParam.nTxPowerCap);
#else
session->maxTxPower =
QDF_MIN(reg_max, (local_power_constraint));
#endif
lim_log(mac_ctx, LOG1, lim_log(mac_ctx, LOG1,
FL("Reg max = %d, local power con = %d, max tx = %d"), FL("Reg max %d local power con %d max tx pwr %d"),
reg_max, local_power_constraint, session->maxTxPower); reg_max, local_power_constraint, session->maxTxPower);
if (session->gLimCurrentBssUapsd) { if (session->gLimCurrentBssUapsd) {

View File

@@ -56,6 +56,38 @@
#include "wma.h" #include "wma.h"
#define LIM_GET_NOISE_MAX_TRY 5 #define LIM_GET_NOISE_MAX_TRY 5
/**
* get_local_power_constraint_probe_response() - extracts local constraint
* from probe response
* @beacon_struct: beacon structure
* @local_constraint: local constraint pointer
* @session: A pointer to session entry.
*
* Return: None
*/
#ifdef FEATURE_WLAN_ESE
static void get_local_power_constraint_probe_response(
tpSirProbeRespBeacon beacon_struct,
int8_t *local_constraint,
tpPESession session)
{
if (beacon_struct->eseTxPwr.present)
*local_constraint =
beacon_struct->eseTxPwr.power_limit;
session->is_ese_version_ie_present =
beacon_struct->is_ese_ver_ie_present;
}
#else
static void get_local_power_constraint_probe_response(
tpSirProbeRespBeacon beacon_struct,
int8_t *local_constraint,
tpPESession session)
{
}
#endif
/** /**
* lim_extract_ap_capability() - extract AP's HCF/WME/WSM capability * lim_extract_ap_capability() - extract AP's HCF/WME/WSM capability
* @mac_ctx: Pointer to Global MAC structure * @mac_ctx: Pointer to Global MAC structure
@@ -289,20 +321,16 @@ lim_extract_ap_capability(tpAniSirGlobal mac_ctx, uint8_t *p_ie,
/* Extract the UAPSD flag from WMM Parameter element */ /* Extract the UAPSD flag from WMM Parameter element */
if (beacon_struct->wmeEdcaPresent) if (beacon_struct->wmeEdcaPresent)
*uapsd = beacon_struct->edcaParams.qosInfo.uapsd; *uapsd = beacon_struct->edcaParams.qosInfo.uapsd;
#if defined FEATURE_WLAN_ESE
/* If there is Power Constraint Element specifically, if (mac_ctx->roam.configParam.allow_tpc_from_ap) {
* adapt to it. Hence there is else condition check if (beacon_struct->powerConstraintPresent) {
* for this if statement. *local_constraint -=
*/ beacon_struct->localPowerConstraint.
if (beacon_struct->eseTxPwr.present) localPowerConstraints;
*local_constraint = beacon_struct->eseTxPwr.power_limit; } else {
session->is_ese_version_ie_present = get_local_power_constraint_probe_response(
beacon_struct->is_ese_ver_ie_present; beacon_struct, local_constraint, session);
#endif }
if (beacon_struct->powerConstraintPresent) {
*local_constraint -=
beacon_struct->localPowerConstraint.
localPowerConstraints;
} }
session->country_info_present = false; session->country_info_present = false;
/* Initializing before first use */ /* Initializing before first use */

View File

@@ -671,6 +671,31 @@ sch_bcn_process_sta_ibss(tpAniSirGlobal mac_ctx,
return; return;
} }
/**
* get_local_power_constraint_beacon() - extracts local constraint
* from beacon
* @bcn: beacon structure
* @local_constraint: local constraint pointer
*
* Return: None
*/
#ifdef FEATURE_WLAN_ESE
static void get_local_power_constraint_beacon(
tpSchBeaconStruct bcn,
int8_t *local_constraint)
{
if (bcn->eseTxPwr.present)
*local_constraint = bcn->eseTxPwr.power_limit;
}
#else
static void get_local_power_constraint_beacon(
tpSchBeaconStruct bcn,
int8_t *local_constraint)
{
}
#endif
/* /*
* __sch_beacon_process_for_session() - Process the received beacon frame when * __sch_beacon_process_for_session() - Process the received beacon frame when
* station is not scanning and corresponding session is found * station is not scanning and corresponding session is found
@@ -715,12 +740,11 @@ static void __sch_beacon_process_for_session(tpAniSirGlobal mac_ctx,
uint8_t *rx_pkt_info, uint8_t *rx_pkt_info,
tpPESession session) tpPESession session)
{ {
int8_t localRRMConstraint = 0;
uint8_t bssIdx = 0; uint8_t bssIdx = 0;
tUpdateBeaconParams beaconParams; tUpdateBeaconParams beaconParams;
uint8_t sendProbeReq = false; uint8_t sendProbeReq = false;
tpSirMacMgmtHdr pMh = WMA_GET_RX_MAC_HEADER(rx_pkt_info); tpSirMacMgmtHdr pMh = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
int8_t regMax = 0, maxTxPower = 0; int8_t regMax = 0, maxTxPower = 0, local_constraint;
qdf_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams)); qdf_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
beaconParams.paramChangeBitmap = 0; beaconParams.paramChangeBitmap = 0;
@@ -765,35 +789,35 @@ static void __sch_beacon_process_for_session(tpAniSirGlobal mac_ctx,
regMax = cfg_get_regulatory_max_transmit_power(mac_ctx, regMax = cfg_get_regulatory_max_transmit_power(mac_ctx,
session->currentOperChannel); session->currentOperChannel);
if (mac_ctx->rrm.rrmPEContext.rrmEnable local_constraint = regMax;
&& bcn->powerConstraintPresent)
localRRMConstraint = if (mac_ctx->roam.configParam.allow_tpc_from_ap) {
bcn->localPowerConstraint.localPowerConstraints; get_local_power_constraint_beacon(bcn, &local_constraint);
else sch_log(mac_ctx, LOG1, "ESE localPowerConstraint = %d,",
localRRMConstraint = 0; local_constraint);
maxTxPower = lim_get_max_tx_power(regMax, regMax - localRRMConstraint,
if (mac_ctx->rrm.rrmPEContext.rrmEnable &&
bcn->powerConstraintPresent) {
local_constraint = regMax;
local_constraint -=
bcn->localPowerConstraint.localPowerConstraints;
sch_log(mac_ctx, LOG1, "localPowerConstraint = %d,",
local_constraint);
}
}
maxTxPower = lim_get_max_tx_power(regMax, local_constraint,
mac_ctx->roam.configParam.nTxPowerCap); mac_ctx->roam.configParam.nTxPowerCap);
#if defined FEATURE_WLAN_ESE sch_log(mac_ctx, LOG1, "RegMax = %d, MaxTx pwr = %d",
if (session->isESEconnection) { regMax, maxTxPower);
int8_t localESEConstraint = 0;
if (bcn->eseTxPwr.present) {
localESEConstraint = bcn->eseTxPwr.power_limit;
maxTxPower = lim_get_max_tx_power(maxTxPower,
localESEConstraint,
mac_ctx->roam.configParam.nTxPowerCap);
}
sch_log(mac_ctx, LOG1,
FL("RegMax = %d, localEseCons = %d, MaxTx = %d"),
regMax, localESEConstraint, maxTxPower);
}
#endif
/* If maxTxPower is increased or decreased */ /* If maxTxPower is increased or decreased */
if (maxTxPower != session->maxTxPower) { if (maxTxPower != session->maxTxPower) {
sch_log(mac_ctx, LOG1, sch_log(mac_ctx, LOG1,
FL("Local power constraint change..updating new maxTx power %d to HAL"), FL("Local power constraint change, Updating new maxTx power %d from old pwr %d"),
maxTxPower); maxTxPower, session->maxTxPower);
if (lim_send_set_max_tx_power_req(mac_ctx, maxTxPower, session) if (lim_send_set_max_tx_power_req(mac_ctx, maxTxPower, session)
== eSIR_SUCCESS) == eSIR_SUCCESS)
session->maxTxPower = maxTxPower; session->maxTxPower = maxTxPower;

View File

@@ -1168,6 +1168,7 @@ typedef struct tagCsrConfigParam {
* default setting. * default setting.
*/ */
uint8_t nTxPowerCap; uint8_t nTxPowerCap;
bool allow_tpc_from_ap;
/* stats request frequency from PE while in full power */ /* stats request frequency from PE while in full power */
uint32_t statsReqPeriodicity; uint32_t statsReqPeriodicity;
/* stats request frequency from PE while in power save */ /* stats request frequency from PE while in power save */

View File

@@ -567,6 +567,7 @@ typedef struct tagCsrConfig {
* value & 11d. If 11d is disable, the lesser of this & default setting. * value & 11d. If 11d is disable, the lesser of this & default setting.
*/ */
uint8_t nTxPowerCap; uint8_t nTxPowerCap;
bool allow_tpc_from_ap;
uint32_t statsReqPeriodicity; /* stats req freq while in fullpower */ uint32_t statsReqPeriodicity; /* stats req freq while in fullpower */
uint32_t statsReqPeriodicityInPS;/* stats req freq while in powersave */ uint32_t statsReqPeriodicityInPS;/* stats req freq while in powersave */
uint32_t dtimPeriod; uint32_t dtimPeriod;

View File

@@ -1398,6 +1398,7 @@ static void init_config_param(tpAniSirGlobal pMac)
CSR_NUM_P2P_CHAN_COMBINED_CONC; CSR_NUM_P2P_CHAN_COMBINED_CONC;
#endif #endif
pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER; pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER;
pMac->roam.configParam.allow_tpc_from_ap = true;
pMac->roam.configParam.statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity =
CSR_MIN_GLOBAL_STAT_QUERY_PERIOD; CSR_MIN_GLOBAL_STAT_QUERY_PERIOD;
pMac->roam.configParam.statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS =
@@ -2277,6 +2278,8 @@ QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac,
pParam->statsReqPeriodicityInPS; pParam->statsReqPeriodicityInPS;
/* Assign this before calling csr_init11d_info */ /* Assign this before calling csr_init11d_info */
pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap; pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap;
pMac->roam.configParam.allow_tpc_from_ap =
pParam->allow_tpc_from_ap;
if (csr_is11d_supported(pMac)) { if (csr_is11d_supported(pMac)) {
status = csr_init11d_info(pMac, &pParam->Csr11dinfo); status = csr_init11d_info(pMac, &pParam->Csr11dinfo);
} else { } else {
@@ -2579,6 +2582,7 @@ QDF_STATUS csr_get_config_param(tpAniSirGlobal pMac, tCsrConfigParam *pParam)
pParam->vccRssiThreshold = cfg_params->vccRssiThreshold; pParam->vccRssiThreshold = cfg_params->vccRssiThreshold;
pParam->vccUlMacLossThreshold = cfg_params->vccUlMacLossThreshold; pParam->vccUlMacLossThreshold = cfg_params->vccUlMacLossThreshold;
pParam->nTxPowerCap = cfg_params->nTxPowerCap; pParam->nTxPowerCap = cfg_params->nTxPowerCap;
pParam->allow_tpc_from_ap = cfg_params->allow_tpc_from_ap;
pParam->statsReqPeriodicity = cfg_params->statsReqPeriodicity; pParam->statsReqPeriodicity = cfg_params->statsReqPeriodicity;
pParam->statsReqPeriodicityInPS = cfg_params->statsReqPeriodicityInPS; pParam->statsReqPeriodicityInPS = cfg_params->statsReqPeriodicityInPS;
pParam->addTSWhenACMIsOff = cfg_params->addTSWhenACMIsOff; pParam->addTSWhenACMIsOff = cfg_params->addTSWhenACMIsOff;

View File

@@ -2704,6 +2704,9 @@ wma_vdev_set_bss_params(tp_wma_handle wma, int vdev_id,
WMA_LOGW("Setting Tx power limit to 0"); WMA_LOGW("Setting Tx power limit to 0");
} }
WMA_LOGI("Set maxTx pwr [WMI_VDEV_PARAM_TX_PWRLIMIT] to %d",
maxTxPower);
ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
WMI_VDEV_PARAM_TX_PWRLIMIT, WMI_VDEV_PARAM_TX_PWRLIMIT,
maxTxPower); maxTxPower);

View File

@@ -397,7 +397,7 @@ void wma_set_tx_power(WMA_HANDLE handle,
if (wma_handle->interfaces[vdev_id].tx_power != tx_pwr_params->power) { if (wma_handle->interfaces[vdev_id].tx_power != tx_pwr_params->power) {
/* tx_power changed, Push the tx_power to FW */ /* tx_power changed, Push the tx_power to FW */
WMA_LOGW("%s: Set TX power limit [WMI_VDEV_PARAM_TX_PWRLIMIT] to %d", WMA_LOGI("%s: Set TX pwr limit [WMI_VDEV_PARAM_TX_PWRLIMIT] to %d",
__func__, tx_pwr_params->power); __func__, tx_pwr_params->power);
ret = wma_vdev_set_param(wma_handle->wmi_handle, ret = wma_vdev_set_param(wma_handle->wmi_handle,
vdev_id, vdev_id,
@@ -464,7 +464,7 @@ void wma_set_max_tx_power(WMA_HANDLE handle,
ret = QDF_STATUS_SUCCESS; ret = QDF_STATUS_SUCCESS;
goto end; goto end;
} }
WMA_LOGW("Set MAX TX power limit [WMI_VDEV_PARAM_TX_PWRLIMIT] to %d", WMA_LOGI("Set MAX TX pwr limit [WMI_VDEV_PARAM_TX_PWRLIMIT] to %d",
wma_handle->interfaces[vdev_id].max_tx_power); wma_handle->interfaces[vdev_id].max_tx_power);
ret = wma_vdev_set_param(wma_handle->wmi_handle, vdev_id, ret = wma_vdev_set_param(wma_handle->wmi_handle, vdev_id,
WMI_VDEV_PARAM_TX_PWRLIMIT, WMI_VDEV_PARAM_TX_PWRLIMIT,

View File

@@ -740,7 +740,7 @@ QDF_STATUS wma_update_channel_list(WMA_HANDLE handle,
WMI_SET_CHANNEL_REG_POWER(tchan_info, WMI_SET_CHANNEL_REG_POWER(tchan_info,
chan_list->chanParam[i].pwr); chan_list->chanParam[i].pwr);
WMA_LOGD("Channel TX power[%d] = %u: %d", i, tchan_info->mhz, WMA_LOGI("Channel TX power[%d] = %u: %d", i, tchan_info->mhz,
chan_list->chanParam[i].pwr); chan_list->chanParam[i].pwr);
/*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */
/*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */