From: Jakub Kicinski <kuba@kernel.org>
To: Wei Fang <wei.fang@nxp.com>
Cc: claudiu.manoil@nxp.com, vladimir.oltean@nxp.com,
xiaoning.wang@nxp.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
Subject: Re: [PATCH net] net: enetc: fix VSI mailbox timeout handling and DMA lifecycle
Date: Mon, 27 Apr 2026 18:55:56 -0700 [thread overview]
Message-ID: <20260427185556.1805c3e3@kernel.org> (raw)
In-Reply-To: <20260424021534.2740211-1-wei.fang@nxp.com>
On Fri, 24 Apr 2026 10:15:34 +0800 Wei Fang wrote:
> + /* The VSI mailbox may be busy if last message was not yet processed
> + * by PSI. So need to check the mailbox status before sending.
> + */
> + vsimsgsr = enetc_rd(&si->hw, ENETC_VSIMSGSR);
> + if (vsimsgsr & ENETC_VSIMSGSR_MB) {
> + /* It is safe to free the DMA buffer here, the caller does
> + * not access the DMA buffer if enetc_msg_vsi_send() fails.
> + */
> + enetc_msg_dma_free(dev, msg);
> + dev_err(dev, "VSI mailbox is busy\n");
> + return -EBUSY;
Sashiko suggests EIO here, since it's effectively an IO issue
and this errno goes back to user space
> + }
> +
> + /* Free the DMA buffer of the last message */
> + enetc_msg_dma_free(dev, &si->msg);
> + si->msg = *msg;
> enetc_msg_vsi_write_msg(&si->hw, msg);
>
> do {
> @@ -269,7 +292,7 @@ static void enetc_vf_remove(struct pci_dev *pdev)
> enetc_teardown_cbdr(&si->cbd_ring);
>
> free_netdev(si->ndev);
> -
> + enetc_msg_dma_free(&pdev->dev, &si->msg);
> enetc_pci_remove(pdev);
Sashiko points out that if the goal is to avoid memory corruption we
should only free the buffer if the mbox is not busy. If it's busy
printing a warning and leaking is probably better.
--
pw-bot: cr
prev parent reply other threads:[~2026-04-28 1:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 2:15 [PATCH net] net: enetc: fix VSI mailbox timeout handling and DMA lifecycle Wei Fang
2026-04-28 1:55 ` Jakub Kicinski [this message]
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=20260427185556.1805c3e3@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=imx@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vladimir.oltean@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.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