Skip to contentSkip to conversation

net: phy: add and use helper phy_advertise_eee_all

PATCH Applied Heiner Kallweit 3 participants 5 messages Feb 3, 2024 – Feb 7, 2024

Subsystems (4)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

v2 cover net: phy: add and use helper phy_advertise_eee_all

Per default phylib preserves the EEE advertising at the time of phy probing. The EEE advertising can be changed from user space, in addition this helper allows to set the EEE advertising to all supported modes from drivers in kernel space.

v2:
- extend kernel doc description of new function

Heiner Kallweit (2):
net: phy: add helper phy_advertise_eee_all
r8169: use new helper phy_advertise_eee_all

 drivers/net/ethernet/realtek/r8169_main.c | 3 +--
 drivers/net/phy/phy_device.c              | 6 +++++-
 2 files changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH v2 1/2 net: phy: add helper phy_advertise_eee_all

Per default phylib preserves the EEE advertising at the time of phy probing. The EEE advertising can be changed from user space, in addition this helper allows to set the EEE advertising to all supported modes from drivers in kernel space.

---
v2:
- extend kernel doc description of new function

---
 drivers/net/phy/phy_device.c | 16 ++++++++++++++++
 include/linux/phy.h          |  1 +
 2 files changed, 17 insertions(+)
drivers/net/phy/phy_device.c +16 -0
index dd778c7fd..dda5ece0d 100644
@@ -2769,6 +2769,22 @@ void phy_advertise_supported(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(phy_advertise_supported);
 
+/**
+ * phy_advertise_eee_all - Advertise all supported EEE modes
+ * @phydev: target phy_device struct
+ *
+ * Description: Per default phylib preserves the EEE advertising at the time of
+ * phy probing, which might be a subset of the supported EEE modes. Use this
+ * function when all supported EEE modes should be advertised. This does not
+ * trigger auto-negotiation, so must be called before phy_start()/
+ * phylink_start() which will start auto-negotiation.
+ */
+void phy_advertise_eee_all(struct phy_device *phydev)
+{
+	linkmode_copy(phydev->advertising_eee, phydev->supported_eee);
+}
+EXPORT_SYMBOL_GPL(phy_advertise_eee_all);
+
 /**
  * phy_support_sym_pause - Enable support of symmetrical pause
  * @phydev: target phy_device struct
include/linux/phy.h +1 -0
index a66f07d3f..1343a4081 100644
@@ -1960,6 +1960,7 @@ int phy_get_rate_matching(struct phy_device *phydev,
 void phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
 void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode);
 void phy_advertise_supported(struct phy_device *phydev);
+void phy_advertise_eee_all(struct phy_device *phydev);
 void phy_support_sym_pause(struct phy_device *phydev);
 void phy_support_asym_pause(struct phy_device *phydev);
 void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx,
Signature · 1 line
2.43.0
author maintainer
#3 lore raw

PATCH v2 2/2 r8169: use new helper phy_advertise_eee_all

In reply to Heiner Kallweit

Use new helper phy_advertise_eee_all() to simplify the code.

---
 drivers/net/ethernet/realtek/r8169_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +1 -2
index c70869539..b43db3c49 100644
@@ -5091,8 +5091,7 @@ static int r8169_mdio_register(struct rtl8169_private *tp)
 
 	tp->phydev->mac_managed_pm = true;
 	if (rtl_supports_eee(tp))
-		linkmode_copy(tp->phydev->advertising_eee,
-			      tp->phydev->supported_eee);
+		phy_advertise_eee_all(tp->phydev);
 	phy_support_asym_pause(tp->phydev);
 
 	/* PHY will be woken up in rtl_open() */
Signature · 1 line
2.43.0
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH net-next v2 1/2] net: phy: add helper phy_advertise_eee_all

In reply to Heiner Kallweit
Quoted 7 lines · Heiner Kallweit

Per default phylib preserves the EEE advertising at the time of phy probing. The EEE advertising can be changed from user space, in addition this helper allows to set the EEE advertising to all supported modes from drivers in kernel space.

Andrew

#4 lore raw
In reply to Heiner Kallweit
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Sat, 3 Feb 2024 20:47:53 +0100 you wrote:

Per default phylib preserves the EEE advertising at the time of phy probing. The EEE advertising can be changed from user space, in addition this helper allows to set the EEE advertising to all supported modes from drivers in kernel space.

v2:
- extend kernel doc description of new function

[...]

Here is the summary with links:
- [net-next,v2,1/2] net: phy: add helper phy_advertise_eee_all

    https://git.kernel.org/netdev/net-next/c/b64691274f5d
  - [net-next,v2,2/2] r8169: use new helper phy_advertise_eee_all
    https://git.kernel.org/netdev/net-next/c/7cc0187ea252

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html