Re: [PATCH net-next v2 3/3] phy: dp83td510: Utilize ALCD for cable length measurement when link is active

From: Oleksij Rempel
Date: Tue Aug 20 2024 - 13:59:42 EST


On Tue, Aug 20, 2024 at 06:49:00PM +0200, Andrew Lunn wrote:
> > +static int dp83td510_cable_test_get_status(struct phy_device *phydev,
> > + bool *finished)
> > +{
> > + *finished = false;
> > +
> > + if (!phydev->link)
> > + return dp83td510_cable_test_get_tdr_status(phydev, finished);
> > +
> > + return dp83td510_cable_test_get_alcd_status(phydev, finished);
>
> Sorry, missed this earlier. It seems like there is a race here. It
> could be the cable test was started without link, but when phylib
> polls a few seconds later link could of established. Will valid ALCD
> results be returned?

Hm.. probably not. In this case the best option I have is to store
results in the priv. Will it be acceptable?

--
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 |