diff --git a/man/udev.xml b/man/udev.xml index ae7dc61b03..9733b85760 100644 --- a/man/udev.xml +++ b/man/udev.xml @@ -982,15 +982,16 @@ - MTU= + MTUBytes= - The MTU to set for the device. + The maximum transmission unit in bytes to set for the device. - SpeedMBytes= + BitsPerSecond= - The speed to set for the device. + The speed to set for the device, the value is rounded down + to the nearest Mbps. diff --git a/src/udev/net/link-config-gperf.gperf b/src/udev/net/link-config-gperf.gperf index 277ceb5386..3384ca0418 100644 --- a/src/udev/net/link-config-gperf.gperf +++ b/src/udev/net/link-config-gperf.gperf @@ -30,7 +30,7 @@ Link.MACAddress, config_parse_hwaddr, 0, Link.NamePolicy, config_parse_name_policy, 0, offsetof(link_config, name_policy) Link.Name, config_parse_ifname, 0, offsetof(link_config, name) Link.Alias, config_parse_ifalias, 0, offsetof(link_config, alias) -Link.MTU, config_parse_unsigned, 0, offsetof(link_config, mtu) -Link.SpeedMBytes, config_parse_unsigned, 0, offsetof(link_config, speed) +Link.MTUBytes, config_parse_bytes_size, 0, offsetof(link_config, mtu) +Link.BitsPerSecond, config_parse_bytes_size, 0, offsetof(link_config, speed) Link.Duplex, config_parse_duplex, 0, offsetof(link_config, duplex) Link.WakeOnLan, config_parse_wol, 0, offsetof(link_config, wol) diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 92d248fc6b..05225e0111 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -365,10 +365,11 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev if (!old_name) return -EINVAL; - r = ethtool_set_speed(ctx->ethtool_fd, old_name, config->speed, config->duplex); + r = ethtool_set_speed(ctx->ethtool_fd, old_name, config->speed / 1024, config->duplex); if (r < 0) - log_warning("Could not set speed or duplex of %s to %u Mbytes (%s): %s", - old_name, config->speed, duplex_to_string(config->duplex), strerror(-r)); + log_warning("Could not set speed or duplex of %s to %u Mbps (%s): %s", + old_name, config->speed / 1024, duplex_to_string(config->duplex), + strerror(-r)); r = ethtool_set_wol(ctx->ethtool_fd, old_name, config->wol); if (r < 0)