1、软硬件环境
硬件: 飞腾E2000Q 平台
软件: linux 4.19.246
2、问题现象
网卡在高速收包的过程中,出现 rx error , 细查是 rx_resource_errors 如下:
root@E2000-Ubuntu:~# ifconfig eth1
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.100.1.2 netmask 255.255.255.0 broadcast 10.100.1.255
inet6 fe80::5ed2:bff:fe13:817d prefixlen 64 scopeid 0x20<link>
ether 5c:d2:0b:13:81:7d txqueuelen 1000 (Ethernet)
RX packets 28043321 bytes 41384388153 (41.3 GB)
RX errors 17434 dropped 0 overruns 1305 frame 16129
TX packets 26633002 bytes 39782515051 (39.7 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 93
root@E2000-Ubuntu:~#
root@E2000-Ubuntu:~# ethtool -S eth1 | grep error
tx_carrier_sense_errors: 0
rx_frame_check_sequence_errors: 0
rx_length_field_frame_errors: 0
rx_symbol_errors: 0
rx_alignment_errors: 0
rx_resource_errors: 16129
rx_ip_header_checksum_errors: 0
rx_tcp_checksum_errors: 0
rx_udp_checksum_errors: 0
问题复现过程如下:
Server端 (问题设备):
ifconfig eth3 192.168.1.11 netmask 255.255.255.0
iperf3 -s -B 192.168.1.11 -p 10002
Client 端 (正常设备):
ifconfig eth3 192.168.1.10 netmask 255.255.255.0
iperf3 -c 192.168.1.11 -p 10002 -t500 -u -b 0
3、问题分析
rx error 有很多种类,具体ethtool 就列出了这几类,有些是硬件原因,有些是软件可调整的。
rx_frame_check_sequence_errors
rx_length_field_frame_errors
rx_symbol_errors
rx_alignment_errors
rx_resource_errors
rx_ip_header_checksum_errors
rx_tcp_checksum_errors
rx_udp_checksum_errors
MAC在收发包的同时,如果出现有CRC的错包,或者来不及缓存被溢出包,都会被统计到相应的寄存器中,这些数值一般都可以在MAC 的寄存器中读出的,以E2000Q为例
drivers/net/ethernet/phytium/macb.h
/* GEM register offsets. */
.......
#