文章目录
如何开启网卡TSO分段卸载和校验功能
启用和禁用“TCP分段卸载(TSO)”
#启用TSO分段卸载前,必须打开“分散收集”和“出站校验和”
ethtool -K enp161s0f0np0 tx on
ethtool -K enp161s0f0np0 sg on
ethtool -K enp161s0f0np0 tso on
#ethtool -K enp161s0f0np0 tx on sg on tso on #或者直接一条命令
配置接收校验和卸载功能
#配置让网卡执行“入站|接收校验和卸载”功能
ethtool -K enp161s0f0np0 rx on
#配置让CPU执行"入站|接收校验和卸载"功能
ethtool -K enp161s0f0np0 rx off
配置传输校验和卸载功能
#配置让网卡执行“入站|接收校验和卸载”功能
ethtool -K enp161s0f0np0 tx on
#配置让CPU执行"出站|传输校验和卸载"功能
ethtool -K enp161s0f0np0 tx off
=======我测试还原回去,网卡性能都已经达不到了(改回去重启才生效)======
查看NIC ring buffer大小
ethtool -g enp161s0f0np0
设置NIC ring buffer大小
ethtool -G enp161s0f0np0 rx 1024
ethtool -G enp161s0f0np0 tx 1024
linux如何开启网卡多队列
1、查看网卡是否支持多队列(内核版本2.6.35及以上,否则不支持网卡多队列。)
[root@C20230217144723 cache]# ethtool -l eth0
Channel parameters for eth0:
Pre-set maximums:
RX: 0
TX: 0
Other: 0
Combined: 2 #表示最多支持设置2个队列
Current hardware settings:
RX: 0
TX: 0
Other: 0
Combined: 1 #表示当前生效的是1个队列,如果返回信息中,两个Combined字段取值相同,则表示弹性网卡已开启支持多队列。
2、开启网卡的多队列功能(先查看支持几个队列,然后设置成相应的队列数)
[root@localhost ~]# ethtool -L eth0 combined 2
ethtool命令介绍(linux下如何查看网卡属性,网卡速率)
ethtool eth0 查看网卡物理特性(网卡速率)
ethtool -t eth0 online 网卡测试命令(其中online表示不需要重启网卡的测试,offline表示要重启网卡)
ethtool -S eth0 查看网卡状态
ethtool -S eth0 | grep -i error 查询网卡接收数据包信息
ethtool -p eth0 确定网卡物理位置(多网卡服务器,该网卡灯会闪烁)
ethtool -i eth0 查看网卡驱动信息
ethtool -g eth0 查看NIC ring buffer大小
ethtool -G eth0 rx 4078 设置NIC ring buffer大小(ethtool -G|--set-ring devname [rx N] [rx-mini N] [rx-jumbo N] [tx N]) #(若是bond成员接口,改回原值不负载,重启系统即可)(不要设置超过当前硬件的值)
cat /proc/interrupts | grep -E "enp1s0f0|CPU" #linux查看网卡队列数
ethtool -s eth0 speed 100 #将网卡的速度降为百兆(改变网卡速率)
ethtool -k eth0 #查看LRO/GRO当前是否打开
ethtool -K eth0 lro off #关闭LRO
ethtool -K eth0 gro off #关闭GRO
ethtool -K eth0 gso off #关闭GSO
ethtool -L eth0 combined 4 #开启网卡多队列
#开启vxlan offload
ethtool -K ens2f0 rx-checksum on
ethtool -K ens2f0 tx-udp_tnl-segmentation on
#查看网卡光功率(下面便是发射和接收功率)
ethtool -m em0
Laser output power : 0.5162 mW / -2.87 dBm
Receiver signal average optical power : 0.4702 mW / -3.28 dBm
动态监控网卡队列
watch -d -n 1 'cat /proc/interrupts'
watch -d -n 1 'cat /proc/interrupts | grep -E "enp1s0f0|CPU"'
如果文章对你有帮助,欢迎点击上方按钮打赏作者
暂无评论