Skip to contentSkip to conversation

code From d0f446931dfee7afa9f6ce5b1ac032e4dfa98460 Mon Sep 17 00:00:00 2001

PATCH Superseded Ley Foon Tan 2 participants 6 messages Nov 1, 2024 – Nov 4, 2024

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

This patch series fixes the bugs in the dwmac4 drivers:

Patch #1: Fix incorrect _SHIFT and _MASK for MTL_OP_MODE_RTC_* macros. Patch #2: Fix bit mask off operation for MTL_OP_MODE_*_MASK. Patch #3: Fix Receive Watchdog Timeout (RWT) interrupt handling.

Changes since v1:
- Updated CC list from get_maintainers.pl.
- Removed Fixes tag.
- Add more description in cover letter.

History:
v1: https://lore.kernel.org/linux-arm-kernel/[email protected]/T/

Ley Foon Tan (3):
net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros
net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation
net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal
interrupt summary

 drivers/net/ethernet/stmicro/stmmac/dwmac4.h     | 4 ++--
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 4 ++--
 drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 6 ++++--
 3 files changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/3 net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros

RTC fields are located in bits [1:0]. Correct the _MASK and _SHIFT macros to use the appropriate mask and shift.

---
 drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4.h +2 -2
index 28fff6cab812..dd21dcfbbab3 100644
@@ -394,8 +394,8 @@ static inline u32 mtl_chanx_base_addr(const struct dwmac4_addrs *addrs,
 
 #define MTL_OP_MODE_EHFC		BIT(7)
 
-#define MTL_OP_MODE_RTC_MASK		0x18
-#define MTL_OP_MODE_RTC_SHIFT		3
+#define MTL_OP_MODE_RTC_MASK		GENMASK(1, 0)
+#define MTL_OP_MODE_RTC_SHIFT		0
 
 #define MTL_OP_MODE_RTC_32		(1 << MTL_OP_MODE_RTC_SHIFT)
 #define MTL_OP_MODE_RTC_64		0
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/3 net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation

In reply to Ley Foon Tan

In order to mask off the bits, we need to use the '~' operator to invert all the bits of _MASK and clear them.

---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +2 -2
index 7c895e0ae71f..1be77d189ccb 100644
@@ -266,7 +266,7 @@ static void dwmac4_dma_rx_chan_op_mode(struct stmmac_priv *priv,
 	} else {
 		pr_debug("GMAC: disable RX SF mode (threshold %d)\n", mode);
 		mtl_rx_op &= ~MTL_OP_MODE_RSF;
-		mtl_rx_op &= MTL_OP_MODE_RTC_MASK;
+		mtl_rx_op &= ~MTL_OP_MODE_RTC_MASK;
 		if (mode <= 32)
 			mtl_rx_op |= MTL_OP_MODE_RTC_32;
 		else if (mode <= 64)
@@ -335,7 +335,7 @@ static void dwmac4_dma_tx_chan_op_mode(struct stmmac_priv *priv,
 	} else {
 		pr_debug("GMAC: disabling TX SF (threshold %d)\n", mode);
 		mtl_tx_op &= ~MTL_OP_MODE_TSF;
-		mtl_tx_op &= MTL_OP_MODE_TTC_MASK;
+		mtl_tx_op &= ~MTL_OP_MODE_TTC_MASK;
 		/* Set the transmit threshold */
 		if (mode <= 32)
 			mtl_tx_op |= MTL_OP_MODE_TTC_32;
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 3/3 net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary

In reply to Ley Foon Tan

The Receive Watchdog Timeout (RWT, bit[9]) is not part of Abnormal Interrupt Summary (AIS). Move the RWT handling out of the AIS condition statement.

From databook, the AIS is the logical OR of the following interrupt bits:

- Bit 1: Transmit Process Stopped
- Bit 7: Receive Buffer Unavailable
- Bit 8: Receive Process Stopped
- Bit 10: Early Transmit Interrupt
- Bit 12: Fatal Bus Error
- Bit 13: Context Descriptor Error

---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +4 -2
index 0d185e54eb7e..57c03d491774 100644
@@ -185,8 +185,6 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,
 			x->rx_buf_unav_irq++;
 		if (unlikely(intr_status & DMA_CHAN_STATUS_RPS))
 			x->rx_process_stopped_irq++;
-		if (unlikely(intr_status & DMA_CHAN_STATUS_RWT))
-			x->rx_watchdog_irq++;
 		if (unlikely(intr_status & DMA_CHAN_STATUS_ETI))
 			x->tx_early_irq++;
 		if (unlikely(intr_status & DMA_CHAN_STATUS_TPS)) {
@@ -198,6 +196,10 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,
 			ret = tx_hard_error;
 		}
 	}
+
+	if (unlikely(intr_status & DMA_CHAN_STATUS_RWT))
+		x->rx_watchdog_irq++;
+
 	/* TX/RX NORMAL interrupts */
 	if (likely(intr_status & DMA_CHAN_STATUS_RI)) {
 		u64_stats_update_begin(&stats->syncp);
Signature · 1 line
2.34.1
#4 lore raw
In reply to Ley Foon Tan
Quoted 9 lines · Ley Foon Tan

This patch series fixes the bugs in the dwmac4 drivers:

Patch #1: Fix incorrect _SHIFT and _MASK for MTL_OP_MODE_RTC_* macros. Patch #2: Fix bit mask off operation for MTL_OP_MODE_*_MASK. Patch #3: Fix Receive Watchdog Timeout (RWT) interrupt handling.

Changes since v1:
- Updated CC list from get_maintainers.pl.
- Removed Fixes tag.

It looks to me that the first two patches really are fixes? The last patch is just a statistics counter, so probably not a fix?

If this is correct, please spit these into two series. The first two should target net, and have Fixes: tags. The last patch should target net-next, and does not need a Fixes: tag.

Quoted 1 line

- Add more description in cover letter.

The Subject: like of the cover letter could be better.

Andrew

#5 lore raw
Quoted 27 lines

-----Original Message-----
From: Andrew Lunn <[email protected]>
Sent: Friday, November 1, 2024 9:31 PM
To: Leyfoon Tan <[email protected]>
Cc: Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; David S . Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; [email protected]; linux-stm32@st-md- mailman.stormreply.com; [email protected]; linux- [email protected]; [email protected]
Subject: Re: code From d0f446931dfee7afa9f6ce5b1ac032e4dfa98460 Mon Sep 17 00:00:00 2001

Quoted 9 lines · Ley Foon Tan

This patch series fixes the bugs in the dwmac4 drivers:

Patch #1: Fix incorrect _SHIFT and _MASK for MTL_OP_MODE_RTC_* macros. Patch #2: Fix bit mask off operation for MTL_OP_MODE_*_MASK. Patch #3: Fix Receive Watchdog Timeout (RWT) interrupt handling.

Changes since v1:
- Updated CC list from get_maintainers.pl.
- Removed Fixes tag.

Quoted 6 lines

It looks to me that the first two patches really are fixes? The last patch is just a statistics counter, so probably not a fix?

If this is correct, please spit these into two series. The first two should target net, and have Fixes: tags. The last patch should target net-next, and does not need a Fixes: tag.

From the comment in [1], the fixes for net should be for the user-visible problem. That's why these 3 patches are resend to net-next.

Quoted 4 lines
Quoted 2 lines

- Add more description in cover letter.

The Subject: like of the cover letter could be better.

[1] https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/

Regards
Ley Foon