git: 30ccf2f48c11 - main - igc: defer sysctl-driven reinit to the admin task

Kevin Bowling <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm
Message-ID <[email protected]>
The branch main has been updated by kbowling:

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

commit 30ccf2f48c11e54fc0540510dcec7cd006a2c366
Author:     Abdelkader Boudih <[email protected]>
AuthorDate: 2026-08-05 04:40:58 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-08-05 04:40:58 +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.
    
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D58629
---
 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 1f10d244f2dd..0900689e5f01 100644
--- a/sys/dev/igc/if_igc.c
+++ b/sys/dev/igc/if_igc.c
@@ -816,8 +816,6 @@ igc_if_resume(if_ctx_t ctx)
 	 */
 	igc_disable_broken_l1_2(ctx);
 
-	igc_if_init(ctx);
-
 	return(0);
 }
 
@@ -1297,8 +1295,6 @@ igc_if_media_change(if_ctx_t ctx)
 		device_printf(sc->dev, "Unsupported media type\n");
 	}
 
-	igc_if_init(ctx);
-
 	return (0);
 }
 
@@ -3357,6 +3353,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:
@@ -3402,7 +3408,7 @@ igc_sysctl_dmac(SYSCTL_HANDLER_ARGS)
 			return (EINVAL);
 	}
 	/* Reinit the interface */
-	igc_if_init(sc->ctx);
+	igc_sysctl_request_reinit(sc);
 	return (error);
 }
 
@@ -3423,7 +3429,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.