lede/package/qca/nss/qca-nss-dp/patches/0016-edma_v1-move-rxfill-to-specific-irq-handler.patch
2022-09-12 14:06:04 +08:00

126 lines
4.1 KiB
Diff

From b7fe6524ef7e1b3579141030a784b311c913f721 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 24 Jun 2022 16:33:07 +0200
Subject: [PATCH 1/2] edma_v1: move rxfill to specific irq handler
Move rxfill logic to specific irq handler.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 2 +-
hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h | 1 +
hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 52 +++++++++++++-------
3 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
index 1d748db..65bd0db 100644
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
@@ -731,7 +731,7 @@ static int edma_irq_init(void)
*/
for (i = 0; i < edma_hw.rxfill_rings; i++) {
err = request_irq(edma_hw.rxfill_intr[i],
- edma_handle_irq, IRQF_SHARED,
+ edma_rx_fill_handle_irq, IRQF_SHARED,
"edma_rxfill", (void *)edma_hw.pdev);
if (err) {
pr_debug("RXFILL ring IRQ:%d request failed\n",
diff --git a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h
index 2bbe478..d0237ba 100644
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h
@@ -283,6 +283,7 @@ enum edma_tx edma_ring_xmit(struct edma_hw *ehw,
uint32_t edma_clean_tx(struct edma_hw *ehw,
struct edma_txcmpl_ring *txcmpl_ring);
irqreturn_t edma_handle_irq(int irq, void *ctx);
+irqreturn_t edma_rx_fill_handle_irq(int irq, void *ctx);
irqreturn_t edma_handle_misc_irq(int irq, void *ctx);
int edma_napi(struct napi_struct *napi, int budget);
void edma_cleanup_rings(struct edma_hw *ehw);
diff --git a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
index 355fe83..374c90f 100644
--- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
@@ -740,11 +740,9 @@ irqreturn_t edma_handle_irq(int irq, void *ctx)
uint32_t reg_data = 0;
uint32_t rxdesc_intr_status = 0;
uint32_t txcmpl_intr_status = 0;
- uint32_t rxfill_intr_status = 0;
int i;
struct edma_txcmpl_ring *txcmpl_ring = NULL;
struct edma_rxdesc_ring *rxdesc_ring = NULL;
- struct edma_rxfill_ring *rxfill_ring = NULL;
struct edma_hw *ehw = NULL;
struct platform_device *pdev = (struct platform_device *)ctx;
@@ -788,9 +786,40 @@ irqreturn_t edma_handle_irq(int irq, void *ctx)
EDMA_MASK_INT_DISABLE);
}
+ if ((rxdesc_intr_status == 0) && (txcmpl_intr_status == 0))
+ return IRQ_NONE;
+
+ for (i = 0; i < ehw->rxdesc_rings; i++) {
+ rxdesc_ring = &ehw->rxdesc_ring[i];
+ edma_reg_write(EDMA_REG_RXDESC_INT_MASK(rxdesc_ring->id),
+ EDMA_MASK_INT_DISABLE);
+ }
+
/*
- * Read RxFill intr status
+ *TODO - per core NAPI
*/
+ if (rxdesc_intr_status || txcmpl_intr_status)
+ if (likely(napi_schedule_prep(&ehw->napi)))
+ __napi_schedule(&ehw->napi);
+
+ return IRQ_HANDLED;
+}
+
+irqreturn_t edma_rx_fill_handle_irq(int irq, void *ctx)
+{
+ struct platform_device *pdev = (struct platform_device *)ctx;
+ struct edma_rxfill_ring *rxfill_ring;
+ uint32_t rxfill_intr_status;
+ struct edma_hw *ehw;
+ uint32_t reg_data;
+ int i;
+
+ ehw = platform_get_drvdata(pdev);
+ if (!ehw) {
+ pr_info("Unable to retrieve platrofm data");
+ return IRQ_HANDLED;
+ }
+
for (i = 0; i < ehw->rxfill_rings; i++) {
rxfill_ring = &ehw->rxfill_ring[i];
reg_data = edma_reg_read(
@@ -806,22 +835,9 @@ irqreturn_t edma_handle_irq(int irq, void *ctx)
}
- if ((rxdesc_intr_status == 0) && (txcmpl_intr_status == 0) &&
- (rxfill_intr_status == 0))
+ if (!rxfill_intr_status)
return IRQ_NONE;
- for (i = 0; i < ehw->rxdesc_rings; i++) {
- rxdesc_ring = &ehw->rxdesc_ring[i];
- edma_reg_write(EDMA_REG_RXDESC_INT_MASK(rxdesc_ring->id),
- EDMA_MASK_INT_DISABLE);
- }
-
- /*
- *TODO - per core NAPI
- */
- if (rxdesc_intr_status || txcmpl_intr_status || rxfill_intr_status)
- if (likely(napi_schedule_prep(&ehw->napi)))
- __napi_schedule(&ehw->napi);
-
return IRQ_HANDLED;
}
+
--
2.36.1