netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: phy_ethtool_ksettings_set: Allow any supported speed
@ 2024-12-02  8:33 Nikita Yushchenko
  2024-12-02  9:03 ` Maxime Chevallier
  2024-12-02 10:03 ` Russell King (Oracle)
  0 siblings, 2 replies; 21+ messages in thread
From: Nikita Yushchenko @ 2024-12-02  8:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Michael Dege, Christian Mardmoeller,
	Dennis Ostermann, Nikita Yushchenko

When auto-negotiation is not used, allow any speed/duplex pair
supported by the PHY, not only 10/100/1000 half/full.

This enables drivers to use phy_ethtool_set_link_ksettings() in their
ethtool_ops and still support configuring PHYs for speeds above 1 GBps.

Also this will cause an error return on attempt to manually set
speed/duplex pair that is not supported by the PHY.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
---
 drivers/net/phy/phy.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 4f3e742907cb..1f85a90cb3fc 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1101,11 +1101,7 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
 		return -EINVAL;
 
 	if (autoneg == AUTONEG_DISABLE &&
-	    ((speed != SPEED_1000 &&
-	      speed != SPEED_100 &&
-	      speed != SPEED_10) ||
-	     (duplex != DUPLEX_HALF &&
-	      duplex != DUPLEX_FULL)))
+	    !phy_check_valid(speed, duplex, phydev->supported))
 		return -EINVAL;
 
 	mutex_lock(&phydev->lock);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-12-03 16:37 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02  8:33 [PATCH] net: phy: phy_ethtool_ksettings_set: Allow any supported speed Nikita Yushchenko
2024-12-02  9:03 ` Maxime Chevallier
2024-12-02  9:20   ` Nikita Yushchenko
2024-12-02  9:59     ` Maxime Chevallier
2024-12-02 10:10     ` Russell King (Oracle)
2024-12-02 10:17       ` Nikita Yushchenko
2024-12-02 10:23         ` Russell King (Oracle)
2024-12-02 11:09           ` Nikita Yushchenko
2024-12-02 12:30             ` Russell King (Oracle)
2024-12-02 15:51               ` Nikita Yushchenko
2024-12-02 16:03                 ` Russell King (Oracle)
2024-12-03 11:01                   ` Nikita Yushchenko
2024-12-03 15:15                     ` Russell King (Oracle)
2024-12-03 14:05                   ` Dennis Ostermann
2024-12-03 14:45                     ` Andrew Lunn
2024-12-03 15:21                       ` Russell King (Oracle)
2024-12-03 15:51                         ` Maxime Chevallier
2024-12-03 16:37                           ` Russell King (Oracle)
2024-12-02 14:32             ` Andrew Lunn
2024-12-02 10:03 ` Russell King (Oracle)
2024-12-03 14:02   ` Nikita Yushchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).