mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/9] net: sparx5/lan969x: add support for changing the MTU
@ 2026-11-20 11:56 Daniel Machon
  2026-11-20 11:56 ` [PATCH net-next v3 1/9] net: sparx5/lan969x: stop the FDMA channels properly Daniel Machon
                   ` (8 more replies)
  0 siblings, 9 replies; 17+ messages in thread
From: Daniel Machon @ 2026-11-20 11:56 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Steen Hegelund, UNGLinuxDriver, Richard Cochran,
	Russell King
  Cc: netdev, linux-arm-kernel, linux-kernel, Robert Marko,
	Horatiu Vultur, Jens Emil Schulz Østergaard, Simon Horman

This series adds support for changing the MTU on Sparx5 and lan969x.

Currently, there is no ndo_change_mtu callback, and the MAC maximum
frame length, the FDMA buffers, the queue watermarks and the TAS guard
band are all fixed for a 1518 byte frame. This series makes them follow
the MTU, and sets the maximum MTU from the 14000 byte frame limit of the
MACs. As the FDMA is shared by all ports, new buffers are allocated
while the FDMA keeps running, and the FDMA is only stopped briefly to
replace them. Details are in the commits.

Patch 1 makes the FDMA stop sequence actually stop the channels, and
patch 2 frees the FDMA buffers on init errors and deinit. Until now, the
stop sequence was only used on deinit. This series also uses it, and the
new free functions, to resize the buffers.

Patches 3-4 prepare for the MTU change, by adding a helper for setting
the MAC maximum frame length, and by making the FDMA init and alloc
functions operate on the rings passed to them.

Patches 5-6 size the FDMA buffers from the port MTUs, and add support
for resizing them.

Patches 7-8 scale the queue watermarks and the TAS guard band with the
MTU.

Patch 9 adds the ndo_change_mtu callback and sets the maximum MTU.

Tested on Sparx5 (PCB135) and lan969x (EV23X71A), by forwarding frames
up to the MTU and checking that frames one byte over the MTU are
dropped, by sending jumbo frames to and from the CPU while stepping the
MTU up and down between 1500 and 9216, and by changing the MTU
repeatedly while flooding the CPU with frames in both directions.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
Changes in v3:
- Rebase on net-next, which now has commits 81d2cf1c6d56 ("net: sparx5:
  fix RX ring stall on frames from inactive ports") and 1a47bc214d00
  ("net: lan969x: fix RX ring stall on frames from inactive ports").
- Patches 1-2: drop the Fixes tags and the testing notes.
- Patch 2: on Sparx5, clear the RX buffer slot as soon as the skb leaves
  the ring, so that a frame dropped because of an inactive source port
  is not freed again by sparx5_fdma_rx_free().
- Patch 6: likewise on lan969x, clear the RX buffer slot as soon as the
  page leaves the ring, also when it goes back to the page_pool.
- Patch 9: extend the top RMON histogram range to the maximum frame
  length.
- Patches 5, 6, 9: use SKB_WITH_OVERHEAD() for the lan969x DB size,
  and fit lines to 80 columns.
- Link to v2: https://lore.kernel.org/r/20261111-sparx5-mtu-change-v2-0-59c91357e8f6@microchip.com

Changes in v2:
- Patch 1: add a Fixes tag.
- Patch 2: also release the lan969x TX buffers that are still in flight
  on deinit, store the length of the mapped TX buffers so that two-step
  PTP skbs are not touched when unmapping, and add Fixes tags.
- Patch 6: reuse the lan969x TX buffer release from patch 2, and mention
  in the commit message that frames still in flight are dropped.
- Rebase on net-next, which now has commit 873363ac591a1 ("net:
  sparx5/lan969x: release the in-flight slot of a stale TX skb"), so
  that a two-step PTP frame dropped by a resize no longer leaks its
  timestamp slot.
- Link to v1: https://lore.kernel.org/r/20261105-sparx5-mtu-change-v1-0-f27bab580463@microchip.com

---
Daniel Machon (9):
      net: sparx5/lan969x: stop the FDMA channels properly
      net: sparx5/lan969x: free the FDMA buffers on init errors and deinit
      net: sparx5/lan969x: add a helper for setting the MAC max frame length
      net: sparx5/lan969x: pass the FDMA rings to the init and alloc functions
      net: sparx5/lan969x: size the FDMA buffers from the port MTUs
      net: sparx5/lan969x: add support for resizing the FDMA buffers
      net: sparx5/lan969x: scale the queue watermarks with the MTU
      net: sparx5/lan969x: scale the TAS guard band with the MTU
      net: sparx5/lan969x: add support for changing the MTU

 .../ethernet/microchip/sparx5/lan969x/lan969x.c    |  10 +
 .../ethernet/microchip/sparx5/lan969x/lan969x.h    |   2 +
 .../microchip/sparx5/lan969x/lan969x_fdma.c        | 185 ++++++++++--
 .../net/ethernet/microchip/sparx5/sparx5_ethtool.c |   2 +-
 .../net/ethernet/microchip/sparx5/sparx5_fdma.c    | 322 ++++++++++++++++++---
 .../net/ethernet/microchip/sparx5/sparx5_main.c    |   2 +
 .../net/ethernet/microchip/sparx5/sparx5_main.h    |  14 +
 .../ethernet/microchip/sparx5/sparx5_main_regs.h   |  34 +++
 .../net/ethernet/microchip/sparx5/sparx5_netdev.c  |  48 ++-
 .../net/ethernet/microchip/sparx5/sparx5_port.c    | 123 +++++---
 .../net/ethernet/microchip/sparx5/sparx5_port.h    |   5 +
 drivers/net/ethernet/microchip/sparx5/sparx5_tas.c |  43 ++-
 12 files changed, 687 insertions(+), 103 deletions(-)
---
base-commit: 2208ab00f4f213ade91ab775e7f8c4dacdcc856e
change-id: 20260930-sparx5-mtu-change-d7ebb1a7fcaa

Best regards,
-- 
Daniel Machon <daniel.machon@microchip.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-11-23 14:58 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 11:56 [PATCH net-next v3 0/9] net: sparx5/lan969x: add support for changing the MTU Daniel Machon
2026-11-20 11:56 ` [PATCH net-next v3 1/9] net: sparx5/lan969x: stop the FDMA channels properly Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko
2026-11-20 11:56 ` [PATCH net-next v3 2/9] net: sparx5/lan969x: free the FDMA buffers on init errors and deinit Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko
2026-11-20 11:57 ` [PATCH net-next v3 3/9] net: sparx5/lan969x: add a helper for setting the MAC max frame length Daniel Machon
2026-11-20 11:57 ` [PATCH net-next v3 4/9] net: sparx5/lan969x: pass the FDMA rings to the init and alloc functions Daniel Machon
2026-11-20 11:57 ` [PATCH net-next v3 5/9] net: sparx5/lan969x: size the FDMA buffers from the port MTUs Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko
2026-11-20 11:57 ` [PATCH net-next v3 6/9] net: sparx5/lan969x: add support for resizing the FDMA buffers Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko
2026-11-20 11:57 ` [PATCH net-next v3 7/9] net: sparx5/lan969x: scale the queue watermarks with the MTU Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko
2026-11-20 11:57 ` [PATCH net-next v3 8/9] net: sparx5/lan969x: scale the TAS guard band " Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko
2026-11-20 11:57 ` [PATCH net-next v3 9/9] net: sparx5/lan969x: add support for changing " Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®