From bea353e14cff51b28fc38979aef4ec1e6d0fa7a5 Mon Sep 17 00:00:00 2001 From: "Pamidipati, Vijay" Date: Wed, 5 Jul 2017 03:09:20 +0530 Subject: [PATCH] qcacmn: Set the Tx completion ring size to appropriate value Size the completion ring using following 2 parameters - NAPI schedule latency (assuming 1 netdev, gmac, competing for CPU) = 20ms (2 jiffies) - Worst case PPS requirement = 400K PPS Ring size = 20 * 400 = 8000 Change-Id: Iaac0b61f50b52a4e824c3c8ef5d980adf455854c CRs-Fixed: 2068155 --- dp/wifi3.0/dp_main.c | 24 ++++++++++++++++++------ wlan_cfg/wlan_cfg.c | 28 ++++++++++++++++++++++++++++ wlan_cfg/wlan_cfg.h | 16 ++++++++++++++++ 3 files changed, 62 insertions(+), 6 deletions(-) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index e94aae0b37..3bdf1ae780 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -862,8 +862,6 @@ static void dp_hw_link_desc_pool_cleanup(struct dp_soc *soc) /* TODO: Following should be configurable */ #define WBM_RELEASE_RING_SIZE 64 -#define TCL_DATA_RING_SIZE 512 -#define TX_COMP_RING_SIZE 1024 #define TCL_CMD_RING_SIZE 32 #define TCL_STATUS_RING_SIZE 32 #define REO_DST_RING_SIZE 2048 @@ -891,6 +889,8 @@ static int dp_soc_cmn_setup(struct dp_soc *soc) { int i; struct hal_reo_params reo_params; + int tx_ring_size; + int tx_comp_ring_size; if (qdf_atomic_read(&soc->cmn_init_done)) return 0; @@ -916,16 +916,20 @@ static int dp_soc_cmn_setup(struct dp_soc *soc) if (!wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) { soc->num_tcl_data_rings = wlan_cfg_num_tcl_data_rings(soc->wlan_cfg_ctx); + tx_comp_ring_size = + wlan_cfg_tx_comp_ring_size(soc->wlan_cfg_ctx); + tx_ring_size = + wlan_cfg_tx_ring_size(soc->wlan_cfg_ctx); for (i = 0; i < soc->num_tcl_data_rings; i++) { if (dp_srng_setup(soc, &soc->tcl_data_ring[i], - TCL_DATA, i, 0, TCL_DATA_RING_SIZE)) { + TCL_DATA, i, 0, tx_ring_size)) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, FL("dp_srng_setup failed for tcl_data_ring[%d]"), i); goto fail1; } if (dp_srng_setup(soc, &soc->tx_comp_ring[i], - WBM2SW_RELEASE, i, 0, TX_COMP_RING_SIZE)) { + WBM2SW_RELEASE, i, 0, tx_comp_ring_size)) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, FL("dp_srng_setup failed for tx_comp_ring[%d]"), i); @@ -1186,6 +1190,9 @@ static struct cdp_pdev *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc, struct cdp_cfg *ctrl_pdev, HTC_HANDLE htc_handle, qdf_device_t qdf_osdev, uint8_t pdev_id) { + int tx_ring_size; + int tx_comp_ring_size; + struct dp_soc *soc = (struct dp_soc *)txrx_soc; struct dp_pdev *pdev = qdf_mem_malloc(sizeof(*pdev)); @@ -1232,14 +1239,19 @@ static struct cdp_pdev *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc, /* Setup per PDEV TCL rings if configured */ if (wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) { + tx_ring_size = + wlan_cfg_tx_ring_size(soc->wlan_cfg_ctx); + tx_comp_ring_size = + wlan_cfg_tx_comp_ring_size(soc->wlan_cfg_ctx); + if (dp_srng_setup(soc, &soc->tcl_data_ring[pdev_id], TCL_DATA, - pdev_id, pdev_id, TCL_DATA_RING_SIZE)) { + pdev_id, pdev_id, tx_ring_size)) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, FL("dp_srng_setup failed for tcl_data_ring")); goto fail1; } if (dp_srng_setup(soc, &soc->tx_comp_ring[pdev_id], - WBM2SW_RELEASE, pdev_id, pdev_id, TCL_DATA_RING_SIZE)) { + WBM2SW_RELEASE, pdev_id, pdev_id, tx_comp_ring_size)) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, FL("dp_srng_setup failed for tx_comp_ring")); goto fail1; diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index e968d8bc78..2502f1e559 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -36,6 +36,8 @@ #define WLAN_CFG_PER_PDEV_RX_RING 0 #define NUM_RXDMA_RINGS_PER_PDEV 2 #define WLAN_LRO_ENABLE 1 +#define WLAN_CFG_TX_RING_SIZE 512 +#define WLAN_CFG_TX_COMP_RING_SIZE 1024 /* Tx Descriptor and Tx Extension Descriptor pool sizes */ #define WLAN_CFG_NUM_TX_DESC 1024 @@ -71,6 +73,17 @@ #define WLAN_CFG_INT_TIMER_THRESHOLD_TX 1000 #define WLAN_CFG_INT_TIMER_THRESHOLD_RX 500 #define WLAN_CFG_INT_TIMER_THRESHOLD_OTHER 8 + +#define WLAN_CFG_TX_RING_SIZE 512 + +/* Size the completion ring using following 2 parameters + * - NAPI schedule latency (assuming 1 netdev competing for CPU) = 20 ms (2 jiffies) + * - Worst case PPS requirement = 400K PPS + * + * Ring size = 20 * 400 = 8000 + * 8192 is nearest power of 2 + */ +#define WLAN_CFG_TX_COMP_RING_SIZE (8 << 10) #endif #define WLAN_CFG_INT_NUM_CONTEXTS 4 @@ -232,6 +245,8 @@ struct wlan_cfg_dp_soc_ctxt { int int_timer_threshold_rx; int int_batch_threshold_other; int int_timer_threshold_other; + int tx_ring_size; + int tx_comp_ring_size; int int_tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; int int_rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; int int_rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; @@ -292,6 +307,9 @@ struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach() wlan_cfg_ctx->htt_packet_type = WLAN_CFG_HTT_PKT_TYPE; wlan_cfg_ctx->max_peer_id = WLAN_CFG_MAX_PEER_ID; + wlan_cfg_ctx->tx_ring_size = WLAN_CFG_TX_RING_SIZE; + wlan_cfg_ctx->tx_comp_ring_size = WLAN_CFG_TX_COMP_RING_SIZE; + wlan_cfg_ctx->int_batch_threshold_tx = WLAN_CFG_INT_BATCH_THRESHOLD_TX; wlan_cfg_ctx->int_timer_threshold_tx = WLAN_CFG_INT_TIMER_THRESHOLD_TX; wlan_cfg_ctx->int_batch_threshold_rx = WLAN_CFG_INT_BATCH_THRESHOLD_RX; @@ -509,6 +527,16 @@ int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) return cfg->num_tcl_data_rings; } +int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + return cfg->tx_ring_size; +} + +int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + return cfg->tx_comp_ring_size; +} + int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg) { return cfg->per_pdev_rx_ring; diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index fb811932e6..62671b08b4 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -473,4 +473,20 @@ int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg); * Return: Timer threshold */ int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg); + +/* + * wlan_cfg_tx_ring_size - Get Tx DMA ring size (TCL Data Ring) + * @wlan_cfg_soc_ctx + * + * Return: Tx Ring Size + */ +int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); + +/* + * wlan_cfg_tx_comp_ring_size - Get Tx completion ring size (WBM Ring) + * @wlan_cfg_soc_ctx + * + * Return: Tx Completion ring size + */ +int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); #endif