Skip to contentSkip to conversation

net: stmmac: xgmac: fix handling of DPP safety error for DMA channels

PATCH Superseded Furong Xu 2 participants 2 messages Jan 26, 2024 – Jan 30, 2024

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Furong Xu

author
#0 lore raw

PATCH v2 1/1 net: stmmac: xgmac: fix handling of DPP safety error for DMA channels

Commit 56e58d6c8a56 ("net: stmmac: Implement Safety Features in XGMAC core") checks and reports safety errors, but leaves the Data Path Parity Errors for each channel in DMA unhandled at all, lead to a storm of interrupt.
Fix it by checking and clearing the DMA_DPP_Interrupt_Status register.

Fixes 56e58d6c8a56 ("net: stmmac: Implement Safety Features in XGMAC core")

---
Changes in v2:
- explicit enable Data Path Parity Protection
- add new counters to stmmac_safety_stats
- add detailed log

---
 drivers/net/ethernet/stmicro/stmmac/common.h  |  1 +
 .../net/ethernet/stmicro/stmmac/dwxgmac2.h    |  3 +
 .../ethernet/stmicro/stmmac/dwxgmac2_core.c   | 58 ++++++++++++++++++-
 3 files changed, 61 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -0
index 721c1f8e892f..b4f60ab078d6 100644
@@ -216,6 +216,7 @@ struct stmmac_safety_stats {
 	unsigned long mac_errors[32];
 	unsigned long mtl_errors[32];
 	unsigned long dma_errors[32];
+	unsigned long dma_dpp_errors[32];
 };
 
 /* Number of fields in Safety Stats */
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +3 -0
index 207ff1799f2c..5c67a3f89f08 100644
@@ -303,6 +303,8 @@
 #define XGMAC_RXCEIE			BIT(4)
 #define XGMAC_TXCEIE			BIT(0)
 #define XGMAC_MTL_ECC_INT_STATUS	0x000010cc
+#define XGMAC_MTL_DPP_CONTROL		0x000010e0
+#define XGMAC_DDPP_DISABLE		BIT(0)
 #define XGMAC_MTL_TXQ_OPMODE(x)		(0x00001100 + (0x80 * (x)))
 #define XGMAC_TQS			GENMASK(25, 16)
 #define XGMAC_TQS_SHIFT			16
@@ -385,6 +387,7 @@
 #define XGMAC_DCEIE			BIT(1)
 #define XGMAC_TCEIE			BIT(0)
 #define XGMAC_DMA_ECC_INT_STATUS	0x0000306c
+#define XGMAC_DMA_DPP_INT_STATUS	0x00003074
 #define XGMAC_DMA_CH_CONTROL(x)		(0x00003100 + (0x80 * (x)))
 #define XGMAC_SPH			BIT(24)
 #define XGMAC_PBLx8			BIT(16)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +57 -1

88 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer
#1 lore raw

drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c static int dwxgmac3_safety_feat_irq_status(struct net_device *ndev, · line 972

Quoted 11 lines · Furong Xu
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +6 -1
@@ -914,7 +964,12 @@ static int dwxgmac3_safety_feat_irq_status(struct net_device *ndev,
 		ret |= !corr;
 	}
 
-	err = dma & (XGMAC_DEUIS | XGMAC_DECIS);
+	/* DMA_DPP_Interrupt_Status is indicated by MCSIS bit in
+	 * DMA_Safety_Interrupt_Status, so we handle DMA Data Path
+	 * Parity Errors here
+	 */
+	err = (dma & (XGMAC_DEUIS | XGMAC_DECIS)) ||
+	      (dma & XGMAC_MCSIS);

The above syntax is IMHO confusing,

err = (dma & (XGMAC_DEUIS | XGMAC_DECIS | XGMAC_MCSIS))

should be more readable.

Cheers,

Paolo