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
Infos
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
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.
News
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.