🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19865

[PATCH net v6 2/5] bnxt_en: check HWRM response if completion never arrives

#19865
From: Joe Damato
Date: Fri, 20 Nov 2026 15:28
86 lines
14011 bytes
When HWRM_RING_FREE is sent over a completion ring, __hwrm_send() waits
for NAPI to consume the completion and gives up if it never arrives,
without looking at the response.

If a completion is not posted within the timeout, check the response
before giving up. If resp_len is set, the sequence id matches, and the
valid byte is set then the firmware completed the command and only the
notification was lost. Fall through to the normal error_code handling in
that case.

This check runs only after the full command timeout. A response that is
still being written reads a zero valid byte, so the command is still
treated as failed. The rest of the response is read only after the valid
byte has been seen.

Log the response state on both paths so there is more data when this rare
event occurs.

Fixes: 74608fc98d28 ("bnxt_en: Ring free response from close path should use completion ring")
Signed-off-by: Joe Damato <joe@dama.to>
---
 .../net/ethernet/broadcom/bnxt/bnxt_hwrm.c    | 47 +++++++++++++++++--
 1 file changed, 43 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c
index de02d1baa751..53667c0c38aa 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c
@@ -582,11 +582,50 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
 		}
 
 		if (READ_ONCE(token->state) != BNXT_HWRM_COMPLETE) {
-			hwrm_err(bp, ctx, "Resp cmpl intr err msg: 0x%x\n",
-				 req_type);
-			goto exit;
+			__le16 resp_seq_id;
+			u8 valid_byte = 0;
+
+			/* Only HWRM_RING_FREE checks the response here. The
+			 * other users of a completion ring depend on the
+			 * completion itself: the IRQ self test, and
+			 * HWRM_RING_RESET, which reuses the ring. A cancelled
+			 * wait means the device is being torn down.
+			 */
+			if (req_type != HWRM_RING_FREE ||
+			    READ_ONCE(token->state) == BNXT_HWRM_CANCELLED) {
+				hwrm_err(bp, ctx, "Resp cmpl intr err msg: 0x%x\n",
+					 req_type);
+				goto exit;
+			}
+
+			/* The completion was not delivered, but the firmware
+			 * may still have freed the ring. Check the response
+			 * before giving up and log the state.
+			 */
+			resp_seq_id = READ_ONCE(ctx->resp->seq_id);
+			len = le16_to_cpu(READ_ONCE(ctx->resp->resp_len));
+			if (len && resp_seq_id == ctx->req->seq_id)
+				valid_byte = READ_ONCE(*((u8 *)ctx->resp + len - 1));
+
+			if (!valid_byte) {
+				hwrm_err(bp, ctx,
+					 "Resp cmpl intr err msg: 0x%x len:%d seq:0x%x/0x%x\n",
+					 req_type, len,
+					 le16_to_cpu(resp_seq_id),
+					 le16_to_cpu(ctx->req->seq_id));
+				goto exit;
+			}
+
+			/* Read the rest of the response after the valid byte */
+			dma_rmb();
+			if (!(ctx->flags & BNXT_HWRM_CTX_SILENT))
+				netdev_warn(bp->dev,
+					    "Resp cmpl intr not delivered, msg: 0x%x completed anyway (len:%d valid:0x%x err:0x%x)\n",
+					    req_type, len, valid_byte,
+					    le16_to_cpu(ctx->resp->error_code));
+		} else {
+			len = le16_to_cpu(READ_ONCE(ctx->resp->resp_len));
 		}
