DEFINE_STRING_TABLE_LOOKUP(ethtool_link_mode_bit, enum ethtool_link_mode_bit_indices);
-static int ethtool_connect_or_warn(int *ret, bool warn) {
+static int ethtool_connect(int *ret) {
int fd;
assert_return(ret, -EINVAL);
fd = socket_ioctl_fd();
if (fd < 0)
- return log_full_errno(warn ? LOG_WARNING: LOG_DEBUG, fd,
- "ethtool: could not create control socket: %m");
+ return log_debug_errno(fd, "ethtool: could not create control socket: %m");
*ret = fd;
assert(ret);
if (*ethtool_fd < 0) {
- r = ethtool_connect_or_warn(ethtool_fd, true);
+ r = ethtool_connect(ethtool_fd);
if (r < 0)
return r;
}
assert(ifname);
if (*ethtool_fd < 0) {
- r = ethtool_connect_or_warn(ethtool_fd, false);
+ r = ethtool_connect(ethtool_fd);
if (r < 0)
return r;
}
ethtool_fd = &fd;
if (*ethtool_fd < 0) {
- r = ethtool_connect_or_warn(ethtool_fd, false);
+ r = ethtool_connect(ethtool_fd);
if (r < 0)
return r;
}
return 0;
if (*ethtool_fd < 0) {
- r = ethtool_connect_or_warn(ethtool_fd, true);
+ r = ethtool_connect(ethtool_fd);
if (r < 0)
return r;
}
return 0;
if (*ethtool_fd < 0) {
- r = ethtool_connect_or_warn(ethtool_fd, true);
+ r = ethtool_connect(ethtool_fd);
if (r < 0)
return r;
}
assert(ring);
if (*ethtool_fd < 0) {
- r = ethtool_connect_or_warn(ethtool_fd, true);
+ r = ethtool_connect(ethtool_fd);
if (r < 0)
return r;
}
assert(features);
if (*ethtool_fd < 0) {
- r = ethtool_connect_or_warn(ethtool_fd, true);
+ r = ethtool_connect(ethtool_fd);
if (r < 0)
return r;
}
r = get_stringset(*ethtool_fd, &ifr, ETH_SS_FEATURES, &strings);
if (r < 0)
- return log_warning_errno(r, "ethtool: could not get ethtool features for %s", ifname);
+ return log_debug_errno(r, "ethtool: could not get ethtool features for %s", ifname);
sfeatures = alloca0(sizeof(struct ethtool_sfeatures) + DIV_ROUND_UP(strings->len, 32U) * sizeof(sfeatures->features[0]));
sfeatures->cmd = ETHTOOL_SFEATURES;
if (features[i] != -1) {
r = set_features_bit(strings, netdev_feature_table[i], features[i], sfeatures);
if (r < 0) {
- log_warning_errno(r, "ethtool: could not find feature, ignoring: %s", netdev_feature_table[i]);
+ log_debug_errno(r, "ethtool: could not find feature, ignoring: %s", netdev_feature_table[i]);
continue;
}
}
r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr);
if (r < 0)
- return log_warning_errno(r, "ethtool: could not set ethtool features for %s", ifname);
+ return log_debug_errno(r, "ethtool: could not set ethtool features for %s", ifname);
return 0;
}
assert(advertise);
if (autonegotiation != AUTONEG_DISABLE && memeqzero(advertise, sizeof(uint32_t) * N_ADVERTISE)) {
- log_info("ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable.");
+ log_debug("ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable.");
return 0;
}
if (*fd < 0) {
- r = ethtool_connect_or_warn(fd, true);
+ r = ethtool_connect(fd);
if (r < 0)
return r;
}
if (r < 0) {
r = get_gset(*fd, &ifr, &u);
if (r < 0)
- return log_warning_errno(r, "ethtool: Cannot get device settings for %s : %m", ifname);
+ return log_debug_errno(r, "ethtool: Cannot get device settings for %s : %m", ifname);
}
if (speed > 0)
else
r = set_sset(*fd, &ifr, u);
if (r < 0)
- return log_warning_errno(r, "ethtool: Cannot set device settings for %s: %m", ifname);
+ return log_debug_errno(r, "ethtool: Cannot set device settings for %s: %m", ifname);
return r;
}
assert(channels);
if (*fd < 0) {
- r = ethtool_connect_or_warn(fd, true);
+ r = ethtool_connect(fd);
if (r < 0)
return r;
}
assert(ifname);
if (*fd < 0) {
- r = ethtool_connect_or_warn(fd, true);
+ r = ethtool_connect(fd);
if (r < 0)
return r;
}