[PATCH net-next v2 1/2] net: phy: Add phy library support to check supported list when autoneg is enabled

Divya Koppera posted 2 patches 1 year, 5 months ago
There is a newer version of this series
[PATCH net-next v2 1/2] net: phy: Add phy library support to check supported list when autoneg is enabled
Posted by Divya Koppera 1 year, 5 months ago
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>
---
 drivers/net/phy/phy.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 785182fa5fe0..5e028ddc03da 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -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 &&
-- 
2.34.1
Re: [PATCH net-next v2 1/2] net: phy: Add phy library support to check supported list when autoneg is enabled
Posted by Jakub Kicinski 1 year, 5 months ago
On Tue, 13 Aug 2024 23:45:14 +0530 Divya Koppera wrote:
> -	if (autoneg == AUTONEG_ENABLE && linkmode_empty(advertising))
> +	if (autoneg == AUTONEG_ENABLE &&
> +	    (linkmode_empty(advertising) ||
> +	     !(linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
> +				 phydev->supported))))

nti: no need to wrap the linkmode_test_bit() in brackets:

	     !linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
				 phydev->supported)))

otherwise LGTM.

Please try to put links to previous versions into the cover letter.
-- 
pw-bot: cr