All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: stmmac: dwxgmac2: configure INTM for per-channel interrupt routing
@ 2026-07-23 13:24 Zxyan Zhu
  2026-07-23 13:50 ` Maxime Chevallier
  0 siblings, 1 reply; 5+ messages in thread
From: Zxyan Zhu @ 2026-07-23 13:24 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: netdev, linux-kernel, Zxyan Zhu

The XGMAC DMA_MODE register has an INTM field (bits 13:12) that
controls interrupt routing behavior for DMA transfer completion
events:

  00 (default): sbd_perch_* are pulse signals, sbd_intr_o is also
                asserted for each completion event.
  01:          sbd_perch_* are level signals, sbd_intr_o is NOT
                asserted for packet transfer completion events.

When multi-MSI is enabled (dma_cfg->multi_msi_en), per-channel TX/RX
interrupts are expected to arrive on their dedicated lines
(sbd_perch_tx_intr_o / sbd_perch_rx_intr_o).  In the default INTM=00
mode, sbd_intr_o also fires for DMA completion events, but the
multi-MSI handler stmmac_mac_interrupt() only processes MAC-layer
events (LPI, PMT, timestamps) and does not service DMA channels,
silently dropping the interrupt.

Set INTM to mode 1 when multi-MSI is enabled, following the same
pattern as the GMAC4 DMA_BUS_MODE_INTM configuration in commit
6ccf12ae111e ("net: stmmac: use interrupt mode INTM=1 for multi-MSI").

Signed-off-by: Zxyan Zhu <zxyan0222@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h     | 2 ++
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
index 61b6d45a02f5..f8ab347f7b5b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
@@ -320,6 +320,8 @@
 /* DMA Registers */
 #define XGMAC_DMA_MODE			0x00003000
 #define XGMAC_SWR			BIT(0)
+#define XGMAC_INTM_MASK			GENMASK(13, 12)
+#define XGMAC_INTM_MODE1		0x1
 #define XGMAC_DMA_SYSBUS_MODE		0x00003004
 #define XGMAC_WR_OSR_LMT		GENMASK(29, 24)
 #define XGMAC_RD_OSR_LMT		GENMASK(21, 16)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
index 03437f1cf3df..72aceb06f5af 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
@@ -31,6 +31,15 @@ static void dwxgmac2_dma_init(void __iomem *ioaddr,
 		value |= XGMAC_EAME;
 
 	writel(value, ioaddr + XGMAC_DMA_SYSBUS_MODE);
+
+	/*
+	 * Route DMA interrupts to per-channel lines when multi-MSI enabled.
+	 */
+	if (dma_cfg->multi_msi_en) {
+		value = readl(ioaddr + XGMAC_DMA_MODE);
+		value = u32_replace_bits(value, XGMAC_INTM_MODE1, XGMAC_INTM_MASK);
+		writel(value, ioaddr + XGMAC_DMA_MODE);
+	}
 }
 
 static void dwxgmac2_dma_init_chan(struct stmmac_priv *priv,

base-commit: 1df10cef2d1e7f9f2fb7eddb67fc70d3abf101f9
-- 
2.34.1


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

* Re: [PATCH net-next] net: stmmac: dwxgmac2: configure INTM for per-channel interrupt routing
  2026-07-23 13:24 [PATCH net-next] net: stmmac: dwxgmac2: configure INTM for per-channel interrupt routing Zxyan Zhu
@ 2026-07-23 13:50 ` Maxime Chevallier
  2026-07-28  1:16   ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Maxime Chevallier @ 2026-07-23 13:50 UTC (permalink / raw)
  To: Zxyan Zhu, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel

Hi,

