Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Apr 2026 06:45:02 +0000
From:      Sumit Saxena <ssaxena@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Cc:        Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Subject:   git: 8743209350cb - main - bnxt_en: Re-enable SR-IOV after firmware reset
Message-ID:  <69f0576e.30542.432194c9@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=8743209350cb4b7db6d367df99da0a7ae3bc5d39

commit 8743209350cb4b7db6d367df99da0a7ae3bc5d39
Author:     Chandrakanth Patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2026-03-31 16:59:02 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2026-04-28 06:34:31 +0000

    bnxt_en: Re-enable SR-IOV after firmware reset
    
    When the firmware undergoes a hot-reset and the driver re-opens the
    device, previously active Virtual Functions lose their resource
    configuration.  bnxt_reenable_sriov() restores that configuration by
    replaying bnxt_cfg_hw_sriov() with the saved resource parameters.
    
    The function is called from bnxt_fw_reset_task() in the
    BNXT_FW_RESET_STATE_OPENING state, guarded by #ifdef PCI_IOV.
    Because bnxt_cfg_hw_sriov() is a no-op when active_vfs is zero the
    call is safe on any PF regardless of whether VFs were ever created.
    
    MFC after:      1 month
    Reviewed by:    ssaxena
    Differential Revision: https://reviews.freebsd.org/D56201
---
 sys/dev/bnxt/bnxt_en/bnxt_sriov.c | 10 ++++++++++
 sys/dev/bnxt/bnxt_en/if_bnxt.c    |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/sys/dev/bnxt/bnxt_en/bnxt_sriov.c b/sys/dev/bnxt/bnxt_en/bnxt_sriov.c
index 2d9b43728c2d..2aeefd9308fb 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt_sriov.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_sriov.c
@@ -972,3 +972,13 @@ void bnxt_sriov_attach(struct bnxt_softc *softc)
 		device_printf(dev, "Failed to initialize SR-IOV (error=%d)\n", rc);
 }
 
+void bnxt_reenable_sriov(struct bnxt_softc *bp)
+{
+	if (BNXT_PF(bp)) {
+		struct bnxt_pf_info *pf = &bp->pf;
+		uint16_t n = pf->active_vfs;
+
+		if (n)
+			bnxt_cfg_hw_sriov(bp, &n, true);
+	}
+}
diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c
index 8023ee1524c5..b48c28f002d8 100644
--- a/sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -2327,6 +2327,9 @@ static void bnxt_fw_reset_task(struct work_struct *work)
 		bnxt_ulp_start(bp, 0);
 		clear_bit(BNXT_STATE_FW_ACTIVATE, &bp->state);
 		set_bit(BNXT_STATE_OPEN, &bp->state);
+#ifdef PCI_IOV
+		bnxt_reenable_sriov(bp);
+#endif
 		rtnl_unlock();
 	}
 	return;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f0576e.30542.432194c9>