Skip to content

Commit 78b7920

Browse files
EricChankuba-moo
authored andcommitted
net: stmmac: Fix interrupt handling for level-triggered mode in DWC_XGMAC2
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: d6ddfac ("net: stmmac: Add DMA related callbacks for XGMAC2") Tested-by: EricChan <[email protected]> Signed-off-by: EricChan <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 31ec70a commit 78b7920

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -364,19 +364,17 @@ static int dwxgmac2_dma_interrupt(struct stmmac_priv *priv,
364364
}
365365

366366
/* TX/RX NORMAL interrupts */
367-
if (likely(intr_status & XGMAC_NIS)) {
368-
if (likely(intr_status & XGMAC_RI)) {
369-
u64_stats_update_begin(&stats->syncp);
370-
u64_stats_inc(&stats->rx_normal_irq_n[chan]);
371-
u64_stats_update_end(&stats->syncp);
372-
ret |= handle_rx;
373-
}
374-
if (likely(intr_status & (XGMAC_TI | XGMAC_TBU))) {
375-
u64_stats_update_begin(&stats->syncp);
376-
u64_stats_inc(&stats->tx_normal_irq_n[chan]);
377-
u64_stats_update_end(&stats->syncp);
378-
ret |= handle_tx;
379-
}
367+
if (likely(intr_status & XGMAC_RI)) {
368+
u64_stats_update_begin(&stats->syncp);
369+
u64_stats_inc(&stats->rx_normal_irq_n[chan]);
370+
u64_stats_update_end(&stats->syncp);
371+
ret |= handle_rx;
372+
}
373+
if (likely(intr_status & (XGMAC_TI | XGMAC_TBU))) {
374+
u64_stats_update_begin(&stats->syncp);
375+
u64_stats_inc(&stats->tx_normal_irq_n[chan]);
376+
u64_stats_update_end(&stats->syncp);
377+
ret |= handle_tx;
380378
}
381379

382380
/* Clear interrupts */

0 commit comments

Comments
 (0)