From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE702C61DD3 for ; Thu, 3 Sep 2026 12:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=abT7VqpybEgUMKiyUxYdksUtrvwhOjj1ImBvIGn0b08=; b=W8jKe1MPjzI8SHUCpWYIH6BG56 16ybYUh8i/pT0crfsbqG+B2K9iiW4YkfKgULIyVISU5NqwzKTaLogMFKD/8D06mZ5dPfPmc1GogYu /MpC+nNrav4it8uGwsJho4Qjao0lW4/GYos3eAS9qGfkjypwh7E7h4N2M0kJJqKavPWwA0Ue2jMKV TgU89wzUeKIT3Yln9H9kWdmZHcXaHjv8GbTKPh0d7VZ3i22sPn0NhiXTnGKZrxOp4BXmabKfH8z0V /ZUB+vLsA9dDkSSRQQl/zB0pchCuRktp2HHt0I105Pfc1F9E+v6djvdJeXeGHtwOrBkqwnqMqAXec PukHES1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x26gV-0000000HJRw-3wJf; Thu, 03 Sep 2026 12:36:51 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x26gT-0000000HJQZ-1mye for linux-arm-kernel@lists.infradead.org; Thu, 03 Sep 2026 12:36:50 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-482e257a23aso1634289f8f.0 for ; Thu, 03 Sep 2026 05:36:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lex.la; s=google; t=1788439007; x=1789043807; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=abT7VqpybEgUMKiyUxYdksUtrvwhOjj1ImBvIGn0b08=; b=PWT9klCjhna1SOqX9zxyQBpl3Uedt8gINzn/YZnFty7fdxg6/Fi6ldlmiuk0oAFsKd RYRhbvyYJKvbcejCswpzg4+iLX2k9DduGN8YSfnCFfNWkRH6C9eQKOVMTiQnnN5AHEXH 023wwneMKjiAhOVsbYGeBq0nvY9P4Uckf0tVkyvbMNfIhOuCYyGYivCFK7wNx86i+TsS VFWm4BMse2EBOBn8RxCyNE0C9FXRmUfewzTYJbdF9YcqkCeex9jmd52FcgCQUWvoUMId dJNRWRsIyw8G+v/NB/jtVjOV2ED6o2kQ62aGauJwduZOpdsvfoUmYodS9krodr3zr9Ou RQcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788439007; x=1789043807; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=abT7VqpybEgUMKiyUxYdksUtrvwhOjj1ImBvIGn0b08=; b=KV4xl3DC3SxgYc/vIaKiv2SeSQQ+zSAipGUDdn4wsXhOfY/vp4+bXNQaAkGIlk564X LEJ3vwm5yQX+D9+ceCzfPSs9GxJpeyiy+pW48PfbkNvGj8n+ZsVx+zu6vOowdf3G6sYN pGje2DIkDGm9o+KPT27UhCPVqK3kHfI0jkH496scW+ndJbwDz7au6GfWWor3lXothx2r RPJPltljSXdUjj4015JyrkWlWWVNvgKLA9kwSwMcZ6tji/RaTeCRlFsR6Vd4/t/b7xvK umT6AIcHmn3l9WlEMgMVwiTJPQxzJMWTayV78+VkjERy8qzGA7XKfGzhO/I2jSTAoLQz qSfA== X-Forwarded-Encrypted: i=1; AKwUvBzT+Y3NXlyRsVQGHP6/uy8FvyFAAuqr9wmBJsLX7JU/G2Kg7Pxztf0ZWE3eJE4/oQDC//HCbKzwr18YX21Ad1eL@lists.infradead.org X-Gm-Message-State: AFuF++lvweijhOvtZsz9JFJ2ffU+ZKPxt+IdPbFEjqnqfVZNvFVwspWQ V1Mcho3bisQAB2FqFJ7N6eOM+0jp1/oK+ZRzMyxfZZq8/KsOsuBPk0MV1jM2plgg2z0= X-Gm-Gg: AYBFou3c4eObM/myE+6zB1gcwLuwymjcM3xQuk3PNm2cxspm5t/xSNkVALxJ9/s30qa KanAXJ6NmTpX0UP9e3knJ3vUVYNuR/BIXeZ/LHoVxGtWfUX7I62TuORAv50w0ibxbQ8OeVR8qcc GTbzYUvWCqHp8O94+xNMpkI8SzOdi2jX3Lryu4YaBUuEKiahcDL04nkFjp7Jp2Y/XgFfK/R0eAl s31e41V8Q/nsvNuClJeMkNqS4qNsrOVenXft2lvm7kPKCKLqsiRx0tMybXcSS647S5Ii8bmbFdJ b1WvZja8m4lIFSnnY4O0z0lxEaQj22a5rwt6WxnyFkKogKqEy3lhQDYuFC4IloXWpUuvxq9D/Kg lnYBRdtznDnFH+doGvvLxhGdNniTIAy+oc7C0u4wMPx6ih8Dxk5VL8k4IAlrO4hxP9ltXW0fp/X NAR5ffFaclyKX0t523RVMqoqqY9qu2udio4iw6qwmIgwmP8ClHJWc= X-Received: by 2002:a05:6000:98c:b0:474:530:9d with SMTP id ffacd0b85a97d-48488f20a10mr24494726f8f.13.1788439006829; Thu, 03 Sep 2026 05:36:46 -0700 (PDT) Received: from remote-01 ([84.17.55.227]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48448e72d2asm12828927f8f.8.2026.09.03.05.36.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 05:36:46 -0700 (PDT) From: Aleksei Sviridkin To: chester.a.unal@arinc9.com, daniel@makrotopia.org, andrew@lunn.ch, olteanv@gmail.com, nbd@nbd.name, lorenzo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org Cc: linux@armlinux.org.uk, dqfext@gmail.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net v5 0/2] net: restore EEE on MediaTek switches and SoC MACs Date: Thu, 3 Sep 2026 12:36:42 +0000 Message-ID: <20260903123644.23800-1-f@lex.la> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260903_053649_514365_D4547F6F X-CRM114-Status: GOOD ( 19.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Both drivers fill in phylink_config.lpi_capabilities and lpi_timer_default but never lpi_interfaces. phylink treats a MAC as supporting managed EEE only when the tx_lpi methods are implemented and BOTH bitmaps are non-empty, which phylink_create() decides once and for all, so EEE has been off on every mt753x port and on every mtk_eth_soc MAC that uses mtk_phylink_ops since the two commits named in the Fixes: tags. Because the tx_lpi methods ARE implemented, phylink takes the other branch and calls phy_disable_eee(), which fills eee_disabled_modes - so userspace cannot enable EEE either. On an MT7981B board with an MT7531 switch, before these patches: == lan1 Cannot get EEE settings: Not supported == lan2 Cannot get EEE settings: Not supported == lan3 Cannot get EEE settings: Not supported == lan4 Cannot get EEE settings: Not supported == wan Cannot get EEE settings: Not supported lan1-3 are the MT7531 internal PHYs, lan4 is an EN8811H on switch port 5 whose MAC side runs 2500BASE-X rate matched to a 1 Gbps media link, and wan is the mtk_eth_soc MAC with its directly attached 1 Gbps PHY - so both drivers are covered. Each patch fills lpi_interfaces from supported_interfaces and leaves 2.5 Gbps out of both bitmaps for now. LPI above 1 Gbps is unvalidated rather than unsupported: both MACs fold 2.5 Gbps onto their 1 Gbps speed encoding, so the 1 Gbps EEE force bit is what would govern it. MediaTek's SDK driver sets the force bits for 100 Mbps and 1 Gbps only, EEE signalling on 2500BASE-X is outside 802.3, and the 1 us unit of the wakeup timers is undocumented at 2.5 times the port clock. The SoC MAC patch fills lpi_interfaces only on SoCs carrying a new MTK_GMAC_EEE capability. mtk_mac_enable_tx_lpi() programs wake-up times taken from MT7531's reset values, and the capability marks the SoCs where those have been measured to work: MT7981 for now. The others keep today's behaviour, EEE unreachable from userspace, until someone with the hardware confirms them. Neither driver sets eee_enabled_default, so LPI stays off until userspace asks for it with ethtool --set-eee. The EEE advertisement is a different matter: phylink stops force-clearing it, so a PHY that advertises EEE out of reset advertises it again and the link may negotiate EEE, without this MAC asserting LPI. MT7531's internal PHYs and EN7528 are the exceptions, for the reasons in patch 1. Devicetree eee-broken-* marks act at the PHY level and keep working, so a board that already distrusts its PHYs stays protected: OpenWrt marks all modes broken on MT7621's internal PHYs. The two patches are independent and touch different subsystems; they are sent together because they are the same bug. Targeted at net as a regression fix with an active userspace lockout; can be retargeted at net-next if maintainers prefer. Based on net-next at 91ec20351349. All three files touched are byte identical in net/main and the series applies there unchanged. After the series, all five ports report: EEE status: disabled Tx LPI: disabled Supported EEE link modes: 100baseT/Full 1000baseT/Full Advertised EEE link modes: Not reported No 2.5G mode is offered, which is the narrowed lpi_capabilities, and nothing is advertised until userspace asks. On this board no PHY came out of reset advertising EEE, so the case where the advertisement returns once phylink stops clearing it is not exercised here. Enabling it on lan1, whose partner advertises EEE at both speeds: # ethtool --set-eee lan1 eee on EEE status: enabled - active Advertised EEE link modes: 100baseT/Full 1000baseT/Full Link partner advertised EEE link modes: 100baseT/Full 1000baseT/Full # ethtool --set-eee lan1 eee on tx-lpi on EEE status: enabled - active Tx LPI: 30 (us) With LPI armed, 30 parallel ICMPv6 streams of 1400-byte payload, 300 packets each one second apart - so every gap crosses the LPI threshold and the link enters and leaves LPI thousands of times over 300 s - lost nothing: 300/300 on every stream, tx and rx error counters unchanged, carrier_changes unchanged, and no mac_enable_tx_lpi errors in dmesg. On wan, cabled for this round to a partner that advertises EEE (a BCM5720), the MT7981 GMAC's own LPI was exercised. With tx-lpi armed the wan PHY's MMD 3.1 reads 0x0f44, Tx LPI indication set, so the MAC is asserting LPI; it drops to 0x0044 with tx-lpi off and comes back with it on. The same 30-stream test at 1 Gbps lost nothing over 9000 packets with the link cycling through LPI at every 1 s gap. At 100 Mbps the only losses were the first packet or two of some streams, and those reproduce with EEE disabled on both ends: neighbour discovery for 30 streams starting at once. The 17 and 36 that mtk_mac_enable_tx_lpi() programs therefore hold on MT7981 against this partner at both speeds. Its Tx LPI reads 1000 (us) against lan1's 30; see the note below the scissors of patch 1. lan4 keeps EEE disabled and never arms LPI, which is what dropping 2500BASE-X from lpi_interfaces is for. Forwarding through it was lossless with no carrier change. --- v5: in-code comments cut to one line each; the reasoning stays in the commit messages (Maxime Chevallier). No code change. https://lore.kernel.org/netdev/20260902080519.2211373-1-f@lex.la/ v4: patch 2: populate lpi_interfaces only on SoCs carrying a new MTK_GMAC_EEE capability, set for MT7981 after measuring its LPI exits; the other SoCs keep the current behaviour (Paolo Abeni). patch 1: lpi_capabilities is derived from mac_capabilities instead of asserting both speeds. Cover: the MT7981 GMAC LPI measurement. https://lore.kernel.org/netdev/20260827211652.63504-1-f@lex.la/ v3: both commit messages cut down to the Why, with the mechanism left to the diff and the detail below the scissors (Andrew Lunn); no code changes. https://lore.kernel.org/netdev/20260824024117.46154-1-f@lex.la/ v2: commit messages rewritten to carry the Why only, mechanism notes moved below the scissors (Andrew Lunn); comments and commit messages reworded so the 2.5 Gbps exclusion reads as unvalidated rather than impossible (Daniel Golle); no functional changes. https://lore.kernel.org/netdev/20260822195252.2934-1-f@lex.la/ Aleksei Sviridkin (2): net: dsa: mt7530: populate lpi_interfaces to fix EEE support net: ethernet: mtk_eth_soc: populate lpi_interfaces to fix EEE support drivers/net/dsa/mt7530.c | 16 ++++++++++++---- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 18 +++++++++++++++--- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 +++- 3 files changed, 30 insertions(+), 8 deletions(-) -- 2.53.0