The branch stable/15 has been updated by ssaxena:

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

commit ae84473dece1233c7dba3cd4a351d769b25d7084
Author:     Chandrakanth Patil <[email protected]>
AuthorDate: 2026-03-31 16:59:02 +0000
Commit:     Sumit Saxena <[email protected]>
CommitDate: 2026-09-30 10:39:30 +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
    
    (cherry picked from commit 8743209350cb4b7db6d367df99da0a7ae3bc5d39)
---
 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 7897e39ffe24..817a33083d81 100644
--- a/sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -2338,6 +2338,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;

Reply via email to