From: Bhargava Marreddy <bhargava.marreddy@broadcom.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
vsrama-krishna.nemani@broadcom.com, vikas.gupta@broadcom.com,
Bhargava Marreddy <bhargava.marreddy@broadcom.com>
Subject: [PATCH net-next v4 0/5] bnge: Make NQ0 persistent across open/close
Date: Wed, 11 Nov 2026 19:00:06 +0000 [thread overview]
Message-ID: <20261111190011.53437-1-bhargava.marreddy@broadcom.com> (raw)
Hi,
This series ensures the bnge driver's Notification Queue 0 (NQ0) remains
persistent across interface close/open cycles rather than being destroyed
and recreated on each cycle.
Currently, NQ0 exists only between ndo_open() and ndo_stop(), so firmware
async events (e.g., link changes) and HWRM completions are not received
while the interface is down.
NQ0 and its MSI-X vector are now allocated at probe and retained until
remove. To conserve MSI-X vectors for Rx/Tx queues, vector 0 is shared.
NQ0's NAPI exists only between ndo_open() and ndo_stop(), like every other
NQ. While the interface is up, NQ0 runs via NAPI; while down, an
IRQ-triggered work item processes non-datapath events.
Patches 1-4: Preparatory refactoring (alloc/free helpers, logging
fallbacks, NQ iterator, irq_tbl layout). No functional
change apart from the items noted in their commit messages.
Patch 5 : Create NQ0 at probe, free it at remove, and add the worker
fallback.
irq_tbl layout after this series:
Vector 0 : NQ0 (probe to remove)
Vectors 1..A : RoCE (auxiliary driver)
Vectors A+1..N : Main L2 NQs (open/close only)
v4:
Addressed feedback from Jakub Kicinski on v3:
- NQ0's NAPI no longer outlives the open state: it is added in
ndo_open() and deleted in ndo_stop(), like every other NQ.
- While down, the NQ0 IRQ handler queues a work item for async and
HWRM events instead. The mode switches only in open/stop, so one
context consumes NQ0 at a time.
https://lore.kernel.org/all/20261022181639.1815c338@kernel.org/
v3:
Addressed feedback from Simon Horman:
- Extracted the failure-path NULL dereference fix in bnge_alloc_core() and
submitted it as a standalone patch to 'net'.
- Dropped unnecessary defensive NULL checks (!bn->rx_ring and !bn->tx_ring)
from bnge_free_tpa_info(), bnge_free_rx_rings(), and bnge_free_tx_rings().
Addressed comments from Sashiko:
https://sashiko.dev/#/patchset/20260922052904.59237-1-bhargava.marreddy%40broadcom.com
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260922052904.59237-1-bhargava.marreddy%40broadcom.com
Other changes:
- Renamed series from "bnge: Support async events while down" to "bnge:
Make NQ0 persistent across open/close" to accurately reflect the
streamlined focus on NQ0 persistence.
- Completely reorganized and streamlined the series from 6 patches down to 5.
- Redesigned and shifted the MSI-X vector/offset mapping layout:
Vector 0 (IRQ0) : Permanently dedicated to NQ0 at probe
(no longer recreated on RoCE load/unload or open/close)
Vectors 1..A : RoCE (aux) queues
Vectors A..N : Main L2 queues
- Added a new patch introducing bnge_err()/bnge_warn()/bnge_dbg() logging
helper macros to fall back to PCI dev-level logging before netdev
registration during probe (Patch 2).
- Switched to the bnge_for_each_open_nq() loop iterator to clarify which
loops are open-only versus those that cover all NQs (Patch 3).
- Enhanced safety in bnge_napi_poll() to skip CQ notification processing
on NQ0 when completion rings are unallocated while the interface is down,
preventing invalid dereferences of cp_ring_arr (Patch 5).
v2:
https://lore.kernel.org/all/20260922052904.59237-1-bhargava.marreddy@broadcom.com/
Addressed comments from Sashiko
https://sashiko.dev/#/patchset/20260901191728.643212-1-bhargava.marreddy%40broadcom.com
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260901191728.643212-1-bhargava.marreddy%40broadcom.com
- Dropped patch 7/7 ("bnge: Process async events while administratively down"):
- Link events while down are unnecessary to process since bnge_open() already
queries and updates PHY settings via bnge_update_phy_setting().
- Keeps the series focused strictly on the NQ0/NAPI lifecycle refactoring.
- Corrected the order of operations in bnge_quiesce_nq0() to disable NAPI
first, synchronize IRQ, and then ring the doorbell to prevent NAPI
rescheduling race conditions.
- Added support for dynamic MSI-X vector reallocation by introducing
bnge_reinit_nq0() during interface open.
- Fixed potential NULL pointer dereferences in core ring cleanups (e.g. bn->rx_ring,
bn->tx_ring, and bn->grp_info) on allocation failure paths and failed opens.
- Fixed a resource leak in bnge_init_nic() where RX ring pair buffers
were leaked if chip initialization failed.
- Corrected the MSI-X vector demand check in bnge_resc.c to ensure
sufficient vectors are allocated for both NQ0/aux and main rings.
- Changed CPU affinity hint failure from a fatal error to a warning.
- Added robust NULL pointer and safety checks in ring allocation and
cleanup paths to prevent potential kernel crashes on allocation failures.
v1: https://lore.kernel.org/all/20260901191728.643212-1-bhargava.marreddy@broadcom.com/
Bhargava Marreddy (5):
bnge: factor out per-NQ alloc/free helpers
bnge: add bnge_err()/bnge_warn()/bnge_dbg() logging helpers
bnge: add bnge_for_each_open_nq() iterator
bnge: make irq_tbl layout depend on BNGE_FIRST_OPEN_NQ
bnge: create NQ0 during probe and keep it active across open/close
drivers/net/ethernet/broadcom/bnge/bnge.h | 47 ++
.../net/ethernet/broadcom/bnge/bnge_auxr.c | 4 +-
.../ethernet/broadcom/bnge/bnge_hwrm_lib.c | 8 +-
.../net/ethernet/broadcom/bnge/bnge_netdev.c | 518 +++++++++++++-----
.../net/ethernet/broadcom/bnge/bnge_netdev.h | 5 +
.../net/ethernet/broadcom/bnge/bnge_rmem.c | 10 -
.../net/ethernet/broadcom/bnge/bnge_txrx.c | 57 +-
.../net/ethernet/broadcom/bnge/bnge_txrx.h | 3 +
8 files changed, 493 insertions(+), 159 deletions(-)
--
2.47.3
next reply other threads:[~2026-11-11 19:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 19:00 Bhargava Marreddy [this message]
2026-11-11 19:00 ` [PATCH net-next v4 1/5] bnge: factor out per-NQ alloc/free helpers Bhargava Marreddy
2026-11-11 19:00 ` [PATCH net-next v4 2/5] bnge: add bnge_err()/bnge_warn()/bnge_dbg() logging helpers Bhargava Marreddy
2026-11-11 19:00 ` [PATCH net-next v4 3/5] bnge: add bnge_for_each_open_nq() iterator Bhargava Marreddy
2026-11-11 19:00 ` [PATCH net-next v4 4/5] bnge: make irq_tbl layout depend on BNGE_FIRST_OPEN_NQ Bhargava Marreddy
2026-11-11 19:00 ` [PATCH net-next v4 5/5] bnge: create NQ0 during probe and keep it active across open/close Bhargava Marreddy
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=20261111190011.53437-1-bhargava.marreddy@broadcom.com \
--to=bhargava.marreddy@broadcom.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=vikas.gupta@broadcom.com \
--cc=vsrama-krishna.nemani@broadcom.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
all inboxes | Powered by JetHome®