Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Lorenzo Bianconi
Fri, 30 Oct 2026 12:32
Re: [PATCH net] net: stmmac: Clear DMA errors for multi-channel interrupts
Author: Lorenzo Bianconi
Date: Fri, 30 Oct 2026 12:32
Date: Fri, 30 Oct 2026 12:32
196 lines
22596 bytes
22596 bytes
--MiK4MvEZXEgqTADb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
> The Multi-MSI interrupt handler doesn't clear the DMA error interrupts,
> and this leads to interrupt storms when one of these interrupts starts
> firing :
>=20
> - The RBU (rx buff unav) which triggers under high traffic load
>=20
> This triggers easily with iperf3 and small udp packets, and shows
> when running the netpoll kselftest
>=20
> - The RPS (rx process stop) which triggers when we stop the DMA RX.
>=20
> This one shows when restarting the RX logic without doing a down/up
> cycle, like when attaching an XDP program. The XSK kselftests
> triggers it.
>=20
> Let's make sure we clear these interrupts for multi-MSI cases. It's
> already properly done for the single-chan interrupt, and for that
> introduce an "ERR" DMA dir, as we don't want to touch the RI/TI bits
> when handling these interrupts.
>=20
> To avoid duplication, the DMA TX error handling is factored out in a
> dedicated helper (in the same commit to ease backporting).
>=20
> Both of the above storms have been found on dwmac-motorcomm (YT8601),
> and are triggered by the xdp.py, xsk_reconfig.py, xdp_features.py,
> ring_reconfig.py and netpoll_basic kernel selftests.
>=20
> This seems to only affect dwmac4, there's no multi-msi mode on
> dwmac1000, and on dwxgmac these interrupts are masked as of today.
>=20
> Fixes: 6ccf12ae111e ("net: stmmac: use interrupt mode INTM=3D1 for multi-=
MSI")
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/common.h | 1 +
> .../net/ethernet/stmicro/stmmac/dwmac4_dma.h | 5 ++
> .../net/ethernet/stmicro/stmmac/dwmac4_lib.c | 2 +
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 46 +++++++++++++------
> 4 files changed, 40 insertions(+), 14 deletions(-)
>=20
> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/e=
thernet/stmicro/stmmac/common.h
> index c74bc7c9750e..a972bee66504 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/common.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
> @@ -382,6 +382,7 @@ enum dma_irq_dir {
> DMA_DIR_RX =3D 0x1,
> DMA_DIR_TX =3D 0x2,
> DMA_DIR_RXTX =3D 0x3,
> + DMA_DIR_ERR =3D 0x4,
> };
> =20
> enum request_irq_err {
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h b/drivers/n=
et/ethernet/stmicro/stmmac/dwmac4_dma.h
> index 43b036d4e95b..a7caac3c98e6 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
> @@ -173,6 +173,11 @@ static inline u32 dma_chanx_base_addr(const struct d=
wmac4_addrs *addrs,
> DMA_CHAN_STATUS_TI | \
> DMA_CHAN_STATUS_MSK_COMMON)
> =20
> +#define DMA_CHAN_STATUS_MSK_ERR (DMA_CHAN_STATUS_AIS | \
> + DMA_CHAN_STATUS_FBE | \
> + DMA_CHAN_STATUS_RPS | \
> + DMA_CHAN_STATUS_RBU)
> +
> int dwmac4_dma_reset(void __iomem *ioaddr);
> void dwmac4_enable_dma_irq(struct stmmac_priv *priv, void __iomem *ioadd=
r,
> u32 chan, bool rx, bool tx);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/n=
et/ethernet/stmicro/stmmac/dwmac4_lib.c
> index a0249715fafa..02aa1a3dd1e2 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> @@ -150,6 +150,8 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, vo=
id __iomem *ioaddr,
> intr_status &=3D DMA_CHAN_STATUS_MSK_RX;
> else if (dir =3D=3D DMA_DIR_TX)
> intr_status &=3D DMA_CHAN_STATUS_MSK_TX;
> + else if (dir =3D=3D DMA_DIR_ERR)
> + intr_status &=3D DMA_CHAN_STATUS_MSK_ERR;
> =20
> /* ABNORMAL interrupts */
> if (unlikely(intr_status & DMA_CHAN_STATUS_AIS)) {
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/=
net/ethernet/stmicro/stmmac/stmmac_main.c
> index 9ded31150fbe..2068b57df8d5 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -3141,6 +3141,16 @@ static int stmmac_napi_check(struct stmmac_priv *p=
riv, u32 chan, u32 dir)
> return status;
> }
> =20
> +static void stmmac_dma_tx_error(struct stmmac_priv *priv, u32 chan, int =
status)
> +{
> + if (unlikely(status & tx_hard_error_bump_tc)) {
> + /* Try to bump up the dma threshold on this failure */
> + stmmac_bump_dma_threshold(priv, chan);
> + } else if (unlikely(status =3D=3D tx_hard_error)) {
> + stmmac_tx_err(priv, chan);
> + }
> +}
> +
> /**
> * stmmac_dma_interrupt - DMA ISR
> * @priv: driver private structure
> @@ -3165,13 +3175,24 @@ static void stmmac_dma_interrupt(struct stmmac_pr=
iv *priv)
> status[chan] =3D stmmac_napi_check(priv, chan,
> DMA_DIR_RXTX);
> =20
> - for (chan =3D 0; chan < tx_channel_count; chan++) {
> - if (unlikely(status[chan] & tx_hard_error_bump_tc)) {
> - /* Try to bump up the dma threshold on this failure */
> - stmmac_bump_dma_threshold(priv, chan);
> - } else if (unlikely(status[chan] =3D=3D tx_hard_error)) {
> - stmmac_tx_err(priv, chan);
> - }
> + for (chan =3D 0; chan < tx_channel_count; chan++)
> + stmmac_dma_tx_error(priv, chan, status[chan]);
> +}
> +
> +static void stmmac_dma_err_interrupt(struct stmmac_priv *priv)
> +{
> + u8 tx_channel_count =3D priv->plat->tx_queues_to_use;
> + u8 channels_to_check =3D max(priv->plat->rx_queues_to_use,
> + tx_channel_count);
> + int status;
> + u8 chan;
> +
> + for (chan =3D 0; chan < channels_to_check; chan++) {
> + status =3D stmmac_dma_interrupt_status(priv, priv->ioaddr,
> + &priv->xstats, chan,
> + DMA_DIR_ERR);
> + if (chan < tx_channel_count)
> + stmmac_dma_tx_error(priv, chan, status);
> }
> }
> =20
> @@ -6466,6 +6487,9 @@ static irqreturn_t stmmac_mac_interrupt(int irq, vo=
id *dev_id)
> /* To handle Common interrupts */
> stmmac_common_interrupt(priv);
> =20
> + if (priv->plat->core_type =3D=3D DWMAC_CORE_GMAC4)
> + stmmac_dma_err_interrupt(priv);
> +
> return IRQ_HANDLED;
> }
> =20
> @@ -6500,13 +6524,7 @@ static irqreturn_t stmmac_msi_intr_tx(int irq, voi=
d *data)
> return IRQ_HANDLED;
> =20
> status =3D stmmac_napi_check(priv, chan, DMA_DIR_TX);
> -
> - if (unlikely(status & tx_hard_error_bump_tc)) {
> - /* Try to bump up the dma threshold on this failure */
> - stmmac_bump_dma_threshold(priv, chan);
> - } else if (unlikely(status =3D=3D tx_hard_error)) {
> - stmmac_tx_err(priv, chan);
> - }
> + stmmac_dma_tx_error(priv, chan, status);
> =20
> return IRQ_HANDLED;
> }
> --=20
> 2.56.0
>=20
--MiK4MvEZXEgqTADb
Content-Type: application/pgp-signature; name=signature.asc
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCauSOZQAKCRA6cBh0uS2t
rLt2AP94/xq3HXI972oCxjUn64hJJfAqS/VqduknEbpg04vgCQEAoFB4EmEfJdaY
5GXrYPGGorHqDH29hb7XSJ6BbhpAnQI=
=yMqN
-----END PGP SIGNATURE-----
--MiK4MvEZXEgqTADb--
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads