错误描述
ethtool -K eth0 tso on
Cannot set device tcp segmentation offload settings: Invalid argument
TSO选项开启失败。
网卡驱动
显示网卡驱动
ethtool -i | --driver ethX
例:ethtool -i eth0
driver: tg3
version: 3.122n
firmware-version: 5752-v3.19
bus-info: 0000:0b:00.0
例:ethtool -i eth0
driver: e1000
version: 7.3.21-k4-NAPI
firmware-version: N/A
bus-info: 0000:03:06.0
intel的e1000
drivers/ net/ ethernet/ intel/ e1000/ e1000_main.c
broadcom的tg3
drivers/ net/ ethernet/ broadcom/ tg3.h
drivers/ net/ ethernet/ broadcom/ tg3.c
网卡型号
PCI (Peripheral Component Interconnect),外围部件互联总线。
lspci — list all PCI devices
例:lspci -vvv | grep Ethernet
0b:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5752 Gigabit Ethernet PCI Express (rev 02)
网卡为Broadcom的千兆网卡,型号为BCM5752。
解决过程
找台能正常设置TSO的机器,依次检查和对比:
1. 网卡类型 - support TSO
2. 网卡驱动 - support TSO
3. ethtool - support TSO
4. 内核版本 - support TSO
5. 依赖关系 - 问题出在这里!
A driver that wants to offer TSO needs to set the NETIF_F_TSO bit in the network structure.
In oder for a device to support TSO, it needs to also support TCP_checksum_offloading and
Scatter_Gather.
想要使用TSO,必须确保:
ethtool -K eth0 tx on // specifies whether TX checksumming should be enabled.
ethtool -K eth0 sg on // specifies whether scatter-gather should be enabled.
ethtool -K eth0 tso on // specifies whether TCP segmentation offload should be eabled.
这三者缺一不可,而出现"Cannot set device tcp segmentation offload settings: Invalid argument"的原因
就是没有事先启用scatter-gather选项。