Re: [PATCH] net: phy: genphy_loopback: fix loopback failed when speed is unknown
From: Andrew Lunn
Date: Thu Mar 31 2022 - 08:23:54 EST
On Thu, Mar 31, 2022 at 07:48:19PM +0800, Guangbin Huang wrote:
> If phy link status is down because link partner goes down, the phy speed
> will be updated to SPEED_UNKNOWN when autoneg on with general phy driver.
> If test loopback in this case, the phy speed will be set to 10M. However,
> the speed of mac may not be 10M, it causes loopback test failed.
>
> To fix this problem, if speed is SPEED_UNKNOWN, don't configure link speed.
I don't think this explanation is correct.
If speed is UNKNOWN, ctl is just going to have BMCR_LOOPBACK set. That
is very similar to what you are doing. The code then waits for the
link to establish. This is where i guess your problem is. Are you
seeing ETIMEDOUT? Does the link not establish?
Thanks
Andrew