diff mbox series

[RFC/RFT,20/23] net: phylink: Add MAC_EEE to mac_capabilites

Message ID 20230327170201.2036708-21-andrew@lunn.ch (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: ethernet: Rework EEE | expand

Checks

Context Check Description
netdev/series_format fail Series longer than 15 patches (and no cover letter)
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 120 this patch: 117
netdev/cc_maintainers warning 4 maintainers not CCed: pabeni@redhat.com kuba@kernel.org edumazet@google.com davem@davemloft.net
netdev/build_clang fail Errors and warnings before: 37 this patch: 37
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 118 this patch: 117
netdev/checkpatch warning WARNING: Block comments use * on subsequent lines WARNING: Block comments use a trailing */ on a separate line
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Andrew Lunn March 27, 2023, 5:01 p.m. UTC
If the MAC supports Energy Efficient Ethernet, it should indicate this
by setting the MAC_EEE bit in the config.mac_capabilities
bitmap. phylink will then enable EEE in the PHY, if it supports it.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/phy/phylink.c | 3 +++
 include/linux/phylink.h   | 3 +++
 2 files changed, 6 insertions(+)

Comments

Russell King (Oracle) March 27, 2023, 9:59 p.m. UTC | #1
On Mon, Mar 27, 2023 at 07:01:58PM +0200, Andrew Lunn wrote:
> If the MAC supports Energy Efficient Ethernet, it should indicate this
> by setting the MAC_EEE bit in the config.mac_capabilities
> bitmap. phylink will then enable EEE in the PHY, if it supports it.

I know it will be a larger patch, but I would prefer to add it after
MAC_ASYM_PAUSE and shuffle the speeds up. I'm sure network speeds will
continue to increase, resulting in more bits added in the future.

Thanks.
Andrew Lunn March 27, 2023, 10:15 p.m. UTC | #2
On Mon, Mar 27, 2023 at 10:59:51PM +0100, Russell King (Oracle) wrote:
> On Mon, Mar 27, 2023 at 07:01:58PM +0200, Andrew Lunn wrote:
> > If the MAC supports Energy Efficient Ethernet, it should indicate this
> > by setting the MAC_EEE bit in the config.mac_capabilities
> > bitmap. phylink will then enable EEE in the PHY, if it supports it.
> 
> I know it will be a larger patch, but I would prefer to add it after
> MAC_ASYM_PAUSE and shuffle the speeds up. I'm sure network speeds will
> continue to increase, resulting in more bits added in the future.

O.K, i can make the new symbol BIT(2).

Thanks
	Andrew
diff mbox series

Patch

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 2e9ce6862042..192f9d13d3d1 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1637,6 +1637,9 @@  static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
 	 */
 	phy_support_asym_pause(phy);
 
+	if (pl->config->mac_capabilities & MAC_EEE)
+		phy_support_eee(phy);
+
 	memset(&config, 0, sizeof(config));
 	linkmode_copy(supported, phy->supported);
 	linkmode_copy(config.advertising, phy->advertising);
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 6eee6194b5ab..beac34b71343 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -72,6 +72,9 @@  enum {
 	MAC_100000FD	= BIT(16),
 	MAC_200000FD	= BIT(17),
 	MAC_400000FD	= BIT(18),
+	/* MAC_EEE indicates that the MAC is Energy Efficient capable
+	   and that the PHY should negotiate its use, if possible */
+	MAC_EEE		= BIT(31),
 };
 
 static inline bool phylink_autoneg_inband(unsigned int mode)