-		len = le16_to_cpu(READ_ONCE(ctx->resp->resp_len));
 		valid = ((u8 *)ctx->resp) + len - 1;
 	} else {
 		__le16 seen_out_of_seq = ctx->req->seq_id; /* will never see */
-- 
2.53.1-Meta
Technical Details
Message-ID: <20261120152830.699712-3-joe@dama.to>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367996-linux-kernel-netdev=dewy.ru
References: <20261120152830.699712-1-joe@dama.to>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367996-linux-kernel-netdev=dewy.ru
From: joe@dama.to (Joe Damato)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v6 2/5] bnxt_en: check HWRM response if completion never arrives
Date: Fri, 20 Nov 2026 07:28:24 -0800
Organization: Usenet Network
Message-ID: <20261120152830.699712-3-joe@dama.to>
References: <20261120152830.699712-1-joe@dama.to>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3199721"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:m4dBQu3VT5EZOtRUTfbzkR/Cn/Y= sha256:o7nK0z9u7b1i7kfHI7JQR4VusKZ4labLQv3Fy5xY3qw=
	sha1:YSnScD5bfiTvwD/yXP+Ynb/jFyc= sha256:5buK3aTpW3afuPWXh/BxECM5ncGLiG3Rj1lChm4u/9E=
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 7AFBD1159EF; Fri, 20 Nov 2026 19:08:39 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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 FsPNkZBPxAwj;
	Fri, 20 Nov 2026 19:08:36 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-367996-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 0EBE31159EA; Fri, 20 Nov 2026 19:08:25 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 6C576205B12; Fri, 20 Nov 2026 15:28:52 +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=1795188525;
	b=kBgtw/DTw7GlwkBdSqQKlAZC2Vv7fJ59zOci0YQqW3Akxo2FmQ9Ez2p3KpdwJGV71WOh
	 sUd28GYN6lqBBOu8bGtG40sBJBbNeaNyCtZldq+5IzFCvxuH/4aF/CvYC14LbZpttN26J
	 OhYSIQOizA25lIlNL5LypSk18/nIDOrktDnOn5iXY8+mTAIbCuN1dMDOnWCZonarfhd2p
	 T7EyjPQGeKwT6d8VWHGeboAq68aQCcaiAY6flyJV5HQ21ukEfLJBr31wRqwVx+PCt1yrn
	 YhGAXPEQNssLmuopPpFHUdeZA2QbGwQlbD7h4yTGl92vDWeaAuCjp7wBBj77dm7HXQQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795188525;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=6iFyG/TRTFnFVaxbHFa4tzavqW4H7pOjO5Kz0xPyRdE=;
	b=a3rrX2kgvuZFe3WgEcojpcw8l3VDY2xZaYZYkeCSoGsRwE6fcV8isGytKmXzTkgVwVyQ
	 u9RK15to1KoIl38y6rWknPFtURlFeSiVuRZffvijaRmt2BY79aRXME8hZ3P9Vl0Yh1l0I
	 pLFgJuKc+cIsbcieR1/CHl9x9Xs6wrtl9uUdJ5n5QR9QLy4Emeds6ukHjbyLaQp7tcQuH
	 MMrkU0BS6xwuf6t8sJTY0UBbDE4PsExhBmDcMGBcrY/CKF04Na8dAt4ePwbb83G07GvAH
	 zf7XLGStPoiO/6xyusBFswxFw+KjRvUUXfUlbi7WkZC3nXbG8vZxuUgQKYdwGMCsqqA==
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=m7gqa9dx;
	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 5525460A2601;
	Fri, 20 Nov 2026 15:28:45 +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=m7gqa9dx
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.178
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795188524;
	b=twxauEEr/JB8qPTzEapmlcyOrh/3H87OCa8zm7yDObovPncM1ARa4GK4F1zumL50fGBa
	 f0pZCUJgXzujx+/nn1wc4z6P3IIWgVZgtw45lLsp19NPKYcFPnNP+0tOm/nK1xsCaqr4p
	 kd8oM7cQoQ/RGRXWwbiz3SC6SPO6MKRpHKNVYmW0D0Uep7Xj9slY4+uJL/+k2x0sh+0S6
	 TIdpnRN4aRO40rRIOMXPUtKezYkVJ/5Zd4nqmE91bXwXmIHLSE7J6VG0pY7jBzRTRbINJ
	 rypoAXd7lz0RDBc5j/cYuEioADPcDNzjEJMpUPngyuX8XUa/W/brGWYsOJsOsN5LgqA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795188524;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=6iFyG/TRTFnFVaxbHFa4tzavqW4H7pOjO5Kz0xPyRdE=;
	b=FTEC+qG0lkBDvTNssUR9N2oVjS9DuyXJPuLu1srmQEv/Taq/c62i5izhj1ff1S1upayj
	 PA9g0+wmnGstb8kfiFuurBAEIPqgiP1FGsRktElrsgOZpTnGFad5Fyf3WtaEdy0Vl2uxP
	 GHoa92OQAhDTLwVtP88dlndW1kFTUAhMhO25Qo/Kli3qhpxT5axVcX/NDAoVF3irdmmtc
	 nbgsLGk6jbnHcRWkW5GqBFxLisldY+DfyKe7NzBw4QiL3R1GW/U+/dLiF6lRRNao7+PX6
	 3ohI5sR7nIpfDs5mKyWiShtTTI9sPDqyUKLNEAC4sqS8VK6t/EPGCPzMx09gwJjefEg==
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=m7gqa9dx;
	arc=none smtp.remote-ip=209.85.210.178
