xdp-project / xdp-tutorial

XDP tutorial
2.49k stars 579 forks source link

Who can help me about frame loss by bpf redirect action? #92

Open sofardware opened 4 years ago

sofardware commented 4 years ago

On my device wtih Intel i7-6700 CPU and igb NIC driver and centos7.5 kernel 5.4.0, using bpf_redirecct_map() in tutors of packet03, there is always handreds fram losss, no metter the trafic is 500Mbit/s or 10Mbit/s. But there is no fram loss without xdp program loaded , with the same traffic . With xdp programof bpf_redirecct_map(), the performace can reach about 500Mbit/s, but just loss a little packets, though I reduce the trafic to 10Mbit/s, but still a little packets loss. The above traffic is produce by hardware tester of SPIRENT. There is no packet loss if the traffic is very little for example of no more than 1000 packes/s . The packets should not loss in receiving and bpf_redirecct_map processing. Because the rx packets in ifconfig ino and xdp_stats are both right, and the tx packets in ifcong info is not right. And it also should not result in rx and tx buff or fifo, because the "dropped" and "overrun" in ifconfig info are "0".

So, I do not know what's wrong in bpf redirect action???

The details of my testing: Threre are 10 000 000 udp packets in my test trafic and 100 arp packets, in both direction. using xdp_router in turor of packet03. The xdp_stats result is: XDP-action
XDP_ABORTED 0 pkts ( 0 pps) 0 Kbytes ( 0 Mbits/s) period:2.000460 XDP_DROP 0 pkts ( 0 pps) 0 Kbytes ( 0 Mbits/s) period:2.000471 XDP_PASS 100 pkts ( 0 pps) 6 Kbytes ( 0 Mbits/s) period:2.000478 XDP_TX 0 pkts ( 0 pps) 0 Kbytes ( 0 Mbits/s) period:2.000483 XDP_REDIRECT 10,000,000 pkts ( 0 pps) 600,000 Kbytes ( 0 Mbits/s) period:2.000489

The ifconfig info  before and after transmiting are:

before: [root@localhost ~]# ifconfig eth0 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.1 netmask 255.255.255.0 broadcast 0.0.0.0 inet6 fe80::e73:ebff:fe90:80f1 prefixlen 64 scopeid 0x20 ether 0c:73:eb:90:80:f1 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 7 bytes 826 (826.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0xdf000000-df0fffff

[root@localhost ~]# ifconfig eth1 eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.1 netmask 255.255.255.0 broadcast 0.0.0.0 inet6 fe80::e73:ebff:fe90:80f2 prefixlen 64 scopeid 0x20 ether 0c:73:eb:90:80:f2 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 7 bytes 826 (826.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0xded00000-dedfffff
after: [root@localhost ~]# ifconfig eth1 eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.1 netmask 255.255.255.0 broadcast 0.0.0.0 inet6 fe80::e73:ebff:fe90:80f2 prefixlen 64 scopeid 0x20 ether 0c:73:eb:90:80:f2 txqueuelen 1000 (Ethernet) RX packets 10000100 bytes 600006000 (572.2 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9999759 bytes 599984146 (572.1 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0xded00000-dedfffff

[root@localhost ~]# ifconfig eth0 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.1 netmask 255.255.255.0 broadcast 0.0.0.0 inet6 fe80::e73:ebff:fe90:80f1 prefixlen 64 scopeid 0x20 ether 0c:73:eb:90:80:f1 txqueuelen 1000 (Ethernet) RX packets 10000100 bytes 600006000 (572.2 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9999727 bytes 599982226 (572.1 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0xdf000000-df0fffff

netoptimizer commented 4 years ago

The igb NIC driver does not support XDP native.

sofardware commented 4 years ago

The igb NIC driver does not support XDP native.

yes. I used "--skb" mode. But , the paskets do be lost by redrect action . How can I debug this probem?

sofardware commented 4 years ago

The igb NIC driver does not support XDP native.

yes. I used "--skb" mode. But , the paskets do be lost by redrect action . How can I debug this probem?