qcacld-3.0: update WMA with ini config for max_peers

Max_peers configuration is needed only by WMA. Remove dependency of
ol layer for max_peers and move it WMA.

Change-Id: I336b02ae84c72c70ca459425b38b197e5fe551a0
CRs-Fixed: 967765
This commit is contained in:
Komal Seelam 2016-02-23 18:03:19 +05:30 • committed by Prakash Dhavali
commit 02d0934a4a
6 changed files with 88 additions and 52 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
* Copyright (c) 2014, 2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@ -49,16 +49,10 @@
#ifdef HIF_PCI
void ol_target_failure(void *instance, CDF_STATUS status);
uint8_t ol_get_number_of_peers_supported(struct ol_softc *scn);
#else
static inline void ol_target_failure(void *instance, CDF_STATUS status)
{
return;
}
static inline uint8_t ol_get_number_of_peers_supported(struct ol_softc *scn)
{
return 1;
}
#endif
#endif /* _OL_FW_H_ */

View file

@ -1635,27 +1635,3 @@ static int ol_target_coredump(void *inst, void *memory_block,
}
return ret;
}
#define MAX_SUPPORTED_PEERS_REV1_1 14
#define MAX_SUPPORTED_PEERS_REV1_3 32
uint8_t ol_get_number_of_peers_supported(struct ol_softc *scn)
{
struct hif_config_info *ini_cfg = hif_get_ini_handle(scn);
struct hif_target_info *tgt_info = hif_get_target_info_handle(scn);
uint8_t max_no_of_peers = ini_cfg->max_no_of_peers;
switch (tgt_info->target_version) {
case AR6320_REV1_1_VERSION:
if (max_no_of_peers > MAX_SUPPORTED_PEERS_REV1_1)
max_no_of_peers = MAX_SUPPORTED_PEERS_REV1_1;
break;
default:
if (max_no_of_peers > MAX_SUPPORTED_PEERS_REV1_3)
max_no_of_peers = MAX_SUPPORTED_PEERS_REV1_3;
break;
}
return max_no_of_peers;
}

View file

