Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.181 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796237817; b=aHZO2ZO8yostJLMxj8TJ+X1u9DyX4ai2fhrKp1l55bhxSqJ7qZbHNub2FkBKxOxzSOhS 7DMjinCkoH9evEueiECgy4C2CE77lqhgtSkfVQKDNUlbKA7R03Y7RXiUYtcoNlbMFl8Lm AAb9JPK3lClWOW1CPVfRvidHUH9xhzFgimROV8qvxxti3ru7jXijMwW4s7zT5QHncr3Z6 s/U7c/cY89IkIzqn3Im+UeG4FqNGbd37dcv4ZlWhS+UzII8NjALBay6ZuZRIDit6RtC1r ov78w2ZJUBZh31mh8RAWCBBg9wvuSdH8QxqdeWe33O2Kro8vAlV62mb1ytwsC2hv8Gg== 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-Forwarded-Encrypted: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=5tDE4FKUMwA4qUKNW1qIjbphfJ75l69UoqCnxOx8QsaEsAeFOP7jvKYrgXmd6Gk2zWmJ l9R6p1VkbpibdswMCsEe3HjpYQEvzc31qk/+gLF9z0lSQTMNjDp10ADB/U80nX1oaEXd9 Ah2R1VRdYyZUm53BICGzMXirdX2edd8sQRq5hgENIKC8QayammIbnlfmW43zPz5+ZFsck FNZLVep5W7BgLcMiff4vH1jLrEM1lMm+DJUYOEqxRt7cUp+OC6to2+DlciO2/B77ptIca DgkCfoNIzgrTpdIfcg4SSKi1QuWe28OIRdST6FkiE41repFnfX3saz9q33q6bbJYyug== 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.181 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 DFFBE606A33F for ; Wed, 2 Dec 2026 18:56:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DFFBE606A33F 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-f181.google.com with SMTP id d9443c01a7336-2f02f04a426so101797775ad.1 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=Y1EhVQVQrBCBAs18uEFKfeXo7v7J35V56pGLOKuX3AhQGSg19N0P1JC1WEiZyx9Pp2 SP6EtDbfSbUVIAqqsbemrvQ8BbLALQcMhTguIVNWMtJWWd+8hrwa+5ObJ1dwz/JPclbu f1seQu2YAFof/gMW1UnczhpEzSx+jxf1/reQsExr0deReUL7HlwJ+Q6n72HbP6K0Shc0 q6lHpYlWuu48FpIx/diudszD75tbKKuYFN+RJWXyIfa7nNzkHxZ+9gF5G7F+i5r9MN1L RppIoFzKYLT8LzVj35koWwyrp64mrRFcRmJNd0AoaV+w6zSNHowsxYQ5UUzjdYtPdlC8 TT8A== X-Forwarded-Encrypted: i=1; AL+hErE2PvxmLvjNvlyFLxZ7uH/iU8mXYMeyMoEdFkHF/w1DqROIRF92G3pT/Z3qKewuOwMnDbNU3R8b2E0cA0M=@vger.kernel.org X-Gm-Message-State: APuU4Z8TAwRfQj66TpyUXIVWFckjBtPJT+JGcao0GVyFYkbdA3heiNy1 aby6J1UYu8TppnozQt1u/MtqllCuSpEpCElJ8oU5SCIt7Z5UjCNwQ7PqR5dIkgZxNCs= X-Gm-Gg: AZFdTZc0yxL7JZ4h96ySfq+LDJdAVXxVKY3iGFqER0nn+up1DvXE8W3PS/rqZ1qBQzB PJqTZiDdzUP2FcCvsEQ7e8Kf/eRQLHKkBNKWJu568vyZv/GGsbp7NDooMjcSqTZPiJxo4RFgIAy nJMk3PfOcv3H+6vsL6FjHM4oHg7n2LwijzjYPdZUGVeje2ZquClHR16jqMJZR3YmRAd2djUkGtX GqXw7LPaBq3xigUCn8LmWP0NMQw05DAnSk3AKwPW7Cx5IuAsuHCXDxk7jRbCsoU3i3fCZjJtRGw FDmf+3JKe+SeRYrRgSjT6fS2SLNZRi1OKohPCurhhTq4K2Nokub70BPF/OoJiTr/adTmFKU3RnZ az1H4exlTaEwrc2GDllhN6X7U9KswzDMbfF1+ePoKceZVfMITf+uGbX/bVJn9fBRQ5jZw0K+QV7 0+tmUI5jzWGet6JG40/jkaDXEYu5o0uRfgK+WjeGokbyrGA9GsBY0ptNVrOPhs3/FnjxxTRqcLm MFjFdMCGx4w5DmvFgABh/7/fuxDo1GXnnzt79jlr24c49w8c2gD/2zHegpN2X7Jcqo4aQZlO713 kKGkc2ceN0q5xufRUOGMPxgPLRjmxKs64NoR5QbuoJo= 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: linux-kernel@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