XDP (eXpress Data Path) is an
eBPF-based high-performance
data path used to send and receive
network packets at high rates by bypassing most of the
operating system networking stack. It is merged in the
Linux kernel
The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU ope ...
since version 4.8. This implementation is licensed under
GPL. Large technology firms including Amazon, Google and Intel support its development. Microsoft released their
free and open source implementation ''XDP for Windows'' in May 2022.
It is licensed under
MIT License.
Data path

The idea behind XDP is to add an early hook in the RX path of the kernel, and let a user supplied eBPF program decide the fate of the packet. The hook is placed in the
network interface controller (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 million packets per second per core with commodity hardware.
The eBPF program must pass a preverifier test 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:
*
XDP_PASS
: let the packet continue through the network stack
*
XDP_DROP
: silently drop the packet
*
XDP_ABORTED
: drop the packet with trace point exception
*
XDP_TX
: bounce the packet back to the same NIC it arrived on
*
XDP_REDIRECT
: redirect the packet to another NIC or user space socket via the
AF_XDP
XDP (eXpress Data Path) is an eBPF-based high-performance data path used to send and receive network packets at high rates by bypassing most of the operating system networking stack. It is merged in the Linux kernel since version 4.8. This implem ...
address family
XDP requires support in the NIC driver but, as not all drivers support it, it can fallback to a generic implementation, which performs the eBPF processing in the network stack, though with slower performance.
XDP has infrastructure to offload the eBPF program to a network interface controller which supports it, reducing the CPU load. In 2022, many network cards support it, e.g.
Netronome,
Intel and
Mellanox.
Microsoft is partnering with other companies and adding support for XDP in the
MsQuic
MsQuic is a free and open source implementation of the IETF QUIC protocol written in C that is officially supported on the Microsoft Windows (including Server), Linux, and Xbox platforms. The project also provides libraries for macOS and Android ...
protocol.
AF_XDP
Along with XDP, a new
address family
An address family identifier is used to identify individual network address schemes or numbering plans for network communication in contexts where the use of individual addresses might otherwise be ambiguous. Address family identifiers were first d ...
entered in the Linux kernel starting 4.18. AF_XDP, formerly known as AF_PACKETv4 (which was never included in the mainline kernel), is a
raw socket optimized for high performance packet processing and allows
zero-copy between kernel and applications. As the socket can be used for both receiving and transmitting, it supports high performance network applications purely in user space.
See also
*
Application layer
An application layer is an abstraction layer that specifies the shared communications protocols and Interface (computing), interface methods used by Host (network), hosts in a communications network. An ''application layer'' abstraction is speci ...
*
Network layer
*
Data link layer
References
External links
XDP documentationon
Read the Docs
AF_XDP documentationon
kernel.org
*
XDP walkthroughat
FOSDEM 2017 by Daniel Borkmann, Cilium
AF_XDPat
FOSDEM 2018 by Magnus Karlsson,
Intel
eBPF.io - Introduction, Tutorials & Community ResourcesL4Drop: XDP DDoS Mitigations Cloudflare
Unimog: Cloudflare's edge load balancer Cloudflare
Open-sourcing Katran, a scalable network load balancer Facebook
Cilium's L4LB: standalone XDP load balancerCiliumKube-proxy replacement at the XDP layerCiliumeCHO Podcast on XDP and load balancing
{{Authority control
Command-line software
Firewall software
Linux security software
Linux kernel features
Free and open-source software
Microsoft free software
Software using the GPL license
Software using the MIT license
2016 software