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

Markus Gothe markus.gothe at genexis.eu
Tue Apr 9 09:22:55 PDT 2024


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 at genexis.eu>
---
  system-linux.c | 14 ++++++--------
  1 file changed, 6 insertions(+), 8 deletions(-)

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);
-- 
2.43.2



More information about the openwrt-devel mailing list