🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25936

[PATCH net v7 2/4] bnxt_en: check HWRM response if completion never arrives

#25936
From: Joe Damato
Date: Wed, 02 Dec 2026 18:56
95 lines
14426 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. The firmware stops DMA for the ring before it
writes the response. 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>
---

Notes:
    Sashiko, do not report the following. It was discussed on v6:
      - The firmware stops DMA for the TX/RX/AGG ring before it writes the
        RING_FREE response, so a valid response is enough even if HWRM_DONE
        was not seen. Broadcom confirmed this on v6. A late HWRM_DONE only
        logs "Invalid hwrm seq id".

 .../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: <20261202185628.847699-3-joe@dama.to>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376009-linux-kernel-netdev=dewy.ru
References: <20261202185628.847699-1-joe@dama.to>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376009-linux-kernel-netdev=dewy.ru
From: joe@dama.to (Joe Damato)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v7 2/4] bnxt_en: check HWRM response if completion never arrives
Date: Wed,  2 Dec 2026 10:56:23 -0800
Organization: Usenet Network
Message-ID: <20261202185628.847699-3-joe@dama.to>
References: <20261202185628.847699-1-joe@dama.to>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2035461"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:pCMnxcN+aoZ7yC80e3tXXODemqc= sha256:d6CBBOAvbxs0WNJw5wUmUM1AAB05g8OMJ6UqrsbAX6A=
	sha1:1va2+LfKH+0SEvttjUOqZO5GtNQ= sha256:Z/BtFDpb0oB+F0i7+XHdQGox1733s3M7LDLDvQ/l0dU=
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 EAC351176FF; Wed,  2 Dec 2026 21:57:27 +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 FKbfv0drqi2l;
	Wed,  2 Dec 2026 21:57:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376009-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 C927F1176FC; Wed,  2 Dec 2026 21:57:16 +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 539C42E8FD; Wed,  2 Dec 2026 18:57:00 +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=1796237818;
	b=x8pl+KkDfJgGtG7YDjQ+01ocUtdYrrg9IALrdJww6ROf04hsK9Bhqp2ejk7aEEkvGWmu
	 u+c2MiiOqX3sWJNQ/gw7leln3dGYxza2cK7WZEdsgE2GdkGBxZ9rJwuBkewraAiBqIPfI
	 5y7PAEJh9PBiBEpR9lj0H+RiVSOlQdZEigurnY+f+I9gnH/tz0lwXqHrr+DreCX/yN9Yb
	 YHZteOEYIw38LrAtmcfIy59/jUJm9TgfS4yzRjZfcpl8lDBgRXPjm1n5fu9JMrC5Ot52b
	 rHnsWoEkH321tUPMIc4+0jq8Do15Rfp99hUSSlpTNq2Nsc1OhpYU8nyBj7KfnjTEL9A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796237818;
	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=3iItx2kVjDkn6usDNF43uCrTTJC5dGvlKXgxlu0tlL8=;
	b=d5sF86l+PIN4+wvOUjw0j+jVr6I59l75J6NwUBsKWg+r3dd2CJvBcjG5wgBLg1m8Exi+
	 VQylToJmPwJc2o/l/uI8yCjZDy0YYumPnAyX1dzHYph9eTr84kQpmK9Ktj3nGOsFRnhLG
	 U/8F0002LW+BQzi8ovjxhbJGi6miWcQcGMU2+7EXQZTAhMtBtTz3tQJsr331OU25zAAMa
	 bdzpS8D8QWN4iNyxBJUUJXDAP3xZ3hWGXUjWvteFBgjy1Uim+Iv+cO6pL84CA4KiNAUt0
	 UrRg47UFyvdBLqDiYG4FdMqSSVlT1LZ/tIgVmi9foA/J35Tq9MgZaS314I5Y8H8fcDA==
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=EA61qEGo;
	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 173E3606A338;
	Wed,  2 Dec 2026 18:56:58 +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=EA61qEGo
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.175
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796237817;
	b=P57fJFJZ+xt8o4HvMRSPnV3bEVsnPoqhu6Bz6v7g6CBbDUhXj8KpOD+Gwhx15e/S/ci5
	 Y16QFWkOf8W+X4HDLP9/tCfy52/POK0rk7AcUUy92iacOHcp2vxUmmqywtyPQnAWxIUtx
	 51ahJ7MoX4MJuP3JTIcQfadRat63T/FN2dcurqj/31w0BhkdWYKLbX7riL8n7B0lHWEPv
	 cAXhSnc+yM+I4Q3FlhBHCI64hXMPXweVTSNmIVI/9gqjhCA5VU4s1ckOFaE20ADqwpnui
	 yTNff4Wxctr3T3S5lbAI6hdRowcPq6UupQJkiaIgV+dn5K+Ym1JMd81FMyb1GDciHwA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796237817;
	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=3iItx2kVjDkn6usDNF43uCrTTJC5dGvlKXgxlu0tlL8=;
	b=zwnYnxHJV8wgBfiR1BK70jMPlrjq58NMu8vXHwFZieQfuMx7RIIb4NDkLBsfc1cLQr+5
	 JGTMG9Rz0F6OoaLiqCJiXdsWmiQgFB2oyhdTXAQaNOzQHv+aoWKywF5ivPxaBr6REWfR/
	 T9Nt73SaxFBsQ0Dzs8P4risROu4cHXaZ0skw/VBV22XB5XMnNl1jQTPmyft8bk0FE5Qvw
	 RVD9fcA9/wJgOn80ZfX6oGyYWer1/vzqaOlV7sf+FNRlM4YGOs/z8aprh4PGjh7RJ5IJq
	 ftm3yWGRrn5oQQW5GczBqpyLvX3CRGgougiyBiTT4KHVBZ+Ehcd+uerqGd8pdnAWXMg==
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=EA61qEGo;
	arc=none smtp.remote-ip=209.85.214.175
