git: dc1d2c7f1453 - stable/14 - iflib: Permit SR-IOV configuration on a down interface
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 16 Aug 2026 20:55:26 UTC
The branch stable/14 has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=dc1d2c7f1453544ad11d9f88e5207cc6670acec5
commit dc1d2c7f1453544ad11d9f88e5207cc6670acec5
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-06 11:03:28 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-16 20:54:37 +0000
iflib: Permit SR-IOV configuration on a down interface
Drivers which remap PF queues need a stop/mutate/restart transaction
only when the interface has live queues. Permit their IOV
initialization callback while the interface is administratively down
and leave it down afterward.
This restores the standard boot-time iovctl.conf workflow and
lets other opt-in drivers configure VFs before netif brings the PF up.
(cherry picked from commit 2cf580c694f6f392531a63f01c3fb89c0244f89a)
---
sys/net/iflib.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 0f6ecb73a8a0..dcdbe816f9aa 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5585,6 +5585,37 @@ iflib_device_iov_init(device_t dev, uint16_t num_vfs, const nvlist_t *params)
return (error);
}
+int
+iflib_device_iov_init_restart(device_t dev, uint16_t num_vfs,
+ const nvlist_t *params)
+{
+ if_ctx_t ctx;
+ if_t ifp;
+ bool restart, running;
+ int error;
+
+ ctx = device_get_softc(dev);
+ ifp = ctx->ifc_ifp;
+
+ CTX_LOCK(ctx);
+ /*
+ * Drivers which change the PF queue layout need the complete iflib
+ * stop/init sequence around their IOV callback when the interface is
+ * active. An administratively-down interface has no live queues to
+ * quiesce, and must remain down after the new layout is installed.
+ * Keep the transition within one context-lock critical section.
+ */
+ restart = (if_getflags(ifp) & IFF_UP) != 0;
+ running = (if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0;
+ if (restart || running)
+ iflib_stop(ctx);
+ error = IFDI_IOV_INIT(ctx, num_vfs, params);
+ if (restart)
+ iflib_init_locked(ctx);
+ CTX_UNLOCK(ctx);
+ return (error);
+}
+
void
iflib_device_iov_uninit(device_t dev)
{