Article View: linux.kernel.netdev
Article #26655Re: [PATCH net v7 1/4] bnxt_en: return the RING_FREE status to callers
From: Joe Damato
Date: Fri, 04 Dec 2026 02:14
Date: Fri, 04 Dec 2026 02:14
133 lines
16864 bytes
16864 bytes
On Thu, Dec 03, 2026 at 07:17:11PM +0000, netdev-bot+sashiko@kernel.org wrote:
> 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?
Yea, if I need to respin I can reword the commit message. Not sure it is worth
a v8 for this though.
> > 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?
This predates the series. An error reply means the firmware is alive
and handled the request, and Broadcom confirmed on v6 that only a
missing response should count as stuck. Every TX/RX/AGG failure in the
production logs was a missing response.
Technical Details
Message-ID:
<axIiCaiuGvJWLY/Q@devvm20253.cco0.facebook.com>Path:
mbox-mo1.pugleaf.net!news-sfo.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376968-linux-kernel-netdev=dewy.ruReferences:
<20261202185628.847699-2-joe@dama.to> <179632543122.3146.2991834310660738786@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-sfo.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376968-linux-kernel-netdev=dewy.ru
From: joe@dama.to (Joe Damato)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v7 1/4] bnxt_en: return the RING_FREE status to
callers
Date: Thu, 3 Dec 2026 18:14:33 -0800
Organization: Usenet Network
Message-ID: <axIiCaiuGvJWLY/Q@devvm20253.cco0.facebook.com>
References: <20261202185628.847699-2-joe@dama.to>
<179632543122.3146.2991834310660738786@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2653911"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:c+N7IELsYDJyWbDasQN4Y89/Qro= sha256:xi8At5K7gtuuHYDyBWEQiSDGQ1hNOzSETVkhL6VFAI4=
sha1:E94R2qb1u5WEz2JeHALHstmPuBA= sha256:fQajwgRsH5IfyXuEQLJ4Ml2lDXvAx0sapYQNDF/D1LY=
Content-Disposition: inline
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 E6F9D117AA9; Fri, 4 Dec 2026 05:14:50 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.299
X-Spam-Status: No, score=-3.299 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.001, 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=dama-to.20260707.gappssmtp.com
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 Xu_foS1UcwmK;
Fri, 4 Dec 2026 05:14:48 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-376968-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=dama.to
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id 25550116D9F; Fri, 4 Dec 2026 05:14:39 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sto.lore.kernel.org (Postfix) with ESMTP id 31B1C601656; Fri, 4 Dec 2026 02:14:39 +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=1796350477;
b=MiqjdiWTVz1j+QTDlRPrGL7gihMG+brefo4kvMAdxn2uqUy56xbEEfR7ojn4b+6U0Y6q
u4w6F6l+ejIYgizahSqP5JZPPpercZdECQJDz34R9Av93bX+K3LW4LoDflydL2Vp5dLjG
alGPIPakSrMekkQNis8/OrTtaPq11Bix/n/TBulS7ZigokfYdUYJWPWvvk22Mji+iHcYW
IY5fXjB6wePxxargN9u7gfS7E3I+suqmw9TtKoXwYvLy19K7DFg0TQNu4/r+loM9lR5CK
L/cD3wXqdyRnazLfm0F4o1NzdvNCPVo2qW8xVBOV3SUHhbdXm55AQcEADF1bmYMLU1Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796350477;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:
References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
Content-Disposition:Content-Transfer-Encoding:In-Reply-To;
bh=CoA+QCPa8+XT3SUbbv6OKzxblYoy9qbg9CWtaPZPXvc=;
b=CY5yagqtb+thsiDRJKvwE45Zwj7YFR8hXW64Voy7ixEZHSOhmA+T3MzL4f0wzsshG2Qm
T1hv/h318jgcQR16Fb3Wds0b4LQEdUKiuK6APWJx+cw5/3LJMB92/IdiNvUWW87mo/cKh
BRKAF4IiMzhfD8yZd8oGc56ipApyc5ei+Fgm/+Ltol6rs/L8E0PoBrY8HbyNndFK6DtNe
zZH6mmMBMRaF2kiVYRNuyga5OZxs/yulHoNH+2eIpW914xMIRV4qByp4o3TFAqh+dVIEm
+cyXj+MH58DxL33x3B+o+DRklCqkEWY7Bx9h30bu3ePyIwu91ZmxcTD0qMRe7dk354A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=KWgonbKC;
dmarc=none header.from=dama.to;
spf=none smtp.mailfrom=dama.to;
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 7009D606A68F;
Fri, 4 Dec 2026 02:14:37 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=KWgonbKC
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.179
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796350476;
b=a7f1iIP7+gjqLDJprKNgRkByvbF2u1gm7sJGYmnMbZa2rS53/LYHhOHeKaPJGRGCPZgt
gON8uCFxwdsvJVekpVue1ub+mL5PWk4YHH9RzJ2b9edXDZ7POEKgR+JF5YhBoEvDfWGLO
uwCdhAOtFig2kNFBFYSYcgicM1tnN/FOrfTlNiabvrm3NffzQtdy8EbE7Rp+/2hQCWVmL
PVCQxbXtUi3zfiAbRRTpCHw+lMX2rpGPDPXNpCHrLM+rywAdbi7KPbEbjdc2DSKXG8vXu
KfbH3KltOExelysaTNBodwj4t28VrjDAG2AgW0YDve+oUZ8ukohsl1dpilVDmMOQ+CQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796350476;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Date:From:To:Cc:
Subject:Message-ID:Mail-Followup-To:References:MIME-Version:
Content-Type:Content-Disposition:Content-Transfer-Encoding:
In-Reply-To;
bh=CoA+QCPa8+XT3SUbbv6OKzxblYoy9qbg9CWtaPZPXvc=;
b=OeRkj7jBKDjAZpwfI5RbtvhOph2g8+ANlWBpZGkTGA92z8PrTPtvktpJhjW5e3YHLMzz
iKrmRjE2QsAgjgAxl2y+KBU1klS5q63Rb2MHwvsPneI575PZZ4tAOLgBPsuoPIrGlgY61
5jAzjWVF784ygmFNzwNOF3H91CqIj5vempa8oO9RtHYwn21vdWahv2bzTKM+62NaWYiNb
9V7P7v7UeDqf+6lHLVyCbu2eVLnucXMGxDxmB7K2aq9xeGB8tLQaF04naXkWsOAOUk9wB
bxOfMh4WfPZhLfig9R7hGTEYzg7DyX1WepK6mhgCvuKtPDuOe6SM6i4znxFzl5NeyYQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=dama.to;
spf=none smtp.mailfrom=dama.to;
dkim=pass header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=KWgonbKC;
arc=none smtp.remote-ip=209.85.215.179
X-Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id F4050606A685
for <netdev@vger.kernel.org>; Fri, 4 Dec 2026 02:14:35 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F4050606A685
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=dama.to
X-Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-cddc597d062so269067a12.3
for <netdev@vger.kernel.org>; Thu, 03 Dec 2026 18:14:35 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=dama-to.20260707.gappssmtp.com; s=20260707; t=1796350475; x=1796955275; darn=vger.kernel.org;
h=in-reply-to:content-transfer-encoding:content-disposition
:content-type:mime-version:references:mail-followup-to:message-id
:subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=CoA+QCPa8+XT3SUbbv6OKzxblYoy9qbg9CWtaPZPXvc=;
b=KWgonbKC/z0vfN9muFBi6ndIa2Rzjr02gcc4HkW5VVovHnMBe/7S25nEjK08HPThre
NdlCv7gzA+3m/RpPKhWc+d5az13mTz0S01A2m4Ix3x1t/0Ai+HiTYeFmKelSwRRHU5AK
HAMYWpdIv/hV1dKItboeC8bnWHJwhfXB9zKdmH+qit9Mky0j+ZAMQRRMBrXqdyoNgboM
Kwc/0yI18B4CxTL9EQU8ywOXxFZsQxy7d9U/2LW1jDUIOFx5D2T72ztmQ2rlmQ4K7bAX
ASoOXBvHTaZJ7epR/xReU+2/28Z/bvB/Dyd69poIQ7rbbzYnkZ5OGiu56e8fspvPxJb2
imXA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796350475; x=1796955275;
h=in-reply-to:content-transfer-encoding:content-disposition
:content-type:mime-version:references:mail-followup-to:message-id
:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to:content-type;
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lcVKaEu4VzxjTUFe+ZEEEozRpGnUbh3/gx5GK7fFC4LHiZyOtylvQb5xx
Nf+tIR4Jyrs7IJzn9IBe4DG1kOcuI2O4vfyk1PL0Hjg=
X-Received: by 2002:a05:6a21:3a46:b0:3f9:ceaa:90e with SMTP id adf61e73a8af0-41561744046mr669366637.23.1796350475143;
Thu, 03 Dec 2026 18:14:35 -0800 (PST)
X-Received: from localhost ([2a03:2880:2ff:5f::])
by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ce1237e1730sm373150a12.23.2026.12.03.18.14.34
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 03 Dec 2026 18:14:34 -0800 (PST)
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-Mail-Followup-To: Joe Damato <joe@dama.to>, netdev-bot+sashiko@kernel.org,
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-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
X-In-Reply-To: <179632543122.3146.2991834310660738786@kernel.org>