xdp-tutorial
xdp-tutorial copied to clipboard
Some times packets are not receiving in AF_XDP socket
I am trying to write AF_XDP program for passing only packets having specific udp port with bpf_redirect_map, but sometimes no packets are coming to AF_XDP socket. My sender and receiver are connected with a switch. Any protocol like ARP is missing is the reason ? I am doing XDP_PASS for all other packets, but still i am unable to receive packets some time. My code is based on this example. https://github.com/timfehr/xdp/blob/master/reqrouter_kern.c May I know the reason for it. I am unable to see those packets in wireshark also. I can see some ICMP messages poping up in wireshark during that time, not sure is this has a role in the issue.
Maybe @magnus-karlsson or @bjoto have an idea; otherwise I'd suggest posting to [email protected] with a description of your problem.
In either case, "sometimes I don't get packets" is not going to cut it as a problem description. You'll need to provide some more details such as:
- Which kernel version, NIC model and driver, compiler version and libbpf version are you using?
- What do you mean "sometimes no packets are coming to AF_XDP socket"? When does it work and when doesn't it?
- Sharing the source code of your program would be helpful.
Hi, Kernel version is 5+ (I am using ubuntu 20.x). Nic driver is ixgbe. No compile issues i am seeing. Some times means, if i am sending packets 10 times, out of these I am not receiving 10 times, sometimes in the first try I won't receive the packet, sometime after some try i won't get packets. My code is available here - https://github.com/Adarsh97/XDP
Please let me know if you need more details.
You're using rxq_index as your xsk map key. What mechanism are you using to ensure packets always arrive on queue idx 0?
I am using " ethtool -L interface combined 1", for ensuring only one queue is present. Any issue with that ?
@tohojo any idea why it is happening like that ?
Adarsh Sunilkumar @.***> writes:
@tohojo any idea why it is happening like that ?
Not really, no... some issue with how your userspace program is reading packets from the ringbuffer? Does the xdpsock example in the kernel samples directory work?
On Sun, Jun 13, 2021 at 10:04 PM Toke Høiland-Jørgensen < @.***> wrote:
Adarsh Sunilkumar @.***> writes:
@tohojo any idea why it is happening like that ?
Not really, no... some issue with how your userspace program is reading packets from the ringbuffer? Does the xdpsock example in the kernel samples directory work?
Adarsh,
As Toke suggests, please try the standard xdpsock program and check if it exhibits the same behaviour. If not, then add your code to that in small pieces to check where the error is coming from. One question is if your packets are really dropped or if they arrive later in batches of X packets?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xdp-project/xdp-tutorial/issues/223#issuecomment-860263110, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASGUEMGYE76CBXMLOFXKXDTSUFLPANCNFSM46S3S3YQ .