From: Petr Machata <petrm@nvidia.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
<netdev@vger.kernel.org>
Cc: Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>,
<mlxsw@nvidia.com>
Subject: [PATCH net-next 0/2] mlxsw: Fix teardown order of CQ NAPI instances
Date: Mon, 16 Nov 2026 11:16:45 +0100 [thread overview]
Message-ID: <cover.1794823524.git.petrm@nvidia.com> (raw)
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
next reply other threads:[~2026-11-16 10:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 10:16 Petr Machata [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1794823524.git.petrm@nvidia.com \
--to=petrm@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox