diff options
author | Michael Chan <mchan@broadcom.com> | 2005-10-07 13:45:10 -0700 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-25 02:31:43 -0400 |
commit | af2dbf701797d5c2bb5b8ea24bc1832ac79a7d7a (patch) | |
tree | af187ef663286548e9750f1bcbd24eac166a351a /ethtool.c | |
parent | a69768a4266ef72fb6936334013a4183269732f2 (diff) | |
download | ethtool-af2dbf701797d5c2bb5b8ea24bc1832ac79a7d7a.tar.gz |
[PATCH] ethtool: Fix default advertsing
Change 'ethtool -s eth0 autoneg on' to pass in only the supported
speeds to advertise if speed and duplex are not specified by the user.
This makes more sense than the current behavior of advertising 10/100/
1000, some of which may not be supported by the device.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'ethtool.c')
-rw-r--r-- | ethtool.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -614,13 +614,10 @@ static void parse_cmdline(int argc, char **argp) duplex_wanted == DUPLEX_FULL) advertising_wanted = ADVERTISED_1000baseT_Full; else - /* auto negotiate without forcing */ - advertising_wanted = ADVERTISED_100baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_10baseT_Half | - ADVERTISED_1000baseT_Full | - ADVERTISED_1000baseT_Half; + /* auto negotiate without forcing, + * all supported speed will be assigned in do_sset() + */ + advertising_wanted = 0; } @@ -1588,8 +1585,18 @@ static int do_sset(int fd, struct ifreq *ifr) ecmd.phy_address = phyad_wanted; if (xcvr_wanted != -1) ecmd.transceiver = xcvr_wanted; - if (advertising_wanted != -1) - ecmd.advertising = advertising_wanted; + if (advertising_wanted != -1) { + if (advertising_wanted == 0) + ecmd.advertising = ecmd.supported & + (ADVERTISED_10baseT_Half | + ADVERTISED_10baseT_Full | + ADVERTISED_100baseT_Half | + ADVERTISED_100baseT_Full | + ADVERTISED_1000baseT_Half | + ADVERTISED_1000baseT_Full); + else + ecmd.advertising = advertising_wanted; + } /* Try to perform the update. */ ecmd.cmd = ETHTOOL_SSET; |