🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25934

[PATCH net v7 4/4] bnxt_en: refuse to open a device with stopped DMA

#25934
From: Joe Damato
Date: Wed, 02 Dec 2026 18:56
110 lines
14835 bytes
Add BNXT_STATE_DMA_STOPPED and set it in bnxt_stop_dma() to signal that
the device had DMA disabled. When opening the device later, check this
bit and exit with an error. Also add the bit to BNXT_NO_FW_ACCESS() so
most HWRM commands sent after DMA is stopped fail right away instead of
waiting for the timeout. HWRM_VER_GET and HWRM_FUNC_RESET are still
sent.

This is a very rare case, but when it happens the driver must be rebound
to make the device usable again. A firmware reset, resume or AER
recovery does not clear the bit.

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. They were discussed on v6:
      - BNXT_STATE_DMA_STOPPED is never cleared. Recovery is rebind only,
        on purpose.
      - bnxt_resume(), bnxt_fw_reset_task() and bnxt_io_slot_reset() call
        pci_set_master() without checking the bit. Will be fixed in
        net-next.
      - bnxt_re is not notified when DMA is stopped. This needs a bnxt_re
        rework; agreed with Broadcom on v6.

 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 26 ++++++++++++++++++++---
 drivers/net/ethernet/broadcom/bnxt/bnxt.h |  2 ++
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index c1c58f5c930a..1f40914610bb 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -7848,9 +7848,20 @@ static void bnxt_stop_dma(struct bnxt *bp)
 
 	netdev_err(bp->dev,
 		   "Disabling DMA before releasing ring memory, the driver must be rebound to recover\n");
+	set_bit(BNXT_STATE_DMA_STOPPED, &bp->state);
 	pci_clear_master(bp->pdev);
 }
 
+static int bnxt_check_dma_stopped(struct bnxt *bp)
+{
+	if (!test_bit(BNXT_STATE_DMA_STOPPED, &bp->state))
+		return 0;
+
+	netdev_err(bp->dev,
+		   "DMA was disabled after the firmware failed to free rings, rebind the driver to recover\n");
+	return -ENODEV;
+}
+
 static int __bnxt_trim_rings(struct bnxt *bp, int *rx, int *tx, int max,
 			     bool shared);
 static int bnxt_trim_rings(struct bnxt *bp, int *rx, int *tx, int max,
@@ -13483,9 +13494,10 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
 
 int bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
 {
-	int rc = 0;
+	int rc;
 
-	if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state))
+	rc = bnxt_check_dma_stopped(bp);
+	if (!rc && test_bit(BNXT_STATE_ABORT_ERR, &bp->state))
 		rc = -EIO;
 	if (!rc)
 		rc = __bnxt_open_nic(bp, irq_re_init, link_re_init);
