qcacld-3.0: Add CFG items of power

Add power items related CFG items in new file,
and store the respective inis in MLME component

Change-Id: Iac183da52495aca07c6270edeb9f383ab49c1ff5
CRs-Fixed: 2341900
This commit is contained in:
gaurank kathpalia 2018-10-03 22:03:23 +05:30 committed by nshrivas
parent 5b574dd196
commit 3d2e38572b
17 changed files with 364 additions and 185 deletions

View File

@ -1420,6 +1420,29 @@ mlme_limit_max_per_index_score(uint32_t per_index_score)
return per_index_score;
}
static void mlme_init_power_cfg(struct wlan_objmgr_psoc *psoc,
struct wlan_mlme_power *power)
{
power->tx_power_2g = cfg_get(psoc, CFG_SET_TXPOWER_LIMIT2G);
power->tx_power_5g = cfg_get(psoc, CFG_SET_TXPOWER_LIMIT5G);
power->max_tx_power_24.max_len = CFG_MAX_TX_POWER_2_4_LEN;
qdf_uint8_array_parse(cfg_default(CFG_MAX_TX_POWER_2_4),
power->max_tx_power_24.data,
sizeof(power->max_tx_power_24.data),
&power->max_tx_power_24.len);
power->max_tx_power_5.max_len = CFG_MAX_TX_POWER_5_LEN;
qdf_uint8_array_parse(cfg_default(CFG_MAX_TX_POWER_5),
power->max_tx_power_5.data,
sizeof(power->max_tx_power_5.data),
&power->max_tx_power_5.len);
power->power_usage.max_len = CFG_POWER_USAGE_MAX_LEN;
power->power_usage.len = CFG_POWER_USAGE_MAX_LEN;
qdf_mem_copy(power->power_usage.data, cfg_get(psoc, CFG_POWER_USAGE),
power->power_usage.len);
}
static void mlme_init_scoring_cfg(struct wlan_objmgr_psoc *psoc,
struct wlan_mlme_scoring_cfg *scoring_cfg)
{
@ -1818,6 +1841,7 @@ QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
mlme_init_scoring_cfg(psoc, &mlme_cfg->scoring);
mlme_init_threshold_cfg(psoc, &mlme_cfg->threshold);
mlme_init_acs_cfg(psoc, &mlme_cfg->acs);
mlme_init_power_cfg(psoc, &mlme_cfg->power);
mlme_init_oce_cfg(psoc, &mlme_cfg->oce);
mlme_init_wep_cfg(&mlme_cfg->wep_params);
mlme_init_wps_params_cfg(psoc, &mlme_cfg->wps_params);

View File

@ -27,6 +27,7 @@
#include "cfg_mlme_edca_params.h"
#include "cfg_mlme_generic.h"
#include "cfg_mlme_acs.h"
#include "cfg_mlme_power.h"
#include "cfg_mlme_ht_caps.h"
#include "cfg_mlme_he_caps.h"
#include "cfg_mlme_lfr.h"
@ -62,6 +63,7 @@
CFG_HE_CAPS_ALL \
CFG_LFR_ALL \
CFG_MBO_ALL \
CFG_MLME_POWER_ALL \
CFG_MLME_PRODUCT_DETAILS_ALL \
CFG_NSS_CHAINS_ALL \
CFG_OBSS_HT40_ALL \

View File

@ -0,0 +1,120 @@
/*
* Copyright (c) 2012-2018 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains centralized definitions of converged configuration.
*/
#ifndef __CFG_MLME_POWER_H
#define __CFG_MLME_POWER_H
/*
* <cfg>
* max_tx_power_24 - max tx power allowed for 2.4 ghz
* @Min: 0 minimum length of tx power
* @Max: default data length of tx power in string format
* @Default: 1, 14, 20
*/
#define CFG_MAX_TX_POWER_2_4_DATA "1, 14, 20"
#define CFG_MAX_TX_POWER_2_4 CFG_STRING( \
"max_tx_power_24", \
0, \
sizeof(CFG_MAX_TX_POWER_2_4_DATA) - 1, \
CFG_MAX_TX_POWER_2_4_DATA, \
"max tx power 24")
/*
* <cfg>
* max_tx_power_5 - max tx power allowed for 5 ghz
* @Min: 0 minimum length of tx power
* @Max: default data length of tx power in string format
* @Default: 36, 126, 20
*/
#define CFG_MAX_TX_POWER_5_DATA "36, 126, 20"
#define CFG_MAX_TX_POWER_5 CFG_STRING( \
"max_tx_power_5", \
0, \
sizeof(CFG_MAX_TX_POWER_5_DATA) - 1, \
CFG_MAX_TX_POWER_5_DATA, \
"max tx power 5")
/*
* <ini>
* gPowerUsage - power usage name
* @Min: "Min" - minimum power usage
* @Max: "Max" - maximum power usage
* @Default: "Mod"
*
* Usage: Internal/External
*
* </ini>
*/
#define CFG_POWER_USAGE CFG_INI_STRING( \
"gPowerUsage", \
0, \
3, \
"Mod", \
"power usage")
/*
* <ini>
* TxPower2g - Limit power in case of 2.4ghz
* @Min: 0
* @Max: 30
* @Default: 30
*
* Usage: Internal/External
*
* </ini>
*/
#define CFG_SET_TXPOWER_LIMIT2G CFG_INI_UINT( \
"TxPower2g", \
0, \
30, \
30, \
CFG_VALUE_OR_DEFAULT, \
"power limit 2g")
/*
* <ini>
* TxPower5g - Limit power in case of 5ghz
* @Min: 0
* @Max: 30
* @Default: 30
*
* Usage: Internal/External
*
* </ini>
*/
#define CFG_SET_TXPOWER_LIMIT5G CFG_INI_UINT( \
"TxPower5g", \
0, \
30, \
30, \
CFG_VALUE_OR_DEFAULT, \
"power limit 5g")
#define CFG_MLME_POWER_ALL \
CFG(CFG_MAX_TX_POWER_2_4) \
CFG(CFG_MAX_TX_POWER_5) \
CFG(CFG_POWER_USAGE) \
CFG(CFG_SET_TXPOWER_LIMIT2G) \
CFG(CFG_SET_TXPOWER_LIMIT5G)
#endif /* __CFG_MLME_POWER_H */

