diff options
| author | Chandrakanth Patil <chandrakanth.patil@broadcom.com> | 2026-03-31 16:59:02 +0000 |
|---|---|---|
| committer | Sumit Saxena <ssaxena@FreeBSD.org> | 2026-04-28 06:34:31 +0000 |
| commit | 8743209350cb4b7db6d367df99da0a7ae3bc5d39 (patch) | |
| tree | ca0771737f79f61b121f01dd7705cbf5b03ee306 | |
| parent | ea4ab7e36ed9cf153c374782be446254a7d11822 (diff) | |
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
| -rw-r--r-- | sys/dev/bnxt/bnxt_en/bnxt_sriov.c | 10 | ||||
| -rw-r--r-- | sys/dev/bnxt/bnxt_en/if_bnxt.c | 3 |
2 files changed, 13 insertions, 0 deletions
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; |
