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.go...@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

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to