Article View: linux.kernel.netdev
Article #26562Re: [PATCH net v7 1/4] bnxt_en: return the RING_FREE status to callers
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 19:17
Date: Thu, 03 Dec 2026 19:17
129 lines
12591 bytes
12591 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message says that from hwrm_ring_free_send_msg() and
the TX/RX/AGG ring-free helpers…
Pre-existing issues:
- [Low] bnxt_hwrm_tx_ring_free(), bnxt_hwrm_rx_ring_free() and
bnxt_hwrm_rx_agg_ring_free() set ring->fw_ring_id (and for RX also…
--
bnxt_en: return the RING_FREE status to callers
This commit changes hwrm_ring_free_send_msg() to return the errno from
hwrm_req_init() or hwrm_req_send() instead of always returning -EIO. It
also makes bnxt_hwrm_tx_ring_free(), bnxt_hwrm_rx_ring_free() and
bnxt_hwrm_rx_agg_ring_free() return that value. No caller acts on it yet.
> Return the errno instead. -EBUSY means the request was sent but no
> response arrived: the wait timed out or was abandoned.
[Severity: Low]
Is this always true? __hwrm_send() starts with rc set to -EBUSY. It
returns that value from the BNXT_NO_FW_ACCESS() early exit, before
anything is written to BAR0:
drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c:__hwrm_send() {
...
int rc = -EBUSY;
...
if (BNXT_NO_FW_ACCESS(bp) &&
(req_type != HWRM_FUNC_RESET && req_type != HWRM_VER_GET)) {
...
goto exit;
}
...
}
hwrm_ring_free_send_msg() runs its own BNXT_NO_FW_ACCESS() check first.
The two checks are not atomic, though. BNXT_STATE_FW_FATAL_COND could be
set, or pci_channel_offline() could become true, between them. In that
case the helper returns -EBUSY for a RING_FREE that was never sent.
The opposite case also exists. After the doorbell has been rung, a device
that is no longer enabled makes __hwrm_send() return -ENODEV, not -EBUSY:
writel(1, bp->bar0 + doorbell_offset);
...
if (!pci_is_enabled(bp->pdev)) {
rc = -ENODEV;
goto exit;
}
The kernel-doc for hwrm_req_send() also gives EBUSY a wider meaning:
* EBUSY: The firmware is in a fatal state or the request timed out
Neither case seems to cause a functional problem in the series. A
RING_FREE that was never sent leaves the ring owned by firmware, so later
treating -EBUSY as stuck is still correct. -ENODEV only happens after
pci_disable_device() has already cleared bus mastering.
Could the commit message be reworded so it matches what -EBUSY can
actually mean here?
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 85ce4b2e297ec..c3777e85a6d98 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -7674,55 +7674,62 @@ static int hwrm_ring_free_send_msg(struct bnxt *bp,
[ ... ]
> -static void bnxt_hwrm_tx_ring_free(struct bnxt *bp,
> - struct bnxt_tx_ring_info *txr,
> - bool close_path)
> +static int bnxt_hwrm_tx_ring_free(struct bnxt *bp,
> + struct bnxt_tx_ring_info *txr,
> + bool close_path)
> {
> struct bnxt_ring_struct *ring = &txr->tx_ring_struct;
> u32 cmpl_ring_id;
> + int rc;
>
> if (ring->fw_ring_id == INVALID_HW_RING_ID)
> - return;
> + return 0;
>
> cmpl_ring_id = close_path ? bnxt_cp_ring_for_tx(bp, txr) :
> INVALID_HW_RING_ID;
> - hwrm_ring_free_send_msg(bp, ring, RING_FREE_REQ_RING_TYPE_TX,
> - cmpl_ring_id);
> + rc = hwrm_ring_free_send_msg(bp, ring, RING_FREE_REQ_RING_TYPE_TX,
> + cmpl_ring_id);
> ring->fw_ring_id = INVALID_HW_RING_ID;
> + return rc;
> }
[Severity: Low]
This isn't a bug introduced by this patch, but the ring ID is cleared
here even when hwrm_ring_free_send_msg() fails. The same happens in
bnxt_hwrm_rx_ring_free() and bnxt_hwrm_rx_agg_ring_free(). Those two also
clear bp->grp_info[grp_idx].rx_fw_ring_id and agg_fw_ring_id. Does this
drop the driver's only handle to a ring the firmware may still own?
After an unanswered (-EBUSY) RING_FREE, the main risk is DMA into memory
that has already been freed. Later patches in the series seem to cover
that:
"bnxt_en: stop DMA before releasing rings the firmware did not free"
makes __bnxt_close_nic() call bnxt_stop_dma() before bnxt_free_skbs()
and bnxt_free_mem().
"bnxt_en: refuse to open a device with stopped DMA" then requires the
driver to be rebound.
That leaves a RING_FREE the firmware rejects, for example with -EAGAIN.
It is not counted as stuck, and the ring ID is still thrown away. Is it
known whether firmware can keep a rejected ring DMA-active?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202185628.847699-1-joe%40dama.to
Technical Details
Message-ID:
<179632543122.3146.2991834310660738786@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376836-linux-kernel-netdev=dewy.ruReferences:
<20261202185628.847699-2-joe@dama.to>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376836-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v7 1/4] bnxt_en: return the RING_FREE status to callers Date: Thu, 03 Dec 2026 19:17:11 +0000 Organization: Usenet Network Message-ID: <179632543122.3146.2991834310660738786@kernel.org> References: <20261202185628.847699-2-joe@dama.to> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2574724"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Qz3XdYkw+Dgt3NhVBZAMMNw3jYM= sha256:O9gCL9QinAMCUSUZmA2Z9KPM1mhZzVooTl0dK/5VNE4= sha1:b1ludULVNP0/of+3F6rNQRSseKY= sha256:mcjv1W/W8wevWrm7b1QU/148IELpBFkdW4Yfm5tSdfM= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 9161F117A1F; Thu, 3 Dec 2026 22:17:39 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.74 X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6eOTqNWcIb6h; Thu, 3 Dec 2026 22:17:32 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-376836-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id ED563117A1B; Thu, 3 Dec 2026 22:17:21 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id CC37524000; Thu, 3 Dec 2026 19:17:17 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796325433; b=Jp1tIkOlquMypCN99US2xr7Sm1lHFuSgxWZ67suNpomCUIqq0PzqHCDI8DiH4BBLEu4A NyysLu9Gp1B6Yob8hADQ0EsjhNgpz02bgjcCj74WcN9DzsZMcVHp+ve2hQDVzl4c2Vnug yYEnX235z0rTUnVYwd+p6fvksyr29W1jr7ZarD1qq8NUD9zWQ0Ykq9ND7YQWOhhiSEZ/5 KuzZh9R6oYLmv8bJqmnSxwlfKPnguEHWbG86X9www+5E+Ozr8qBloysFIACOoXIvsC68F 3QKKBE2P4WP5B6aGmu0uW6t66tmpY7n350ltMZmsyCbwNwDEGgM/sv865TGAhmBrpaA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796325433; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=cdFbYnHDliSNOoAFxsXNh4ECSXul+judjab17U7zyPg=; b=aAcwPO6ESV1R/ENl+s69y61xb8J9No4KRytZkRiShzmb5CK/14qzjkH91EPNdTsWz1lt X0wxhduehvsnkTIq9geMPSXALb1UnXLKLx4QlhAe5Pmed9T+yOWBRl6SLC03QG/I4iDCD SIFTKZWFb2RtpdyNnYh0rZfSQQdFSaeXKlDIB9JXfGsnQ1B0uoHcUpgzWcAbGl8EtT58o ZryEuXjUA5JIBBo6Zrtoutclfz6ingrD5eTW9rAyh7kI9L+2DudlPnCSAIi3MiDSFVxve M2eDqZplwlzOdEyWKTf2n716XQOOVcj+ozmlI494sG7A9zHxmNleLjXm+RAA55e4X2w== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Vup5U3r8; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6E3D606A686; Thu, 3 Dec 2026 19:17:13 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Vup5U3r8 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796325433; b=sSZwpxZCUhmKroruF02qaNLBVZYjBuq6keuZ6gND0zN34BDeh5ku7AnskVLM3OorqiUO pEZCdYomtbsnua8gN8l+ogv3MbjAIW1F0qfyyKZ7HOPkX3Pp41RC41Ra/nUgdOPUaR3GE 9WSNIDjLlNCfuTX5iWz4rmuE7u869+sPS4x1YnAqEisBPg5SxAzSUn5IzANvkS0q9oByt SGCiWSO7SU5hQ8FNXVbWwE18RNsGNCth6WQowKRl2wbeNGwwJMamQUYGrwVFzqB2Fw0Qi PfZhVushpWmAEAnOJky3bpBbkyvTAT1wvwQ0qIBzDKMcSk9PlL1qmKSVYTDQC39SGig== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796325433; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=cdFbYnHDliSNOoAFxsXNh4ECSXul+judjab17U7zyPg=; b=zs4EnXGEpzGJXpegl7IbVdJ+esC0+99rU1cBcWfHpFMBLIEZfp9E4j17/gvE/R4qGuEI KeJjKDUznn/ME/DNNwyMrjkAXwuVzu67Pd9vkQNYJTu6ZbhRAITEz2QG/8VZqUt2rGvXC Od0tRaR9i14lSZH5RH8Wt7MQwkPL6es+uwoddGSkqmJrAgBPZEmBwVDc8rSyXtzO3m/JG 7ukd7RoLnBi+7mbWykiFgiXX/+gU8n62F4A28hNQItwkVwnQh5bjH2iS2AnvctnC9VC2R u0iqMzp30nShJDMGNwfuKMX00vhEv7S83f5pqYZDFCmEMAE6nPG3dLNR0iD8n1VnW/w== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Vup5U3r8; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3AA6606A322; Thu, 3 Dec 2026 19:17:12 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADE781F000C2; Thu, 3 Dec 2026 19:17:11 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796325432; bh=cdFbYnHDliSNOoAFxsXNh4ECSXul+judjab17U7zyPg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Vup5U3r8fSBSJXeIDD+O67bIQKwkTMtG3boBTD9hEMPEc+h3GxZ/LaXnKiPtXzO6D Q/Y7dAJSsmOt9lG2vzRwpaUhrR/4BoBS4t0GO0uwQHjOKQoVvrIPkczq6biHIS2mVq fnvJh2vkji1RtwdXB4UiD9acWknMvsT6zN691CwEdQZZkCZYsMNDYbf9j4V2/7h/Tp sQ3b7N7r0TZB/x2/5wO8ML+kJw/J95jzAyq+MdcUQ7OeF6BhVmrsX9/YcA8eMy8Ww/ FSlA9aCay4Ozbvw2dGhU9tTLaXCqNOew0qSXs7u75XuNIas+atX5iS/HiPaa3vv7ae 5TNGvq82Q8D2A== X-Cc: netdev@vger.kernel.org, michael.chan@broadcom.com, pavan.chebbi@broadcom.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, prashant@broadcom.com, selvin.xavier@broadcom.com, kalesh-anakkur.purayil@broadcom.com, edumazet@google.com, horms@kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261202185628.847699-2-joe@dama.to> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list