Express Data Path
Original author(s) | Brenden Blanco, Tom Herbert |
---|---|
Initial release | 2016 |
Written in | C |
Operating system | Linux |
Type | Packet filtering |
License | GPL |
XDP (eXpress Data Path) is an eBPF based high performance data path merged in the Linux kernel since version 4.8[1].
The idea behind XDP is to add an early hook in the RX path of the kernel, and let an user supplied eBPF program decide the fate of the packet. The hook is placed in the NIC driver just after the interrupt processing, and before any memory allocation needed by the network stack itself, because memory allocation can be an expensive operation. Due to this design, XDP can drop 26 millions of packets per second with commodity hardware[2].
The eBPF program must pass a preverifier test[3] before being loaded, to avoid executing malicious code in kernel space. The preverifier checks that the program contains no out-of-bounds accesses, loops or global variables.
The program is allowed to edit the packet data and, after the eBPF program returns, an action code determines what to do with the packet:
- let the packet continue through the network stack
- silently drop the packet
- bounce the packet back from the same NIC it arrived on
- send the packet to an users pace socket via the AF_XDP address family
XDP requires support in the NIC driver but, as not all drivers supports it, it can fallback to a generic implementation, which performs the eBPF processing in the network stack, though with slower performances[4].
XDP has infrastructure to offload the eBPF program to a NIC card which supports it, reducing the CPU load. At the time only Netronome cards supports it[5], with Intel and Mellanox working on it[6].
References
- ^ "[GIT] Networking - David Miller". lore.kernel.org. Retrieved 2019-05-14.
- ^ Høiland-Jørgensen, Toke (2019-05-03), Source text and experimental data for our paper describing XDP: tohojo/xdp-paper, retrieved 2019-05-14
- ^ "A thorough introduction to eBPF [LWN.net]". lwn.net. Retrieved 2019-05-14.
- ^ "[PATCH net-next v5] net: Generic XDP". www.mail-archive.com. Retrieved 2019-05-14.
- ^ "BPF, eBPF, XDP and Bpfilter… What are these things and what do they mean for the enterprise? - Netronome". www.netronome.com. Retrieved 2019-05-14.
- ^ "XDP acceleration using NIC metadata" (PDF).
{{cite web}}
: Cite has empty unknown parameter:|dead-url=
(help)
External links
- [1] XDP documentation on Read the Docs
- [2] AF_XDP documentation on kernel.org
- [5] L4Drop: XDP DDoS Mitigations, Cloudflare