Re: [PATCH net-next v5 00/15] net: macb: implement context swapping
From: Paolo Abeni
Date: Thu Jul 30 2026 - 08:02:19 EST
On 7/24/26 5:29 PM, 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.
>
> The change is super intrusive so conflicts will be major. Sorry!
>
> --
>
> During iteration V3, the LLM raised many race conditions because BH
> features aren't disabled at close and might do a variety of bad things
> (interact with NAPI while disabled or re-arm IRQs). This is NOT fixed
> here. Here we focus on swap, not close. The series is way too long
> already.
Note that Sashiko gemini has more to say:
https://sashiko.dev/#/patchset/20260724-macb-context-v5-0-569b1852bc7f%40bootlin.com
At least the possible deadlock in patch 13/15 looks real to me.
Please also note net-next commit c82ff94592fb
/P