diff mbox series

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

Message ID 20240813181515.863208-2-divya.koppera@microchip.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Adds support for lan887x phy | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 29 this patch: 29
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 29 this patch: 29
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 29 this patch: 29
netdev/checkpatch warning WARNING: From:/Signed-off-by: email name mismatch: 'From: Divya Koppera <divya.koppera@microchip.com>' != 'Signed-off-by: Divya.Koppera <divya.koppera@microchip.com>'
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 34 this patch: 34
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-15--18-00 (tests: 706)

Commit Message

Divya Koppera Aug. 13, 2024, 6:15 p.m. UTC
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(-)

Comments

Jakub Kicinski Aug. 16, 2024, 6:18 p.m. UTC | #1
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.
diff mbox series

Patch

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