From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.175 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== 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== 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 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 ; Wed, 2 Dec 2026 18:56:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E1D1D606A684 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=dama.to 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 Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2f037bc348dso104857645ad.0 for ; Wed, 02 Dec 2026 10:56:56 -0800 (PST) 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) 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) From: Joe Damato To: netdev@vger.kernel.org, Michael Chan , Pavan Chebbi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Prashant Sreedharan Cc: selvin.xavier@broadcom.com, kalesh-anakkur.purayil@broadcom.com, edumazet@google.com, horms@kernel.org, linux-kernel@vger.kernel.org, Joe Damato Subject: [PATCH net v7 2/4] bnxt_en: check HWRM response if completion never arrives Date: Wed, 2 Dec 2026 10:56:23 -0800 Message-ID: <20261202185628.847699-3-joe@dama.to> X-Mailer: git-send-email 2.53.1 In-Reply-To: <20261202185628.847699-1-joe@dama.to> References: <20261202185628.847699-1-joe@dama.to> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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