git: a58471a2789d - stable/14 - igc: defer sysctl-driven reinit to the admin task

Kevin Bowling <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a7cd802.384a1.302da04c__530.058522575416$1786566678$gmane$org@gitrepo.freebsd.org>
The branch stable/14 has been updated by kbowling:

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

commit a58471a2789dd6c96933d9ecb8c30bafb1705fba
Author:     Abdelkader Boudih <[email protected]>
AuthorDate: 2026-08-05 04:40:58 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-08-12 20:30:46 +0000

    igc: defer sysctl-driven reinit to the admin task
    
    igc_sysctl_eee() and igc_sysctl_dmac() called igc_if_init() directly.
    
    Request the reset through iflib instead, and skipping while the interface
    is down; the new value is picked up by the next init.
    
    Unlike e1000, igc has no ASSERT_CTX_LOCK_HELD and no acquire_swflag
    path, so the defect is silent here rather than an assertion failure.
    
    While here also remove unnecessary igc_if_init uses:
    iflib_if_init_locked() already runs after IFDI_RESUME and
    IFDI_MEDIA_CHANGE, so the trailing *_if_init() only added an unstopped
    IFDI_INIT that the following iflib_stop() undoes.
    
    Differential Revision:  https://reviews.freebsd.org/D58629
    
    (cherry picked from commit 30ccf2f48c11e54fc0540510dcec7cd006a2c366)
---
 sys/dev/igc/if_igc.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c
index fe278f2029f3..c49948f7c57e 100644
--- a/sys/dev/igc/if_igc.c
+++ b/sys/dev/igc/if_igc.c
@@ -807,8 +807,6 @@ igc_if_resume(if_ctx_t ctx)
 	 */
 	igc_disable_broken_l1_2(ctx);
 
-	igc_if_init(ctx);
-
 	return(0);
 }
 
@@ -1288,8 +1286,6 @@ igc_if_media_change(if_ctx_t ctx)
 		device_printf(sc->dev, "Unsupported media type\n");
 	}
 
-	igc_if_init(ctx);
-
 	return (0);
 }
 
@@ -3224,6 +3220,16 @@ igc_set_flowcntl(SYSCTL_HANDLER_ARGS)
 	return (error);
 }
 
+static void
+igc_sysctl_request_reinit(struct igc_softc *sc)
+{
+	if ((if_getflags(iflib_get_ifp(sc->ctx)) & IFF_UP) == 0)
+		return;
+
+	iflib_request_reset(sc->ctx);
+	iflib_admin_intr_deferred(sc->ctx);
+}
+
 /*
  * Manage DMA Coalesce:
  * Control values:
@@ -3269,7 +3275,7 @@ igc_sysctl_dmac(SYSCTL_HANDLER_ARGS)
 			return (EINVAL);
 	}
 	/* Reinit the interface */
-	igc_if_init(sc->ctx);
+	igc_sysctl_request_reinit(sc);
 	return (error);
 }
 
@@ -3290,7 +3296,7 @@ igc_sysctl_eee(SYSCTL_HANDLER_ARGS)
 		return (error);
 
 	sc->hw.dev_spec._i225.eee_disable = (value != 0);
-	igc_if_init(sc->ctx);
+	igc_sysctl_request_reinit(sc);
 
 	return (0);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.