From: Joe Damato <joe@dama.to>
To: Michael Chan <michael.chan@broadcom.com>
Cc: netdev@vger.kernel.org, Pavan Chebbi <pavan.chebbi@broadcom.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Prashant Sreedharan <prashant@broadcom.com>,
horms@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC net v3 3/3] bnxt_en: stop DMA before releasing rings the firmware did not free
Date: Thu, 24 Sep 2026 10:41:04 -0700 [thread overview]
Message-ID: <arVgsJAfoupBPoEm@devvm20253.cco0.facebook.com> (raw)
In-Reply-To: <CACKFLinDP66z0EA_1pL+4jbC_tr1Fe2mcsaan+xEFebORBcyAw@mail.gmail.com>
On Wed, Sep 23, 2026 at 11:26:47PM -0700, Michael Chan wrote:
> On Wed, Sep 23, 2026 at 2:07 PM Joe Damato <joe@dama.to> wrote:
>
> > @@ -7798,6 +7802,19 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path)
> > bp->grp_info[i].cp_fw_ring_id = INVALID_HW_RING_ID;
> > }
> > }
> > +
> > + if (!stuck)
> > + return 0;
> > +
> > + netdev_err(bp->dev, "Firmware did not free %d ring(s)\n", stuck);
> > + return -EIO;
> > +}
> > +
> > +static void bnxt_stop_dma(struct bnxt *bp)
> > +{
> > + netdev_err(bp->dev,
> > + "Disabling DMA before releasing ring memory, a firmware reset is required\n");
> > + pci_clear_master(bp->pdev);
> > }
> >
> Thanks for the patches. The general scheme to more properly handle
> RING_FREE timeout to prevent possible memory corruption is correct.
> However, the corrective action here feels incomplete. We should at
> least set some bp->state flags so that at the next open, we would know
> that something was wrong and could take further actions (e.g. FLR,
> etc) to try to bring it back.
Thanks for the review. That makes sense. Were you thinking of trying to bring
the device back up automatically or requiring user intervention?
The automatic path is probably somewhat tricky, it might look something like
(psuedo code):
#define BNXT_STATE_DMA_STOPPED 10
/* bnxt_stop_dma */
set_bit(BNXT_STATE_DMA_STOPPED, &bp->state);
pci_clear_master(bp->pdev);
/* bnxt_open, bnxt_open_nic, and probably bnxt_half_open_nic */
if (test_bit(BNXT_STATE_DMA_STOPPED, ...
bnxt_recover_stopped_dma(...)
/* pseudo code */
bnxt_recover_stopped_dma(...) {
pcie_flr();
pci_set_master();
bnxt_fw_init_one();
clear_bit(BNXT_STATE_DMA_STOPPED, ...
}
That's just a basic outline; I suspect the details will be much trickier and
would probably take a few revisions to get right.
Instead, if you are OK with leaving the device disabled until a user rebinds
it, then I'd define a new bit (BNXT_STATE_DMA_STOPPED), set it in
bnxt_stop_dma, and then return ENODEV from the open paths. Simpler, but
requires manual intervention when this occurs.
I am guessing you mean the former, but wanted to check before I started to try
to write that code.
next prev parent reply other threads:[~2026-09-24 17:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 21:07 [RFC net v3 0/3] bnxt_en: Make RING FREE more robust Joe Damato
2026-09-23 21:07 ` [RFC net v3 1/3] bnxt_en: return the RING_FREE status to callers Joe Damato
2026-09-23 21:07 ` [RFC net v3 2/3] bnxt_en: check HWRM response if completion never arrives Joe Damato
2026-09-23 21:07 ` [RFC net v3 3/3] bnxt_en: stop DMA before releasing rings the firmware did not free Joe Damato
2026-09-24 6:26 ` Michael Chan
2026-09-24 17:41 ` Joe Damato [this message]
2026-09-24 19:47 ` Michael Chan
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=arVgsJAfoupBPoEm@devvm20253.cco0.facebook.com \
--to=joe@dama.to \
--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=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®