[PATCH v2 0/2] net: phy: add PHY-autonomous EEE provider support
James Hilliard <[email protected]> Mon, 03 Aug 2026 15:54:02 -0600
| Newsgroups | org.kernel.vger.netdev,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Some PHYs implement a vendor-specific autonomous EEE mode. Once EEE is
negotiated, the PHY can generate transmit Low Power Idle (LPI) without
MAC assistance. Linux must select exactly one LPI provider: enabling both
the MAC and PHY paths conflicts, while enabling neither makes a successful
ethtool request ineffective.
Earlier autonomous-EEE design discussions established that:
- provider control belongs in phylib first, so non-phylink drivers can
use it too;
- PHY drivers should receive a narrow autonomous-EEE operation rather
than the complete ethtool structure;
- phylib must remember whether the MAC or PHY provides Tx LPI, because
enable_tx_lpi must ask the MAC only when the MAC was selected; and
- userspace should continue to see one EEE interface. Provider choice is
an implementation detail, not a new ethtool mode.
Patch 1 implements that phylib model. It adds explicit legacy, MAC and
PHY provider states, a set_autonomous_eee() driver operation taking the
enable state and idle timer, and phylib calls which select either provider.
It routes ethtool Tx LPI changes to the selected PHY with rollback, keeps
enable_tx_lpi clear for the PHY provider, and restores the selected mode
after a PHY reset.
Patch 2 makes phylink select the MAC when its LPI implementation is
usable for the attached interface, otherwise fall back to a configurable
autonomous PHY. A PHY which changes interface with speed uses the MAC only
when all its possible interfaces support MAC LPI, keeping the provider
stable across link transitions. EEE remains unavailable when neither path
can provide it.
Previous discussions and review:
https://lore.kernel.org/netdev/[email protected]/
https://lore.kernel.org/netdev/[email protected]/
https://lore.kernel.org/netdev/[email protected]/
Changes v1 -> v2:
- split the generic EEE work into this standalone series
- replace callback-presence inference with explicit provider state
- replace the full eee_config callback argument with enable and timer
- add the phylib provider API before integrating it with phylink
- handle interface-specific MAC support without changing providers when a
PHY switches interface with link speed
Tested with x86_64 and arm64 defconfig builds of phy.o, phy_device.o
and phylink.o. Runtime-tested on an Allwinner H616 system with an
X-Powers AC300 PHY using the autonomous PHY provider path. Testing
covered EEE enable and disable, Tx LPI timer validation and rollback,
restoration across a control-provider power cycle, and link traffic
with EEE active. The generated patches pass checkpatch.pl --strict.
Signed-off-by: James Hilliard <[email protected]>
---
James Hilliard (2):
net: phy: support PHY-autonomous EEE as an LPI provider
net: phylink: use PHY-autonomous EEE when MAC LPI is unavailable
drivers/net/phy/phy.c | 48 ++++++++++++++++--
drivers/net/phy/phy_device.c | 118 +++++++++++++++++++++++++++++++++++++------
drivers/net/phy/phylink.c | 89 ++++++++++++++++++++++++++++----
include/linux/phy.h | 41 +++++++++++++--
4 files changed, 262 insertions(+), 34 deletions(-)
---
base-commit: 848acc8ffe1b7cd5f1bf427b93069becfebc2c9d
change-id: 20260803-phy-autonomous-eee-v1-38ed922f20c9
Best regards,
--
James Hilliard <[email protected]>