git: f75a28ea852c - stable/14 - iflib: Add restart transactions for IOV reconfiguration
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 16 Aug 2026 22:19:31 UTC
The branch stable/14 has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=f75a28ea852c824d92f2fbc10de9412e8b3b7de4
commit f75a28ea852c824d92f2fbc10de9412e8b3b7de4
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-07-28 21:53:18 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-16 22:18:01 +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 dcdbe816f9aa..0403b2d63ca8 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5626,6 +5626,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 fbadab0af565..69ac12b27d0b 100644
--- a/sys/net/iflib.h
+++ b/sys/net/iflib.h
@@ -446,7 +446,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 *);
/*