From: Joe Damato <joe@dama.to>
To: netdev@vger.kernel.org, Michael Chan <michael.chan@broadcom.com>,
Pavan Chebbi <pavan.chebbi@broadcom.com>,
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>,
Prashant Sreedharan <prashant@broadcom.com>
Cc: edumazet@google.com, horms@kernel.org,
linux-kernel@vger.kernel.org, Joe Damato <joe@dama.to>
Subject: [RFC net v4 4/4] bnxt_en: refuse to open a device with stopped DMA
Date: Fri, 25 Sep 2026 10:44:01 -0700 [thread overview]
Message-ID: <20260925174404.2789072-5-joe@dama.to> (raw)
In-Reply-To: <20260925174404.2789072-1-joe@dama.to>
Add BNXT_STATE_DMA_STOPPED and set it in bnxt_stop_dma() to signal that
the device had DMA disabled. When opening the device later, check this
bit and exit with an error.
This is a very rare case, but when it happens the device needs manual
intervention by the user to become usable again.
Fixes: 74608fc98d28 ("bnxt_en: Ring free response from close path should use completion ring")
Signed-off-by: Joe Damato <joe@dama.to>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 26 ++++++++++++++++++++---
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 +
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 33e9ce8eb449..21da989e136e 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -7814,9 +7814,20 @@ static void bnxt_stop_dma(struct bnxt *bp)
{
netdev_err(bp->dev,
"Disabling DMA before releasing ring memory, the driver must be rebound to recover\n");
+ set_bit(BNXT_STATE_DMA_STOPPED, &bp->state);
pci_clear_master(bp->pdev);
}
+static int bnxt_check_dma_stopped(struct bnxt *bp)
+{
+ if (!test_bit(BNXT_STATE_DMA_STOPPED, &bp->state))
+ return 0;
+
+ netdev_err(bp->dev,
+ "DMA was disabled after the firmware failed to free rings, rebind the driver to recover\n");
+ return -ENODEV;
+}
+
static int __bnxt_trim_rings(struct bnxt *bp, int *rx, int *tx, int max,
bool shared);
static int bnxt_trim_rings(struct bnxt *bp, int *rx, int *tx, int max,
@@ -13387,9 +13398,10 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
int bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
{
- int rc = 0;
+ int rc;
- if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state))
+ rc = bnxt_check_dma_stopped(bp);
+ if (!rc && test_bit(BNXT_STATE_ABORT_ERR, &bp->state))
rc = -EIO;
if (!rc)
rc = __bnxt_open_nic(bp, irq_re_init, link_re_init);
@@ -13406,7 +13418,11 @@ int bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
*/
int bnxt_half_open_nic(struct bnxt *bp)
{
- int rc = 0;
+ int rc;
+
+ rc = bnxt_check_dma_stopped(bp);
+ if (rc)
+ goto half_open_err;
if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) {
netdev_err(bp->dev, "A previous firmware reset has not completed, aborting half open\n");
@@ -13466,6 +13482,10 @@ static int bnxt_open(struct net_device *dev)
struct bnxt *bp = netdev_priv(dev);
int rc;
+ rc = bnxt_check_dma_stopped(bp);
+ if (rc)
+ return rc;
+
if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) {
rc = bnxt_reinit_after_abort(bp);
if (rc) {
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index c673b2ce4a0d..061f57824c7a 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -2470,6 +2470,7 @@ struct bnxt {
#define BNXT_STATE_DRV_REGISTERED 7
#define BNXT_STATE_PCI_CHANNEL_IO_FROZEN 8
#define BNXT_STATE_NAPI_DISABLED 9
+#define BNXT_STATE_DMA_STOPPED 10
#define BNXT_STATE_FW_ACTIVATE 11
#define BNXT_STATE_RECOVER 12
#define BNXT_STATE_FW_NON_FATAL_COND 13
--
2.53.0-Meta
next prev parent reply other threads:[~2026-09-25 17:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 17:43 [RFC net v4 0/4] bnxt_en: Make RING FREE more robust Joe Damato
2026-09-25 17:43 ` [RFC net v4 1/4] bnxt_en: return the RING_FREE status to callers Joe Damato
2026-09-25 17:43 ` [RFC net v4 2/4] bnxt_en: check HWRM response if completion never arrives Joe Damato
2026-09-25 17:44 ` [RFC net v4 3/4] bnxt_en: stop DMA before releasing rings the firmware did not free Joe Damato
2026-09-25 17:44 ` Joe Damato [this message]
2026-09-29 0:20 ` [RFC net v4 4/4] bnxt_en: refuse to open a device with stopped DMA Joe Damato
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=20260925174404.2789072-5-joe@dama.to \
--to=joe@dama.to \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=edumazet@kernel.org \
--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=prashant@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®