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
This commit is contained in:
Neha Bisht
2021-10-28 12:14:26 +05:30
committed by Madan Koyyalamudi
parent 08f1f6b1af
commit 5f8681ff1e
13 changed files with 181 additions and 13 deletions

View File

@@ -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 =

View File

@@ -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;

View File

@@ -25,6 +25,7 @@
#include "dp_tx_desc.h"
#include "dp_li_rx.h"
#include "dp_peer.h"
#include <wlan_utility.h>
#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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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",

View File

@@ -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) \

View File

@@ -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;

View File

@@ -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

View File

@@ -79,4 +79,5 @@
#define MAX_RX_MAC_RINGS 2
#define WBM2SW_TXCOMP_RING4_NUM 4
#endif /* __WLAN_INIT_CFG_H */