diff options
| author | 2026-10-13 15:16:40 +0200 | |
|---|---|---|
| committer | 2026-10-20 09:30:24 +0200 | |
| commit | 435345c6518071ce38d534acfdf49a79e879e55d (patch) | |
| tree | e954657832cc3486c1e5ecfd5996721a7a04a595 /scripts/Makefile.thinlto | |
| parent | net: macb: close race between NAPI polls & ndo_stop (diff) | |
net: macb: introduce macb_context struct for buffer management
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 NULL. Instead, introduce
bp->configured_{rx,tx}_ring_size which get updated on user requests.
- macb_open() starts by allocating bp->ctx. It gets freed in the
open error codepath or by macb_close().
- Guided by compile errors, update all codepaths. Most diff is changing
`queue->tx_*` to `txq->*` and `queue->rx_*` to `rxq->*`, with a new
local variable. Also rx_buffer_size / rx_ring_size / tx_ring_size
move from bp to bp->ctx.
Introduce two helpers macb_txq|rxq() functions to convert macb_queue
pointers.
- macb_get_regs() is tweaked to support being ran while interface is
offline (and context is NULL). Use default values at zero and
override them only if context is present.
- Protect our ctx freeing in at91ether code with a synchronize_irq()
call.
Note: bp->configured_{rx,tx}_ring_size contain proper values for EMAC,
meaning 9/1 on ethtool -G on RM9200 whereas it reported 0/0 before.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Link: https://patch.msgid.link/20261013-macb-context-v11-2-b27785167566@bootlin.com
Tested-by: Nicolai Buchwitz <nb@tipi-net.de> # RPi CM5 with RP1 GEM
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
