From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.179 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== 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== 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 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 ; Wed, 2 Dec 2026 18:57:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 413F9606A6A1 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=Hjenco39 Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2f037bc348dso104858235ad.0 for ; Wed, 02 Dec 2026 10:57:01 -0800 (PST) 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+6ZsmY9LxpEoeEtmfn2NR5NZrYAeuKo4fTEa+2qR7w qIaRum91xpe3oBIMOIKYnFnFvd1rd5ur01IZc0GDQ90hBqmnm8Yjg8l4rFaFH5X38txv Rw94nb6NfRDGAohaJKKP7dQwNkYhOakzJGuiT8RUDT9azpwAw/NbIFLzBb/+uH+7GTWS lcUr9WMU6HyxjIB9nKYCq31et74H5T8/qMjtDknE+oxTUWdRX7jTskGL78JpKYIyKjyy 4BwQ== X-Gm-Message-State: APuU4Z+ZXN63WXBp56fvr7Z8jXr5k0vUahtmHy8Sc1eNI75kSO6i8EQb U4OZtaU9y0A9Qaxjmx+XpWqDDglzx9OqntauZg2rhNBE1RLIYH+uuz/do3ddKwSYijmqxI/z8QI zNjfH X-Gm-Gg: AZFdTZdjj9L4pSUi26cwyxhyVjxJnE+h9aoD7X6135fu9x+2Bemv+y7q/ZMU4WbJnGi Eu/O0kD1n6NmbGuAdd8ywMLTCT9/F1QkfBWLnR6MYB8SXfZOqlUS9yvbDAlvCN//dDS9hY0iSNd 6X/Rm5FYK8UYC0DhkE3Q6haLwHtmi4UPvhCtZjvtzyX1ai5Pofzp0fT1rwbanpvxH2XHxxVvY2S evjRlKkWTxSKNHjP8kV6/La11sfmTZXTxRAE/LSggi9AdFU7UBQwiMQS4Nr7cfjJWm8inhBLDlJ IRDcnhb/Ys2g40kCzXrPDAbILAYDC1fWBDRt1YclvQwE2+841ELrliMl+duo9ilsv7jtzUxhUMW TI+XipHcCYeFnCGl0tHdyWgGO+kXxW/ICG87JCs+RFI9CN9qBBZ1tmB2tlM2RVAWwkEtkdT0fkD AZ/WDuI4xlhPi+I0iin9KqMh2VvzG/ihVXVbbAcxx/TTlELe57eURb69JvFwgnhB0eoqStmD17a uHi/F9v1ZScFgJo0kn/m5U+m6TC7cidszWP7OzyOTfk1BZT/GaBKJSjpLc+3KsVKWqN/NdXFAD7 ErX746fgEQ/FOYTyPZsyBBTMBLx500Peer5Vm/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) 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) 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 4/4] bnxt_en: refuse to open a device with stopped DMA Date: Wed, 2 Dec 2026 10:56:25 -0800 Message-ID: <20261202185628.847699-5-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 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 --- 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