From 14fe4fbf5c5d766033188de5a6efeae32c7d4243 Mon Sep 17 00:00:00 2001 From: jiad Date: Tue, 8 Aug 2017 13:33:14 +0800 Subject: [PATCH] qcacld-3.0: fix ipa mcc tx_desc pool size A list of ipa tx_desc is created to have a one-to-one mapping between tx_desc from ipa driver and tx_desc in wlan. The list pool size is now set to IpaUcTxBufCount, which is IPA wlan FW tx comp ring size and is more like a HW resource. But the list is used only for SW MCC TX path. Fix is to define a new INI to set hdd_ipa_tx_desc pool size. But real size is minumum of this INI and the global tx_desc pool size. Change-Id: I3216a4c14ac624cc313d11226909efd4f63841d0 CRs-Fixed: 2076672 --- core/hdd/inc/wlan_hdd_cfg.h | 29 +++++++++++++++++++++++++++++ core/hdd/src/wlan_hdd_cfg.c | 9 +++++++++ core/hdd/src/wlan_hdd_ipa.c | 24 ++++++++++++++++-------- 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 07cb7040eb26..d853256bf738 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -6896,6 +6896,34 @@ enum hdd_link_speed_rpt_type { #define CFG_IPA_LOW_BANDWIDTH_MBPS_MAX (100) #define CFG_IPA_LOW_BANDWIDTH_MBPS_DEFAULT (100) +/* + * + * gIPAMccTxDescSize - hdd_ipa_tx_desc pool size for MCC TX + * @Min: 512 + * @Max: 4096 + * @Default: 1024 + * + * This ini is used to specify hdd_ipa_tx_desc pool size for MCC TX path. + * The pool is maintained to have a one-to-one mapping with desc from IPA + * driver so that when wlan TX completes, wlan driver could replenish the + * correct desc to IPA driver. Note that in MCC TX case, desc size is limited + * to global tx desc pool size. Therefore the real hdd_ipa_tx_desc pool size + * is the minimum of this ini and global tx desc pool size. + * + * + * Related: STA/SAP + * + * Supported Feature: IPA offload + * + * Usage: Internal + * + * + */ +#define CFG_IPA_MCC_TX_DESC_SIZE "gIPAMccTxDescSize" +#define CFG_IPA_MCC_TX_DESC_SIZE_MIN (512) +#define CFG_IPA_MCC_TX_DESC_SIZE_MAX (4096) +#define CFG_IPA_MCC_TX_DESC_SIZE_DEFAULT (1024) + /* * Firmware uart print */ @@ -11551,6 +11579,7 @@ struct hdd_config { uint32_t IpaHighBandwidthMbps; uint32_t IpaMediumBandwidthMbps; uint32_t IpaLowBandwidthMbps; + uint32_t IpaMccTxDescSize; #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH uint32_t WlanMccToSccSwitchMode; #endif diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 71b83b95c21f..b70dd7c79f96 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -2688,6 +2688,13 @@ struct reg_table_entry g_registry_table[] = { CFG_IPA_LOW_BANDWIDTH_MBPS_DEFAULT, CFG_IPA_LOW_BANDWIDTH_MBPS_MIN, CFG_IPA_LOW_BANDWIDTH_MBPS_MAX), + + REG_VARIABLE(CFG_IPA_MCC_TX_DESC_SIZE, WLAN_PARAM_Integer, + struct hdd_config, IpaMccTxDescSize, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_IPA_MCC_TX_DESC_SIZE_DEFAULT, + CFG_IPA_MCC_TX_DESC_SIZE_MIN, + CFG_IPA_MCC_TX_DESC_SIZE_MAX), #endif REG_VARIABLE(CFG_VHT_AMPDU_LEN_EXPONENT_NAME, WLAN_PARAM_Integer, @@ -5783,6 +5790,8 @@ void hdd_cfg_print(hdd_context_t *pHddCtx) pHddCtx->config->IpaMediumBandwidthMbps); hdd_debug("Name = [IpaLowBandwidthMbps] Value = [%u] ", pHddCtx->config->IpaLowBandwidthMbps); + hdd_info("Name = [IpaMccTxDescSize] Value = [%u] ", + pHddCtx->config->IpaMccTxDescSize); #endif hdd_debug("Name = [gEnableOverLapCh] Value = [%u] ", pHddCtx->config->gEnableOverLapCh); diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index aaa14b49da8c..056160609fdc 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -439,6 +439,7 @@ struct hdd_ipa_priv { qdf_spinlock_t q_lock; struct list_head pend_desc_head; + uint16_t tx_desc_size; struct hdd_ipa_tx_desc *tx_desc_list; struct list_head free_tx_desc_head; @@ -4442,12 +4443,22 @@ static int hdd_ipa_alloc_tx_desc_list(struct hdd_ipa_priv *hdd_ipa) int i; uint32_t max_desc_cnt; struct hdd_ipa_tx_desc *tmp_desc; + struct ol_txrx_pdev_t *pdev; - max_desc_cnt = hdd_ipa->hdd_ctx->config->IpaUcTxBufCount; + pdev = cds_get_context(QDF_MODULE_ID_TXRX); + if (!pdev) { + HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR, "pdev is NULL"); + return -ENODEV; + } + + hdd_ipa->tx_desc_size = QDF_MIN( + hdd_ipa->hdd_ctx->config->IpaMccTxDescSize, + pdev->tx_desc.pool_size); INIT_LIST_HEAD(&hdd_ipa->free_tx_desc_head); - tmp_desc = qdf_mem_malloc(sizeof(struct hdd_ipa_tx_desc)*max_desc_cnt); + tmp_desc = qdf_mem_malloc(sizeof(struct hdd_ipa_tx_desc) * + hdd_ipa->tx_desc_size); if (!tmp_desc) { HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR, @@ -4458,7 +4469,7 @@ static int hdd_ipa_alloc_tx_desc_list(struct hdd_ipa_priv *hdd_ipa) hdd_ipa->tx_desc_list = tmp_desc; qdf_spin_lock_bh(&hdd_ipa->q_lock); - for (i = 0; i < max_desc_cnt; i++) { + for (i = 0; i < hdd_ipa->tx_desc_size; i++) { tmp_desc->id = i; tmp_desc->ipa_tx_desc_ptr = NULL; list_add_tail(&tmp_desc->link, @@ -4564,7 +4575,7 @@ static int hdd_ipa_setup_sys_pipe(struct hdd_ipa_priv *hdd_ipa) hdd_ipa->sys_pipe[HDD_IPA_RX_PIPE].conn_hdl_valid = 1; } - /* Allocate free Tx desc list */ + /* Allocate free Tx desc list */ ret = hdd_ipa_alloc_tx_desc_list(hdd_ipa); if (ret) goto setup_sys_pipe_fail; @@ -4591,7 +4602,6 @@ setup_sys_pipe_fail: static void hdd_ipa_teardown_sys_pipe(struct hdd_ipa_priv *hdd_ipa) { int ret = 0, i; - uint32_t max_desc_cnt; struct hdd_ipa_tx_desc *tmp_desc; struct ipa_rx_data *ipa_tx_desc; @@ -4608,10 +4618,8 @@ static void hdd_ipa_teardown_sys_pipe(struct hdd_ipa_priv *hdd_ipa) } if (hdd_ipa->tx_desc_list) { - max_desc_cnt = hdd_ipa->hdd_ctx->config->IpaUcTxBufCount; - qdf_spin_lock_bh(&hdd_ipa->q_lock); - for (i = 0; i < max_desc_cnt; i++) { + for (i = 0; i < hdd_ipa->tx_desc_size; i++) { tmp_desc = hdd_ipa->tx_desc_list + i; ipa_tx_desc = tmp_desc->ipa_tx_desc_ptr; if (ipa_tx_desc)