Thread (30 messages) 30 messages, 2 authors, 2d ago

Re: [PATCH net-next v4 07/15] net: macb: introduce macb_context struct for buffer management

From: Théo Lebrun <theo.lebrun@bootlin.com>
Date: 2026-07-24 14:00:50
Also in: lkml

Hello Nicolai,

On Sun Jul 19, 2026 at 12:38 PM CEST, Nicolai Buchwitz wrote:
Hi Théo

On 17.7.2026 21:48, Théo Lebrun wrote:
quoted
Whenever an operation requires buffer realloc, we close the interface,
update parameters and reopen. To improve reliability under memory
pressure, we should rather alloc new buffers, reconfigure HW and free
old buffers. This requires MACB to support having multiple "contexts"
in parallel.

Introduce this concept by adding the macb_context struct, which owns 
all
queue buffers and the parameters associated. We do not yet support
multiple contexts in parallel, because all functions access bp->ctx
(the currently active context) directly.

Steps:

 - Introduce `struct macb_context` and its children `struct macb_rxq`
   and `struct macb_txq`. Context fields are stolen from `struct macb`
   and rxq/txq fields are from `struct macb_queue`.

   Making it two separate structs per queue simplifies accesses: we 
grab
   a txq/rxq local variable and access fields like txq->head instead of
   queue->tx_head. It also anecdotally improves data locality.

 - macb_init_dflt() / macb_get_ringparam() do not access
   bp->ctx->{rx,tx}_ring_size as they will/might run while interface is
   offline and ctx is not NULL. Instead, introduce
   bp->configured_{rx,tx}_ring_size which get updated on user requests.
nit: In the commit message: "ctx is not NULL" should be "ctx is NULL".
Indeed. Interface offline == ctx is NULL.

Thanks,

--
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