]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: stmmac: Fix interrupt handling for level-triggered mode in DWC_XGMAC2
authorEricChan <chenchuangyu@xiaomi.com>
Thu, 3 Jul 2025 02:04:49 +0000 (10:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2025 16:35:10 +0000 (18:35 +0200)
[ Upstream commit 78b7920a03351a8402de2f81914c1d2e2bdf24b7 ]

According to the Synopsys Controller IP XGMAC-10G Ethernet MAC Databook
v3.30a (section 2.7.2), when the INTM bit in the DMA_Mode register is set
to 2, the sbd_perch_tx_intr_o[] and sbd_perch_rx_intr_o[] signals operate
in level-triggered mode. However, in this configuration, the DMA does not
assert the XGMAC_NIS status bit for Rx or Tx interrupt events.

This creates a functional regression where the condition
if (likely(intr_status & XGMAC_NIS)) in dwxgmac2_dma_interrupt() will
never evaluate to true, preventing proper interrupt handling for
level-triggered mode. The hardware specification explicitly states that
"The DMA does not assert the NIS status bit for the Rx or Tx interrupt
events" (Synopsys DWC_XGMAC2 Databook v3.30a, sec. 2.7.2).

The fix ensures correct handling of both edge and level-triggered
interrupts while maintaining backward compatibility with existing
configurations. It has been tested on the hardware device (not publicly
available), and it can properly trigger the RX and TX interrupt handling
in both the INTM=0 and INTM=2 configurations.

Fixes: d6ddfacd95c7 ("net: stmmac: Add DMA related callbacks for XGMAC2")
Tested-by: EricChan <chenchuangyu@xiaomi.com>
Signed-off-by: EricChan <chenchuangyu@xiaomi.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250703020449.105730-1-chenchuangyu@xiaomi.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c

index dd2ab6185c40e813ee4401857875d3e8478303e7..05ea74e9379399fdcf255275f1f43a90c59016ab 100644 (file)
@@ -364,19 +364,17 @@ static int dwxgmac2_dma_interrupt(struct stmmac_priv *priv,
        }
 
        /* TX/RX NORMAL interrupts */
-       if (likely(intr_status & XGMAC_NIS)) {
-               if (likely(intr_status & XGMAC_RI)) {
-                       u64_stats_update_begin(&stats->syncp);
-                       u64_stats_inc(&stats->rx_normal_irq_n[chan]);
-                       u64_stats_update_end(&stats->syncp);
-                       ret |= handle_rx;
-               }
-               if (likely(intr_status & (XGMAC_TI | XGMAC_TBU))) {
-                       u64_stats_update_begin(&stats->syncp);
-                       u64_stats_inc(&stats->tx_normal_irq_n[chan]);
-                       u64_stats_update_end(&stats->syncp);
-                       ret |= handle_tx;
-               }
+       if (likely(intr_status & XGMAC_RI)) {
+               u64_stats_update_begin(&stats->syncp);
+               u64_stats_inc(&stats->rx_normal_irq_n[chan]);
+               u64_stats_update_end(&stats->syncp);
+               ret |= handle_rx;
+       }
+       if (likely(intr_status & (XGMAC_TI | XGMAC_TBU))) {
+               u64_stats_update_begin(&stats->syncp);
+               u64_stats_inc(&stats->tx_normal_irq_n[chan]);
+               u64_stats_update_end(&stats->syncp);
+               ret |= handle_tx;
        }
 
        /* Clear interrupts */