* [PATCH] net: phy: fix waiting for link
@ 2021-03-12 10:13 Sascha Hauer
2021-03-12 10:23 ` Ahmad Fatoum
0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2021-03-12 10:13 UTC (permalink / raw)
To: Barebox List; +Cc: Ahmad Fatoum, Uwe Kleine-König
phydev->adjust_link() is called only from phy_update_status() when the
link status changes during that function. phydev->link is also updated
in genphy_update_link() called from phy_wait_aneg_done(), so it can
happen that phydev->link changes outside of phy_update_status(), thus
phydev->adjust_link is never called and no link change notice is
printed.
Instead of calling genphy_update_link() from phy_wait_aneg_done(), call
phy_update_status(). This makes sure that a link change is properly
noticed.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/phy/phy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 622acbe40d..e8e8dad5bd 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -571,7 +571,7 @@ int phy_wait_aneg_done(struct phy_device *phydev)
}
do {
- genphy_update_link(phydev);
+ phy_update_status(phydev);
if (phydev->link == 1)
return 0;
} while (!is_timeout(start, PHY_AN_TIMEOUT * SECOND));
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: fix waiting for link
2021-03-12 10:13 [PATCH] net: phy: fix waiting for link Sascha Hauer
@ 2021-03-12 10:23 ` Ahmad Fatoum
2021-03-15 9:24 ` Sascha Hauer
0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2021-03-12 10:23 UTC (permalink / raw)
To: Sascha Hauer, Barebox List; +Cc: Uwe Kleine-König
On 12.03.21 11:13, Sascha Hauer wrote:
> phydev->adjust_link() is called only from phy_update_status() when the
> link status changes during that function. phydev->link is also updated
> in genphy_update_link() called from phy_wait_aneg_done(), so it can
> happen that phydev->link changes outside of phy_update_status(), thus
> phydev->adjust_link is never called and no link change notice is
> printed.
>
> Instead of calling genphy_update_link() from phy_wait_aneg_done(), call
> phy_update_status(). This makes sure that a link change is properly
> noticed.
>
Fixes: 8f75aa496dcb ("net: reply to ping requests")
Isn't it?
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/net/phy/phy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 622acbe40d..e8e8dad5bd 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -571,7 +571,7 @@ int phy_wait_aneg_done(struct phy_device *phydev)
> }
>
> do {
> - genphy_update_link(phydev);
> + phy_update_status(phydev);
> if (phydev->link == 1)
> return 0;
> } while (!is_timeout(start, PHY_AN_TIMEOUT * SECOND));
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: fix waiting for link
2021-03-12 10:23 ` Ahmad Fatoum
@ 2021-03-15 9:24 ` Sascha Hauer
0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2021-03-15 9:24 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: Barebox List, Uwe Kleine-König
On Fri, Mar 12, 2021 at 11:23:56AM +0100, Ahmad Fatoum wrote:
>
>
> On 12.03.21 11:13, Sascha Hauer wrote:
> > phydev->adjust_link() is called only from phy_update_status() when the
> > link status changes during that function. phydev->link is also updated
> > in genphy_update_link() called from phy_wait_aneg_done(), so it can
> > happen that phydev->link changes outside of phy_update_status(), thus
> > phydev->adjust_link is never called and no link change notice is
> > printed.
> >
> > Instead of calling genphy_update_link() from phy_wait_aneg_done(), call
> > phy_update_status(). This makes sure that a link change is properly
> > noticed.
> >
>
> Fixes: 8f75aa496dcb ("net: reply to ping requests")
>
> Isn't it?
8f75aa496dcb Isn't exactly broken, it just triggers a problem on this
particular board. It might be confusing to add a fixes tag here.
Sascha
>
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > drivers/net/phy/phy.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> > index 622acbe40d..e8e8dad5bd 100644
> > --- a/drivers/net/phy/phy.c
> > +++ b/drivers/net/phy/phy.c
> > @@ -571,7 +571,7 @@ int phy_wait_aneg_done(struct phy_device *phydev)
> > }
> >
> > do {
> > - genphy_update_link(phydev);
> > + phy_update_status(phydev);
> > if (phydev->link == 1)
> > return 0;
> > } while (!is_timeout(start, PHY_AN_TIMEOUT * SECOND));
> >
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-15 9:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12 10:13 [PATCH] net: phy: fix waiting for link Sascha Hauer
2021-03-12 10:23 ` Ahmad Fatoum
2021-03-15 9:24 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox