在开启 tso 的时候,使用命令 ethtool -K ethX tso on,会报 Could not change any device features。一开始我查阅网上资料以为网卡并不支持 tso,事实并非如此。
部分 driver 默认关闭 tso 的:
/* don't enable SG, IP_CSUM and TSO by default - it might not work
* properly for all devices */
使用 ethtool -k ethX 显示网卡 Offload 参数的状态,可以看到 tcp-segmentation-offload 是关闭的。
这时如果使用 ethtool -K ethX tso on,会报 Could not change any device features。在网上查阅资料后发现,并非 driver 不支持 tso,而是 tso 依赖 sg 和 tx,所以应该同时开启这三项,当然有些 driver 的 tx 是开启的,只需开启 sg。
使用命令 sudo ethtool -K ethX tso on sg on tx on 后,可以得到下图,这样 tso 就开启了。
如果觉得这篇文章有用的话,可以点赞、评论或者收藏,万分感谢,goodbye~