Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178275633
D62344.1796400408.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D62344.1796400408.diff
View Options
Index: share/man/man9/iflibdi.9
===================================================================
--- share/man/man9/iflibdi.9
+++ share/man/man9/iflibdi.9
@@ -1,4 +1,4 @@
-.Dd November 2, 2026
+.Dd December 2, 2026
.Dt IFLIBDI 9
.Os
.Sh NAME
@@ -281,8 +281,8 @@
DMA before returning.
This function does not quiesce VFs, firmware queues, or other driver-owned
resources, and does not drain the administrative task.
-It is safe to call from that task and is a no-op if the datapath is already
-stopped.
+It is safe to call from that task.
+If the datapath is already stopped, the driver stop callback is skipped.
.Pp
Interrupt filters and transmit queue-selection callbacks are not synchronized.
Filters may still access hardware or reenable interrupts.
@@ -290,6 +290,8 @@
any synchronization its reset requires.
.Pp
The administrative interface flags are unchanged, and no restart is scheduled.
+A successful quiesce cancels earlier reset requests, including those
+already picked up by the current administrative task.
After rebuilding its resources, the driver may request a restart with
.Fn iflib_request_reset_if_up
and schedule the administrative task.
Index: sys/net/iflib.c
===================================================================
--- sys/net/iflib.c
+++ sys/net/iflib.c
@@ -226,6 +226,7 @@
iflib_rxq_t ifc_rxqs;
uint32_t ifc_if_flags;
uint32_t ifc_flags;
+ uint32_t ifc_active_reset_flags; /* Current admin pass, under ctx lock. */
enum iflib_datapath_state ifc_datapath_state;
enum iflib_pm_state ifc_pm_state;
/* Atomic software admission snapshot, not proof of DMA quiescence. */
@@ -396,6 +397,7 @@
#define IFC_DO_RESET 0x080
#define IFC_DO_WATCHDOG 0x100
#define IFC_DO_RESET_IF_UP 0x200
+#define IFC_RESET_FLAGS (IFC_DO_RESET | IFC_DO_RESET_IF_UP)
#define IFC_SPARE2 0x400
#define IFC_IN_DETACH 0x800
@@ -2630,8 +2632,7 @@
txq->ift_pidx);
STATE_LOCK(ctx);
iflib_set_running(ctx, false);
- ctx->ifc_flags |=
- (IFC_DO_WATCHDOG | IFC_DO_RESET);
+ ctx->ifc_flags |= IFC_DO_WATCHDOG;
iflib_admin_intr_deferred(ctx);
STATE_UNLOCK(ctx);
return;
@@ -3006,6 +3007,11 @@
return (EBUSY);
if (ctx->ifc_datapath_state != IFLIB_DP_STOPPED)
iflib_stop(ctx);
+ /* The driver owns restart after quiescing, including from admin. */
+ ctx->ifc_active_reset_flags = 0;
+ STATE_LOCK(ctx);
+ ctx->ifc_flags &= ~IFC_RESET_FLAGS;
+ STATE_UNLOCK(ctx);
return (0);
}
@@ -4486,19 +4492,9 @@
if_softc_ctx_t sctx = &ctx->ifc_softc_ctx;
iflib_txq_t txq;
int i;
- bool do_reset, do_reset_if_up, do_watchdog;
- bool in_detach;
-
- STATE_LOCK(ctx);
- do_reset = (ctx->ifc_flags & IFC_DO_RESET);
- do_reset_if_up = (ctx->ifc_flags & IFC_DO_RESET_IF_UP);
- do_watchdog = (ctx->ifc_flags & IFC_DO_WATCHDOG);
- in_detach = (ctx->ifc_flags & IFC_IN_DETACH);
- ctx->ifc_flags &= ~(IFC_DO_RESET | IFC_DO_RESET_IF_UP |
- IFC_DO_WATCHDOG);
- STATE_UNLOCK(ctx);
+ bool do_watchdog, in_detach;
- if (in_detach)
+ if (iflib_in_detach(ctx))
return;
KFAIL_POINT_CODE_COND(_debug_fail_point_iflib,
admin_task_after_detach_check,
@@ -4507,14 +4503,21 @@
iflib_admin_task_fail_device) == 0, FAIL_POINT_NONSLEEPABLE, {});
CTX_LOCK(ctx);
- if (ctx->ifc_pm_state != IFLIB_PM_ACTIVE ||
+ STATE_LOCK(ctx);
+ in_detach = (ctx->ifc_flags & IFC_IN_DETACH) != 0;
+ do_watchdog = (ctx->ifc_flags & IFC_DO_WATCHDOG) != 0;
+ ctx->ifc_active_reset_flags = ctx->ifc_flags & IFC_RESET_FLAGS;
+ ctx->ifc_flags &= ~(IFC_RESET_FLAGS | IFC_DO_WATCHDOG);
+ STATE_UNLOCK(ctx);
+ if (in_detach || ctx->ifc_pm_state != IFLIB_PM_ACTIVE ||
!iflib_admin_enabled(ctx)) {
CTX_UNLOCK(ctx);
return;
}
- if (!do_reset && do_reset_if_up &&
- (if_getflags(ctx->ifc_ifp) & IFF_UP) != 0)
- do_reset = true;
+ /* A stop or reinit may already have superseded the watchdog. */
+ if (do_watchdog && ctx->ifc_datapath_state == IFLIB_DP_RUNNING &&
+ !iflib_is_running(ctx))
+ ctx->ifc_active_reset_flags |= IFC_DO_RESET_IF_UP;
for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) {
CALLOUT_LOCK(txq);
callout_stop(&txq->ift_timer);
@@ -4532,7 +4535,9 @@
txq->ift_timer.c_cpu);
}
IFDI_LINK_INTR_ENABLE(ctx);
- if (do_reset)
+ if ((ctx->ifc_active_reset_flags & IFC_DO_RESET) != 0 ||
+ ((ctx->ifc_active_reset_flags & IFC_DO_RESET_IF_UP) != 0 &&
+ (if_getflags(ctx->ifc_ifp) & IFF_UP) != 0))
iflib_if_init_locked(ctx);
CTX_UNLOCK(ctx);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 4, 4:06 PM (19 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42206754
Default Alt Text
D62344.1796400408.diff (4 KB)
Attached To
Mode
D62344: iflib: Cancel stale reset requests when a driver quiesces
Attached
Detach File
Event Timeline