Managing your network interface with ethtool

TSO

Another gotcha I've come across in the past is called TCP Segmentation Offload (known as TSO), which is used for outbound, egress traffic. TSO is well-intentioned and is designed to improve the throughput performance of a NIC while helping to cut down on the CPU hit for processing high levels of traffic.

The hardware helps to introduce a buffer that can then have its contents split up into segments. In short, TSO has control and may change how your TCP traffic flows. This feature works well until something breaks its functionality and you need to disable it quick smart. You can disable TSO with:

# ethtool -K eth0 tso off

Conversely, if you want to re-enable it, you can use the command:

# ethtool -K eth0 tso on

But, there's more. In the following command:

# ethtool -K eth0 tx off   sg off tso off

the tx relates to pause functionality for transmitted, egress data. The sg stands for scatter-gather. From what I can tell, scatter-gather is the act of pulling together data from different places and reformatting it so that you can output it as one data stream.

For a network card to support TSO, both checksumming and scatter-gather functionality must be present. Switching off the ability to pause traffic, as well as sg and TSO, is a good starting point for debugging. You have ufo (UDP Fragmentation) and gso (Generic Segmentation) options as well.

Incidentally, TSO's counterpart for ingress traffic is something called LRO (Large Receive Offload), which uses a very similar premise and the lro moniker as its syntax. Some reports say using LRO on Linux routers is a very bad idea that will cause significant performance headaches, so watch out with LRO if you're forwarding traffic.

Flow Control

Another common networking issue is flow control. In its first incarnation, flow control was defined in IEEE 802.3x, and later in IEEE 802.1Qbb, which describes "priority-based flow control."

Flow control works clevely by offering a helping hand to the part of the network link that has too much work to do. When the network is struggling, flow control allows a brief pause so that traffic can catch up. Unfortunately, in some situations, overall network speed can be severely affected if the clever flow control misbehaves.

One such nightmare scenario might be using Gigabit switches, Gigabit servers, and 100Mbps client machines. Badly behaving flow control might force all devices, Gigabit or otherwise, all the way down to 100Mbps.

You'll need to have a network card that supports pause functionality to adjust these settings. The most basic type of pause functionality lets you pause all traffic on a link; a newer version also lets you prioritize per traffic class. You can query your card with the -a option, which is the same as --show-pause:

# ethtool -a eth0
Pause parameters for eth0:
Autonegotiate:  on
RX:             on
TX:             on

For this NIC, all is well with hardware support.

You can disable this sometimes-pesky pause functionality with the following syntax:

# ethtool -a|--pause devname   [rx on|off] [tx on|off]   [autoneg on|off]

In other words, an example to switch off both ingress and egress "pause" functionality might look like the following:

# ethtool --pause eth0   rx off tx off autoneg off

Some users contend that making sure the auto-negotiation is switched off will ensure your settings are applied correctly. You can simply run:

# ethtool -a eth0

to check whether your new settings have taken effect.

Unconscious

At some point in the future, you'll be sitting impatiently, blaming a piece of software for your woes and the resulting bad mood your boss is in. Lo and behold the issue might be a network problem you can diagnose with ethtool.

Just remember to run through your "flow control" settings, test TSO both on and off, and force your speed and duplex settings. Fire up a tool like ngrep to sniff the data as it traverses your links, and bear in mind the fun and games you can experience with auto-negotiation too.

See the box titled "Mii-tool" for a look at an alternative for older systems that might not support ethtool.

Mii-tool

An older tool called mii-tool also allows the user to query NIC settings. Mii-tool is a precursor to ethtool, and many consider it obsolete, but it is still effective on older systems where ethtool isn't available.

If you are going to try mii-tool, be aware of the caveat in the "NOTE" section of the mii-tool man page:

"This program is obsolete. Valid media are only 100baseT4, 100baseTx-FD,100baseTx-HD, 10baseT-FD and 10baseT-HD ethernet cards. For replacement, check ethtool."

In layman's terms, the note means you can't count on mii-tool to help you if the network speed is higher than 100Mbps.

To drop link up/down messages to the Syslog daemon:

# mii-tool -lw

To force a speed setting:

# mii-tool --force 10baseT-HD

HD stands for "half duplex." FD cranks up the setting to full blast.

You might get lost in the configuration parameters available from mii-tool and need to reset the config back to defaults (hardware settings only):

# mii-tool --reset

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Charly's Column

    A touchy LAN that plays like a movie diva can spoil any admin’s day. Ethtool to the rescue!

  • Ask Klaus!

    Klaus Knopper is the creator of Knoppix and co-founder of the LinuxTag expo. He currently works as a teacher, programmer, and consultant. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: klaus@linux-magazine.com

  • systemd-networkd

    The new networkd component of the systemd project supports basic network configuration. Despite its early stage of development, one thing is clear: This is a daemon with brains.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News