Skip to contentSkip to conversation

net: phy: Fix overlong PHY timeout

PATCH New Andre Przywara 5 participants 6 messages Jan 3, 2020 – Mar 5, 2020

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

PATCH 1/1 net: phy: Fix overlong PHY timeout

Commit 27c3f70f3b50 ("net: phy: Increase link up delay in genphy_update_link()") increased the per-iteration waiting time from 1ms to 50ms, without adjusting the timeout counter. This lead to the timeout increasing from the typical 4 seconds to over three minutes.

Adjust the timeout counter evaluation by that factor of 50 to bring the timeout back to the intended value.

---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
index 80a7664e49..5cf9c165b6 100644
@@ -244,7 +244,7 @@ int genphy_update_link(struct phy_device *phydev)
 			/*
 			 * Timeout reached ?
 			 */
-			if (i > PHY_ANEG_TIMEOUT) {
+			if (i > (PHY_ANEG_TIMEOUT / 50)) {
 				printf(" TIMEOUT !\n");
 				phydev->link = 0;
 				return -ETIMEDOUT;
Signature · 1 line
2.14.5
#1 lore raw

PATCH 1/1 net: phy: Fix overlong PHY timeout

Quoted 19 lines · Andre Przywara

Commit 27c3f70f3b50 ("net: phy: Increase link up delay in genphy_update_link()") increased the per-iteration waiting time from 1ms to 50ms, without adjusting the timeout counter. This lead to the timeout increasing from the typical 4 seconds to over three minutes.

Adjust the timeout counter evaluation by that factor of 50 to bring the timeout back to the intended value.

---
  drivers/net/phy/phy.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +0 -0
index 80a7664e49..5cf9c165b6 100644

drivers/net/phy/phy.c int genphy_update_link(struct phy_device *phydev) · line 250

Quoted 8 lines
drivers/net/phy/phy.c +1 -1
@@ -244,7 +244,7 @@ int genphy_update_link(struct phy_device *phydev)
  			/*
  			 * Timeout reached ?
  			 */
-			if (i > PHY_ANEG_TIMEOUT) {
+			if (i > (PHY_ANEG_TIMEOUT / 50)) {
  				printf(" TIMEOUT !\n");
  				phydev->link = 0;
  				return -ETIMEDOUT;

Andre, thanks for taking care of this.

Thanks,
Stefan

#2 lore raw

PATCH 1/1 net: phy: Fix overlong PHY timeout

In reply to Andre Przywara
Quoted 9 lines · Andre Przywara

Commit 27c3f70f3b50 ("net: phy: Increase link up delay in genphy_update_link()") increased the per-iteration waiting time from 1ms to 50ms, without adjusting the timeout counter. This lead to the timeout increasing from the typical 4 seconds to over three minutes.

Adjust the timeout counter evaluation by that factor of 50 to bring the timeout back to the intended value.

I tested this on RPi4 with the genet patches on top. Now the timeout is reasonable :)

Quoted 18 lines
---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
index 80a7664e49..5cf9c165b6 100644
@@ -244,7 +244,7 @@ int genphy_update_link(struct phy_device *phydev)
 			/*
 			 * Timeout reached ?
 			 */
-			if (i > PHY_ANEG_TIMEOUT) {
+			if (i > (PHY_ANEG_TIMEOUT / 50)) {
 				printf(" TIMEOUT !\n");
 				phydev->link = 0;
 				return -ETIMEDOUT;
#3 lore raw

PATCH 1/1 net: phy: Fix overlong PHY timeout

Hi Joe,

Quoted 11 lines · Matthias Brugger
Quoted 8 lines · Andre Przywara

Commit 27c3f70f3b50 ("net: phy: Increase link up delay in genphy_update_link()") increased the per-iteration waiting time from 1ms to 50ms, without adjusting the timeout counter. This lead to the timeout increasing from the typical 4 seconds to over three minutes.

Adjust the timeout counter evaluation by that factor of 50 to bring the timeout back to the intended value.

Quoted 7 lines
Quoted 1 line

I tested this on RPi4 with the genet patches on top. Now the timeout is reasonable :)

Friedly reminder, are you planning to take this fix for v2020.04?

Regards,
Matthias

Quoted 18 lines
Quoted 18 lines
---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
index 80a7664e49..5cf9c165b6 100644
@@ -244,7 +244,7 @@ int genphy_update_link(struct phy_device *phydev)
 			/*
 			 * Timeout reached ?
 			 */
-			if (i > PHY_ANEG_TIMEOUT) {
+			if (i > (PHY_ANEG_TIMEOUT / 50)) {
 				printf(" TIMEOUT !\n");
 				phydev->link = 0;
 				return -ETIMEDOUT;
#4 lore raw

PATCH 1/1 net: phy: Fix overlong PHY timeout

Quoted 16 lines · Matthias Brugger

Hi Joe,

Quoted 12 lines · Matthias Brugger
Quoted 9 lines · Andre Przywara

Commit 27c3f70f3b50 ("net: phy: Increase link up delay in genphy_update_link()") increased the per-iteration waiting time from 1ms to 50ms, without adjusting the timeout counter. This lead to the timeout increasing from the typical 4 seconds to over three minutes.

Adjust the timeout counter evaluation by that factor of 50 to bring the timeout back to the intended value.

A "Fixes:" tag would have been nice...

Anyway:

Quoted 8 lines
Quoted 6 lines

I tested this on RPi4 with the genet patches on top. Now the timeout is reasonable :)

Friedly reminder, are you planning to take this fix for v2020.04?

Yes, please! This timeout is really annoying right now!

Regards,
Simon

Quoted 23 lines

Regards,
Matthias

Quoted 18 lines
Quoted 18 lines
---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
index 80a7664e49..5cf9c165b6 100644
@@ -244,7 +244,7 @@ int genphy_update_link(struct phy_device *phydev)
                     /*
                      * Timeout reached ?
                      */
-                    if (i > PHY_ANEG_TIMEOUT) {
+                    if (i > (PHY_ANEG_TIMEOUT / 50)) {
                             printf(" TIMEOUT !\n");
                             phydev->link = 0;
                             return -ETIMEDOUT;
#5 lore raw

PATCH 1/1 net: phy: Fix overlong PHY timeout

In reply to Andre Przywara
Quoted 10 lines · Andre Przywara

Commit 27c3f70f3b50 ("net: phy: Increase link up delay in genphy_update_link()") increased the per-iteration waiting time from 1ms to 50ms, without adjusting the timeout counter. This lead to the timeout increasing from the typical 4 seconds to over three minutes.

Adjust the timeout counter evaluation by that factor of 50 to bring the timeout back to the intended value.