From: Yu Watanabe Date: Thu, 20 May 2021 20:32:17 +0000 (+0900) Subject: ethtool-util: move and rebreak comments X-Git-Tag: v249-rc1~169^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4323046c5fa9fc235af65ad759540abcde62244a;p=thirdparty%2Fsystemd.git ethtool-util: move and rebreak comments --- diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c index da47aff7201..11e69929813 100644 --- a/src/shared/ethtool-util.c +++ b/src/shared/ethtool-util.c @@ -805,12 +805,6 @@ static int set_sset(int fd, struct ifreq *ifr, const struct ethtool_link_usettin return 0; } -/* If autonegotiation is disabled, the speed and duplex represent the fixed link - * mode and are writable if the driver supports multiple link modes. If it is - * enabled then they are read-only. If the link is up they represent the negotiated - * link mode; if the link is down, the speed is 0, %SPEED_UNKNOWN or the highest - * enabled speed and @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode. - */ int ethtool_set_glinksettings( int *fd, const char *ifname, @@ -828,6 +822,12 @@ int ethtool_set_glinksettings( assert(ifname); assert(advertise); + /* If autonegotiation is disabled, the speed and duplex represent the fixed link mode and are + * writable if the driver supports multiple link modes. If it is enabled then they are + * read-only. If the link is up they represent the negotiated link mode; if the link is down, + * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and @duplex is %DUPLEX_UNKNOWN + * or the best enabled duplex mode. */ + if (autonegotiation != AUTONEG_DISABLE && memeqzero(advertise, sizeof(uint32_t) * N_ADVERTISE)) { log_debug("ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable."); return 0;