From nobody Sun Oct 11 00:57:58 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4j2Mdy4H4mz6w7ml for ; Sun, 11 Oct 2026 00:57:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j2Mdy3N5Yz3FNt for ; Sun, 11 Oct 2026 00:57:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791680278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p5YI5w6Ps/8VhXj0gH7aNBCFqz+58Qq1amc0cBIkZfg=; b=Wd2i5wUNkp82OIlo3fT9jLZlg+fq5XjfKgFMT+/8NmdcUIDT8VgQHdsXP2kRt8rAYzxcfR 0sJeWkNiVzcWBRyr5K/Nn8K95e5laSVFY1wVslRLVc9WhUW2sWeoBgm7lfmPxb4gCCGaEh FS6tU2QhKKnw3y3qfuCGTJkNcXCUhefRR1iZA6ISDQJPxsjWRhFIpZJLtV0BqU96THrp9I rW3gWD3lfLZS+TqkDtEIONcVISYXhUenK/3biFyHaH2gBXLeQkmUFaO843vueKzM5g7Abz HIcJxaM2qOWSgSlsjU0dMmdyH/xNDK477FcUe5S69zYGjtuNHzcl4whHl2zQKw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791680278; b=MbbTiTBJKs8B/f0ZEJJDYvVamrPTkGgfhJGZ4rf9+8fmGKY06qhL03SXtQaQFAR2KlQJmC 3lA/ihCSb/WFlYbhAAAFL1HtRhbVXkX3zGPQ76qleZ68JmNZw5Z2Ap3PRedQUipDPdK6vD Hp7g85bvMDZ4nVlL8RcQ07yL3VdE9JjeI0EOWNH/hS2dua31iMpQJ5jwHFW5zP/sxmlbH/ /CcvvAalKOEoTZ/YKFBoFc5pB62IezmtEEywj+FBY8XI1Mbcuiuvgl3bSrIXo4soLKef21 N4x8ksfVgCNM3FT7ej5rq9ctYDzk1Y86Psk3buiU0FqjCO2kpIkM6jikRHWCcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791680278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p5YI5w6Ps/8VhXj0gH7aNBCFqz+58Qq1amc0cBIkZfg=; b=m+qN2q/e1kT8wH+C2UkGwi8HJb/iVIfUNpHugu7AzIGh4C8dk5eFuMmsDyxnEPR1mTjWv1 PZFnhZuKdTTAPFbZ+RFMPuFCgksCXSh/0qPxYM+28BNAPtgAIcwAnBoE5f3RQn62nYNxIj vKB/ObVdxp/Ry86o7s99T3vnXbk2GwOKP4NJO+F1CAaOFeN9fjMb4JfqhC7Sb46/KB0M4Y suOZw7oIYNNLTRnTbx/OHEU0dY767Nw4lqn74fUXWq4bh2YodFSXd2v7ideIb1meltWfGT tQdPUWBzMc7IHHGE3fk/fsAit8liEMKKvJJRJ7NqoxEHYE/1aMplTW7sgb3BwA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j2Mdy2P97zJMr for ; Sun, 11 Oct 2026 00:57:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 331d5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 11 Oct 2026 00:57:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 6a1b101a9f37 - stable/15 - e1000: Configure PCH low-power link modes for suspend List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: Commits to the stable branches of the FreeBSD src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 6a1b101a9f3764f690128dcef2ccea3218680a3e Auto-Submitted: auto-generated Date: Sun, 11 Oct 2026 00:57:58 +0000 Message-Id: <6acadf16.331d5.12c4753@gitrepo.freebsd.org> The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=6a1b101a9f3764f690128dcef2ccea3218680a3e commit 6a1b101a9f3764f690128dcef2ccea3218680a3e Author: Kevin Bowling AuthorDate: 2026-08-30 08:25:09 +0000 Commit: Kevin Bowling CommitDate: 2026-10-11 00:57:06 +0000 e1000: Configure PCH low-power link modes for suspend The PCH suspend path kept a wake link fully powered and did not restore the negotiated EEE modes after its stop-time reset. Intel provides the ULP entry and exit machinery in the shared code, but FreeBSD did not invoke its Sx policy. Enter ULP on LPT and newer PCH controllers when wake is armed without directed-unicast, multicast, or broadcast filters, which ULP cannot preserve. For a link retained by host wake or management, restore the 100BASE-TX and 1000BASE-T LPI controls selected by the local advertisement and the cached link-partner ability. Keep these power reductions best-effort: wake filters and PME are already configured independently, and a ULP or EEE failure is logged without converting an optional power optimization into a suspend failure. The existing PCH resume workaround forcibly exits ULP and clears automatic Sx LPI state before normal initialization. Validated on a ThinkPad T440p with an I217-LM. FBT confirmed that the helper received the magic-wake mask during device suspend. The shared ULP helper returned its documented no-op for the initial I217 device ID. A full S3 cycle resumed cleanly. On a ThinkPad P51 with an I219, full S3 waited for a magic packet and then resumed with the 1-Gbps link and traffic restored. Sponsored by: BBOX.io (cherry picked from commit 52fbff96549904933898908644f3a99e5cd4cdca) --- share/man/man4/em.4 | 5 ++++- sys/dev/e1000/if_em.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/share/man/man4/em.4 b/share/man/man4/em.4 index 6a6aed8a0bc3..96d68eb4fcca 100644 --- a/share/man/man4/em.4 +++ b/share/man/man4/em.4 @@ -32,7 +32,7 @@ .\" .\" * Other names and brands may be claimed as the property of others. .\" -.Dd August 29, 2026 +.Dd August 30, 2026 .Dt EM 4 .Os .Sh NAME @@ -106,6 +106,9 @@ The .Xr ifconfig 8 wake capabilities select the controller packet filters; they do not enable the ACPI wake source. +On supported PCH controllers, suspend uses the PHY ultra-low-power mode when +the selected wake filters permit it and preserves negotiated Energy Efficient +Ethernet operation while the wake link remains active. .Pp Furthermore it supports TCP segmentation offload (TSO) on all adapters but those based on the 82542, 82543, 82544 and 82547 controller chips. diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index e08894606e0d..b1ac04589c09 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -495,6 +495,7 @@ static void em_release_hw_control(struct e1000_softc *); static void em_get_wakeup(if_ctx_t); static void em_fill_wakeup_mta(struct e1000_hw *); static int em_enable_wakeup(if_ctx_t); +static void em_configure_sx_low_power(struct e1000_softc *, u32); static int em_enable_phy_wakeup(struct e1000_softc *, u32); static int em_disable_phy_wakeup(struct e1000_softc *, u16 *); static void em_power_up_wakeup_link(struct e1000_softc *); @@ -6288,6 +6289,7 @@ em_enable_wakeup(if_ctx_t ctx) if (manage) { if (sc->suspend_link_powered_down) em_power_up_wakeup_link(sc); + em_configure_sx_low_power(sc, 0); pci_enable_pme(dev); } else { em_power_down_wakeup_link(sc); @@ -6351,6 +6353,7 @@ em_enable_wakeup(if_ctx_t ctx) if (sc->hw.mac.type < igb_mac_min && sc->hw.phy.type == e1000_phy_igp_3) e1000_igp3_phy_powerdown_workaround_ich8lan(&sc->hw); + em_configure_sx_low_power(sc, wufc); pme: if (!error) @@ -6376,6 +6379,63 @@ master_disable: return (error == E1000_SUCCESS ? 0 : EIO); } +/* Configure the PCH low-power link modes used while the system sleeps. */ +static void +em_configure_sx_low_power(struct e1000_softc *sc, u32 wufc) +{ + struct e1000_hw *hw = &sc->hw; + struct e1000_dev_spec_ich8lan *dev_spec; + s32 error; + u16 eee_advert, lpi_ctrl; + + if (hw->mac.type < e1000_pch_lpt || hw->mac.type >= igb_mac_min || + sc->suspend_link_powered_down) + return; + + if (wufc != 0 && + (wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC)) == 0) { + /* ULP cannot preserve directed or broad multicast wake. */ + error = e1000_enable_ulp_lpt_lp(hw, true); + if (error != E1000_SUCCESS) { + device_printf(sc->dev, + "Could not enter PHY ultra-low-power mode: %d\n", + error); + return; + } + } + + dev_spec = &hw->dev_spec.ich8lan; + if (hw->phy.type != e1000_phy_i217 || dev_spec->eee_disable || + dev_spec->eee_lp_ability == 0) + return; + + error = hw->phy.ops.acquire(hw); + if (error != E1000_SUCCESS) + goto out; + error = hw->phy.ops.read_reg_locked(hw, I82579_LPI_CTRL, &lpi_ctrl); + if (error != E1000_SUCCESS) + goto release; + error = e1000_read_emi_reg_locked(hw, I217_EEE_ADVERTISEMENT, + &eee_advert); + if (error != E1000_SUCCESS) + goto release; + + if ((eee_advert & dev_spec->eee_lp_ability & + I82579_EEE_100_SUPPORTED) != 0) + lpi_ctrl |= I82579_LPI_CTRL_100_ENABLE; + if ((eee_advert & dev_spec->eee_lp_ability & + I82579_EEE_1000_SUPPORTED) != 0) + lpi_ctrl |= I82579_LPI_CTRL_1000_ENABLE; + error = hw->phy.ops.write_reg_locked(hw, I82579_LPI_CTRL, lpi_ctrl); +release: + hw->phy.ops.release(hw); +out: + if (error != E1000_SUCCESS) + device_printf(sc->dev, + "Could not configure Energy Efficient Ethernet for sleep: %d\n", + error); +} + static void em_power_up_wakeup_link(struct e1000_softc *sc) {