net: add and use phy_disable_eee
Subsystems (6)
Heiner Kallweit
maintainercover net: add and use phy_disable_eee
If a MAC driver doesn't support EEE, then the PHY shouldn't advertise it. Add phy_disable_eee() for this purpose, and use it in cpsw driver.
Heiner Kallweit (3):
net: phy: add phy_disable_eee
net: ethernet: ti: cpsw: disable PHY EEE advertisement
ARM: dts: ti/omap: remove eee-broken properties
arch/arm/boot/dts/ti/omap/am335x-baltos.dtsi | 2 -- .../arm/boot/dts/ti/omap/am335x-myirtech-myd.dts | 1 - .../arm/boot/dts/ti/omap/am5729-beagleboneai.dts | 2 -- drivers/net/ethernet/ti/cpsw.c | 3 ++- drivers/net/ethernet/ti/cpsw_ethtool.c | 12 ------------ drivers/net/ethernet/ti/cpsw_new.c | 3 ++- drivers/net/ethernet/ti/cpsw_priv.h | 1 - drivers/net/phy/phy_device.c | 16 ++++++++++++++++ include/linux/phy.h | 1 + 9 files changed, 21 insertions(+), 20 deletions(-)
Signature · 1 line
2.47.1
Heiner Kallweit
maintainerPATCH 1/3 net: phy: add phy_disable_eee
If a MAC driver doesn't support EEE, then the PHY shouldn't advertise it. Add phy_disable_eee() for this purpose.
--- 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
@@ -2993,6 +2993,22 @@ void phy_support_eee(struct phy_device *phydev) }EXPORT_SYMBOL (phy_support_eee); +/** +* phy_disable_eee - Disable EEE for the PHY +* @phydev: Target phy_device struct +* +* This function is used by MAC drivers for MAC's which don't support EEE. +* It disables EEE on the PHY layer. +*/ +void phy_disable_eee (struct phy_device *phydev) +{ +linkmode_zero (phydev->supported_eee); +linkmode_zero (phydev->advertising_eee); + phydev->eee_cfg.tx_lpi_enabled = false; + phydev->eee_cfg.eee_enabled = false; +} +EXPORT_SYMBOL_GPL (phy_disable_eee); +/** * phy_support_sym_pause - Enable support of symmetrical pause * @phydev: target phy_device struct
include/linux/phy.h +1 -0
@@ -2071,6 +2071,7 @@ 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_support_eee (struct phy_device *phydev); +void phy_disable_eee (struct phy_device *phydev);void phy_set_sym_pause (struct phy_device *phydev,bool rx,bool tx,bool autoneg);void phy_set_asym_pause (struct phy_device *phydev,bool rx,bool tx);
Signature · 1 line
2.47.1
Andrew Lunn
maintainerRe: [PATCH net-next 1/3] net: phy: add phy_disable_eee
include/linux/phy.h void phy_advertise_eee_all(struct phy_device *phydev); · line 2074
Quoted 5 lines
include/linux/phy.h +1
-0@@ -2071,6 +2071,7 @@ 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_support_eee (struct phy_device *phydev); +void phy_disable_eee (struct phy_device *phydev);
So we have three states:
MAC tells PHYLIB it does support EEE
MAC tells PHYLIB it does not support EEE
MAC says nothing.
Do we really want this?
For phylink, i think we have a nice new clean design and can say, if the MAC does not indicate it supports EEE, we turn it off in the PHY. For phylib, we have more of a mess, and there could be MACs actually doing EEE by default using default setting but with no user space control. Do we want to keep this, or should we say any MAC which does not call phy_support_eee() before phy_start() would have EEE disabled in the PHY?
Andrew
Heiner Kallweit
maintainerRe: [PATCH net-next 1/3] net: phy: add phy_disable_eee
Quoted 14 lines · Andrew Lunn
include/linux/phy.h void phy_advertise_eee_all(struct phy_device *phydev); · line 2074
Quoted 5 lines
include/linux/phy.h +1
-0@@ -2071,6 +2071,7 @@ 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_support_eee (struct phy_device *phydev); +void phy_disable_eee (struct phy_device *phydev);So we have three states:
MAC tells PHYLIB it does support EEE
MAC tells PHYLIB it does not support EEE
MAC says nothing.Do we really want this?
Quoted 8 lines
For phylink, i think we have a nice new clean design and can say, if the MAC does not indicate it supports EEE, we turn it off in the PHY. For phylib, we have more of a mess, and there could be MACs actually doing EEE by default using default setting but with no user space control. Do we want to keep this, or should we say any MAC which does not call
phy_support_eee()beforephy_start()would have EEE disabled in the PHY?
The case "MAC says nothing" isn't desirable. However, if we did what you mention, we'd silently change the behavior of several drivers, resulting in disabled EEE and higher power consumption.
I briefly grepped the kernel source for phy_start() and found about 70 drivers. Some of them have the phylib EEE call, and in some cases like cpsw the MAC doesn't support EEE. But what remains is IMO too many drivers where we'd change the behavior.
Quoted 1 line
Andrew
Heiner
Andrew Lunn
maintainerRe: [PATCH net-next 1/3] net: phy: add phy_disable_eee
Quoted 23 lines · Heiner Kallweit
Quoted 14 lines · Andrew Lunn
include/linux/phy.h void phy_advertise_eee_all(struct phy_device *phydev); · line 2074
Quoted 5 lines
include/linux/phy.h +1
-0@@ -2071,6 +2071,7 @@ 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_support_eee (struct phy_device *phydev); +void phy_disable_eee (struct phy_device *phydev);So we have three states:
MAC tells PHYLIB it does support EEE
MAC tells PHYLIB it does not support EEE
MAC says nothing.Do we really want this?
Quoted 8 lines
For phylink, i think we have a nice new clean design and can say, if the MAC does not indicate it supports EEE, we turn it off in the PHY. For phylib, we have more of a mess, and there could be MACs actually doing EEE by default using default setting but with no user space control. Do we want to keep this, or should we say any MAC which does not call
phy_support_eee()beforephy_start()would have EEE disabled in the PHY?
Quoted 7 lines
The case "MAC says nothing" isn't desirable. However, if we did what you mention, we'd silently change the behavior of several drivers, resulting in disabled EEE and higher power consumption.
I briefly grepped the kernel source forphy_start()and found about 70 drivers. Some of them have the phylib EEE call, and in some cases like cpsw the MAC doesn't support EEE. But what remains is IMO too many drivers where we'd change the behavior.
So for phylib, we keep with the three states. But phylink? Can we disable EEE when the MAC says nothing?
Andrew
Heiner Kallweit
maintainerRe: [PATCH net-next 1/3] net: phy: add phy_disable_eee
Quoted 32 lines · Andrew Lunn
Quoted 23 lines · Heiner Kallweit
Quoted 14 lines · Andrew Lunn
include/linux/phy.h void phy_advertise_eee_all(struct phy_device *phydev); · line 2074
Quoted 5 lines
include/linux/phy.h +1
-0@@ -2071,6 +2071,7 @@ 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_support_eee (struct phy_device *phydev); +void phy_disable_eee (struct phy_device *phydev);So we have three states:
MAC tells PHYLIB it does support EEE
MAC tells PHYLIB it does not support EEE
MAC says nothing.Do we really want this?
Quoted 8 lines
For phylink, i think we have a nice new clean design and can say, if the MAC does not indicate it supports EEE, we turn it off in the PHY. For phylib, we have more of a mess, and there could be MACs actually doing EEE by default using default setting but with no user space control. Do we want to keep this, or should we say any MAC which does not call
phy_support_eee()beforephy_start()would have EEE disabled in the PHY?Quoted 7 lines
The case "MAC says nothing" isn't desirable. However, if we did what you mention, we'd silently change the behavior of several drivers, resulting in disabled EEE and higher power consumption.
I briefly grepped the kernel source forphy_start()and found about 70 drivers. Some of them have the phylib EEE call, and in some cases like cpsw the MAC doesn't support EEE. But what remains is IMO too many drivers where we'd change the behavior.
Quoted 3 lines
So for phylib, we keep with the three states. But phylink? Can we disable EEE when the MAC says nothing?
Looking at patch 5 of Russell's series behavior doesn't change if pl->mac_supports_eee is false. So I think he also goes with the three states, at least initially, until all drivers using phylink have implemented the new phylink ops. AFAICS this affects about 25 drivers.
Quoted 1 line
Andrew
Heiner
Jakub Kicinski
maintainerRe: [PATCH net-next 1/3] net: phy: add phy_disable_eee
In reply to Andrew LunnQuoted 8 lines · On Tue, 17 Dec 2024 11:43:11 +0100 Andrew Lunn wrote:
include/linux/phy.h void phy_advertise_eee_all(struct phy_device *phydev); · line 2074
Quoted 5 lines
include/linux/phy.h +1
-0@@ -2071,6 +2071,7 @@ 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_support_eee (struct phy_device *phydev); +void phy_disable_eee (struct phy_device *phydev);So we have three states:
Quoted 5 lines
MAC tells PHYLIB it does support EEE
MAC tells PHYLIB it does not support EEE
MAC says nothing.Do we really want this?
Hi Andrew, do you feel convinced? I think I messed up merging some EEE patches recently, an explicit Ack would boost my confidence..
Andrew Lunn
maintainerRe: [PATCH net-next 1/3] net: phy: add phy_disable_eee
Quoted 9 lines · Jakub Kicinski
Quoted 8 lines · On Tue, 17 Dec 2024 11:43:11 +0100 Andrew Lunn wrote:
include/linux/phy.h void phy_advertise_eee_all(struct phy_device *phydev); · line 2074
Quoted 5 lines
include/linux/phy.h +1
-0@@ -2071,6 +2071,7 @@ 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_support_eee (struct phy_device *phydev); +void phy_disable_eee (struct phy_device *phydev);So we have three states:
Quoted 8 lines
Quoted 5 lines
MAC tells PHYLIB it does support EEE
MAC tells PHYLIB it does not support EEE
MAC says nothing.Do we really want this?
Hi Andrew, do you feel convinced? I think I messed up merging some EEE patches recently, an explicit Ack would boost my confidence..
For phylib, yes, we have to live with this unknown state. so these patches are O.K.
For phylink, i would like Russells opinion. It would be better if we could avoid having the third state. Maybe we need a couple of cycles where if the MAC says nothing, but the PHY negotiates EEE, we issue a warning? We might then get an idea of how many systems are in this unknown category, and can encourage MAC driver Maintainers to add the missing EEE support.
Russell?
Andrew
Re: [PATCH net-next 1/3] net: phy: add phy_disable_eee
In reply to Heiner KallweitQuoted 4 lines · Heiner Kallweit
If a MAC driver doesn't support EEE, then the PHY shouldn't advertise it. Add
phy_disable_eee()for this purpose.Signed-off-by Heiner Kallweit <[email protected]>
Andrew
Heiner Kallweit
maintainerPATCH 2/3 net: ethernet: ti: cpsw: disable PHY EEE advertisement
In reply to Heiner KallweitIt seems the cpsw MAC doesn't support EEE. See e.g. the commit message of ce2899428ec0 ("ARM: dts: am335x-baltos: disable EEE for Atheros 8035 PHY"). There are cases where this causes issues if the PHY's on both sides have negotiated EEE. As a workaround EEE modes of the PHY are marked broken in DT, effectively disabling EEE advertisement.
Improve this by using new function phy_disable_eee() in the MAC driver. This properly disables EEE advertisement, and allows to remove the eee-broken-xxx properties from DT. As EEE is disabled anyway, we can remove also the set_eee ethtool op.
--- drivers/net/ethernet/ti/cpsw.c | 3 ++- drivers/net/ethernet/ti/cpsw_ethtool.c | 12 ------------ drivers/net/ethernet/ti/cpsw_new.c | 3 ++- drivers/net/ethernet/ti/cpsw_priv.h | 1 - 4 files changed, 4 insertions(+), 15 deletions(-)
drivers/net/ethernet/ti/cpsw.c +2 -1
@@ -635,6 +635,8 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) slave->phy = phy; +phy_disable_eee (slave->phy); +phy_attached_info (slave->phy);phy_start (slave->phy);
@@ -1225,7 +1227,6 @@ static const struct ethtool_ops cpsw_ethtool_ops = { .get_link_ksettings = cpsw_get_link_ksettings, .set_link_ksettings = cpsw_set_link_ksettings, .get_eee = cpsw_get_eee, - .set_eee = cpsw_set_eee, .nway_reset = cpsw_nway_reset, .get_ringparam = cpsw_get_ringparam, .set_ringparam = cpsw_set_ringparam,
drivers/net/ethernet/ti/cpsw_ethtool.c +0 -12
@@ -434,18 +434,6 @@ int cpsw_get_eee(struct net_device *ndev, struct ethtool_keee *edata)return -EOPNOTSUPP ; } -int cpsw_set_eee (struct net_device *ndev,struct ethtool_keee *edata) -{ -struct cpsw_priv *priv =netdev_priv (ndev); -struct cpsw_common *cpsw = priv->cpsw; -int slave_no =cpsw_slave_index (cpsw, priv); - -if (cpsw->slaves[slave_no].phy) -return phy_ethtool_set_eee (cpsw->slaves[slave_no].phy, edata); -else -return -EOPNOTSUPP ; -} -int cpsw_nway_reset (struct net_device *ndev) {struct cpsw_priv *priv =netdev_priv (ndev);
drivers/net/ethernet/ti/cpsw_new.c +2 -1
@@ -778,6 +778,8 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) slave->phy = phy; +phy_disable_eee (slave->phy); +phy_attached_info (slave->phy);phy_start (slave->phy);
@@ -1209,7 +1211,6 @@ static const struct ethtool_ops cpsw_ethtool_ops = { .get_link_ksettings = cpsw_get_link_ksettings, .set_link_ksettings = cpsw_set_link_ksettings, .get_eee = cpsw_get_eee, - .set_eee = cpsw_set_eee, .nway_reset = cpsw_nway_reset, .get_ringparam = cpsw_get_ringparam, .set_ringparam = cpsw_set_ringparam,
drivers/net/ethernet/ti/cpsw_priv.h +0 -1
@@ -497,7 +497,6 @@ int cpsw_get_link_ksettings(struct net_device *ndev,int cpsw_set_link_ksettings (struct net_device *ndev,const struct ethtool_link_ksettings *ecmd);int cpsw_get_eee (struct net_device *ndev,struct ethtool_keee *edata); -int cpsw_set_eee (struct net_device *ndev,struct ethtool_keee *edata);int cpsw_nway_reset (struct net_device *ndev); void cpsw_get_ringparam(struct net_device *ndev, struct ethtool_ringparam *ering,
Signature · 1 line
2.47.1
Re: [PATCH net-next 2/3] net: ethernet: ti: cpsw: disable PHY EEE advertisement
Quoted 11 lines · Heiner Kallweit
It seems the cpsw MAC doesn't support EEE. See e.g. the commit message of
ce2899428ec0("ARM: dts: am335x-baltos: disable EEE for Atheros 8035 PHY"). There are cases where this causes issues if the PHY's on both sides have negotiated EEE. As a workaround EEE modes of the PHY are marked broken in DT, effectively disabling EEE advertisement.
Improve this by using new functionphy_disable_eee()in the MAC driver. This properly disables EEE advertisement, and allows to remove the eee-broken-xxx properties from DT. As EEE is disabled anyway, we can remove also theset_eeeethtool op.Signed-off-by Heiner Kallweit <[email protected]>
Andrew
Heiner Kallweit
maintainerPATCH 3/3 ARM: dts: ti/omap: remove eee-broken properties
In reply to Heiner KallweitNow that the cpsw(-new) MAC driver disables PHY EEE advertisement, we can remove the eee-broken-xxx workaround.
--- arch/arm/boot/dts/ti/omap/am335x-baltos.dtsi | 2 -- arch/arm/boot/dts/ti/omap/am335x-myirtech-myd.dts | 1 - arch/arm/boot/dts/ti/omap/am5729-beagleboneai.dts | 2 -- 3 files changed, 5 deletions(-)
arch/arm/boot/dts/ti/omap/am335x-baltos.dtsi +0 -2
@@ -354,8 +354,6 @@ &davinci_mdio_sw { phy1: ethernet-phy@1 { reg = <7>; - eee-broken-100tx; - eee-broken-1000t; }; };
arch/arm/boot/dts/ti/omap/am335x-myirtech-myd.dts +0 -1
@@ -96,7 +96,6 @@ &cpsw_port2 { &davinci_mdio_sw { phy1: ethernet-phy@6 { reg = <6>; - eee-broken-1000t; }; };
arch/arm/boot/dts/ti/omap/am5729-beagleboneai.dts +0 -2
@@ -492,8 +492,6 @@ &davinci_mdio_sw { phy0: ethernet-phy@4 { reg = <4>; - eee-broken-100tx; - eee-broken-1000t; }; };
Signature · 1 line
2.47.1
Re: [PATCH net-next 3/3] ARM: dts: ti/omap: remove eee-broken properties
Quoted 4 lines · Heiner Kallweit
Now that the cpsw(-new) MAC driver disables PHY EEE advertisement, we can remove the eee-broken-xxx workaround.
Signed-off-by Heiner Kallweit <[email protected]>
Andrew
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 Mon, 16 Dec 2024 22:29:58 +0100 you wrote:
If a MAC driver doesn't support EEE, then the PHY shouldn't advertise it. Add
phy_disable_eee()for this purpose, and use it in cpsw driver.Heiner Kallweit (3):
net: phy: addphy_disable_eee
net: ethernet: ti: cpsw: disable PHY EEE advertisement
ARM: dts: ti/omap: remove eee-broken properties[...]
Here is the summary with links:
- [net-next,1/3] net: phy: add phy_disable_eee
https://git.kernel.org/netdev/net-next/c/b55498ff14bd - [net-next,2/3] net: ethernet: ti: cpsw: disable PHY EEE advertisement https://git.kernel.org/netdev/net-next/c/c9f5a5dabbf5
- [net-next,3/3] ARM: dts: ti/omap: remove eee-broken properties (no matching commit)
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Heiner Kallweit
maintainerQuoted 16 lines · On 20.12.2024 04:30, [email protected] wrote:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Mon, 16 Dec 2024 22:29:58 +0100 you wrote:
If a MAC driver doesn't support EEE, then the PHY shouldn't advertise it. Add
phy_disable_eee()for this purpose, and use it in cpsw driver.Heiner Kallweit (3):
net: phy: addphy_disable_eee
net: ethernet: ti: cpsw: disable PHY EEE advertisement
ARM: dts: ti/omap: remove eee-broken properties[...]
Quoted 8 lines
Here is the summary with links:
- [net-next,1/3] net: phy: addphy_disable_eeehttps://git.kernel.org/netdev/net-next/c/b55498ff14bd - [net-next,2/3] net: ethernet: ti: cpsw: disable PHY EEE advertisement https://git.kernel.org/netdev/net-next/c/c9f5a5dabbf5- [net-next,3/3] ARM: dts: ti/omap: remove eee-broken properties (no matching commit)
Patch 3 is marked "not applicable" in patchwork and didn't make it to net-next. Any issue with this patch?
Quoted 1 line
You are awesome, thank you!
Andrew Lunn
maintainerQuoted 25 lines · Heiner Kallweit
Quoted 16 lines · On 20.12.2024 04:30, [email protected] wrote:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Mon, 16 Dec 2024 22:29:58 +0100 you wrote:
If a MAC driver doesn't support EEE, then the PHY shouldn't advertise it. Add
phy_disable_eee()for this purpose, and use it in cpsw driver.Heiner Kallweit (3):
net: phy: addphy_disable_eee
net: ethernet: ti: cpsw: disable PHY EEE advertisement
ARM: dts: ti/omap: remove eee-broken properties[...]
Quoted 8 lines
Here is the summary with links:
- [net-next,1/3] net: phy: addphy_disable_eeehttps://git.kernel.org/netdev/net-next/c/b55498ff14bd - [net-next,2/3] net: ethernet: ti: cpsw: disable PHY EEE advertisement https://git.kernel.org/netdev/net-next/c/c9f5a5dabbf5- [net-next,3/3] ARM: dts: ti/omap: remove eee-broken properties (no matching commit)
Quoted 2 lines
Patch 3 is marked "not applicable" in patchwork and didn't make it to net-next. Any issue with this patch?
Maybe Jakub wants you to submit it to the TI DT Maintainer? Or get an
Acked-by: from said Maintainer.
Andrew
Jakub Kicinski
maintainerQuoted 5 lines · On Fri, 20 Dec 2024 09:40:38 +0100 Andrew Lunn wrote:
Quoted 2 lines
Patch 3 is marked "not applicable" in patchwork and didn't make it to net-next. Any issue with this patch?
Maybe Jakub wants you to submit it to the TI DT Maintainer? Or get an
Acked-by: from said Maintainer.
Indeed, we got screamed at once for applying dts changes. I filter them out now 🤷️ Sorry for not letting you know.
Heiner Kallweit
maintainerQuoted 9 lines · Jakub Kicinski
Quoted 5 lines · On Fri, 20 Dec 2024 09:40:38 +0100 Andrew Lunn wrote:
Quoted 2 lines
Patch 3 is marked "not applicable" in patchwork and didn't make it to net-next. Any issue with this patch?
Maybe Jakub wants you to submit it to the TI DT Maintainer? Or get an
Acked-by: from said Maintainer.Indeed, we got screamed at once for applying dts changes. I filter them out now 🤷️ Sorry for not letting you know.
OK, thanks for the explanation. Then I hope Tony as TI Omap DT maintainer picks it up.