View File

@ -85,6 +85,25 @@ QDF_STATUS mlme_get_wep_key(struct wlan_mlme_wep_cfg *wep_params,
QDF_STATUS mlme_set_wep_key(struct wlan_mlme_wep_cfg *wep_params,
enum wep_key_id wep_keyid, uint8_t *key_to_set,
qdf_size_t len);
/**
* wlan_mlme_get_tx_power() - Get the max tx power in particular band
* @psoc: pointer to psoc object
* @band: 2ghz/5ghz band
*
* Return: value of tx power in the respective band
*/
uint8_t wlan_mlme_get_tx_power(struct wlan_objmgr_psoc *psoc,
enum band_info band);
/**
* wlan_mlme_get_power_usage() - Get the power usage info
* @psoc: pointer to psoc object
*
* Return: pointer to character array of power usage
*/
char *wlan_mlme_get_power_usage(struct wlan_objmgr_psoc *psoc);
/**
* wlan_mlme_get_ht_cap_info() - Get the HT cap info config
* @psoc: pointer to psoc object

View File

@ -43,6 +43,9 @@
#define CFG_STR_DATA_LEN 17
#define CFG_EDCA_DATA_LEN 17
#define CFG_MAX_TX_POWER_2_4_LEN 128
#define CFG_MAX_TX_POWER_5_LEN 128
#define CFG_POWER_USAGE_MAX_LEN 4
#define CFG_VALID_CHANNEL_LIST_LEN 100
#define CFG_VALID_CHANNEL_LIST_STRING_LEN (CFG_VALID_CHANNEL_LIST_LEN * 4)
@ -1490,6 +1493,55 @@ struct wlan_mlme_threshold {
uint32_t frag_threshold;
};
/* struct mlme_max_tx_power_24 - power related items
* @max_len: max length of string
* @len: actual len of string
* @data: Data in string format
*/
struct mlme_max_tx_power_24 {
qdf_size_t max_len;
qdf_size_t len;
uint8_t data[CFG_MAX_TX_POWER_2_4_LEN];
};
/* struct mlme_max_tx_power_5 - power related items
* @max_len: max length of string
* @len: actual len of string
* @data: Data in string format
*/
struct mlme_max_tx_power_5 {
qdf_size_t max_len;
qdf_size_t len;
uint8_t data[CFG_MAX_TX_POWER_5_LEN];
};
/* struct mlme_power_usage - power related items
* @max_len: max length of string
* @len: actual len of string
* @data: Data in string format
*/
struct mlme_power_usage {
qdf_size_t max_len;
qdf_size_t len;
char data[CFG_POWER_USAGE_MAX_LEN];
};
/*
* struct wlan_mlme_power - power related config items
* @max_tx_power_24: max power Tx for 2.4 ghz
* @max_tx_power_5: max power Tx for 5 ghz
* @power_usage: power usage mode, min, max, mod
* @tx_power_2g: limit tx power in 2.4 ghz
* @tx_power_5g: limit tx power in 5 ghz
*/
struct wlan_mlme_power {
struct mlme_max_tx_power_24 max_tx_power_24;
struct mlme_max_tx_power_5 max_tx_power_5;
struct mlme_power_usage power_usage;
uint8_t tx_power_2g;
uint8_t tx_power_5g;
};
/*
* struct wlan_mlme_timeout - mlme timeout related config items
* @join_failure_timeout: join failure timeout
@ -1602,6 +1654,7 @@ struct wlan_mlme_wep_cfg {
* @threshold: threshold related cfg items
* @timeouts: mlme timeout related CFG items
* @twt_cfg: TWT CFG Items
* @wlan_mlme_power: power related items
* @acs: ACS related CFG items
* @feature_flags: Feature flag config items
* @wep_params: WEP related config items
@ -1633,6 +1686,7 @@ struct wlan_mlme_cfg {
struct wlan_mlme_threshold threshold;
struct wlan_mlme_timeout timeouts;
struct wlan_mlme_cfg_twt twt_cfg;
struct wlan_mlme_power power;
struct wlan_mlme_acs acs;
struct wlan_mlme_feature_flag feature_flags;
struct wlan_mlme_wep_cfg wep_params;

View File

@ -117,6 +117,31 @@ static inline QDF_STATUS ucfg_mlme_pdev_close(struct wlan_objmgr_pdev *pdev)
}
#endif
/**
* wlan_mlme_get_power_usage() - Get the power usage info
* @psoc: pointer to psoc object
*
* Return: pointer to character array of power usage
*/
static inline
char *ucfg_mlme_get_power_usage(struct wlan_objmgr_psoc *psoc)
{
return wlan_mlme_get_power_usage(psoc);
}
/**
* ucfg_get_tx_power() - Get the max tx power in particular band
* @psoc: pointer to psoc object
* @band: 2ghz/5ghz band
*
* Return: value of tx power in the respective band
*/
static inline
uint8_t ucfg_get_tx_power(struct wlan_objmgr_psoc *psoc, uint8_t band)
{
return wlan_mlme_get_tx_power(psoc, band);
}
/**
* ucfg_mlme_get_ht_cap_info() - Get the HT cap info config
* @psoc: pointer to psoc object

View File

@ -56,6 +56,41 @@ QDF_STATUS wlan_mlme_set_cfg_str(uint8_t *src, struct mlme_cfg_str *dst_cfg_str,
return QDF_STATUS_SUCCESS;
}
uint8_t wlan_mlme_get_tx_power(struct wlan_objmgr_psoc *psoc,
enum band_info band)
{
struct wlan_mlme_psoc_obj *mlme_obj;
mlme_obj = mlme_get_psoc_obj(psoc);
if (!mlme_obj) {
mlme_err("Failed to get MLME Obj");
return 0;
}
switch (band) {
case BAND_2G:
return mlme_obj->cfg.power.tx_power_2g;
case BAND_5G:
return mlme_obj->cfg.power.tx_power_5g;
default:
break;
}
return 0;
}
char *wlan_mlme_get_power_usage(struct wlan_objmgr_psoc *psoc)
{
struct wlan_mlme_psoc_obj *mlme_obj;
mlme_obj = mlme_get_psoc_obj(psoc);
if (!mlme_obj) {
mlme_err("Failed to get MLME Obj");
return NULL;
}
return mlme_obj->cfg.power.power_usage.data;
}
QDF_STATUS wlan_mlme_get_ht_cap_info(struct wlan_objmgr_psoc *psoc,
struct mlme_ht_capabilities_info
*ht_cap_info)

View File

@ -2836,18 +2836,6 @@ enum hdd_link_speed_rpt_type {
#define CFG_ENABLE_SNR_MONITORING_MAX (1)
#define CFG_ENABLE_SNR_MONITORING_DEFAULT (0)
/* SAR Thermal limit values for 2g and 5g */
#define CFG_SET_TXPOWER_LIMIT2G_NAME "TxPower2g"
#define CFG_SET_TXPOWER_LIMIT2G_MIN (0)
#define CFG_SET_TXPOWER_LIMIT2G_MAX (30)
#define CFG_SET_TXPOWER_LIMIT2G_DEFAULT (30)
#define CFG_SET_TXPOWER_LIMIT5G_NAME "TxPower5g"
#define CFG_SET_TXPOWER_LIMIT5G_MIN (0)
#define CFG_SET_TXPOWER_LIMIT5G_MAX (30)
#define CFG_SET_TXPOWER_LIMIT5G_DEFAULT (30)
#ifdef FEATURE_WLAN_RA_FILTERING
#define CFG_RA_RATE_LIMIT_INTERVAL_NAME "gRArateLimitInterval"
#define CFG_RA_RATE_LIMIT_INTERVAL_MIN (60)
@ -3639,28 +3627,6 @@ enum hdd_link_speed_rpt_type {
#define CFG_5G_MAX_RSSI_PENALIZE_MAX (20)
#define CFG_5G_MAX_RSSI_PENALIZE_DEFAULT (10)
/*
* <ini>
* gPowerUsage - Preferred Power Usage
* @Min: Min
* @Max: Max
* @Default: Mod
*
* This ini is used to set the preferred power usage
*
* Related: None
*
* Supported Feature: Power Save
*
* Usage: External
*
* </ini>
*/
#define CFG_POWER_USAGE_NAME "gPowerUsage"
#define CFG_POWER_USAGE_MIN "Min"
#define CFG_POWER_USAGE_MAX "Max"
#define CFG_POWER_USAGE_DEFAULT "Mod"
/*
* <ini>
* gEnableImps - Enable/Disable IMPS
@ -5129,6 +5095,7 @@ struct hdd_config {
bool Is11dSupportEnabled;
bool Is11hSupportEnabled;
char PowerUsageControl[4];
bool fSupplicantCountryCodeHasPriority;
bool fIsImpsEnabled;
bool is_ps_enabled;
uint32_t auto_bmps_timer_val;
@ -5275,8 +5242,6 @@ struct hdd_config {
uint32_t IpaConfig;
bool IpaClkScalingEnable;
uint8_t disableDFSChSwitch;
uint32_t TxPower2g;
uint32_t TxPower5g;
bool fDfsPhyerrFilterOffload;
uint8_t gDisableDfsJapanW53;
bool gEnableOverLapCh;

View File

@ -78,10 +78,6 @@ struct reg_table_entry g_registry_table[] = {
CFG_11H_SUPPORT_ENABLED_MIN,
CFG_11H_SUPPORT_ENABLED_MAX),
REG_VARIABLE_STRING(CFG_POWER_USAGE_NAME, WLAN_PARAM_String,
struct hdd_config, PowerUsageControl,
VAR_FLAGS_OPTIONAL,
(void *)CFG_POWER_USAGE_DEFAULT),
REG_VARIABLE(CFG_ENABLE_IMPS_NAME, WLAN_PARAM_Integer,
struct hdd_config, fIsImpsEnabled,
@ -644,20 +640,6 @@ struct reg_table_entry g_registry_table[] = {
CFG_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_MIN,
CFG_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_MAX),
REG_VARIABLE(CFG_SET_TXPOWER_LIMIT2G_NAME, WLAN_PARAM_Integer,
struct hdd_config, TxPower2g,
VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
CFG_SET_TXPOWER_LIMIT2G_DEFAULT,
CFG_SET_TXPOWER_LIMIT2G_MIN,
CFG_SET_TXPOWER_LIMIT2G_MAX),
REG_VARIABLE(CFG_SET_TXPOWER_LIMIT5G_NAME, WLAN_PARAM_Integer,
struct hdd_config, TxPower5g,
VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
CFG_SET_TXPOWER_LIMIT5G_DEFAULT,
CFG_SET_TXPOWER_LIMIT5G_MIN,
CFG_SET_TXPOWER_LIMIT5G_MAX),
REG_VARIABLE(CFG_ENABLE_DFS_PHYERR_FILTEROFFLOAD_NAME,
WLAN_PARAM_Integer,
struct hdd_config, fDfsPhyerrFilterOffload,
@ -2157,9 +2139,9 @@ static void hdd_set_power_save_offload_config(struct hdd_context *hdd_ctx)
struct hdd_config *pConfig = hdd_ctx->config;
uint32_t listenInterval = 0;
if (strcmp(pConfig->PowerUsageControl, "Min") == 0)
if (strcmp(ucfg_mlme_get_power_usage(hdd_ctx->psoc), "Min") == 0)
listenInterval = pConfig->nBmpsMinListenInterval;
else if (strcmp(pConfig->PowerUsageControl, "Max") == 0)
else if (strcmp(ucfg_mlme_get_power_usage(hdd_ctx->psoc), "Max") == 0)
listenInterval = pConfig->nBmpsMaxListenInterval;
/*

View File

@ -10755,8 +10755,8 @@ static int hdd_features_init(struct hdd_context *hdd_ctx)
} else if (cds_is_packet_log_enabled())
hdd_pktlog_enable_disable(hdd_ctx, true, 0, 0);
hddtxlimit.txPower2g = hdd_ctx->config->TxPower2g;
hddtxlimit.txPower5g = hdd_ctx->config->TxPower5g;
hddtxlimit.txPower2g = ucfg_get_tx_power(hdd_ctx->psoc, BAND_2G);
hddtxlimit.txPower5g = ucfg_get_tx_power(hdd_ctx->psoc, BAND_5G);
status = sme_txpower_limit(mac_handle, &hddtxlimit);
if (!QDF_IS_STATUS_SUCCESS(status))
hdd_err("Error setting txlimit in sme: %d", status);

View File

@ -31,8 +31,6 @@ enum {
WNI_CFG_VALID_CHANNEL_LIST,
WNI_CFG_APSD_ENABLED,
WNI_CFG_11D_ENABLED,
WNI_CFG_MAX_TX_POWER_2_4,
WNI_CFG_MAX_TX_POWER_5,
WNI_CFG_CURRENT_TX_POWER_LEVEL,
WNI_CFG_COUNTRY_CODE,
WNI_CFG_11H_ENABLED,

View File

@ -554,62 +554,59 @@ QDF_STATUS wlan_cfg_get_str_len(tpAniSirGlobal mac, uint16_t cfgId,
/**
* cfg_get_dot11d_transmit_power() - regulatory max transmit power
* @mac: pointer to mac data
* @cfgId: configuration ID
* @cfgLength: configuration length
* @pMac: pointer to mac data
* @channel: channel number
*
* Return: int8_t - power
*/
static int8_t
cfg_get_dot11d_transmit_power(tpAniSirGlobal mac, uint16_t cfgId,
uint32_t cfgLength, uint8_t channel)
cfg_get_dot11d_transmit_power(tpAniSirGlobal pMac, uint8_t channel)
{
uint8_t *pCountryInfo = NULL;
uint32_t cfg_length = 0;
int8_t max_tx_pwr = 0;
uint8_t *country_info = NULL;
uint8_t count = 0;
int8_t maxTxPwr = WMA_MAX_TXPOWER_INVALID;
uint8_t first_channel;
uint8_t maxChannels;
/* At least one element is present */
if (cfgLength < sizeof(tSirMacChanInfo)) {
pe_err("Invalid CFGLENGTH: %d while getting 11d txpower",
cfgLength);
if (WLAN_REG_IS_5GHZ_CH(channel))
cfg_length = pMac->mlme_cfg->power.max_tx_power_5.len;
else if (WLAN_REG_IS_24GHZ_CH(channel))
cfg_length = pMac->mlme_cfg->power.max_tx_power_24.len;
else
return max_tx_pwr;
country_info = qdf_mem_malloc(cfg_length);
if (!country_info)
goto error;
if (WLAN_REG_IS_5GHZ_CH(channel)) {
qdf_mem_copy(country_info,
pMac->mlme_cfg->power.max_tx_power_5.data,
cfg_length);
} else if (WLAN_REG_IS_24GHZ_CH(channel)) {
qdf_mem_copy(country_info,
pMac->mlme_cfg->power.max_tx_power_24.data,
cfg_length);
}
pCountryInfo = qdf_mem_malloc(cfgLength);
if (!pCountryInfo)
goto error;
/* The CSR will always update this CFG. The contents will be from country IE if regulatory domain
* is enabled on AP else will contain EEPROM contents
*/
if (wlan_cfg_get_str(mac, cfgId, pCountryInfo, &cfgLength) !=
QDF_STATUS_SUCCESS) {
qdf_mem_free(pCountryInfo);
pCountryInfo = NULL;
pe_warn("Failed to retrieve 11d configuration parameters while retrieving 11d tuples");
goto error;
}
/* Identify the channel and maxtxpower */
while (count <= (cfgLength - (sizeof(tSirMacChanInfo)))) {
uint8_t firstChannel, maxChannels;
while (count <= (cfg_length - (sizeof(tSirMacChanInfo)))) {
first_channel = country_info[count++];
maxChannels = country_info[count++];
max_tx_pwr = country_info[count++];
firstChannel = pCountryInfo[count++];
maxChannels = pCountryInfo[count++];
maxTxPwr = pCountryInfo[count++];
if ((channel >= firstChannel) &&
(channel < (firstChannel + maxChannels))) {
if ((channel >= first_channel) &&
(channel < (first_channel + maxChannels))) {
break;
}
}
error:
if (NULL != pCountryInfo)
qdf_mem_free(pCountryInfo);
if (country_info)
qdf_mem_free(country_info);
return maxTxPwr;
return max_tx_pwr;
}
/**----------------------------------------------------------------------
@ -624,40 +621,7 @@ error:
int8_t cfg_get_regulatory_max_transmit_power(tpAniSirGlobal mac,
uint8_t channel)
{
uint32_t cfgLength = 0;
uint16_t cfgId = 0;
int8_t maxTxPwr;
eRfBandMode rfBand = eRF_BAND_UNKNOWN;
if ((channel >= SIR_11A_CHANNEL_BEGIN) &&
(channel <= SIR_11A_CHANNEL_END))
rfBand = eRF_BAND_5_GHZ;
else
rfBand = eRF_BAND_2_4_GHZ;
/* Get the max transmit power for current channel for the current regulatory domain */
switch (rfBand) {
case eRF_BAND_2_4_GHZ:
cfgId = WNI_CFG_MAX_TX_POWER_2_4;
cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN;
pe_debug("HAL: Reading CFG for 2.4 GHz channels to get regulatory max tx power");
break;
case eRF_BAND_5_GHZ:
cfgId = WNI_CFG_MAX_TX_POWER_5;
cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN;
pe_debug("HAL: Reading CFG for 5.0 GHz channels to get regulatory max tx power");
break;
case eRF_BAND_UNKNOWN:
default:
pe_warn("HAL: Invalid current working band for the device");
return WMA_MAX_TXPOWER_INVALID; /* Its return, not break. */
}
maxTxPwr = cfg_get_dot11d_transmit_power(mac, cfgId, cfgLength, channel);
return maxTxPwr;
return cfg_get_dot11d_transmit_power(mac, channel);
}
/* --------------------------------------------------------------------- */

View File

@ -46,8 +46,6 @@ const char *cfg_get_string(uint16_t cfg_id)
CASE_RETURN_STRING(WNI_CFG_VALID_CHANNEL_LIST);
CASE_RETURN_STRING(WNI_CFG_APSD_ENABLED);
CASE_RETURN_STRING(WNI_CFG_11D_ENABLED);
CASE_RETURN_STRING(WNI_CFG_MAX_TX_POWER_2_4);
CASE_RETURN_STRING(WNI_CFG_MAX_TX_POWER_5);
CASE_RETURN_STRING(WNI_CFG_CURRENT_TX_POWER_LEVEL);
CASE_RETURN_STRING(WNI_CFG_COUNTRY_CODE);
CASE_RETURN_STRING(WNI_CFG_11H_ENABLED);

View File

@ -60,12 +60,6 @@ cgstatic cfg_static[CFG_PARAM_MAX_NUM] = {
WNI_CFG_11D_ENABLED_STAMIN,
WNI_CFG_11D_ENABLED_STAMAX,
WNI_CFG_11D_ENABLED_STADEF},
{WNI_CFG_MAX_TX_POWER_2_4,
CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
0, 0, 0},
{WNI_CFG_MAX_TX_POWER_5,
CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
0, 0, 0},
{WNI_CFG_CURRENT_TX_POWER_LEVEL,
CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMIN,
@ -163,14 +157,6 @@ cfgstatic_string cfg_static_string[CFG_MAX_STATIC_STRING] = {
5, 7, 8, 9, 10, 12, 13, 14, 100, 104, 108, 112, 116, 120, 124, 128,
132, 136, 140, 149, 151, 153, 155, 157, 159, 161, 50, 54, 58, 62, 240,
242, 244, 246, 248, 250, 252} },
{WNI_CFG_MAX_TX_POWER_2_4,
WNI_CFG_MAX_TX_POWER_2_4_LEN,
3,
{0x1, 0xe, 0x14} },
{WNI_CFG_MAX_TX_POWER_5,
WNI_CFG_MAX_TX_POWER_5_LEN,
3,
{0x24, 0x7e, 0x14} },
{WNI_CFG_COUNTRY_CODE,
WNI_CFG_COUNTRY_CODE_LEN,
0,

View File

@ -347,24 +347,24 @@ QDF_STATUS
populate_dot11f_country(tpAniSirGlobal mac,
tDot11fIECountry *pDot11f, struct pe_session *psessionEntry)
{
uint32_t len, maxlen;
uint16_t item;
QDF_STATUS nSirStatus;
uint32_t len;
enum band_info rfBand;
uint8_t temp[CFG_MAX_STR_LEN], code[3];
if (psessionEntry->lim11dEnabled) {
lim_get_rf_band_new(mac, &rfBand, psessionEntry);
if (rfBand == BAND_5G) {
item = WNI_CFG_MAX_TX_POWER_5;
maxlen = WNI_CFG_MAX_TX_POWER_5_LEN;
len = mac->mlme_cfg->power.max_tx_power_5.len;
qdf_mem_copy(temp,
mac->mlme_cfg->power.max_tx_power_5.data,
len);
} else {
item = WNI_CFG_MAX_TX_POWER_2_4;
maxlen = WNI_CFG_MAX_TX_POWER_2_4_LEN;
len = mac->mlme_cfg->power.max_tx_power_24.len;
qdf_mem_copy(temp,
mac->mlme_cfg->power.max_tx_power_24.data,
len);
}
CFG_GET_STR(nSirStatus, mac, item, temp, len, maxlen);
if (3 > len) {
/* no limit on tx power, cannot include the IE because at least */
/* one (channel,num,tx power) must be present */
@ -5845,9 +5845,7 @@ populate_dot11f_timing_advert_frame(tpAniSirGlobal mac_ctx,
tDot11fTimingAdvertisementFrame *frame)
{
uint32_t val, len;
uint16_t item;
uint8_t temp[CFG_MAX_STR_LEN], code[3];
QDF_STATUS nSirStatus;
/* Capabilities */
val = mac_ctx->mlme_cfg->wep_params.is_privacy_enabled;
@ -5875,9 +5873,8 @@ populate_dot11f_timing_advert_frame(tpAniSirGlobal mac_ctx,
(uint16_t)((val >> WNI_CFG_BLOCK_ACK_ENABLED_IMMEDIATE) & 1);
/* Country */
item = WNI_CFG_MAX_TX_POWER_5;
CFG_GET_STR(nSirStatus, mac_ctx, item, temp, len,
WNI_CFG_MAX_TX_POWER_5_LEN);
len = mac_ctx->mlme_cfg->power.max_tx_power_5.len;
qdf_mem_copy(temp, mac_ctx->mlme_cfg->power.max_tx_power_5.data, len);
wlan_reg_read_current_country(mac_ctx->psoc, code);
qdf_mem_copy(&frame->Country, code, 2);
if (len > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE)
@ -5896,7 +5893,7 @@ populate_dot11f_timing_advert_frame(tpAniSirGlobal mac_ctx,
frame->TimeAdvertisement.present = 1;
frame->TimeAdvertisement.timing_capabilities = 1;
return nSirStatus;
return QDF_STATUS_SUCCESS;
}
#ifdef WLAN_FEATURE_11AX

View File

@ -12931,7 +12931,6 @@ QDF_STATUS csr_get_cfg_valid_channels(tpAniSirGlobal mac, uint8_t *pChannels,
int8_t csr_get_cfg_max_tx_power(tpAniSirGlobal mac, uint8_t channel)
{
uint32_t cfgLength = 0;
uint16_t cfgId = 0;
int8_t maxTxPwr = 0;
uint8_t *pCountryInfo = NULL;
uint8_t count = 0;
@ -12939,11 +12938,10 @@ int8_t csr_get_cfg_max_tx_power(tpAniSirGlobal mac, uint8_t channel)
uint8_t maxChannels;
if (WLAN_REG_IS_5GHZ_CH(channel)) {
cfgId = WNI_CFG_MAX_TX_POWER_5;
cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN;
cfgLength = mac->mlme_cfg->power.max_tx_power_5.len;
} else if (WLAN_REG_IS_24GHZ_CH(channel)) {
cfgId = WNI_CFG_MAX_TX_POWER_2_4;
cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN;
cfgLength = mac->mlme_cfg->power.max_tx_power_24.len;
} else
return maxTxPwr;
@ -12951,10 +12949,16 @@ int8_t csr_get_cfg_max_tx_power(tpAniSirGlobal mac, uint8_t channel)
if (!pCountryInfo)
goto error;
if (wlan_cfg_get_str(mac, cfgId, (uint8_t *)pCountryInfo,
&cfgLength) != QDF_STATUS_SUCCESS) {
goto error;
if (WLAN_REG_IS_5GHZ_CH(channel)) {
qdf_mem_copy(pCountryInfo,
mac->mlme_cfg->power.max_tx_power_5.data,
cfgLength);
} else if (WLAN_REG_IS_24GHZ_CH(channel)) {
qdf_mem_copy(pCountryInfo,
mac->mlme_cfg->power.max_tx_power_24.data,
cfgLength);
}
/* Identify the channel and maxtxpower */
while (count <= (cfgLength - (sizeof(tSirMacChanInfo)))) {
firstChannel = pCountryInfo[count++];

View File

@ -657,9 +657,9 @@ void csr_apply_power2_current(tpAniSirGlobal mac)
{
sme_debug("Updating Cfg with power settings");
csr_save_tx_power_to_cfg(mac, &mac->scan.channelPowerInfoList24,
WNI_CFG_MAX_TX_POWER_2_4);
BAND_2G);
csr_save_tx_power_to_cfg(mac, &mac->scan.channelPowerInfoList5G,
WNI_CFG_MAX_TX_POWER_5);
BAND_5G);
}
void csr_apply_channel_power_info_to_fw(tpAniSirGlobal mac_ctx,
@ -1609,23 +1609,24 @@ static void csr_set_cfg_valid_channel_list(tpAniSirGlobal mac,
/*
* The Tx power limits are saved in the cfg for future usage.
*/
static void csr_save_tx_power_to_cfg(tpAniSirGlobal mac, tDblLinkList *pList,
uint32_t cfgId)
static void csr_save_tx_power_to_cfg(tpAniSirGlobal pMac,
tDblLinkList *pList,
enum band_info band)
{
tListElem *pEntry;
uint32_t cbLen = 0, dataLen, tmp_len;
struct csr_channel_powerinfo *ch_set;
uint32_t idx;
tSirMacChanInfo *ch_pwr_set;
uint8_t *pBuf = NULL;
uint8_t *p_buf = NULL;
/* allocate maximum space for all channels */
dataLen = WNI_CFG_VALID_CHANNEL_LIST_LEN * sizeof(tSirMacChanInfo);
pBuf = qdf_mem_malloc(dataLen);
if (pBuf == NULL)
p_buf = qdf_mem_malloc(dataLen);
if (!p_buf)
return;
ch_pwr_set = (tSirMacChanInfo *) (pBuf);
ch_pwr_set = (tSirMacChanInfo *)(p_buf);
pEntry = csr_ll_peek_head(pList, LL_ACCESS_LOCK);
/*
* write the tuples (startChan, numChan, txPower) for each channel found
@ -1666,7 +1667,7 @@ static void csr_save_tx_power_to_cfg(tpAniSirGlobal mac, tDblLinkList *pList,
ch_pwr_set->numChannels = 1;
ch_pwr_set->maxTxPower =
QDF_MIN(ch_set->txPower,
mac->roam.configParam.nTxPowerCap);
pMac->roam.configParam.nTxPowerCap);
sme_debug(
"Setting Max Transmit Power %d",
ch_pwr_set->maxTxPower);
@ -1688,20 +1689,25 @@ static void csr_save_tx_power_to_cfg(tpAniSirGlobal mac, tDblLinkList *pList,
ch_pwr_set->firstChanNum);
ch_pwr_set->numChannels = ch_set->numChannels;
ch_pwr_set->maxTxPower = QDF_MIN(ch_set->txPower,
mac->roam.configParam.nTxPowerCap);
pMac->roam.configParam.nTxPowerCap);
sme_debug(
"Setting Max Tx Power %d, nTxPower %d",
ch_pwr_set->maxTxPower,
mac->roam.configParam.nTxPowerCap);
pMac->roam.configParam.nTxPowerCap);
cbLen += sizeof(tSirMacChanInfo);
ch_pwr_set++;
}
pEntry = csr_ll_next(pList, pEntry, LL_ACCESS_LOCK);
}
if (cbLen)
cfg_set_str(mac, cfgId, (uint8_t *) pBuf, cbLen);
qdf_mem_free(pBuf);
if (band == BAND_2G)
qdf_mem_copy(pMac->mlme_cfg->power.max_tx_power_24.data,
(uint8_t *)p_buf,
pMac->mlme_cfg->power.max_tx_power_24.len);
if (band == BAND_5G)
qdf_mem_copy(pMac->mlme_cfg->power.max_tx_power_5.data,
(uint8_t *)p_buf,
pMac->mlme_cfg->power.max_tx_power_5.len);
qdf_mem_free(p_buf);
}
static void csr_set_cfg_country_code(tpAniSirGlobal mac, uint8_t *countryCode)