net: phy: Add phy library support to check supported list when autoneg is enabled

Adds support in phy library to accept autoneg configuration only when
feature is enabled in supported list.

Signed-off-by: Divya Koppera <divya.koppera@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20240821055906.27717-2-Divya.Koppera@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Divya Koppera 2024-08-21 11:29:05 +05:30 committed by Jakub Kicinski
parent e540e3bcf2
commit d4c897675a

View File

@ -1089,7 +1089,10 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
if (autoneg != AUTONEG_ENABLE && autoneg != AUTONEG_DISABLE)
return -EINVAL;
if (autoneg == AUTONEG_ENABLE && linkmode_empty(advertising))
if (autoneg == AUTONEG_ENABLE &&
(linkmode_empty(advertising) ||
!linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
phydev->supported)))
return -EINVAL;
if (autoneg == AUTONEG_DISABLE &&