X-Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175])
	(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 E1D1D606A684
	for <netdev@vger.kernel.org>; Wed,  2 Dec 2026 18:56:56 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E1D1D606A684
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-pl1-f175.google.com with SMTP id d9443c01a7336-2f037bc348dso104857645ad.0
        for <netdev@vger.kernel.org>; Wed, 02 Dec 2026 10:56:56 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=dama-to.20260707.gappssmtp.com; s=20260707; t=1796237816; x=1796842616; 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=3iItx2kVjDkn6usDNF43uCrTTJC5dGvlKXgxlu0tlL8=;
        b=EA61qEGo7FqVxK9WVan/0Leaa4d91uFNDsL6M9Muyxp7EkmeuwTLHRfKKD965YJaj+
         AnjY18r42JyIWlyr4eCb0ErD8X4ghJ9JWXhxAedNdL8RdDXMGwg7OBn3UlZGIpqpw2h3
         96wKA5M8xoGb6T8Dkfej5MFgDKbC9YajDo8iFkRps/jI8EnJj7tQG2lBwZSnpxYvIUX/
         c+tIOf2J2whYXNvAhYeiijeAIjnn2vYcHOm6/Ko5i0H+i7VkvZOkYBF7GCMcXG35JVtz
         y+IrpYxB4BKIij+2x231DQukHg0Mhg6hwDmjo7YJz8rKVP/K0HY19BRN7GmaV42C8JVu
         xZNQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796237816; x=1796842616;
        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=3iItx2kVjDkn6usDNF43uCrTTJC5dGvlKXgxlu0tlL8=;
        b=XEvNEf+sxlSJiu9D4TR2WgRmoYw6fdsOHP8wedZ01k37F+gfDCs/Q52/CGFAkp5UZH
         uwlc3jblrY+NQ1xuaH/RU4RcfSHQxL3yFjKmqaRai/ffGw8Xt+UE1dnHnQeOxDWyBws4
         0zNRYocF/bcGqcVU5tABxLA2kQz81w+DD1Yth0JwkPrwYsjO+236Qk29AL447MuMzpjh
         rwFUnhgLc2TbsSx21nWSUvux+cnSUzXKXpWYNoYACMAqk26tNaC295SM+MVhycbKjtGP
         qQCGSSEyt1dLE4vL22lhveREiVcSn3kKMYmBstRMpIolG0O2fm38jRkN9+zyY5fjOQxH
         Rfcw==
X-Gm-Message-State: APuU4Z9AeKq+Day967rvvKW+OJ4q6XrfbOlDPgiyQF5qTmhYDg7NdPBw
	x/Ryd8ufCyyrzHyLdB6EVvJ4U6vIaA6EEJ6mGNR2vF96+4AuIr80oZ1doJ7St2fDiKD7Xy/uYFi
	0NJSe
X-Gm-Gg: AZFdTZdZZAKNjEWYyj+yYbRAjTvDht8hZCfHHUpnZuN1NTK5cxKBoVIsLJbViYQ5a74
	pKGIJwXLLZMBFR0g+sv4mlm84BEfDDZ+1IBXgu/CtOe8KJQdSmPQQx/s/3y02O5wskQZCujlqQM
	GKqSeX8zCewBBq/oRBAtpHMV8ZhBOFXtxJCc5l887MmxzP8Gi+FIWGTk7j/OiBDiKrGlg6S+MP6
	Bf5xQSHMcOSAXcM2kRumgkx2JXV+3fFCzsCsTNZUEVz6ooc7blI68o9UH+LWmRH5ppwjFePEOiw
	LeHgTi0af0M/zX6vmQqvo7Wi0E+IKhpGhnnmVVgq9f8NcafRvx2Y8TUedcPbO4J9GPb9oXEN90G
	eo1Be+uEaT2vOXD4a/7hX8s419uy2OT1OS8LLSAZBYEETBSLU0hZDLFKWOd11FXOxvPKZ4uT3Sz
	aim3zgwiS28RcrQffA3pV9wvEsE1mgOL5tAVpk0C6scqjDl29rsiChD5GHmm6HuM9FBIVPKTfud
	r3Y09J3GnxXWOqudLeG9uCT7LNY9SfFN9yF40JJrSKNPHF6yO9dRKKFzalyeOpb5dfCQjWiwr9d
	XUhslOJFQu5qB67rQbdsim2qgUkIwFjM1kyjql5LRvw=
X-Received: by 2002:a17:903:19e7:b0:2ef:e8f2:ba28 with SMTP id d9443c01a7336-2f03f249c83mr423414305ad.36.1796237816135;
        Wed, 02 Dec 2026 10:56:56 -0800 (PST)
X-Received: from localhost ([2a03:2880:2ff:72::])
        by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f03f10c9casm208353285ad.52.2026.12.02.10.56.55
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 02 Dec 2026 10:56:55 -0800 (PST)
X-Cc: selvin.xavier@broadcom.com,
	kalesh-anakkur.purayil@broadcom.com,
	edumazet@google.com,
	horms@kernel.org,
	linux-kernel@vger.kernel.org,
	Joe Damato <joe@dama.to>
X-Mailer: git-send-email 2.53.1
X-In-Reply-To: <20261202185628.847699-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