All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: Patch "net: phy: broadcom: Only advertise EEE for supported modes" failed to apply to 4.19-stable tree
@ 2021-04-12  2:23 Sasha Levin
  2021-04-12 23:30 ` [PATCh stable 4.19] net: phy: broadcom: Only advertise EEE for supported modes Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2021-04-12  2:23 UTC (permalink / raw)
  To: stable, f.fainelli; +Cc: David S . Miller

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From c056d480b40a68f2520ccc156c7fae672d69d57d Mon Sep 17 00:00:00 2001
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 30 Mar 2021 15:00:24 -0700
Subject: [PATCH] net: phy: broadcom: Only advertise EEE for supported modes

We should not be advertising EEE for modes that we do not support,
correct that oversight by looking at the PHY device supported linkmodes.

Fixes: 99cec8a4dda2 ("net: phy: broadcom: Allow enabling or disabling of EEE")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/phy/bcm-phy-lib.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c
index 53282a6d5928..287cccf8f7f4 100644
--- a/drivers/net/phy/bcm-phy-lib.c
+++ b/drivers/net/phy/bcm-phy-lib.c
@@ -369,7 +369,7 @@ EXPORT_SYMBOL_GPL(bcm_phy_enable_apd);
 
 int bcm_phy_set_eee(struct phy_device *phydev, bool enable)
 {
-	int val;
+	int val, mask = 0;
 
 	/* Enable EEE at PHY level */
 	val = phy_read_mmd(phydev, MDIO_MMD_AN, BRCM_CL45VEN_EEE_CONTROL);
@@ -388,10 +388,17 @@ int bcm_phy_set_eee(struct phy_device *phydev, bool enable)
 	if (val < 0)
 		return val;
 
+	if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
+			      phydev->supported))
+		mask |= MDIO_EEE_1000T;
+	if (linkmode_test_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
+			      phydev->supported))
+		mask |= MDIO_EEE_100TX;
+
 	if (enable)
-		val |= (MDIO_EEE_100TX | MDIO_EEE_1000T);
+		val |= mask;
 	else
-		val &= ~(MDIO_EEE_100TX | MDIO_EEE_1000T);
+		val &= ~mask;
 
 	phy_write_mmd(phydev, MDIO_MMD_AN, BCM_CL45VEN_EEE_ADV, (u32)val);
 
-- 
2.30.2





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCh stable 4.19] net: phy: broadcom: Only advertise EEE for supported modes
  2021-04-12  2:23 FAILED: Patch "net: phy: broadcom: Only advertise EEE for supported modes" failed to apply to 4.19-stable tree Sasha Levin
@ 2021-04-12 23:30 ` Florian Fainelli
  2021-04-14 12:30   ` Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2021-04-12 23:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: stable, Florian Fainelli, David S . Miller, Andrew Lunn,
	Heiner Kallweit, Russell King, Jakub Kicinski,
	open list:BROADCOM ETHERNET PHY DRIVERS,
	open list:BROADCOM ETHERNET PHY DRIVERS

commit c056d480b40a68f2520ccc156c7fae672d69d57d upstream

We should not be advertising EEE for modes that we do not support,
correct that oversight by looking at the PHY device supported linkmodes.

Fixes: 99cec8a4dda2 ("net: phy: broadcom: Allow enabling or disabling of EEE")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/bcm-phy-lib.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c
index e10e7b54ec4b..7e5892597533 100644
--- a/drivers/net/phy/bcm-phy-lib.c
+++ b/drivers/net/phy/bcm-phy-lib.c
@@ -198,7 +198,7 @@ EXPORT_SYMBOL_GPL(bcm_phy_enable_apd);
 
 int bcm_phy_set_eee(struct phy_device *phydev, bool enable)
 {
-	int val;
+	int val, mask = 0;
 
 	/* Enable EEE at PHY level */
 	val = phy_read_mmd(phydev, MDIO_MMD_AN, BRCM_CL45VEN_EEE_CONTROL);
@@ -217,10 +217,15 @@ int bcm_phy_set_eee(struct phy_device *phydev, bool enable)
 	if (val < 0)
 		return val;
 
+	if (phydev->supported & SUPPORTED_1000baseT_Full)
+		mask |= MDIO_EEE_1000T;
+	if (phydev->supported & SUPPORTED_100baseT_Full)
+		mask |= MDIO_EEE_100TX;
+
 	if (enable)
-		val |= (MDIO_EEE_100TX | MDIO_EEE_1000T);
+		val |= mask;
 	else
-		val &= ~(MDIO_EEE_100TX | MDIO_EEE_1000T);
+		val &= ~mask;
 
 	phy_write_mmd(phydev, MDIO_MMD_AN, BCM_CL45VEN_EEE_ADV, (u32)val);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCh stable 4.19] net: phy: broadcom: Only advertise EEE for supported modes
  2021-04-12 23:30 ` [PATCh stable 4.19] net: phy: broadcom: Only advertise EEE for supported modes Florian Fainelli
@ 2021-04-14 12:30   ` Sasha Levin
  0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2021-04-14 12:30 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-kernel, stable, David S . Miller, Andrew Lunn,
	Heiner Kallweit, Russell King, Jakub Kicinski,
	open list:BROADCOM ETHERNET PHY DRIVERS,
	open list:BROADCOM ETHERNET PHY DRIVERS

On Mon, Apr 12, 2021 at 04:30:14PM -0700, Florian Fainelli wrote:
>commit c056d480b40a68f2520ccc156c7fae672d69d57d upstream
>
>We should not be advertising EEE for modes that we do not support,
>correct that oversight by looking at the PHY device supported linkmodes.
>
>Fixes: 99cec8a4dda2 ("net: phy: broadcom: Allow enabling or disabling of EEE")
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>Signed-off-by: David S. Miller <davem@davemloft.net>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Queued up this and the 4.14 backport, thanks!

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-14 12:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12  2:23 FAILED: Patch "net: phy: broadcom: Only advertise EEE for supported modes" failed to apply to 4.19-stable tree Sasha Levin
2021-04-12 23:30 ` [PATCh stable 4.19] net: phy: broadcom: Only advertise EEE for supported modes Florian Fainelli
2021-04-14 12:30   ` Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.