diff mbox series

system-linux.c: Allow user to set fixed speed with and without autonegotiation.

Message ID 766b9171-a364-4784-b967-a704a7ab767e@genexis.eu
State New
Headers show
Series system-linux.c: Allow user to set fixed speed with and without autonegotiation. | expand

Commit Message

Markus Gothe April 9, 2024, 4:22 p.m. UTC
On certain types of links, i.e. active ethernet fiber links,
we can have both fixed speed and autonegotiation on at the
same time. It is, in these cases, not speed which is being auto-
negotiatied but the use of pause frames.

This fix reverts back to the old behaviour before switching
to the new ETHTOOL_xLINKSETTINGS API and allows the user to
freely configure these systems.

Signed-off-by: Markus Gothe <markus.gothe@genexis.eu>
---
  system-linux.c | 14 ++++++--------
  1 file changed, 6 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/system-linux.c b/system-linux.c
index 4463a2a..6454900 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -2075,16 +2075,14 @@  system_set_ethtool_settings(struct device *dev, struct device_settings *s)
  		if (!s->asym_pause)
  			ethtool_link_mode_clear_bit(nwords, ETHTOOL_LINK_MODE_Asym_Pause_BIT, advertising);
  
-	if (s->flags & DEV_OPT_AUTONEG) {
+	if (s->flags & DEV_OPT_AUTONEG)
  		ecmd.req.autoneg = s->autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE;
-		if (!s->autoneg) {
-			if (s->flags & DEV_OPT_SPEED)
-				ecmd.req.speed = s->speed;
  
-			if (s->flags & DEV_OPT_DUPLEX)
-				ecmd.req.duplex = s->duplex ? DUPLEX_FULL : DUPLEX_HALF;
-		}
-	}
+	if (s->flags & DEV_OPT_SPEED)
+		ecmd.req.speed = s->speed;
+
+	if (s->flags & DEV_OPT_DUPLEX)
+		ecmd.req.duplex = s->duplex ? DUPLEX_FULL : DUPLEX_HALF;
  
  	ecmd.req.cmd = ETHTOOL_SLINKSETTINGS;
  	ioctl(sock_ioctl, SIOCETHTOOL, &ifr);