Skip to content

Commit

Permalink
net: phy: Do not check Link status when loopback is enabled
Browse files Browse the repository at this point in the history
While running stmmac selftests I found that in my 1G setup some tests
were failling when running with PHY loopback enabled.

It looks like when loopback is enabled the PHY will report that Link is
down even though there is a valid connection.

As in loopback mode the data will not be sent anywhere we can bypass the
logic of checking if Link is valid thus saving unecessary reads.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jose Abreu authored and David S. Miller committed Sep 6, 2019
1 parent d1967e4 commit fe4a7a4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/phy/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,12 @@ static int phy_check_link_status(struct phy_device *phydev)

WARN_ON(!mutex_is_locked(&phydev->lock));

/* Keep previous state if loopback is enabled because some PHYs
* report that Link is Down when loopback is enabled.
*/
if (phydev->loopback_enabled)
return 0;

err = phy_read_status(phydev);
if (err)
return err;
Expand Down

0 comments on commit fe4a7a4

Please sign in to comment.