xdp-project / xdp-tools

Utilities and example programs for use with XDP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help about af_xdp, i have some confusion(eg, i should process arp protocol?)

xjj210130 opened this issue · comments

Hi all:
When I was using af_xdp, I found that af_xdp transferred all the messages to umem. Is there any way to continue to hand over the three-way handshake protocol of arp and tcp to the kernel for processing.
eg : the project bpf-examples/AF_XDP-forwarding. i should process all protocol.
Thanks

The default bpf program for AF_XDP from libxdp will transfer all packet received on a queue to an AF_XDP socket if a socket is attached to that queue.
If you want ARP and TCP handshake handled by the kernel you would need to write a custom bpf program that will either:

  1. filter the packets you want to the af_xdp socket and all other traffic to the kernel. OR
  2. filter the packets you don't want to the kernel and all other traffic to the af_xdp socket.

There's a useful project called CNDP [1] that you might find useful - particularly the cnet stack. It uses a hybrid network stack (kernel space is the control plane and userspace, via af_xdp, provides the accelerated dataplane).

There's also a quick overview of it here [2].

[1] https://github.com/CloudNativeDataPlane/cndp
[2] https://fosdem.org/2023/schedule/event/hybrid_netstack/

@maryamtahhan use xdp prog and af_xdp, we can capture packet from network to user space . when i process the packet in user space , i want forward packet to other network, or other pc, how to deal with it. Of couse, we can't use socket communication。we can get the packet addr from af_xdp api , but how to forward it ? thanks.
it's the question xdp-project/bpf-examples#94

Thanks again

Hi @xjj210130 I've replied in xdp-project/bpf-examples#94 I hope it helps