TSO、UFO、GSO、LRO、GRO和RSS介绍
https://blog.csdn.net/yeasy/article/details/19204639
LRO测试:
1、关闭本端网卡的gro功能,开启lro功能;
ethtool -K ethx lro on
ethtool -K eth1 gro off
2、使用TCP从对端发送文件到测试端,文件大小要求大于MSS值(例如文件大小为9000字节左右),在测试端进行抓包。
测试端:
nc -l 9999 >lro.txt # 9999 为端口号
tcpdump -i ethX
对端发包:
nc 192.1.1.11 9999 < lro.txt #192.1.1.11 为测试网口IP , lro.txt 为待发送的文件
通过tcpdump抓到的包来看,有长度大于MSS值的报文。
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on p1p1, link-type EN10MB (Ethernet), capture size 262144 bytes
10:57:06.587546 IP 192.1.1.10.40834 > localhost.localdomain.distinct: Flags [S], seq 4085210956, win 29200, options [mss 1460,sackOK,TS val 13419579 ecr 0,nop,wscale 7], length 0
10:57:06.587648 IP localhost.localdomain.distinct > 192.1.1.10.40834: Flags [S.], seq 482742982, ack 4085210957, win 28960, options [mss 1460,sackOK,TS val 51916238 ecr 13419579,nop,wscale 7], length 0
10:57:06.590481 IP 192.1.1.10.40834 > localhost.localdomain.distinct: Flags [.], ack 1, win 229, options [nop,nop,TS val 13419580 ecr 51916238], length 0
10:57:06.590567 IP 192.1.1.10.40834 > localhost.localdomain.distinct: Flags [P.], seq 1:8193, ack 1, win 229, options [nop,nop,TS val 13419580 ecr 51916238], length 8192
10:57:06.590595 IP localhost.localdomain.distinct > 192.1.1.10.40834: Flags [.], ack 8193, win 355, options [nop,nop,TS val 51916241 ecr 13419580], length 0
10:57:06.590612 IP 192.1.1.10.40834 > localhost.localdomain.distinct: Flags [FP.], seq 8193:9342, ack 1, win 229, options [nop,nop,TS val 13419580 ecr 51916238], length 1149
10:57:06.590781 IP localhost.localdomain.distinct > 192.1.1.10.40834: Flags [F.], seq 1, ack 9343, win 376, options [nop,nop,TS val 51916241 ecr 13419580], length 0
10:57:06.593488 IP 192.1.1.10.40834 > localhost.localdomain.distinct: Flags [.], ack 2, win 229, options [nop,nop,TS val 13419580 ecr 51916241], length 0
tcpdump是一个用来抓取linux网络数据包的工具,它和网卡之间的工作顺序是:
进来的顺序 Wire -> NIC -> tcpdump -> netfilter/iptables
出去的顺序 iptables -> tcpdump -> NIC -> Wire
可见,CPU无需对接收的报文进行聚合操作,网卡接管了这部分工作。
如果关闭lro功能,则该部分的工作由操作系统进行。tcpdump抓到的报文理应小于1514Byte。