Skip to content

mlxsw: Fix teardown order of CQ NAPI instances

Petr Machata netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyApplied 2/2

Patches in v1 All 2 applied

#Subject and filesSizeRepliesApplied
1/2mlxsw: pci: Process EQ in the IRQ handler instead of a taskletdrivers/net/ethernet/mellanox/mlxsw/pci.c+11 -200 repliesApplied
2/2mlxsw: pci: Fix teardown order of CQ NAPI instancesdrivers/net/ethernet/mellanox/mlxsw/pci.c+44 -20 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchIdo Schimmel
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net-next 0/2] mlxsw: Fix teardown order of CQ NAPI instances

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(-)
Signature · 1 line
2.56.1