Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Alvarado <contact@c127.dev>
To: Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Yao Zi <me@ziyao.cc>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	Johan Alvarado <contact@c127.dev>,
	Pengfei Zhang <zhangfeionline@gmail.com>
Subject: [PATCH net-next 3/3] net: stmmac: motorcomm: mask the MSI vector during NAPI
Date: Fri,  4 Dec 2026 15:31:30 -0500	[thread overview]
Message-ID: <20261204203130.287919-4-contact@c127.dev> (raw)
In-Reply-To: <20261204203130.287919-1-contact@c127.dev>

On the YT6801, an RI or TI set while the DMA channel interrupt is
masked for NAPI raises no MSI on unmask. During a 64-byte UDP TX flood,
bpftrace shows over 1300 gaps longer than 2 ms between
stmmac_napi_poll_tx() calls per 10 s run.

The glue INT_MODERATION register, set to 200 us by motorcomm_init(),
adds up to 200 us of RX latency on top of RIWT (ethtool -C rx-usecs).
With rx-usecs 33, the median ping RTT is 0.32-0.36 ms with
INT_MODERATION at 0 and 0.53-0.54 ms at 200.

Set STMMAC_FLAG_NAPI_MASK_MSI_VEC under MSI-X and INT_MODERATION to 0.
The vector mask alone keeps ping RTT at 0.80-0.87 ms, and moderation 0
alone drops 64-byte UDP TX to 50.2-50.8 kpps.

Orange Pi 5 Pro (RK3588S, YT6801 on PCIe 2.0 x1), 7.3.6 backport,
default coalescing (rx-usecs 328, tx-usecs 5000, tx-frames 25), iperf3
to a peer one routed hop away, 10 s per test, 5 interleaved runs,
min-max. TX poll gaps are gaps over 2 ms traced with bpftrace.

                              before        after
  ping RTT (ms)               0.82-0.86     0.60-0.66
  TCP RX (Mb/s)               917-923       931-935
  TCP TX (Mb/s)               826-866       839-867
  UDP 64B TX (kpps)           67.3-68.1     76.9-78.7
  TX poll gaps per run        1381-1587     14-298
  UDP 64B RX loss (%)         0.65-1.60     0.01-0.06
  CPU, TCP RX (%)             10.1-12.4     11.6-13.9
  RX interrupts/s, TCP RX     1751-1776     2999-3007
  TX interrupts/s, UDP TX     884-928       7684-8492

RIWT alone now times RX interrupts, which accounts for the extra CPU.

motorcomm_resume() calls motorcomm_init(), so the setting survives
resume. Link down/up during a UDP flood left no unbalanced enable_irq()
warning.

With a single MSI only the moderation change applies:

                              before        after
  ping RTT (ms)               0.62-0.74     0.63-0.66
  UDP 64B RX loss (%)         0.68-2.20     0.01-0.03
  CPU, TCP RX (%)             9.2-13.2      13.6-14.1

TCP throughput did not change.

Signed-off-by: Johan Alvarado <contact@c127.dev>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
index 42f0b11a7b60..627cf4000dea 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
@@ -174,8 +174,9 @@ static void motorcomm_init(struct dwmac_motorcomm_priv *priv)
 {
 	writel(0x0, priv->base + MGMT_INT_CTRL0);
 
-	writel(FIELD_PREP(INT_MODERATION_RX, 200) |
-	       FIELD_PREP(INT_MODERATION_TX, 200),
+	/* Interrupt coalescing is left to the stmmac core */
+	writel(FIELD_PREP(INT_MODERATION_RX, 0) |
+	       FIELD_PREP(INT_MODERATION_TX, 0),
 	       priv->base + INT_MODERATION);
 
 	/*
@@ -272,7 +273,8 @@ static int motorcomm_setup_irq(struct pci_dev *pdev,
 		res->tx_irq[0]	= pci_irq_vector(pdev, 4);
 		res->irq	= pci_irq_vector(pdev, 5);
 
-		plat->flags |= STMMAC_FLAG_MULTI_MSI_EN;
+		plat->flags |= STMMAC_FLAG_MULTI_MSI_EN |
+			       STMMAC_FLAG_NAPI_MASK_MSI_VEC;
 	} else {
 		dev_info(&pdev->dev, "failed to allocate MSI-X vector: %d\n",
 			 ret);
-- 
2.56.1



      parent reply	other threads:[~2026-12-04 20:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 20:31 [PATCH net-next 0/3] net: stmmac: reduce DMA interrupt latency on YT6801 Johan Alvarado
2026-12-04 20:31 ` [PATCH net-next 1/3] net: stmmac: dwmac4: do not treat TBU as a TX event Johan Alvarado
2026-12-04 20:31 ` [PATCH net-next 2/3] net: stmmac: add an opt-in MSI vector mask for NAPI Johan Alvarado
2026-12-04 20:31 ` Johan Alvarado [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204203130.287919-4-contact@c127.dev \
    --to=contact@c127.dev \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=me@ziyao.cc \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=zhangfeionline@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox