From 527b0343a3b0fcb65ff3aa61da9e9367c23e7f81 Mon Sep 17 00:00:00 2001 From: Shiva Krishna Pittala Date: Sat, 3 Sep 2022 22:33:20 +0530 Subject: [PATCH] qcacmn: Fix hal_get_srng_ring_id() for Beryllium LMAC rings For Beryllium LMAC rings, hal_get_srng_ring_id() provides the ring IDs separately per each LMAC only if that LMAC ring is a destination ring (This is done to use a common source ring for the DMAC rings). But the ring IDs for LMAC source rings like DIR_BUF_RX_SRC_DMA_RING are not being provided separately per LMAC. As a result, these ring IDs in split-PHY mode are colliding for the 2 LMACs. Fix this by doing the following. - Mark the DMAC common rings within the LMAC rings. - Provide ring ID separately per each LMAC if the ring is an LMAC ring but not a DMAC common ring. Change-Id: Ifdae085b5784a03763abfc4edb42d94593e3ea21 CRs-Fixed: 3282702 --- hal/wifi3.0/hal_internal.h | 1 + hal/wifi3.0/hal_srng.c | 10 ++++------ hal/wifi3.0/qca5332/hal_5332.c | 1 + hal/wifi3.0/qcn9224/v1/hal_9224v1.c | 1 + hal/wifi3.0/qcn9224/v2/hal_9224v2.c | 1 + 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hal/wifi3.0/hal_internal.h b/hal/wifi3.0/hal_internal.h index 2a9358fc57..68d6860031 100644 --- a/hal/wifi3.0/hal_internal.h +++ b/hal/wifi3.0/hal_internal.h @@ -728,6 +728,7 @@ struct hal_hw_srng_config { enum hal_srng_dir ring_dir; uint32_t max_size; bool nf_irq_support; + bool dmac_cmn_ring; }; #define MAX_SHADOW_REGISTERS 40 diff --git a/hal/wifi3.0/hal_srng.c b/hal/wifi3.0/hal_srng.c index 46acc90703..8aced963f1 100644 --- a/hal/wifi3.0/hal_srng.c +++ b/hal/wifi3.0/hal_srng.c @@ -132,13 +132,11 @@ static int hal_get_srng_ring_id(struct hal_soc *hal, int ring_type, return -EINVAL; } - /* - * For BE, dmac_cmn_src_rxbuf_ring is set. If this is set - * and ring is dst and also lmac ring then provide ring id per lmac + /** + * Some DMAC rings share a common source ring, hence don't provide them + * with separate ring IDs per LMAC. */ - if (ring_config->lmac_ring && - (!hal->dmac_cmn_src_rxbuf_ring || - ring_config->ring_dir == HAL_SRNG_DST_RING)) { + if (ring_config->lmac_ring && !ring_config->dmac_cmn_ring) { ring_id = (ring_config->start_ring_id + ring_num + (mac_id * HAL_MAX_RINGS_PER_LMAC)); } else { diff --git a/hal/wifi3.0/qca5332/hal_5332.c b/hal/wifi3.0/qca5332/hal_5332.c index af126e5e1e..4073a485a7 100644 --- a/hal/wifi3.0/qca5332/hal_5332.c +++ b/hal/wifi3.0/qca5332/hal_5332.c @@ -2406,6 +2406,7 @@ struct hal_hw_srng_config hw_srng_table_5332[] = { .reg_start = {}, .reg_size = {}, .max_size = HAL_RXDMA_MAX_RING_SIZE_BE, + .dmac_cmn_ring = TRUE, }, }; diff --git a/hal/wifi3.0/qcn9224/v1/hal_9224v1.c b/hal/wifi3.0/qcn9224/v1/hal_9224v1.c index 34d1ad8727..0c9d01537a 100644 --- a/hal/wifi3.0/qcn9224/v1/hal_9224v1.c +++ b/hal/wifi3.0/qcn9224/v1/hal_9224v1.c @@ -543,6 +543,7 @@ struct hal_hw_srng_config hw_srng_table_9224v1[] = { .reg_start = {}, .reg_size = {}, .max_size = HAL_RXDMA_MAX_RING_SIZE_BE, + .dmac_cmn_ring = TRUE, }, }; diff --git a/hal/wifi3.0/qcn9224/v2/hal_9224v2.c b/hal/wifi3.0/qcn9224/v2/hal_9224v2.c index 0a30c451c5..7bf6555d16 100644 --- a/hal/wifi3.0/qcn9224/v2/hal_9224v2.c +++ b/hal/wifi3.0/qcn9224/v2/hal_9224v2.c @@ -543,6 +543,7 @@ struct hal_hw_srng_config hw_srng_table_9224v2[] = { .reg_start = {}, .reg_size = {}, .max_size = HAL_RXDMA_MAX_RING_SIZE_BE, + .dmac_cmn_ring = TRUE, }, };