git: f5dc44c045c6 - main - ixgbe: Apply DMAC changes through an if-up reset request
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Sep 2026 05:33:16 UTC
The branch main has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=f5dc44c045c6f03a0f1bb2e81b0172e0781faec4
commit f5dc44c045c6f03a0f1bb2e81b0172e0781faec4
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-11 21:48:43 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-17 05:32:42 +0000
ixgbe: Apply DMAC changes through an if-up reset request
Serialize cached DMA coalescing policy with initialization and schedule
its application through the admin task. The old running check
preceded if_init() acquiring the context lock, so an intervening down
operation could be followed by an unconditional initialization.
Use the deferred if-up request so restart permission is checked when the
task runs. Changes made while stopped or suspended remain cached for
the next initialization. Do not schedule a reset for an unchanged value.
MFC after: 2 weeks
Sponsored by: BBOX.io
---
sys/dev/ixgbe/if_ix.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index f5ceb1f0b5eb..2ece3b7bc433 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -5968,11 +5968,13 @@ static int
ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS)
{
struct ixgbe_softc *sc = (struct ixgbe_softc *)arg1;
- if_t ifp = iflib_get_ifp(sc->ctx);
+ struct sx *ctx_lock = iflib_ctx_lock_get(sc->ctx);
int error;
u16 newval;
+ sx_xlock(ctx_lock);
newval = sc->dmac;
+ sx_xunlock(ctx_lock);
error = sysctl_handle_16(oidp, &newval, 0, req);
if ((error) || (req->newptr == NULL))
return (error);
@@ -5980,11 +5982,10 @@ ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS)
switch (newval) {
case 0:
/* Disabled */
- sc->dmac = 0;
break;
case 1:
/* Enable and use default */
- sc->dmac = 1000;
+ newval = 1000;
break;
case 50:
case 100:
@@ -5995,18 +5996,24 @@ ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS)
case 5000:
case 10000:
/* Legal values - allow */
- sc->dmac = newval;
break;
default:
/* Do nothing, illegal value */
return (EINVAL);
}
- /* Re-initialize hardware if it's already running */
- if (iflib_is_running(sc->ctx))
- if_init(ifp, ifp);
+ sx_xlock(ctx_lock);
+ if (iflib_in_detach(sc->ctx)) {
+ error = ENXIO;
+ } else if (sc->dmac != newval) {
+ sc->dmac = newval;
+ /* Apply through init only if still administratively up. */
+ iflib_request_reset_if_up(sc->ctx);
+ iflib_admin_intr_deferred(sc->ctx);
+ }
+ sx_xunlock(ctx_lock);
- return (0);
+ return (error);
} /* ixgbe_sysctl_dmac */
#ifdef IXGBE_DEBUG