Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] mlxsw: Fix teardown order of CQ NAPI instances
@ 2026-11-16 10:16 Petr Machata
  2026-11-16 10:16 ` [PATCH net-next 1/2] mlxsw: pci: Process EQ in the IRQ handler instead of a tasklet Petr Machata
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Petr Machata @ 2026-11-16 10:16 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev
  Cc: Ido Schimmel, Petr Machata, mlxsw

There are the following principal objects for processing of hardware
events: event queue (EQ), completion queues (CQ), and receive and send
queues (RDQ, SDQ). RDQ and SDQ are then configured with a CQ to which
they report completion, and CQ is configured with an EQ, to which it
reports completion events. The order of configuration is therefore EQ,
then CQs, then RDQs and SDQs.

Further, there are NAPI contexts for processing CQ events and working
with either RDQ, or SDQ, a tasklet for processing EQ and scheduling
per-CQ NAPI contexts, and an IRQ handler that schedules the tasklet.
The order of configuration thus must be, first the NAPI contexts
(associated with CQs), then the tasklet (associated with the EQ), then
the IRQ handler.

The code however initializes the queue together with the scheduled
entity that processes that queue, in order of the queue configuration.
Thus is the tasklet initialized prior to NAPI contexts, even though it
refers to these NAPIs. This is actually a problem during destruction,
when the tasklet is destroyed after the queues that it refers to, and
SDQ and RDQ are destroyed prior to the respective NAPI context that
they are processed by.

IRQ handler is then set up as first, and torn down as last, which
is correct.

In this patchset address the ordering issue as follows.

- Patch #1 folds the current tasklet processing directly into the IRQ
  handler. This is possible, because the amount of work is relatively
  small and strictly bounded. The heavy lifting is done in NAPI queues
  scheduled from this code, and the indirection through tasklet does
  not bring much. The reason to actually do it is because it
  simplifies the whole situation, and because the tasklet interface is
  deprecated (see include/linux/interrupt.h).

- In patch #2, per-queue start and stop callbacks are introduced.
  These are invoked after the queues themselves are initialized (and,
  respectively, before they are deinitialized), and are used to set up
  the NAPI context after all relevant resources are ready, and to tear
  them down first before tearing down the resources they consume.

Petr Machata (2):
  mlxsw: pci: Process EQ in the IRQ handler instead of a tasklet
  mlxsw: pci: Fix teardown order of CQ NAPI instances

 drivers/net/ethernet/mellanox/mlxsw/pci.c | 77 ++++++++++++++++-------
 1 file changed, 55 insertions(+), 22 deletions(-)

-- 
2.56.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-16 13:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 10:16 [PATCH net-next 0/2] mlxsw: Fix teardown order of CQ NAPI instances Petr Machata
2026-11-16 10:16 ` [PATCH net-next 1/2] mlxsw: pci: Process EQ in the IRQ handler instead of a tasklet Petr Machata
2026-11-16 10:16 ` [PATCH net-next 2/2] mlxsw: pci: Fix teardown order of CQ NAPI instances Petr Machata
2026-11-16 10:21 ` [PATCH net-next 0/2] mlxsw: " netdev-bot+sinfo
2026-11-16 12:59   ` Petr Machata

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox