netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next, v1 0/3] net: stmmac: dwmac4: Fixes bugs in dwmac4
@ 2024-10-21  5:48 Ley Foon Tan
  2024-10-21  5:48 ` [PATCH net-next, v1 1/3] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros Ley Foon Tan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ley Foon Tan @ 2024-10-21  5:48 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, lftan.linux, leyfoon.tan

This patch series fixes the bugs in the dwmac4 drivers.

Based on the feedback in [1], split the patch series into net and net-next,
and resubmit these three patches to net-next.

[1] https://patchwork.kernel.org/project/netdevbpf/cover/20241016031832.3701260-1-leyfoon.tan@starfivetech.com/

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(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next, v1 1/3] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros
  2024-10-21  5:48 [PATCH net-next, v1 0/3] net: stmmac: dwmac4: Fixes bugs in dwmac4 Ley Foon Tan
@ 2024-10-21  5:48 ` Ley Foon Tan
  2024-10-21  5:48 ` [PATCH net-next, v1 2/3] net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation Ley Foon Tan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ley Foon Tan @ 2024-10-21  5:48 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, lftan.linux, leyfoon.tan

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

Fixes: 35f74c0c5dce ("stmmac: add GMAC4 DMA/CORE Header File")
Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
index 93a78fd0737b..acbe5a027c85 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
@@ -389,8 +389,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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next, v1 2/3] net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation
  2024-10-21  5:48 [PATCH net-next, v1 0/3] net: stmmac: dwmac4: Fixes bugs in dwmac4 Ley Foon Tan
  2024-10-21  5:48 ` [PATCH net-next, v1 1/3] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros Ley Foon Tan
@ 2024-10-21  5:48 ` Ley Foon Tan
  2024-10-21  5:48 ` [PATCH net-next, v1 3/3] net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary Ley Foon Tan
  2024-10-23 11:20 ` [PATCH net-next, v1 0/3] net: stmmac: dwmac4: Fixes bugs in dwmac4 Simon Horman
  3 siblings, 0 replies; 5+ messages in thread
From: Ley Foon Tan @ 2024-10-21  5:48 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, lftan.linux, leyfoon.tan

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

Fixes: 48863ce5940f ("stmmac: add DMA support for GMAC 4.xx")
Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
index e0165358c4ac..4e1b1bd98f68 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next, v1 3/3] net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary
  2024-10-21  5:48 [PATCH net-next, v1 0/3] net: stmmac: dwmac4: Fixes bugs in dwmac4 Ley Foon Tan
  2024-10-21  5:48 ` [PATCH net-next, v1 1/3] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros Ley Foon Tan
  2024-10-21  5:48 ` [PATCH net-next, v1 2/3] net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation Ley Foon Tan
@ 2024-10-21  5:48 ` Ley Foon Tan
  2024-10-23 11:20 ` [PATCH net-next, v1 0/3] net: stmmac: dwmac4: Fixes bugs in dwmac4 Simon Horman
  3 siblings, 0 replies; 5+ messages in thread
From: Ley Foon Tan @ 2024-10-21  5:48 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, lftan.linux, leyfoon.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

Fixes: 48863ce5940f ("stmmac: add DMA support for GMAC 4.xx")
Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
index 0d185e54eb7e..57c03d491774 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
@@ -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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next, v1 0/3] net: stmmac: dwmac4: Fixes bugs in dwmac4
  2024-10-21  5:48 [PATCH net-next, v1 0/3] net: stmmac: dwmac4: Fixes bugs in dwmac4 Ley Foon Tan
                   ` (2 preceding siblings ...)
  2024-10-21  5:48 ` [PATCH net-next, v1 3/3] net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary Ley Foon Tan
@ 2024-10-23 11:20 ` Simon Horman
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2024-10-23 11:20 UTC (permalink / raw)
  To: Ley Foon Tan
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, lftan.linux,
	Andrew Lunn, Giuseppe Cavallaro, Maxime Coquelin,
	linux-arm-kernel, linux-stm32

+ Andrew, Giuseppe, Maxime, linux-arm-kernel, linux-stm32

On Mon, Oct 21, 2024 at 01:48:45PM +0800, Ley Foon Tan wrote:
> This patch series fixes the bugs in the dwmac4 drivers.
> 
> Based on the feedback in [1], split the patch series into net and net-next,
> and resubmit these three patches to net-next.
> 
> [1] https://patchwork.kernel.org/project/netdevbpf/cover/20241016031832.3701260-1-leyfoon.tan@starfivetech.com/
> 
> 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(-)

Hi Ley Foon Tan,

Thanks for the updates.

A few more points on process. Sorry for not pointing these out earlier.

* Please base the CC list on the output of get_maintainers.pl FILE.patch.
  b4 can help with this.

* Please do not include Fixes tags in patches for net-next
  (while please do for patches for net).

  If you wish to cite a patch you can use the following form,
  which may be line-wrapped, in the commit message (above the
  Signed-off-and other tags).

    Some text describing things that relate to
    commit 48863ce5940f ("stmmac: add DMA support for GMAC 4.xx")

    Signed-off-by: ...

* Please include some informative text in the cover letter.
  It will form part of git history. E.g.:

  - [PATCH net-next 0/3] net: sysctl: allow dump_cpumask to handle higher numbers of CPUs
    https://lore.kernel.org/all/20241017152422.487406-1-atenart@kernel.org/

  Which became:

  - Merge branch 'net-sysctl-allow-dump_cpumask-to-handle-higher-numbers-of-cpus'
    https://git.kernel.org/netdev/net-next/c/94fa523e20c3

More information on process for Networking patches can be found here:
https://docs.kernel.org/process/maintainer-netdev.html

-- 
pw-bot: changes-requested

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-23 11:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-21  5:48 [PATCH net-next, v1 0/3] net: stmmac: dwmac4: Fixes bugs in dwmac4 Ley Foon Tan
2024-10-21  5:48 ` [PATCH net-next, v1 1/3] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros Ley Foon Tan
2024-10-21  5:48 ` [PATCH net-next, v1 2/3] net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation Ley Foon Tan
2024-10-21  5:48 ` [PATCH net-next, v1 3/3] net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary Ley Foon Tan
2024-10-23 11:20 ` [PATCH net-next, v1 0/3] net: stmmac: dwmac4: Fixes bugs in dwmac4 Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).