Express Data Path Explained

XDP
Author:Brenden Blanco,
Tom Herbert
Developer:Open source community, Google, Amazon, Intel, Microsoft[1]
Programming Language:C
Operating System:Linux, Windows
Genre:Packet filtering
License:Linux: GPL
Windows: MIT License

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.[2] 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.[3]

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[4] 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 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.[5]

XDP has infrastructure to offload the eBPF program to a network interface controller which supports it, reducing the CPU load. In 2023, only Netronome[6] cards support it.

Microsoft is partnering with other companies and adding support for XDP in its MsQuic implementation of the QUIC protocol.

AF_XDP

Along with XDP, a new address family entered in the Linux kernel starting 4.18.[7] AF_XDP, formerly known as AF_PACKETv4 (which was never included in the mainline kernel),[8] 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.[9]

See also

External links

Notes and References

  1. Web site: Microsoft brings Linux XDP project to Windows. Jawad. Usama. 25 May 2022. Neowin. 26 May 2022.
  2. Web site: [GIT] Networking - David Miller]. lore.kernel.org. 2019-05-14.
  3. Web site: Microsoft introduced open-source XDP for Windows. Yasar. Erdem. 25 May 2022. cloud7. 26 May 2022.
  4. Web site: A thorough introduction to eBPF [LWN.net]]. lwn.net. 2019-05-14.
  5. Web site: net: Generic XDP. www.mail-archive.com. 2019-05-14.
  6. Web site: BPF, eBPF, XDP and Bpfilter… What are these things and what do they mean for the enterprise? - Netronome. www.netronome.com. en. 2019-05-14.
  7. Web site: kernel/git/torvalds/linux.git - Linux kernel source tree. git.kernel.org. 2019-05-16.
  8. Web site: Questions about AF_PACKET V4 and AF_XDP. Kernel.org.
  9. Web site: Accelerating networking with AF_XDP [LWN.net]]. lwn.net. 2019-05-16.