@@ -13502,7 +13514,11 @@ int bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
  */
 int bnxt_half_open_nic(struct bnxt *bp)
 {
-	int rc = 0;
+	int rc;
+
+	rc = bnxt_check_dma_stopped(bp);
+	if (rc)
+		goto half_open_err;
 
 	if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) {
 		netdev_err(bp->dev, "A previous firmware reset has not completed, aborting half open\n");
@@ -13562,6 +13578,10 @@ static int bnxt_open(struct net_device *dev)
 	struct bnxt *bp = netdev_priv(dev);
 	int rc;
 
+	rc = bnxt_check_dma_stopped(bp);
+	if (rc)
+		return rc;
+
 	if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) {
 		rc = bnxt_reinit_after_abort(bp);
 		if (rc) {
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 41d05efd6307..50c024dd3c6c 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -2474,9 +2474,11 @@ struct bnxt {
 #define BNXT_STATE_FW_NON_FATAL_COND	13
 #define BNXT_STATE_FW_ACTIVATE_RESET	14
 #define BNXT_STATE_HALF_OPEN		15	/* For offline ethtool tests */
+#define BNXT_STATE_DMA_STOPPED		16
 
 #define BNXT_NO_FW_ACCESS(bp)					\
 	(test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) ||	\
+	 test_bit(BNXT_STATE_DMA_STOPPED, &(bp)->state) ||	\
 	 pci_channel_offline((bp)->pdev))
 
 	struct bnxt_irq	*irq_tbl;
-- 
2.53.1-Meta
Technical Details
Message-ID: <20261202185628.847699-5-joe@dama.to>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376011-linux-kernel-netdev=dewy.ru
References: <20261202185628.847699-1-joe@dama.to>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376011-linux-kernel-netdev=dewy.ru
From: joe@dama.to (Joe Damato)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v7 4/4] bnxt_en: refuse to open a device with stopped DMA
Date: Wed,  2 Dec 2026 10:56:25 -0800
Organization: Usenet Network
Message-ID: <20261202185628.847699-5-joe@dama.to>
References: <20261202185628.847699-1-joe@dama.to>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2035317"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:iblhIt+7J7emf/YJRe7OS9bK7xI= sha256:/jCtxmCrjuLC7zaRIvCxOBf2u3UcH6k7iJ7qVKnYZSc=
	sha1:5fjE+GrMSCEhNn/n4mIW+8OSE+c= sha256:3YoooAdqkHDcNUFL7EFU+a7ypYR+eKpDsuhdxONGaE4=
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 1A0BB117700; Wed,  2 Dec 2026 21:57:18 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[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 V7yrMIRnDLeV;
	Wed,  2 Dec 2026 21:57:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-376011-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 5D7AF1176FD; Wed,  2 Dec 2026 21:57:06 +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 27A4A602BF0; Wed,  2 Dec 2026 18:57:06 +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=1796237822;
	b=MnkMyzyj2bHNGzCx+WmhTtB3sUM70VOSOEMzkJnSDt2zqU99/+1bNSWENkrEP7QPFoNI
	 QibUlRuotSGBoWdniRcfbKnoM6cIqTjxAiGwFHmljgIqLGAQGpQMux6/o8EKRXOD+KPcM
	 HyOufINphGnuhWpIAJr27Zv6ud4t+9ZLXEB8QY93IVF9UUiTiso7ELK6vfb+6MdzzUQqW
	 7Uz19vwtrBoVXBIPAJxh4KiW6j1ksASBA9cZKsUoJD1jvJ0PEuAMT9NqPYicXvdbdOGYc
	 hjsAGkYlqc2iEVb28hmVaKIQNimuaY+xUA50bzmBB0mDCG25HS57H9IJ+Hx3BHLq/mQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796237822;
	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=wV1hlGqS8fHPGaK152JCix3+4Mm/9tJhC3DQC5srj/Q=;
	b=BZSfb9YFHdDOMo8RBZUuRZknI3F1UEurvFAZGaaehFWKqf+TQSfEw4urQvV3K7+YhFsz
	 NKcVbudP97Rw/cqvjThwVM/lDIgDTQcUPHrYp6ySX1ykeVVwIauYTBexFzM/5BRT9lKny
	 W580n6YVVZWX2PDqMKJjha9L6WROzNKzSfRn92zYmUoISZj2XLzgrSyoX0oQipBFWajcJ
	 lDyb5TbF3wvcQtfjkxAYIGTNIy+8t43a0p/bbvx/PvuM7ljzhHNvUo5ALg+GyWo7Ssy1b
	 C+znaEzYTLoy6wW5c1fNLXcDZXTI1uShUEPbono3QEvaYsYSkrSwSFaN8cBbCuKSBcA==
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=Hjenco39;
	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 6896B606A68C;
	Wed,  2 Dec 2026 18:57:02 +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=Hjenco39
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.179
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796237821;
	b=wnhclPoSKdOvi9TkPlZX8SAFEKYLvkN2QTEzAvJtiQEAgE2Vm9yrOAbUOznIkZimMOi9
	 a1DaN93hTdssbQmU2Q0WmA/pt0UeZF245x76EX2IidoYNt/xN1sYTJBjg6WdCbTPBOQ2K
	 QZhzHfGpDyIFaONQwL9DBKyscf4NTJvOHVG8g/TWIiuZTrX5i5326iUEK9cNZtQlOwU6d
	 BAIXT2UCIgnwPRac0C2lajFh2pBlYjKcEWufB/LZW7r2FGEC7Ea4WozzG/6A+fmWzfUar
	 5p8roC0TE8y40C7us3sHzCPkyAXV4Se6itF59NjE5pkVus6EsjVy2izCP35ZE4NgaNA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796237821;
	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=wV1hlGqS8fHPGaK152JCix3+4Mm/9tJhC3DQC5srj/Q=;
	b=f2uR/3VpKIBfl4JDaABRiN9Gh+sT5BZIO3aCTsXAG1iarSfIzg6dHoL38985v4DQMuwC
	 y8uIWPUUkbTKuaUObkTNMHTLva2iGxjFWH7NuOU177TWYTZRfUEm7cPYTg8+I9yle+64M
	 MYjWNiAl6RLz+v2LKq9iNAC8vnSQnqlo0ymbx2dHnt0+2UXAu7GjTG5R0AXfcWhsA0Wl7
	 5slsm80uqZZPFl0XhyhN7tVqFKi73tJTsvcaZaznYGl3YgTUMzQlQURIXqrmXucteJE+W
	 EMZE3Hy03rxe1RGJeMmcBswcXGmcSCpwgVoR9dm7ZKsLmn9fFKghIMw7NPt9jIEKr5A==
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=Hjenco39;
	arc=none smtp.remote-ip=209.85.214.179
X-Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.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 413F9606A6A1
	for <netdev@vger.kernel.org>; Wed,  2 Dec 2026 18:57:01 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 413F9606A6A1
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-f179.google.com with SMTP id d9443c01a7336-2f037bc348dso104858235ad.0
        for <netdev@vger.kernel.org>; Wed, 02 Dec 2026 10:57:01 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=dama-to.20260707.gappssmtp.com; s=20260707; t=1796237820; x=1796842620; 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=wV1hlGqS8fHPGaK152JCix3+4Mm/9tJhC3DQC5srj/Q=;
        b=Hjenco39W7Ts3A5fDzrP8HETRyf6wJk1SURcT1pZIgApw4Cb6W8QbD0Mu5bFxxCIPn
         77loFj9qSP1a8zfJAVlSvnLsCjwpFDlPrrqbEIXWveb4fT3+S9sVh2XA9BSjSCtWnVgb
         W2ffURPXEOcf5fydFIPBTRBFieW2vRTuiRu8euBBXloIbjTvFjPTf0JyFLrr8EPwejmu
         cKu9y6UrzagZnvzojEbP/pUxaMp+6KMJLBSzY17ePRvfs4a/Q7YGwb50hm66CYxM7iKw
         VPlVd7tcnIW+BcpT82geFWZOK+zPi4Jt7OMH3WKe4X4tpmuCWKKNLKDnQv3kggqRlghb
         Tv1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796237820; x=1796842620;
        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=wV1hlGqS8fHPGaK152JCix3+4Mm/9tJhC3DQC5srj/Q=;
        b=Jj1/iBVmZwtdgPH0R9BA5vhgYsB53aUT9hOkQd4IXNvbhjpv7OtnYZ40wRWHTtyDt5
         jjsVIRHsvHQSoiYF86HA89dGLK+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Vm/NNT2JD
X-Received: by 2002:a17:902:ea08:b0:2f0:4667:7e36 with SMTP id d9443c01a7336-2f046677fc9mr434973175ad.23.1796237820397;
        Wed, 02 Dec 2026 10:57:00 -0800 (PST)
X-Received: from localhost ([2a03:2880:2ff:5f::])
        by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f16e685d36sm27819275ad.48.2026.12.02.10.56.59
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 02 Dec 2026 10:56:59 -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