@ -363,6 +363,7 @@ CDF_STATUS cds_open(void)
mac_openParms.tx_chain_mask_cck = pHddCtx->config->tx_chain_mask_cck;
mac_openParms.self_gen_frm_pwr = pHddCtx->config->self_gen_frm_pwr;
mac_openParms.maxStation = pHddCtx->config->maxNumberOfPeers;
cdf_status = wma_open(gp_cds_context,
hdd_update_tgt_cfg,

View file

@ -7003,7 +7003,6 @@ void hdd_update_hif_config(void *scn, hdd_context_t *hdd_ctx)
cfg->enable_self_recovery = hdd_ctx->config->enableSelfRecovery;
cfg->enable_uart_print = hdd_ctx->config->enablefwprint;
cfg->enable_fw_log = hdd_ctx->config->enable_fw_log;
cfg->max_no_of_peers = hdd_ctx->config->maxNumberOfPeers;
cfg->enable_ramdump_collection =
hdd_ctx->config->is_ramdump_enabled;
cfg->enable_lpass_support = hdd_is_lpass_supported(hdd_ctx);

View file

@ -1034,6 +1034,16 @@ struct wmi_init_cmd {
uint32_t buf_len;
};
/**
* struct wma_ini_config - Structure to hold wma ini configuration
* @max_no_of_peers: Max Number of supported
*
* Placeholder for WMA ini parameters.
*/
struct wma_ini_config {
uint8_t max_no_of_peers;
};
/**
* struct t_wma_handle - wma context
* @wmi_handle: wmi handle
@ -1342,6 +1352,7 @@ typedef struct {
cdf_wake_lock_t wmi_cmd_rsp_wake_lock;
cdf_runtime_lock_t wmi_cmd_rsp_runtime_lock;
uint32_t fine_time_measurement_cap;
struct wma_ini_config ini_config;
} t_wma_handle, *tp_wma_handle;
/**
@ -2012,3 +2023,4 @@ void
wma_indicate_err(enum ol_rx_err_type err_type,
struct ol_error_info *err_info);
#endif
struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma_handle);

View file

@ -125,6 +125,62 @@ end:
CDF_BUG(0);
}
/**
* wma_get_ini_handle() - API to get WMA ini info handle
* @wma: WMA Handle
*
* Returns the pointer to WMA ini structure.
* Return: struct wma_ini_config
*/
struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma)
{
if (!wma) {
WMA_LOGE("%s: Invalid WMA context\n", __func__);
return NULL;
}
return &wma->ini_config;
}
#define MAX_SUPPORTED_PEERS_REV1_1 14
#define MAX_SUPPORTED_PEERS_REV1_3 32
#define MIN_NO_OF_PEERS 1
/**
* wma_get_number_of_peers_supported - API to query for number of peers
* supported
* @wma: WMA Handle
*
* Return: Max Number of Peers Supported
*/
static uint8_t wma_get_number_of_peers_supported(tp_wma_handle wma)
{
struct hif_target_info *tgt_info;
struct wma_ini_config *cfg = wma_get_ini_handle(wma);
uint8_t max_no_of_peers = cfg ? cfg->max_no_of_peers : MIN_NO_OF_PEERS;
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
if (!scn) {
WMA_LOGE("%s: Invalid wma handle", __func__);
return 0;
}
tgt_info = hif_get_target_info_handle(scn);
switch (tgt_info->target_version) {
case AR6320_REV1_1_VERSION:
if (max_no_of_peers > MAX_SUPPORTED_PEERS_REV1_1)
max_no_of_peers = MAX_SUPPORTED_PEERS_REV1_1;
break;
default:
if (max_no_of_peers > MAX_SUPPORTED_PEERS_REV1_3)
max_no_of_peers = MAX_SUPPORTED_PEERS_REV1_3;
break;
}
return max_no_of_peers;
}
/**
* wma_set_default_tgt_config() - set default tgt config
* @wma_handle: wma handle
@ -133,7 +189,6 @@ end:
*/
static void wma_set_default_tgt_config(tp_wma_handle wma_handle)
{
struct ol_softc *scn;
uint8_t no_of_peers_supported;
wmi_resource_config tgt_cfg = {
0, /* Filling zero for TLV Tag and Length fields */
@ -180,13 +235,7 @@ static void wma_set_default_tgt_config(tp_wma_handle wma_handle)
CFG_TGT_NUM_OCB_SCHEDULES,
};
/* Update the max number of peers */
scn = cds_get_context(CDF_MODULE_ID_HIF);
if (!scn) {
WMA_LOGE("%s: cds_context is NULL", __func__);
return;
}
no_of_peers_supported = ol_get_number_of_peers_supported(scn);
no_of_peers_supported = wma_get_number_of_peers_supported(wma_handle);
tgt_cfg.num_peers = no_of_peers_supported + CFG_TGT_NUM_VDEV + 2;
tgt_cfg.num_tids = (2 * (no_of_peers_supported + CFG_TGT_NUM_VDEV + 2));
tgt_cfg.scan_max_pending_req = wma_handle->max_scan;
@ -1513,6 +1562,21 @@ static void wma_set_nan_enable(tp_wma_handle wma_handle,
}
#endif
/**
* wma_init_max_no_of_peers - API to initialize wma configuration params
* @wma_handle: WMA Handle
* @max_peers: Max Peers supported
*
* Return: void
*/
static void wma_init_max_no_of_peers(tp_wma_handle wma_handle,
uint16_t max_peers)
{
struct wma_ini_config *cfg = wma_get_ini_handle(wma_handle);
cfg->max_no_of_peers = max_peers;
}
/**
* wma_open() - Allocate wma context and initialize it.
* @cds_context: cds context
@ -1532,7 +1596,6 @@ CDF_STATUS wma_open(void *cds_context,
cdf_device_t cdf_dev;
void *wmi_handle;
CDF_STATUS cdf_status;
struct ol_softc *scn;
struct txrx_pdev_cfg_param_t olCfg = { 0 };
WMA_LOGD("%s: Enter", __func__);
@ -1648,17 +1711,8 @@ CDF_STATUS wma_open(void *cds_context,
if (cds_get_conparam() == CDF_GLOBAL_FTM_MODE)
wma_utf_attach(wma_handle);
#endif /* QCA_WIFI_FTM */
/*TODO: Recheck below parameters */
scn = cds_get_context(CDF_MODULE_ID_HIF);
if (NULL == scn) {
WMA_LOGE("%s: Failed to get scn", __func__);
cdf_status = CDF_STATUS_E_NOMEM;
goto err_scn_context;
}
mac_params->maxStation = ol_get_number_of_peers_supported(scn);
wma_init_max_no_of_peers(wma_handle, mac_params->maxStation);
mac_params->maxStation = wma_get_number_of_peers_supported(wma_handle);
mac_params->maxBssId = WMA_MAX_SUPPORTED_BSS;
mac_params->frameTransRequired = 0;