Commit 7addb4e5ef17 for kernel

commit 7addb4e5ef1702704914b47bca3f706ef96c1589
Merge: 5d4d98595743 d876c9cb2d16
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Thu Sep 10 13:31:31 2026 +0200

    Merge branch 'net-restore-eee-on-mediatek-switches-and-soc-macs'

    Aleksei Sviridkin says:

    ====================
    net: restore EEE on MediaTek switches and SoC MACs

    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.
    ====================

    Link: https://patch.msgid.link/20260903123644.23800-1-f@lex.la
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>