From 5f8681ff1e7a3d1d9cbb241b8db36b549edcb414 Mon Sep 17 00:00:00 2001 From: Neha Bisht Date: Thu, 28 Oct 2021 12:14:26 +0530 Subject: [PATCH] qcacmn: Enable the 4th Tx. completion ring Enable the 4th Tx. completion ring to save CPU load Initialization and interrupt handling for 4th completion ring is done here. Change-Id: I2db27218a3c3e14d719d012f03454a6a7aa647fe --- dp/wifi3.0/dp_main.c | 32 ++++++++- dp/wifi3.0/dp_types.h | 3 + dp/wifi3.0/li/dp_li.c | 107 +++++++++++++++++++++++++++++ hal/wifi3.0/qca5018/hal_5018.c | 4 +- hal/wifi3.0/qca8074v2/hal_8074v2.c | 4 +- hal/wifi3.0/qcn6122/hal_qcn6122.c | 4 +- hal/wifi3.0/qcn9000/hal_9000.c | 4 +- hif/inc/hif.h | 3 +- hif/src/snoc/if_ahb.c | 4 +- wlan_cfg/cfg_dp.h | 12 ++++ wlan_cfg/wlan_cfg.c | 6 ++ wlan_cfg/wlan_cfg.h | 10 +++ wlan_cfg/wlan_init_cfg.h | 1 + 13 files changed, 181 insertions(+), 13 deletions(-) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 1bbbc6d08d..044d4b6917 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -111,6 +111,12 @@ cdp_dump_flow_pool_info(struct cdp_soc_t *soc) #define WLAN_SYSFS_STAT_REQ_WAIT_MS 3000 #endif +#ifdef QCA_DP_ENABLE_TX_COMP_RING4 +#define TXCOMP_RING4_NUM 3 +#else +#define TXCOMP_RING4_NUM WBM2SW_TXCOMP_RING4_NUM +#endif + #ifdef WLAN_MCAST_MLO #define DP_TX_TCL_METADATA_PDEV_ID_SET(_var, _val) \ HTT_TX_TCL_METADATA_V2_PDEV_ID_SET(_var, _val) @@ -1404,6 +1410,13 @@ static int dp_srng_calculate_msi_group(struct dp_soc *soc, ring_num); if (nf_irq_mask) nf_irq_enabled = true; + + /* + * Using ring 4 as 4th tx completion ring since ring 3 + * is Rx error ring + */ + if (ring_num == WBM2SW_TXCOMP_RING4_NUM) + ring_num = TXCOMP_RING4_NUM; } break; @@ -1748,12 +1761,17 @@ dp_srng_configure_interrupt_thresholds(struct dp_soc *soc, int ring_type, int ring_num, int num_entries) { + uint8_t wbm2_sw_rx_rel_ring_id; + + wbm2_sw_rx_rel_ring_id = wlan_cfg_get_rx_rel_ring_id(soc->wlan_cfg_ctx); + if (ring_type == REO_DST) { ring_params->intr_timer_thres_us = wlan_cfg_get_int_timer_threshold_rx(soc->wlan_cfg_ctx); ring_params->intr_batch_cntr_thres_entries = wlan_cfg_get_int_batch_threshold_rx(soc->wlan_cfg_ctx); - } else if (ring_type == WBM2SW_RELEASE && (ring_num == 3)) { + } else if (ring_type == WBM2SW_RELEASE && + (ring_num == wbm2_sw_rx_rel_ring_id)) { ring_params->intr_timer_thres_us = wlan_cfg_get_int_timer_threshold_other(soc->wlan_cfg_ctx); ring_params->intr_batch_cntr_thres_entries = @@ -1778,12 +1796,18 @@ dp_srng_configure_interrupt_thresholds(struct dp_soc *soc, int ring_type, int ring_num, int num_entries) { + uint8_t wbm2_sw_rx_rel_ring_id; + + wbm2_sw_rx_rel_ring_id = wlan_cfg_get_rx_rel_ring_id(soc->wlan_cfg_ctx); + if (ring_type == REO_DST) { ring_params->intr_timer_thres_us = wlan_cfg_get_int_timer_threshold_rx(soc->wlan_cfg_ctx); ring_params->intr_batch_cntr_thres_entries = wlan_cfg_get_int_batch_threshold_rx(soc->wlan_cfg_ctx); - } else if (ring_type == WBM2SW_RELEASE && (ring_num < 3)) { + } else if (ring_type == WBM2SW_RELEASE && + (ring_num < wbm2_sw_rx_rel_ring_id || + ring_num == WBM2SW_TXCOMP_RING4_NUM)) { ring_params->intr_timer_thres_us = wlan_cfg_get_int_timer_threshold_tx(soc->wlan_cfg_ctx); ring_params->intr_batch_cntr_thres_entries = @@ -2514,7 +2538,7 @@ static uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_budget) int_ctx->rxdma2host_ring_mask); /* Process Tx completion interrupts first to return back buffers */ - for (index = 0; index < soc->num_tcl_data_rings; index++) { + for (index = 0; index < soc->num_tx_comp_rings; index++) { if (!(1 << wlan_cfg_get_wbm_ring_num_for_index(soc->wlan_cfg_ctx, index) & tx_mask)) continue; work_done = dp_tx_comp_handler(int_ctx, @@ -14461,6 +14485,8 @@ static void dp_soc_cfg_attach(struct dp_soc *soc) } else { soc->init_tcl_cmd_cred_ring = true; + soc->num_tx_comp_rings = + wlan_cfg_num_tx_comp_rings(soc->wlan_cfg_ctx); soc->num_tcl_data_rings = wlan_cfg_num_tcl_data_rings(soc->wlan_cfg_ctx); soc->num_reo_dest_rings = diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 82ced51452..cdfb688fe9 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1930,6 +1930,9 @@ struct dp_soc { /* TCL data ring */ struct dp_srng tcl_data_ring[MAX_TCL_DATA_RINGS]; + /* Number of Tx comp rings */ + uint8_t num_tx_comp_rings; + /* Number of TCL data rings */ uint8_t num_tcl_data_rings; diff --git a/dp/wifi3.0/li/dp_li.c b/dp/wifi3.0/li/dp_li.c index 0d0bbc29db..8eeb561042 100644 --- a/dp/wifi3.0/li/dp_li.c +++ b/dp/wifi3.0/li/dp_li.c @@ -25,6 +25,7 @@ #include "dp_tx_desc.h" #include "dp_li_rx.h" #include "dp_peer.h" +#include #if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1) static struct wlan_cfg_tcl_wbm_ring_num_map g_tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = { @@ -346,22 +347,128 @@ dp_rxdma_ring_sel_cfg_li(struct dp_soc *soc) } #endif +#ifdef QCA_DP_ENABLE_TX_COMP_RING4 +static inline +void dp_deinit_txcomp_ring4(struct dp_soc *soc) +{ + if (soc) { + wlan_minidump_remove(soc->tx_comp_ring[3].base_vaddr_unaligned, + soc->tx_comp_ring[3].alloc_size, + soc->ctrl_psoc, WLAN_MD_DP_SRNG_TX_COMP, + "Transmit_completion_ring"); + dp_srng_deinit(soc, &soc->tx_comp_ring[3], WBM2SW_RELEASE, 0); + } +} + +static inline +QDF_STATUS dp_init_txcomp_ring4(struct dp_soc *soc) +{ + if (soc) { + if (dp_srng_init(soc, &soc->tx_comp_ring[3], + WBM2SW_RELEASE, WBM2SW_TXCOMP_RING4_NUM, 0)) { + dp_err("%pK: dp_srng_init failed for rx_rel_ring", + soc); + return QDF_STATUS_E_FAILURE; + } + wlan_minidump_log(soc->tx_comp_ring[3].base_vaddr_unaligned, + soc->tx_comp_ring[3].alloc_size, + soc->ctrl_psoc, WLAN_MD_DP_SRNG_TX_COMP, + "Transmit_completion_ring"); + } + return QDF_STATUS_SUCCESS; +} + +static inline +void dp_free_txcomp_ring4(struct dp_soc *soc) +{ + if (soc) + dp_srng_free(soc, &soc->tx_comp_ring[3]); +} + +static inline +QDF_STATUS dp_alloc_txcomp_ring4(struct dp_soc *soc, uint32_t tx_comp_ring_size, + uint32_t cached) +{ + if (soc) { + if (dp_srng_alloc(soc, &soc->tx_comp_ring[3], WBM2SW_RELEASE, + tx_comp_ring_size, cached)) { + dp_err("dp_srng_alloc failed for tx_comp_ring"); + return QDF_STATUS_E_FAILURE; + } + } + return QDF_STATUS_SUCCESS; +} +#else +static inline +void dp_deinit_txcomp_ring4(struct dp_soc *soc) +{ +} + +static inline +QDF_STATUS dp_init_txcomp_ring4(struct dp_soc *soc) +{ + return QDF_STATUS_SUCCESS; +} + +static inline +void dp_free_txcomp_ring4(struct dp_soc *soc) +{ +} + +static inline +QDF_STATUS dp_alloc_txcomp_ring4(struct dp_soc *soc, uint32_t tx_comp_ring_size, + uint32_t cached) +{ + return QDF_STATUS_SUCCESS; +} +#endif + static void dp_soc_srng_deinit_li(struct dp_soc *soc) { + /* Tx Complete ring */ + dp_deinit_txcomp_ring4(soc); } static void dp_soc_srng_free_li(struct dp_soc *soc) { + dp_free_txcomp_ring4(soc); } static QDF_STATUS dp_soc_srng_alloc_li(struct dp_soc *soc) { + uint32_t tx_comp_ring_size; + uint32_t cached = WLAN_CFG_DST_RING_CACHED_DESC; + struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx; + + soc_cfg_ctx = soc->wlan_cfg_ctx; + + tx_comp_ring_size = wlan_cfg_tx_comp_ring_size(soc_cfg_ctx); + /* Disable cached desc if NSS offload is enabled */ + if (wlan_cfg_get_dp_soc_nss_cfg(soc_cfg_ctx)) + cached = 0; + + if (dp_alloc_txcomp_ring4(soc, tx_comp_ring_size, cached)) + goto fail1; return QDF_STATUS_SUCCESS; +fail1: + dp_soc_srng_free_li(soc); + return QDF_STATUS_E_NOMEM; } static QDF_STATUS dp_soc_srng_init_li(struct dp_soc *soc) { + /* Tx comp ring 3 */ + if (dp_init_txcomp_ring4(soc)) + goto fail1; + return QDF_STATUS_SUCCESS; +fail1: + /* + * Cleanup will be done as part of soc_detach, which will + * be called on pdev attach failure + */ + dp_soc_srng_deinit_li(soc); + return QDF_STATUS_E_FAILURE; } static void dp_tx_implicit_rbm_set_li(struct dp_soc *soc, diff --git a/hal/wifi3.0/qca5018/hal_5018.c b/hal/wifi3.0/qca5018/hal_5018.c index 40fdfa148e..3a6caa8d47 100644 --- a/hal/wifi3.0/qca5018/hal_5018.c +++ b/hal/wifi3.0/qca5018/hal_5018.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. 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 @@ -2119,7 +2119,7 @@ struct hal_hw_srng_config hw_srng_table_5018[] = { }, { /* WBM2SW_RELEASE */ .start_ring_id = HAL_SRNG_WBM2SW0_RELEASE, - .max_rings = 4, + .max_rings = 5, .entry_size = sizeof(struct wbm_release_ring) >> 2, .lmac_ring = FALSE, .ring_dir = HAL_SRNG_DST_RING, diff --git a/hal/wifi3.0/qca8074v2/hal_8074v2.c b/hal/wifi3.0/qca8074v2/hal_8074v2.c index 0b14024eab..b06fa0a6dc 100644 --- a/hal/wifi3.0/qca8074v2/hal_8074v2.c +++ b/hal/wifi3.0/qca8074v2/hal_8074v2.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. 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 @@ -1686,7 +1686,7 @@ struct hal_hw_srng_config hw_srng_table_8074v2[] = { }, { /* WBM2SW_RELEASE */ .start_ring_id = HAL_SRNG_WBM2SW0_RELEASE, - .max_rings = 4, + .max_rings = 5, .entry_size = sizeof(struct wbm_release_ring) >> 2, .lmac_ring = FALSE, .ring_dir = HAL_SRNG_DST_RING, diff --git a/hal/wifi3.0/qcn6122/hal_qcn6122.c b/hal/wifi3.0/qcn6122/hal_qcn6122.c index 74c3a643e6..2e2d3ebaaf 100644 --- a/hal/wifi3.0/qcn6122/hal_qcn6122.c +++ b/hal/wifi3.0/qcn6122/hal_qcn6122.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. 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 @@ -2185,7 +2185,7 @@ struct hal_hw_srng_config hw_srng_table_6122[] = { }, { /* WBM2SW_RELEASE */ .start_ring_id = HAL_SRNG_WBM2SW0_RELEASE, - .max_rings = 4, + .max_rings = 5, .entry_size = sizeof(struct wbm_release_ring) >> 2, .lmac_ring = FALSE, .ring_dir = HAL_SRNG_DST_RING, diff --git a/hal/wifi3.0/qcn9000/hal_9000.c b/hal/wifi3.0/qcn9000/hal_9000.c index fe897bfbbf..04f2436a8c 100644 --- a/hal/wifi3.0/qcn9000/hal_9000.c +++ b/hal/wifi3.0/qcn9000/hal_9000.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. 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 @@ -2221,7 +2221,7 @@ struct hal_hw_srng_config hw_srng_table_9000[] = { }, { /* WBM2SW_RELEASE */ .start_ring_id = HAL_SRNG_WBM2SW0_RELEASE, - .max_rings = 4, + .max_rings = 5, .entry_size = sizeof(struct wbm_release_ring) >> 2, .lmac_ring = FALSE, .ring_dir = HAL_SRNG_DST_RING, diff --git a/hif/inc/hif.h b/hif/inc/hif.h index 7ae419ee61..b509c13a98 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2022 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for @@ -124,6 +124,7 @@ enum hif_ic_irq { host2tcl_input_ring3, host2tcl_input_ring2, host2tcl_input_ring1, + wbm2host_tx_completions_ring4, wbm2host_tx_completions_ring3, wbm2host_tx_completions_ring2, wbm2host_tx_completions_ring1, diff --git a/hif/src/snoc/if_ahb.c b/hif/src/snoc/if_ahb.c index 5f7f8cfc61..89539a06a5 100644 --- a/hif/src/snoc/if_ahb.c +++ b/hif/src/snoc/if_ahb.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 @@ -43,7 +44,7 @@ #endif #define HIF_IC_CE0_IRQ_OFFSET 4 -#define HIF_IC_MAX_IRQ 52 +#define HIF_IC_MAX_IRQ 53 static uint16_t ic_irqnum[HIF_IC_MAX_IRQ]; /* integrated chip irq names */ @@ -96,6 +97,7 @@ const char *ic_irqname[HIF_IC_MAX_IRQ] = { "host2tcl-input-ring3", "host2tcl-input-ring2", "host2tcl-input-ring1", +"wbm2host-tx-completions-ring4", "wbm2host-tx-completions-ring3", "wbm2host-tx-completions-ring2", "wbm2host-tx-completions-ring1", diff --git a/wlan_cfg/cfg_dp.h b/wlan_cfg/cfg_dp.h index 6d23f622d0..22c1d96165 100644 --- a/wlan_cfg/cfg_dp.h +++ b/wlan_cfg/cfg_dp.h @@ -244,6 +244,10 @@ #define WLAN_CFG_NUM_TCL_DATA_RINGS_MIN 1 #define WLAN_CFG_NUM_TCL_DATA_RINGS_MAX MAX_TCL_DATA_RINGS +#define WLAN_CFG_NUM_TX_COMP_RINGS WLAN_CFG_NUM_TCL_DATA_RINGS +#define WLAN_CFG_NUM_TX_COMP_RINGS_MIN WLAN_CFG_NUM_TCL_DATA_RINGS_MIN +#define WLAN_CFG_NUM_TX_COMP_RINGS_MAX WLAN_CFG_NUM_TCL_DATA_RINGS_MAX + #if defined(CONFIG_BERYLLIUM) #define WLAN_CFG_NUM_REO_DEST_RING 8 #else @@ -565,6 +569,13 @@ WLAN_CFG_NUM_REO_DEST_RING, \ CFG_VALUE_OR_DEFAULT, "DP REO Destination Rings") +#define CFG_DP_TX_COMP_RINGS \ + CFG_INI_UINT("dp_tx_comp_rings", \ + WLAN_CFG_NUM_TX_COMP_RINGS_MIN, \ + WLAN_CFG_NUM_TX_COMP_RINGS_MAX, \ + WLAN_CFG_NUM_TX_COMP_RINGS, \ + CFG_VALUE_OR_DEFAULT, "DP Tx Comp Rings") + #define CFG_DP_TCL_DATA_RINGS \ CFG_INI_UINT("dp_tcl_data_rings", \ WLAN_CFG_NUM_TCL_DATA_RINGS_MIN, \ @@ -1500,6 +1511,7 @@ CFG(CFG_DP_MAX_CLIENTS) \ CFG(CFG_DP_MAX_PEER_ID) \ CFG(CFG_DP_REO_DEST_RINGS) \ + CFG(CFG_DP_TX_COMP_RINGS) \ CFG(CFG_DP_TCL_DATA_RINGS) \ CFG(CFG_DP_NSS_REO_DEST_RINGS) \ CFG(CFG_DP_NSS_TCL_DATA_RINGS) \ diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index 0f46a7b886..f3e973b5a4 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -1985,6 +1985,7 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc) wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING); wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS); wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS); + wlan_cfg_ctx->num_tx_comp_rings = cfg_get(psoc, CFG_DP_TX_COMP_RINGS); wlan_cfg_ctx->num_nss_reo_dest_rings = cfg_get(psoc, CFG_DP_NSS_REO_DEST_RINGS); wlan_cfg_ctx->num_nss_tcl_data_rings = @@ -2540,6 +2541,11 @@ int wlan_cfg_num_nss_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) #endif #endif +int wlan_cfg_num_tx_comp_rings(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + return cfg->num_tx_comp_rings; +} + int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) { return cfg->tx_ring_size; diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index a9456f392f..d7a7529018 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -132,6 +132,7 @@ struct wlan_srng_cfg { * allocation request for this device * @per_pdev_tx_ring: 0: TCL ring is not mapped per radio * 1: Each TCL ring is mapped to one radio/pdev + * @num_tx_comp_rings: Number of Tx comp rings supported by device * @num_tcl_data_rings: Number of TCL Data rings supported by device * @per_pdev_rx_ring: 0: REO ring is not mapped per radio * 1: Each REO ring is mapped to one radio/pdev @@ -257,6 +258,7 @@ struct wlan_cfg_dp_soc_ctxt { int max_clients; int max_alloc_size; int per_pdev_tx_ring; + int num_tx_comp_rings; int num_tcl_data_rings; int num_nss_tcl_data_rings; int per_pdev_rx_ring; @@ -917,6 +919,14 @@ uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); */ int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); +/* + * wlan_cfg_num_tx_comp_rings() - Number of Tx comp rings (HOST mode) + * @wlan_cfg_ctx + * + * Return: num_tx_comp_rings + */ +int wlan_cfg_num_tx_comp_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); + /* * wlan_cfg_num_tcl_data_rings() - Number of TCL Data rings (HOST mode) * @wlan_cfg_ctx diff --git a/wlan_cfg/wlan_init_cfg.h b/wlan_cfg/wlan_init_cfg.h index fa4004a346..a8cb733529 100644 --- a/wlan_cfg/wlan_init_cfg.h +++ b/wlan_cfg/wlan_init_cfg.h @@ -79,4 +79,5 @@ #define MAX_RX_MAC_RINGS 2 +#define WBM2SW_TXCOMP_RING4_NUM 4 #endif /* __WLAN_INIT_CFG_H */