X-Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178])
	(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 313F2606A330
	for <netdev@vger.kernel.org>; Fri, 20 Nov 2026 15:28:44 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 313F2606A330
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-pf1-f178.google.com with SMTP id d2e1a72fcca58-8b612fd74e1so425633b3a.0
        for <netdev@vger.kernel.org>; Fri, 20 Nov 2026 07:28:44 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=dama-to.20260707.gappssmtp.com; s=20260707; t=1795188524; x=1795793324; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=6iFyG/TRTFnFVaxbHFa4tzavqW4H7pOjO5Kz0xPyRdE=;
        b=m7gqa9dxsiq/A84tMNHqF4JVUM1Oo42ZflJMzKIecgIJsF75DBOCzd3XyWaMiSm95H
         qHlSzwn2zZL+eW1qMmOfAZ+qBqIPI3iIRxjh4IjLf11qBLiiMeKobi9JQD0s7AloIRMp
         FnBYgJX+E0iFaxg+Uqr2fA0Yz/ErwlL1GTZ8IBbeVKZkvvUCpbjJJmBwQh32VtNGIpzX
         ZYW4jSjvmPawTrzZk7w7t5XM5UNAdjJVS5c+VSwmBAbiaORw3Fpm/vHbMBy3NHof7ehR
         3fnsRWjRQSz42f9uA5eJQC11F7PXukzF3KRJQkl8ta55w24PlGPAPqSi1sNXrMKLSCoJ
         FunQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795188524; x=1795793324;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=6iFyG/TRTFnFVaxbHFa4tzavqW4H7pOjO5Kz0xPyRdE=;
        b=Uo2UxPF/xejfU/bKC1ozgctu0j1olUTZCihK8Uyyj9yGgG1xpAcLWgwNTutVh0ikGo
         68C4meTCtBp8fuoCwM0+gT8riTgTB9y6lM5eAi5dyBoAY+TXhK0aNWw5DqxPsglVSrUK
         2cn/UhNpY6Gs6p+6gmUks3sR4JYkponnXa60XVaI7rk+k4Iw+uu3oyrEUm3f2GP3Dfdl
         WLRV5JL5aqJc/Amt3paIfEcXEwZup+gd1pTMXn4kfFd90QZVpNU6duc20Ulit/3SWvMD
         oZt2weRUYgva9Q725hbAowPHOQUWacdoWtwvo8uLQDh3weLbpSQV29OZTKKUD+d5vXvj
         IAdA==
X-Gm-Message-State: APuU4Z+qvGfnF4YoO5dAq+pt0zp7kcbxh6Rkh7PlJ28zvuL1+8wXD1Z1
	PMeP53fQkqTZ0ZFBQNeN8WXH6oNKzFMaxy47zE3rP+bdy8+aoaKDEAz5LilW6tzMAWDEJeL8ElX
	ODnoC
X-Gm-Gg: AZFdTZefAPR1dyZcQcnx0oAMgoxOgjKQWx2zfhb0sfmp0/bqKlrusWU+G8wCH2OmndQ
	ODgTvUpiKR90/UdQhayK4bQLy84/RfgAqDv4l/+G4116K4gU9C1I4JF4R+4u1Bvc+dYJ1qMllA4
	Vdgk6XJHviGnMn46CFwOXGRwEB20nkw/B0Mz5s8dAYmHqDCOg0ScwsUh2DlAsVrAFWGcpJHdlF7
	FsLMTkGNeirRs7Cs/qf32Yn+xsmTh41pUDuP3U4v46+6c+7c/ZcJgwwO23UMvPiMlMgvum1VjQq
	we00iRWwZAnfVjR+sNXHozrcnU1O042KlYiktqOo76fHMAXOMCiCODB2+rx7/xUy3m1sf5iriDS
	Q7WGHqT2MQFRqJDuPn9sbFlKewYS+unmE1BPZ+f8tYL85f7Bj0wA2aYQBVauT6QWn8vH8dX3QOE
	sbSq0nKK9TsdMudxKteao5/bcfozpP+OLL/vjaBzUcYC5r5DXkzGBHuIPs6x9LB3qmL/NUBX0u5
	cwcA65ZkyFgEJtNBoxwmoqJaVwMWkO2kInJd4ik4SvK8N21Uc/CourNQ4gCOoL0m5cB0n50gRLQ
	uRO+Anccd5ur0RHvlqDamYclu60oUfZH1/CKjgTQ0pw=
X-Received: by 2002:a05:6a00:1ac9:b0:874:705d:f65d with SMTP id d2e1a72fcca58-8c87cf2ad20mr3193643b3a.43.1795188523647;
        Fri, 20 Nov 2026 07:28:43 -0800 (PST)
X-Received: from localhost ([2a03:2880:2ff:53::])
        by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c872e4aca2sm1637924b3a.32.2026.11.20.07.28.42
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 20 Nov 2026 07:28:42 -0800 (PST)
X-Cc: edumazet@google.com,
	horms@kernel.org,
	selvin.xavier@broadcom.com,
	kalesh-anakkur.purayil@broadcom.com,
	linux-kernel@vger.kernel.org,
	Joe Damato <joe@dama.to>
X-Mailer: git-send-email 2.53.1
X-In-Reply-To: <20261120152830.699712-1-joe@dama.to>
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