git: 5abfd8fe4d1a - main - ixgbe: Defer flow control programming while admission is closed

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Thu, 17 Sep 2026 05:40:37 UTC
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=5abfd8fe4d1adb74863231f27a9958cf176e3ded

commit 5abfd8fe4d1adb74863231f27a9958cf176e3ded
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-11 21:42:24 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-17 05:39:41 +0000

    ixgbe: Defer flow control programming while admission is closed
    
    Cache a validated flow control setting without touching hardware when
    iflib has closed admission.  The queues may still be live pending a
    watchdog stop, or the device may already be stopped or suspended.  RX
    initialization and link setup replay the cached flow control policy.
    
    For live updates, decide once under the context lock whether to touch
    hardware, then mask MDD around SRRCTL writes regardless of a concurrent
    watchdog closing admission.  The context lock excludes actual stop and
    reinitialization while these writes are in progress.
    
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
---
 sys/dev/ixgbe/if_ix.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index 2ece3b7bc433..f2841bc04e2e 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -5679,10 +5679,16 @@ ixgbe_set_flowcntl(struct ixgbe_softc *sc, int fc)
 		return (EINVAL);
 	}
 
+	sc->hw.fc.requested_mode = fc;
+	/* Don't autoneg if forcing a value. */
+	sc->hw.fc.disable_fc_autoneg = true;
+	/* Init replays the policy; closed admission does not prove DMA stopped. */
+	if (!iflib_is_running(sc->ctx))
+		return (0);
+
 	/* Updating SRRCTL on a live queue is itself an MDD violation. */
 	mdd_active = sc->num_rx_queues > 1 &&
-	    (sc->feat_en & IXGBE_FEATURE_SRIOV) != 0 &&
-	    iflib_is_running(sc->ctx);
+	    (sc->feat_en & IXGBE_FEATURE_SRIOV) != 0;
 	if (mdd_active)
 		ixgbe_disable_mdd(&sc->hw);
 	if (sc->num_rx_queues > 1) {
@@ -5701,10 +5707,6 @@ ixgbe_set_flowcntl(struct ixgbe_softc *sc, int fc)
 		}
 	}
 
-	sc->hw.fc.requested_mode = fc;
-
-	/* Don't autoneg if forcing a value */
-	sc->hw.fc.disable_fc_autoneg = true;
 	ixgbe_fc_enable(&sc->hw);
 
 	return (0);