Skip to contentSkip to conversation

net: phy: Fix qca8081 with speeds lower than 2.5Gb/s

PATCH Superseded Jonathan McDowell 3 participants 8 messages Jan 30, 2022 – Feb 1, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: Fix qca8081 with speeds lower than 2.5Gb/s

A typo in qca808x_read_status means we try to set SMII mode on the port rather than SGMII when the link speed is not 2.5Gb/s. This results in no traffic due to the mismatch in configuration between the phy and the mac.

Fixes 79c7bc0521545 ("net: phy: add qca8081 read_status")
---
 drivers/net/phy/at803x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/at803x.c +1 -1
index 5b6c0d120e09..7077e3a92d31 100644
@@ -1691,7 +1691,7 @@ static int qca808x_read_status(struct phy_device *phydev)
 	if (phydev->link && phydev->speed == SPEED_2500)
 		phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
 	else
-		phydev->interface = PHY_INTERFACE_MODE_SMII;
+		phydev->interface = PHY_INTERFACE_MODE_SGMII;
 
 	/* generate seed as a lower random value to make PHY linked as SLAVE easily,
 	 * except for master/slave configuration fault detected.
Signature · 1 line
2.30.2
#1 lore raw
Quoted 16 lines · Jonathan McDowell

A typo in qca808x_read_status means we try to set SMII mode on the port rather than SGMII when the link speed is not 2.5Gb/s. This results in no traffic due to the mismatch in configuration between the phy and the mac.

Fixes 79c7bc0521545 ("net: phy: add qca8081 read_status")
---
 drivers/net/phy/at803x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/at803x.c +0 -0
index 5b6c0d120e09..7077e3a92d31 100644

drivers/net/phy/at803x.c static int qca808x_read_status(struct phy_device *phydev) · line 1694

Quoted 5 lines
drivers/net/phy/at803x.c +1 -1
@@ -1691,7 +1691,7 @@ static int qca808x_read_status(struct phy_device *phydev)
 	if (phydev->link && phydev->speed == SPEED_2500)
 		phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
 	else
-		phydev->interface = PHY_INTERFACE_MODE_SMII;
+		phydev->interface = PHY_INTERFACE_MODE_SGMII;

Is it intentional to set the interface to SGMII also when there is no link?

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#2 lore raw
Quoted 12 lines · Russell King (Oracle)
Quoted 11 lines · Jonathan McDowell

A typo in qca808x_read_status means we try to set SMII mode on the port rather than SGMII when the link speed is not 2.5Gb/s. This results in no traffic due to the mismatch in configuration between the phy and the mac.

Fixes 79c7bc0521545 ("net: phy: add qca8081 read_status")
---
 drivers/net/phy/at803x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

drivers/net/phy/at803x.c static int qca808x_read_status(struct phy_device *phydev) · line 1694

Quoted 10 lines
drivers/net/phy/at803x.c +1 -1
index 5b6c0d120e09..7077e3a92d31 100644
@@ -1691,7 +1691,7 @@ static int qca808x_read_status(struct phy_device *phydev)
 	if (phydev->link && phydev->speed == SPEED_2500)
 		phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
 	else
-		phydev->interface = PHY_INTERFACE_MODE_SMII;
+		phydev->interface = PHY_INTERFACE_MODE_SGMII;

Is it intentional to set the interface to SGMII also when there is no link?

My reading of the code is that if this was just a GigE capable phy the interface would be set once and never changed/unset. The only reason it happens here is because the link changes to support the 2.5G mode, so there's no problem with it defaulting to SGMII even when the external link isn't actually up. Perhap Luo can confirm if this is the case?

J.

Signature · 3 lines
Web [  101 things you can't have too much of : 30 - Comfy sofas.   ]
site: https:// [                                          ]      Made by
www.earth.li/~noodles/  [                      ]         HuggieTag 0.0.24
#3 lore raw
Quoted 27 lines · Jonathan McDowell
Quoted 12 lines · Russell King (Oracle)
Quoted 11 lines · Jonathan McDowell

A typo in qca808x_read_status means we try to set SMII mode on the port rather than SGMII when the link speed is not 2.5Gb/s. This results in no traffic due to the mismatch in configuration between the phy and the mac.

Fixes 79c7bc0521545 ("net: phy: add qca8081 read_status")
---
 drivers/net/phy/at803x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

drivers/net/phy/at803x.c static int qca808x_read_status(struct phy_device *phydev) · line 1694

Quoted 10 lines
drivers/net/phy/at803x.c +1 -1
index 5b6c0d120e09..7077e3a92d31 100644
@@ -1691,7 +1691,7 @@ static int qca808x_read_status(struct phy_device *phydev)
 	if (phydev->link && phydev->speed == SPEED_2500)
 		phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
 	else
-		phydev->interface = PHY_INTERFACE_MODE_SMII;
+		phydev->interface = PHY_INTERFACE_MODE_SGMII;

Is it intentional to set the interface to SGMII also when there is no link?

Quoted 5 lines

My reading of the code is that if this was just a GigE capable phy the interface would be set once and never changed/unset. The only reason it happens here is because the link changes to support the 2.5G mode, so there's no problem with it defaulting to SGMII even when the external link isn't actually up. Perhap Luo can confirm if this is the case?

My point is that other PHY drivers only change the interface mode when the link comes up, and we ought to have consistency between PHY drivers rather than each PHY driver deciding on different behaviours - unless there is a good reason to be different.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#4 lore raw
Quoted 34 lines · Russell King (Oracle)
Quoted 27 lines · Jonathan McDowell
Quoted 12 lines · Russell King (Oracle)
Quoted 11 lines · Jonathan McDowell

A typo in qca808x_read_status means we try to set SMII mode on the port rather than SGMII when the link speed is not 2.5Gb/s. This results in no traffic due to the mismatch in configuration between the phy and the mac.

Fixes 79c7bc0521545 ("net: phy: add qca8081 read_status")
---
 drivers/net/phy/at803x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

drivers/net/phy/at803x.c static int qca808x_read_status(struct phy_device *phydev) · line 1694

Quoted 10 lines
drivers/net/phy/at803x.c +1 -1
index 5b6c0d120e09..7077e3a92d31 100644
@@ -1691,7 +1691,7 @@ static int qca808x_read_status(struct phy_device *phydev)
 	if (phydev->link && phydev->speed == SPEED_2500)
 		phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
 	else
-		phydev->interface = PHY_INTERFACE_MODE_SMII;
+		phydev->interface = PHY_INTERFACE_MODE_SGMII;

Is it intentional to set the interface to SGMII also when there is no link?

Quoted 5 lines

My reading of the code is that if this was just a GigE capable phy the interface would be set once and never changed/unset. The only reason it happens here is because the link changes to support the 2.5G mode, so there's no problem with it defaulting to SGMII even when the external link isn't actually up. Perhap Luo can confirm if this is the case?

Quoted 4 lines

My point is that other PHY drivers only change the interface mode when the link comes up, and we ought to have consistency between PHY drivers rather than each PHY driver deciding on different behaviours - unless there is a good reason to be different.

I'm not aware of any reason to do so. I've rolled a v2 that only changes the interface mode when the link is up and it behaves as expected in my testing, so I'll get that sent out later.

J.

Signature · 3 lines
/-\                             | 101 things you can't have too much
|@/  Debian GNU/Linux Developer |           of : 52 - IRC.
\-                              |
#5 lore raw

PATCH v2 1/1 net: phy: Fix qca8081 with speeds lower than 2.5Gb/s

In reply to Jonathan McDowell

A typo in qca808x_read_status means we try to set SMII mode on the port rather than SGMII when the link speed is not 2.5Gb/s. This results in no traffic due to the mismatch in configuration between the phy and the mac.

v2:
Only change interface mode when the link is up

Fixes 79c7bc0521545 ("net: phy: add qca8081 read_status")
---
 drivers/net/phy/at803x.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/net/phy/at803x.c +13 -13
index 5b6c0d120e09..29aa811af430 100644
@@ -1688,19 +1688,19 @@ static int qca808x_read_status(struct phy_device *phydev)
 	if (ret < 0)
 		return ret;
 
-	if (phydev->link && phydev->speed == SPEED_2500)
-		phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
-	else
-		phydev->interface = PHY_INTERFACE_MODE_SMII;
-
-	/* generate seed as a lower random value to make PHY linked as SLAVE easily,
-	 * except for master/slave configuration fault detected.
-	 * the reason for not putting this code into the function link_change_notify is
-	 * the corner case where the link partner is also the qca8081 PHY and the seed
-	 * value is configured as the same value, the link can't be up and no link change
-	 * occurs.
-	 */
-	if (!phydev->link) {
+	if (phydev->link) {
+		if (phydev->speed == SPEED_2500)
+			phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
+		else
+			phydev->interface = PHY_INTERFACE_MODE_SGMII;
+	} else {
+		/* generate seed as a lower random value to make PHY linked as SLAVE easily,
+		 * except for master/slave configuration fault detected.
+		 * the reason for not putting this code into the function link_change_notify is
+		 * the corner case where the link partner is also the qca8081 PHY and the seed
+		 * value is configured as the same value, the link can't be up and no link change
+		 * occurs.
+		 */
 		if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR) {
 			qca808x_phy_ms_seed_enable(phydev, false);
 		} else {
Signature · 1 line
2.30.2
reviewer Reviewed-by on v2 1/1
#6 lore raw
Quoted 11 lines · Jonathan McDowell

A typo in qca808x_read_status means we try to set SMII mode on the port rather than SGMII when the link speed is not 2.5Gb/s. This results in no traffic due to the mismatch in configuration between the phy and the mac.

v2:
Only change interface mode when the link is up

Fixes 79c7bc0521545 ("net: phy: add qca8081 read_status")

Thanks!

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#7 lore raw
In reply to Jonathan McDowell
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 9 lines · On Mon, 31 Jan 2022 13:56:41 +0000 you wrote:

A typo in qca808x_read_status means we try to set SMII mode on the port rather than SGMII when the link speed is not 2.5Gb/s. This results in no traffic due to the mismatch in configuration between the phy and the mac.

v2:
Only change interface mode when the link is up

[...]

Here is the summary with links:
- [net,v2] net: phy: Fix qca8081 with speeds lower than 2.5Gb/s

    https://git.kernel.org/netdev/net/c/881cc731df6a

You are awesome, thank you!

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