git: 8c81b3bdd6b0 - stable/15 - iflib: Add restart transactions for IOV reconfiguration
Kevin Bowling <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.devel.stable.scm |
|---|---|
| Message-ID | <[email protected]> |
The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=8c81b3bdd6b0fb0e6dc1c3fa3432151d5f26dfaf commit 8c81b3bdd6b0fb0e6dc1c3fa3432151d5f26dfaf Author: Kevin Bowling <[email protected]> AuthorDate: 2026-07-28 21:53:18 +0000 Commit: Kevin Bowling <[email protected]> CommitDate: 2026-08-16 22:18:47 +0000 iflib: Add restart transactions for IOV reconfiguration Some devices remap the PF queues when entering or leaving SR-IOV. Add opt-in PCI IOV helpers that hold the iflib context lock across the complete stop, driver callback, and restart transaction. Existing drivers continue to use the non-restarting helpers. Sponsored by: BBOX.io (cherry picked from commit f8fa2d77bc305bec519f9f02afe211e903c57573) --- sys/net/iflib.c | 22 ++++++++++++++++++++++ sys/net/iflib.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 711c27f62939..3ea5296fd2ae 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -5486,6 +5486,28 @@ iflib_device_iov_uninit(device_t dev) CTX_UNLOCK(ctx); } +void +iflib_device_iov_uninit_restart(device_t dev) +{ + if_ctx_t ctx; + bool restart; + + ctx = device_get_softc(dev); + + CTX_LOCK(ctx); + /* + * RUNNING can be clear while a watchdog reset is pending but the + * hardware is still live. Always stop before the driver changes its + * queue layout, and use IFF_UP only to preserve administrative state. + */ + restart = (if_getflags(ctx->ifc_ifp) & IFF_UP) != 0; + iflib_stop(ctx); + IFDI_IOV_UNINIT(ctx); + if (restart) + iflib_init_locked(ctx); + CTX_UNLOCK(ctx); +} + int iflib_device_iov_add_vf(device_t dev, uint16_t vfnum, const nvlist_t *params) { diff --git a/sys/net/iflib.h b/sys/net/iflib.h index 47b461311b09..ed97796b550c 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -447,7 +447,9 @@ int iflib_device_shutdown(device_t); int iflib_device_probe_vendor(device_t); int iflib_device_iov_init(device_t, uint16_t, const nvlist_t *); +int iflib_device_iov_init_restart(device_t, uint16_t, const nvlist_t *); void iflib_device_iov_uninit(device_t); +void iflib_device_iov_uninit_restart(device_t); int iflib_device_iov_add_vf(device_t, uint16_t, const nvlist_t *); /*