git: abdde8b60281 - main - e1000: 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=abdde8b602813753e423610b39be6806da5647e2

commit abdde8b602813753e423610b39be6806da5647e2
Author:     Abdelkader Boudih <[email protected]>
AuthorDate: 2026-08-05 04:34:13 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-08-05 04:40:42 +0000

    e1000: defer sysctl-driven reinit to the admin task
    
    Request the reset through iflib and let the admin task perform the
    stop/init under the context lock, matching what the VF and SR-IOV paths
    already do.
    
    The assertion is compiled out without INVARIANTS, where the same write
    instead resets the MAC and takes the ICH software flag while the queues
    stay live and an ioctl or the admin task may be running.
    
    While here also remove unnecessary em_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/D58628
---
 sys/dev/e1000/if_em.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index fb12345a3f43..361d44168623 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -1739,8 +1739,6 @@ em_if_resume(if_ctx_t ctx)
 
 	if (sc->hw.mac.type == e1000_pch2lan)
 		e1000_resume_workarounds_pchlan(&sc->hw);
-	em_if_init(ctx);
-	em_init_manageability(sc);
 
 	return(0);
 }
@@ -2441,8 +2439,6 @@ em_if_media_change(if_ctx_t ctx)
 		device_printf(sc->dev, "Unsupported media type\n");
 	}
 
-	em_if_init(ctx);
-
 	return (0);
 }
 
@@ -6406,6 +6402,16 @@ em_set_flowcntl(SYSCTL_HANDLER_ARGS)
 	return (error);
 }
 
+static void
+em_sysctl_request_reinit(struct e1000_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:
@@ -6451,7 +6457,7 @@ igb_sysctl_dmac(SYSCTL_HANDLER_ARGS)
 			return (EINVAL);
 	}
 	/* Reinit the interface */
-	em_if_init(sc->ctx);
+	em_sysctl_request_reinit(sc);
 	return (error);
 }
 
@@ -6477,7 +6483,7 @@ em_sysctl_eee(SYSCTL_HANDLER_ARGS)
 		sc->hw.dev_spec.ich8lan.eee_disable = (value != 0);
 	else
 		sc->hw.dev_spec._82575.eee_disable = (value != 0);
-	em_if_init(sc->ctx);
+	em_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.