Re: [PATCH net-next v5 11/15] net: macb: change function signatures to take contexts
From: Nicolai Buchwitz
Date: Fri Jul 24 2026 - 15:36:44 EST
On 24.7.2026 17:29, Théo Lebrun wrote:
For parallel MACB context to start become a reality, many functions need
to stop operating on bp->ctx (the currently active context) and instead
work on a context they get passed. That context might be
(1) the new one that is getting allocated and initialised, or,
(2) the old one to be freed.
To reduce bug surface area, taint those functions to *only* take a
context `struct macb_context *ctx` and no `struct macb *bp`. That way,
no bug of using `bp->ctx` instead of `ctx` will ever occur.
We also convert functions that take a `struct macb_queue *queue` to
instead take `struct macb_context *ctx, unsigned int q`, with q
indexing ctx->txq[] and ctx->rxq[].
Full list:
macb_adj_dma_desc_idx()
macb_tx_ring_wrap()
macb_tx_desc()
macb_rx_ring_wrap()
macb_rx_desc()
macb_get_addr()
gem_rx_refill()
macb_init_rx_ring()
gem_free_rx_buffers()
macb_free_rx_buffers()
macb_tx_ring_size_per_queue()
macb_rx_ring_size_per_queue()
macb_free()
gem_alloc_rx_buffers()
macb_alloc_rx_buffers()
macb_alloc()
gem_init_rx_ring()
gem_init_rings()
macb_init_rings()
Note about gem_rx_refill(): it ends with a netdev_vdbg() that prints the
queue pointer. Change to print the queue index because we do not have
access to the queue anymore.
Acked-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
Signed-off-by: Théo Lebrun <theo.lebrun@xxxxxxxxxxx>
---
[...]
Reviewed-by: Nicolai Buchwitz <nb@xxxxxxxxxxx>
Thanks
Nicolai