git: 2e78e568c268 - main - e1000: Handle igb EEE sysctl

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Tue, 24 Sep 2024 10:16:36 UTC
The branch main has been updated by kbowling:

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

commit 2e78e568c268e4ba846ab140d9ac6b42886f8ec7
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2024-09-24 10:12:40 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2024-09-24 10:15:58 +0000

    e1000: Handle igb EEE sysctl
    
    MFC after:      1 week
    Sponsored by:   Blue Box Systems
---
 sys/dev/e1000/if_em.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 5fb46c9f6dce..d06627bcfda1 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -1094,7 +1094,10 @@ em_if_attach_pre(if_ctx_t ctx)
 			      " due to SOL/IDER session.\n");
 
 	/* Sysctl for setting Energy Efficient Ethernet */
-	hw->dev_spec.ich8lan.eee_disable = eee_setting;
+	if (hw->mac.type < igb_mac_min)
+		hw->dev_spec.ich8lan.eee_disable = eee_setting;
+	else
+		hw->dev_spec._82575.eee_disable = eee_setting;
 	SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "eee_control",
 	    CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0,
 	    em_sysctl_eee, "I", "Disable Energy Efficient Ethernet");
@@ -4981,11 +4984,17 @@ em_sysctl_eee(SYSCTL_HANDLER_ARGS)
 	struct e1000_softc *sc = (struct e1000_softc *) arg1;
 	int error, value;
 
-	value = sc->hw.dev_spec.ich8lan.eee_disable;
+	if (sc->hw.mac.type < igb_mac_min)
+		value = sc->hw.dev_spec.ich8lan.eee_disable;
+	else
+		value = sc->hw.dev_spec._82575.eee_disable;
 	error = sysctl_handle_int(oidp, &value, 0, req);
 	if (error || req->newptr == NULL)
 		return (error);
-	sc->hw.dev_spec.ich8lan.eee_disable = (value != 0);
+	if (sc->hw.mac.type < igb_mac_min)
+		sc->hw.dev_spec.ich8lan.eee_disable = (value != 0);
+	else
+		sc->hw.dev_spec._82575.eee_disable = (value != 0);
 	em_if_init(sc->ctx);
 
 	return (0);