Commit 9337f7d4 authored by David Johnson's avatar David Johnson

On Linux clients, fix eth speed via ethtool; fallback to autoneg on failure.

This is now our strategy for everything except a speed of 0 (which means
autonegotiate); and a speed of 1 Gbps (which requires autoneg anyway).

Not all cards allow ethtool to "fix" speeds; but some (still) require
it.  For instance, this commit when applied to an Intel X710 card that
should be at 10Gbps has no affect; apparently ethtool cannot fix speeds
for that card and/or driver.  On the other hand, Mellanox 10/25Gbps
cards sometimes require the speed to be manually set (i.e., if they are
directly connected to each other via a layer1 switch).  Even on those
cards, it's not really setting it; it's just hinting to the autoneg
process which speed you really want (and I'd guess that is true for all
modern high-speed Ethernet chips).

Anyway, we don't know when to force the speed set/suggest or not unless
we track more data at the server side, so the current strategy is to
always attempt to set/suggest the speed we want, and fallback to setting
autoneg if we fail.  Note that sometimes ethtool returns successfully
even if settings fail (I'm looking at you, Intel X710), so this strategy
is already sort of doomed to failure (but it hasn't made anything not
work!).  If it causes problems for any cards/drivers/speed combinations,
we'll revisit this, obviously.
parent 4b0dbcc2
......@@ -740,13 +740,16 @@ sub os_ifconfig_line($$$$$$$$;$$$)
if ($speed eq '0' || $speed eq '1000') {
$uplines .= " $ethtool -s $iface autoneg on\n ";
}
elsif ($speed eq '10000') {
$uplines .= " true\n ";
}
else {
$uplines .=
" $ethtool -s $iface autoneg off speed $speed duplex $duplex\n " .
" sleep 2 # needed due to likely bug in e100 driver on pc850s\n ";
" if $ethtool -s $iface autoneg off speed $speed duplex $duplex >/dev/null 2>&1 ; then\n " .
" sleep 2 # needed due to likely bug in e100 driver on pc850s\n " .
" else\n " .
" echo ERROR: failed to set speed $speed on iface $iface; falling back to autonegotiation!\n " .
" if ! $ethtool -s $iface autoneg on ; then\n " .
" echo ERROR: failed to fall back to autonegotiation on $iface!\n " .
" fi\n " .
" fi\n ";
}
if ($media eq '') {
$uplines .=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment