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)