lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20231227231657.15152-1-asmaa@nvidia.com> Date: Wed, 27 Dec 2023 18:16:57 -0500 From: Asmaa Mnebhi <asmaa@...dia.com> To: <davem@...emloft.net>, <marek.mojik@....cz>, <netdev@...r.kernel.org> CC: Asmaa Mnebhi <asmaa@...dia.com>, <davthompson@...dia.com>, <linux-kernel@...r.kernel.org> Subject: [PATCH v2 1/1] net: phy: micrel: Add workaround for incomplete autonegotiation Very rarely, the KSZ9031 fails to complete autonegotiation although it was initiated via phy_start(). As a result, the link stays down. Restarting autonegotiation when in this state solves the issue. Signed-off-by: Asmaa Mnebhi <asmaa@...dia.com> --- v1->v2: - Use msleep() instead of mdelay() drivers/net/phy/micrel.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 08e3915001c3..9952a073413f 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1475,6 +1475,7 @@ static int ksz9031_get_features(struct phy_device *phydev) static int ksz9031_read_status(struct phy_device *phydev) { + u8 timeout = 10; int err; int regval; @@ -1494,6 +1495,22 @@ static int ksz9031_read_status(struct phy_device *phydev) return genphy_config_aneg(phydev); } + /* KSZ9031's autonegotiation takes normally 4-5 seconds to complete. + * Occasionally it fails to complete autonegotiation. The workaround is + * to restart it. + */ + if (phydev->autoneg == AUTONEG_ENABLE) { + while (timeout) { + if (phy_aneg_done(phydev)) + break; + msleep(1000); + timeout--; + }; + + if (timeout == 0) + phy_restart_aneg(phydev); + } + return 0; } -- 2.30.1
Powered by blists - more mailing lists