Re: [PATCH net-next v11 0/9] net: macb: implement context swapping
flat view
From: Nicolai Buchwitz <nb@tipi-net.de>
Date: 2026-10-13 19:04:53
Also in:
lkml
Hi Théo On 13.10.2026 15:16, 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.
[...]
Tested on a Raspberry Pi CM5 (RP1 GEM) with lockdep and KASAN enabled: - ring and MTU changes under bidirectional TCP and a UDP flood - ring and MTU changes while the interface is down - ring and MTU changes during autoneg - injected allocation failures in both paths - PTP and EEE after a swap Everything worked, and changing either no longer takes the link down. For the series: Tested-by: Nicolai Buchwitz <nb@tipi-net.de> # RPi CM5 with RP1 GEM Thanks, Nicolai