个人工具

UbuntuHelp:UbuntuLTSP/FlowControl

来自Ubuntu中文

跳转至: 导航, 搜索
This page is specific to Ubuntu versions 8.04, 8.10, 9.04, 10.04

If you find this information applicable to additional versions/releases, please edit this page and modify this header to reflect that. Please also include any necessary modifications for this information to apply to the additional versions.


Introduction

Ethernet flow control, or 802.3x, is a way for a network device to tell its immediate neighbor that it is overloaded with data, such as when a device is receiving data faster than it can process it. Unfortunately, if flow control is enabled on a gigabit switch with a gigabit server and 100Mbps clients, it may bring down the whole network bandwidth to 100Mbps. So flow control should be disabled for mixed-speed LTSP networks.

Disabling flow control on the switch

If your switch is managed, the easiest way would be to disable flow control from its configuration interface.

Disabling flow control with module parameters

For modules that support it, the appropriate parameters may be appended to /etc/modprobe.d/options. IconsPage?action=AttachFile&do=get&target=important.pngNOTE: The file /etc/modprobe.d/options no longer exists in newer versions of Ubuntu. It is still supported by the kernel, however the filename needs the .conf extension, i.e. /etc/modprobe.d/options.conf would be the file you create to save your options. Actually the filename doesn't matter as long as the .conf extension is used. NOTE: if you find the correct parameter for your module (hint: modinfo e1000 | grep ^parm), please edit the page and append the correct line below:

Driver /etc/modprobe.d/options line
e1000 options e1000 !FlowControl=2
3c59x options 3c59x flow_ctrl=0

Disabling flow control with ethtool

For drivers that support ethtool, the following command can be used to disable flow control on the server NIC:

sudo ethtool -A eth0 autoneg off rx off

To see if flow control is currently disabled, you may execute:

ethtool -a eth0

One place to insert this command could be in a new /etc/network/if-up.d/flow-control script. Remember to do chmod +x flow-control. (Note that in the following script you must delete the space between "#" and "!" on the first line. Please edit this section if you know how to make these two characters display side by side.)

# !/bin/sh
# Disable flow control. For more info, see
# https://help.ubuntu.com/community/UbuntuLTSP/FlowControl

set -e

# Don't do anything for the lo interface.
if [ "$IFACE" = lo ]; then
	exit 0
fi

# Only run from ifup.
if [ "$MODE" != start ]; then
	exit 0
fi

# Only care about inet and inet6.
if [ "$ADDRFAM" != inet ] && [ "$ADDRFAM" != inet6 ]; then
	exit 0
fi

# Is /usr mounted?
if [ ! -e /usr/sbin/ethtool ]; then
	exit 0
fi

/usr/sbin/ethtool -A eth0 autoneg off rx off >/dev/null 2>&1 || true

exit 0

In case it will not be applied after startup and flow control still is enabled (e.g in lucid, 10.04) here is a small workaround to disable flow control with ubuntu startup scripts. You can solve it simply by adding "/etc/init.d/networking restart" to the "/etc/rc.local" file. Don't forget setting it executable: "chmod +x /etc/rc.local". Of course the script above ("Disabling flow control with ethtool") must be installed.

Disabling flow control with mii-tool

TODO (please edit the page if you have information on this)

Benchmarks

A real-life benchmark showed that with flow control on, a 100/1000 mixed speed network operated at 90Mbps, and with flow control off the bandwidth increased to 900Mbps.

See Also

  • UbuntuLTSP - Community Ubuntu LTSP Documentation.

External Links