From: Yu Watanabe Date: Thu, 20 May 2021 21:22:37 +0000 (+0900) Subject: udev/net: drop fallback logic to set speed X-Git-Tag: v249-rc1~169^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a7994dd3ab43bbd01424d40ddaef5c1ff57530da;p=thirdparty%2Fsystemd.git udev/net: drop fallback logic to set speed ethtool_set_glinksettings() already fallback to use ETHTOOL_GSET/ETHTOOL_SSET commands when ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS are not supported. --- diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 3685c9d2280..dc6d437718a 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -308,28 +308,30 @@ static int link_config_apply_ethtool_settings(int *ethtool_fd, const link_config config->autonegotiation, config->advertise, config->speed, config->duplex, config->port); if (r < 0) { - if (config->port != _NET_DEV_PORT_INVALID) - log_device_warning_errno(device, r, "Could not set port '%s', ignoring: %m", port_to_string(config->port)); + if (config->autonegotiation >= 0) + log_device_warning_errno(device, r, "Could not %s auto negotiation, ignoring: %m", + enable_disable(config->autonegotiation)); if (!eqzero(config->advertise)) - log_device_warning_errno(device, r, "Could not set advertise mode, ignoring: %m"); /* TODO: include modes in the log message. */ + log_device_warning_errno(device, r, "Could not set advertise mode, ignoring: %m"); - if (config->speed) { - unsigned speed = DIV_ROUND_UP(config->speed, 1000000); - if (r == -EOPNOTSUPP) { - r = ethtool_set_speed(ethtool_fd, name, speed, config->duplex); - if (r < 0) - log_device_warning_errno(device, r, "Could not set speed to %uMbps, ignoring: %m", speed); - } - } + if (config->speed > 0) + log_device_warning_errno(device, r, "Could not set speed to %"PRIu64"Mbps, ignoring: %m", + DIV_ROUND_UP(config->speed, 1000000)); + + if (config->duplex >= 0) + log_device_warning_errno(device, r, "Could not set duplex to %s, ignoring: %m", + duplex_to_string(config->duplex)); - if (config->duplex != _DUP_INVALID) - log_device_warning_errno(device, r, "Could not set duplex to %s, ignoring: %m", duplex_to_string(config->duplex)); + if (config->port >= 0) + log_device_warning_errno(device, r, "Could not set port to '%s', ignoring: %m", + port_to_string(config->port)); } r = ethtool_set_wol(ethtool_fd, name, config->wol); if (r < 0) - log_device_warning_errno(device, r, "Could not set WakeOnLan to %s, ignoring: %m", wol_to_string(config->wol)); + log_device_warning_errno(device, r, "Could not set WakeOnLan to %s, ignoring: %m", + wol_to_string(config->wol)); r = ethtool_set_features(ethtool_fd, name, config->features); if (r < 0)