Skip to content

net: stmmac: reduce DMA interrupt latency on YT6801

Johan Alvarado linux-arm-kernel netdev 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3net: stmmac: dwmac4: do not treat TBU as a TX eventdrivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c+0 -20 replies
2/3net: stmmac: add an opt-in MSI vector mask for NAPIdrivers/net/ethernet/stmicro/stmmac/stmmac.h drivers/net/ethernet/stmicro/stmmac/stmmac_main.c include/linux/stmmac.h+101 -80 replies
3/3net: stmmac: motorcomm: mask the MSI vector during NAPIdrivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c+5 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net-next 0/3] net: stmmac: reduce DMA interrupt latency on YT6801

On the Motorcomm YT6801 (dwmac-motorcomm), an RX or TX completion that happens while stmmac has the DMA channel interrupt masked for NAPI does not raise a new MSI when it is unmasked. The glue's 200 us interrupt moderation adds to the delay. At high packet rates the RX ring overflows. With the series, ping RTT to a peer one routed hop away goes from 0.82-0.86 to 0.60-0.66 ms and 64-byte UDP RX loss from 0.65-1.60 % to 0.01-0.06 %, with more interrupts. Patch 3 has the full numbers.

Patch 1 stops dwmac4 from reporting TBU as TX work, as commit 305deb54c6c2 ("net: stmmac: xgmac: do not treat TBU as a TX event") did for xgmac.

Patch 2 adds an opt-in flag to mask the per-channel MSI vector during NAPI instead of the DMA channel interrupt, as the vendor driver does, so the irq core resends an event raised meanwhile. Patch 3 sets it for the YT6801 with MSI-X and turns the glue moderation off. Neither change is enough alone.

An alternative, keeping the DMA mask and rechecking RI/TI after unmasking, performed the same, but needed a new DMA op, an MMIO read on every unmask and about 2000 extra acknowledges/s under UDP TX.

Only the YT6801 is known to need this. I have no other multi-MSI dwmac4 hardware (dwmac-intel, dwmac-loongson), so only dwmac-motorcomm sets the flag. On an affected device, bpftrace shows gaps over 2 ms between stmmac_napi_poll_tx() calls during a 64-byte UDP TX flood.

Tested on an Orange Pi 5 Pro (RK3588S, YT6801 on PCIe 2.0 x1) with the series backported to 7.3.6. Build tested each patch with W=1 at net-next d5cf954cebe4.

Johan Alvarado (3):
net: stmmac: dwmac4: do not treat TBU as a TX event
net: stmmac: add an opt-in MSI vector mask for NAPI
net: stmmac: motorcomm: mask the MSI vector during NAPI

 .../ethernet/stmicro/stmmac/dwmac-motorcomm.c |   8 +-
 .../net/ethernet/stmicro/stmmac/dwmac4_lib.c  |   2 -
 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |   3 +
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 105 ++++++++++++++++--
 include/linux/stmmac.h                        |   1 +
 5 files changed, 106 insertions(+), 13 deletions(-)

base-commit: d5cf954cebe4f175dfd834e1dc471a3aa203ec7d

Signature · 1 line
2.56.1