On 7/23/26 15:24, Zxyan Zhu wrote:
> The XGMAC DMA_MODE register has an INTM field (bits 13:12) that
> controls interrupt routing behavior for DMA transfer completion
> events:
> 
>   00 (default): sbd_perch_* are pulse signals, sbd_intr_o is also
>                 asserted for each completion event.
>   01:          sbd_perch_* are level signals, sbd_intr_o is NOT
>                 asserted for packet transfer completion events.
> 
> When multi-MSI is enabled (dma_cfg->multi_msi_en), per-channel TX/RX
> interrupts are expected to arrive on their dedicated lines
> (sbd_perch_tx_intr_o / sbd_perch_rx_intr_o).  In the default INTM=00
> mode, sbd_intr_o also fires for DMA completion events, but the
> multi-MSI handler stmmac_mac_interrupt() only processes MAC-layer
> events (LPI, PMT, timestamps) and does not service DMA channels,
> silently dropping the interrupt.
> 
> Set INTM to mode 1 when multi-MSI is enabled, following the same
> pattern as the GMAC4 DMA_BUS_MODE_INTM configuration in commit
> 6ccf12ae111e ("net: stmmac: use interrupt mode INTM=1 for multi-MSI").
> 
> Signed-off-by: Zxyan Zhu <zxyan0222@gmail.com>

Same logic as in dwmac4, this looks good to me,

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime


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

* Re: [PATCH net-next] net: stmmac: dwxgmac2: configure INTM for per-channel interrupt routing
  2026-07-23 13:50 ` Maxime Chevallier
@ 2026-07-28  1:16   ` Jakub Kicinski
  2026-07-28  3:43     ` Zxyan Zhu
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2026-07-28  1:16 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: Zxyan Zhu, Andrew Lunn, David S . Miller, Eric Dumazet,
	Paolo Abeni, netdev, linux-kernel

On Thu, 23 Jul 2026 15:50:50 +0200 Maxime Chevallier wrote:
> On 7/23/26 15:24, Zxyan Zhu wrote:
> > The XGMAC DMA_MODE register has an INTM field (bits 13:12) that
> > controls interrupt routing behavior for DMA transfer completion
> > events:
> > 
> >   00 (default): sbd_perch_* are pulse signals, sbd_intr_o is also
> >                 asserted for each completion event.
> >   01:          sbd_perch_* are level signals, sbd_intr_o is NOT
> >                 asserted for packet transfer completion events.
> > 
> > When multi-MSI is enabled (dma_cfg->multi_msi_en), per-channel TX/RX
> > interrupts are expected to arrive on their dedicated lines
> > (sbd_perch_tx_intr_o / sbd_perch_rx_intr_o).  In the default INTM=00
> > mode, sbd_intr_o also fires for DMA completion events, but the
> > multi-MSI handler stmmac_mac_interrupt() only processes MAC-layer
> > events (LPI, PMT, timestamps) and does not service DMA channels,
> > silently dropping the interrupt.
> > 
> > Set INTM to mode 1 when multi-MSI is enabled, following the same
> > pattern as the GMAC4 DMA_BUS_MODE_INTM configuration in commit
> > 6ccf12ae111e ("net: stmmac: use interrupt mode INTM=1 for multi-MSI").
> > 
> > Signed-off-by: Zxyan Zhu <zxyan0222@gmail.com>  
> 
> Same logic as in dwmac4, this looks good to me,

Is this a fix tho? The commit message reads like DMA irqs are
completely ignored. But neither this commit nor 6ccf12ae111e
really explain much to an outsider..

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

* Re: [PATCH net-next] net: stmmac: dwxgmac2: configure INTM for per-channel interrupt routing
  2026-07-28  1:16   ` Jakub Kicinski
@ 2026-07-28  3:43     ` Zxyan Zhu
  2026-07-28 22:19       ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Zxyan Zhu @ 2026-07-28  3:43 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Maxime Chevallier, Andrew Lunn, David S . Miller, Eric Dumazet,
	Paolo Abeni, netdev, linux-kernel, Zxyan Zhu

On Mon, 27 Jul 2026 18:16:17 -0700 Jakub Kicinski wrote:
> On Thu, 23 Jul 2026 15:50:50 +0200 Maxime Chevallier wrote:
> > Same logic as in dwmac4, this looks good to me,
> 
> Is this a fix tho? The commit message reads like DMA irqs are
> completely ignored. But neither this commit nor 6ccf12ae111e
> really explain much to an outsider..

Thanks for the review.

The commit message does a poor job of explaining the actual impact,
so let me clarify.

I've verified on hardware with XGMAC and multi-MSI enabled. The
results are definitive:

  INTM=00 (default):
    - 5.4 million interrupts on the common IRQ line in 3 seconds
    - ~1.8 million IRQ_NONE returns per second

  INTM=01:
    - 0 interrupts on the common IRQ line
    - Per-channel IRQs work normally
    - 10G line rate works correctly

The behavior is that with INTM=00, sbd_intr_o is also asserted for
each DMA completion event. The common IRQ handler
stmmac_mac_interrupt() only processes MAC-layer events (LPI, PMT,
timestamps) and returns IRQ_NONE for DMA completion events, causing
the interrupt storm. With INTM=01, sbd_intr_o is not asserted for
DMA transfer completion events, which is the correct mode for
per-channel interrupt routing.

Regarding net vs net-next: XGMAC multi-MSI has never worked correctly
since it was introduced, so this is not a regression. The same
INTM=1 configuration for GMAC4 was merged via net-next (6ccf12ae111e
"net: stmmac: use interrupt mode INTM=1 for multi-MSI"). I'm leaning
toward net-next for consistency, but since this makes multi-MSI
completely non-functional without it, I'd appreciate your opinion on
whether net is more appropriate.

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

* Re: [PATCH net-next] net: stmmac: dwxgmac2: configure INTM for per-channel interrupt routing
  2026-07-28  3:43     ` Zxyan Zhu
@ 2026-07-28 22:19       ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2026-07-28 22:19 UTC (permalink / raw)
  To: Zxyan Zhu
  Cc: Maxime Chevallier, Andrew Lunn, David S . Miller, Eric Dumazet,
	Paolo Abeni, netdev, linux-kernel

On Tue, 28 Jul 2026 11:43:03 +0800 Zxyan Zhu wrote:
> The commit message does a poor job of explaining the actual impact,
> so let me clarify.
> 
> I've verified on hardware with XGMAC and multi-MSI enabled. The
> results are definitive:
> 
>   INTM=00 (default):
>     - 5.4 million interrupts on the common IRQ line in 3 seconds
>     - ~1.8 million IRQ_NONE returns per second
> 
>   INTM=01:
>     - 0 interrupts on the common IRQ line
>     - Per-channel IRQs work normally
>     - 10G line rate works correctly
> 
> The behavior is that with INTM=00, sbd_intr_o is also asserted for
> each DMA completion event. The common IRQ handler
> stmmac_mac_interrupt() only processes MAC-layer events (LPI, PMT,
> timestamps) and returns IRQ_NONE for DMA completion events, causing
> the interrupt storm. With INTM=01, sbd_intr_o is not asserted for
> DMA transfer completion events, which is the correct mode for
> per-channel interrupt routing.

Got it, could you respin with this clarification in the commit message?

> Regarding net vs net-next: XGMAC multi-MSI has never worked correctly
> since it was introduced, so this is not a regression. The same
> INTM=1 configuration for GMAC4 was merged via net-next (6ccf12ae111e
> "net: stmmac: use interrupt mode INTM=1 for multi-MSI"). I'm leaning
> toward net-next for consistency, but since this makes multi-MSI
> completely non-functional without it, I'd appreciate your opinion on
> whether net is more appropriate.

Makes sense, we can stick to net-next. Please also add a note to the
commit msg that "XGMAC multi-MSI has never worked correctly."
It will help backporting. Thanks!

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

end of thread, other threads:[~2026-07-28 22:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23 13:24 [PATCH net-next] net: stmmac: dwxgmac2: configure INTM for per-channel interrupt routing Zxyan Zhu
2026-07-23 13:50 ` Maxime Chevallier
2026-07-28  1:16   ` Jakub Kicinski
2026-07-28  3:43     ` Zxyan Zhu
2026-07-28 22:19       ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.