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.
This commit is contained in:
Yu Watanabe
2021-05-21 06:22:37 +09:00
parent ba1030594e
commit a7994dd3ab

View File

@@ -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 != _DUP_INVALID)
log_device_warning_errno(device, r, "Could not set duplex to %s, ignoring: %m", duplex_to_string(config->duplex));
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->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)