Thread (22 messages) flat view 22 messages, 3 authors, 6d ago

Re: [PATCH net-next v9 00/17] net: macb: implement context swapping

From: Théo Lebrun <theo.lebrun@bootlin.com>
Date: 2026-08-15 09:31:18
Also in: lkml

On Wed Aug 12, 2026 at 10:03 AM CEST, Théo Lebrun wrote:
MACB has a pretty primitive approach to buffer management. They are all
stored in `struct macb *bp`. On operations that require buffer realloc
(set_ringparam & change_mtu at the moment), the only option is to close
the interface, change our global state and re-open the interface.

Two issues:
- It doesn't fly on memory pressured systems; we free our precious
  buffers and don't manage to reallocate fully, meaning our machine
  just lost its network access.
- Anecdotally, it is pretty slow because it implies a full PHY reinit.

Instead, we shall:
 - allocate a new context (including buffers) first
 - if it fails, early return without any impact to the interface
 - stop interface
 - update global state (bp, netdev, etc)
 - pass newly allocated buffer pointers to the hardware
 - start interface
 - free old context

This is what we implement here. Both .set_ringparam() and
.ndo_change_mtu() are covered by this series. In the future,
at least .set_channels() [0], XDP [1] and XSK [2] would benefit.
Sorry for the insistence, but do we have a chance of seeing this merged
before the next merge window? Context swapping is a nice feature to get
into v7.3 and it would allow us to send XDP (& XSK) series that are
dependent on context swapping.

Thanks!

Have a nice week-end,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help