From cb1277fa3b1d7a5b6e1b7cce31b91cd2efdad97a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 12 May 2020 23:48:27 +0200 Subject: [PATCH] udev: get rid of "Could not set flow control of" message on "lo" interface When setting flow control attributes of an interface we first acquire the current settings and then add in the new settings before applying them again. This only works on interfaces that implement the ethtool ioctls. on others we'll see an ugly "Could not set flow control of" message, simply because we issue the SIOCETHTOOL ioctl once, for getting the data. In particular we'll get it for the "lo" interface all the time, which sucks hard. Let's get rid of it. --- src/udev/net/link-config.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index e4ace761b72..07e7026549e 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -413,9 +413,11 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, log_warning_errno(r, "Could not set ring buffer of %s: %m", old_name); } - r = ethtool_set_flow_control(&ctx->ethtool_fd, old_name, config->rx_flow_control, config->tx_flow_control, config->autoneg_flow_control); - if (r < 0) - log_warning_errno(r, "Could not set flow control of %s: %m", old_name); + if (config->rx_flow_control >= 0 || config->tx_flow_control >= 0 || config->autoneg_flow_control >= 0) { + r = ethtool_set_flow_control(&ctx->ethtool_fd, old_name, config->rx_flow_control, config->tx_flow_control, config->autoneg_flow_control); + if (r < 0) + log_warning_errno(r, "Could not set flow control of %s: %m", old_name); + } r = sd_device_get_ifindex(device, &ifindex); if (r < 0) -- 2.47.3