Software:Express Data Path

From HandWiki
Revision as of 06:37, 9 February 2024 by S.Timg (talk | contribs) (simplify)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: High performance packet data path in the OS kernel
XDP
Original author(s)Brenden Blanco,
Tom Herbert
Developer(s)Open source community, Google, Amazon, Intel, Microsoft[1]
Initial release2016; 8 years ago (2016)
Written inC
Operating systemLinux, Windows
TypePacket filtering
LicenseLinux: 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.[1] It is licensed under MIT License.[3]

Data path

Packet flow paths in the Linux kernel. XDP bypasses the networking stack and memory allocation for packet metadata.

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

The eBPF program must pass a preverifier test[5] 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 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.[6]

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

Microsoft is partnering with other companies and adding support for XDP in the MsQuic protocol.[1]

AF_XDP

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

See also

References

  1. 1.0 1.1 1.2 Jawad, Usama (25 May 2022). "Microsoft brings Linux XDP project to Windows". https://www.neowin.net/news/microsoft-brings-linux-xdp-project-to-windows/. 
  2. "[GIT Networking - David Miller"]. https://lore.kernel.org/lkml/20160727.010753.2221383279830501569.davem@davemloft.net/. 
  3. Yasar, Erdem (25 May 2022). "Microsoft introduced open-source XDP for Windows". https://cloud7.news/development/microsoft-introduced-open-source-xdp-for-windows/. 
  4. Høiland-Jørgensen, Toke (2019-05-03), Source text and experimental data for our paper describing XDP: tohojo/xdp-paper, https://github.com/tohojo/xdp-paper/blob/master/benchmarks/bench01_baseline.org#initial-data-from-jespers-runs, retrieved 2019-05-21 
  5. "A thorough introduction to eBPF [LWN.net"]. https://lwn.net/Articles/740157/. 
  6. "net: Generic XDP". https://www.mail-archive.com/netdev@vger.kernel.org/msg165397.html. 
  7. "BPF, eBPF, XDP and Bpfilter… What are these things and what do they mean for the enterprise? - Netronome" (in en). https://www.netronome.com/blog/bpf-ebpf-xdp-and-bpfilter-what-are-these-things-and-what-do-they-mean-enterprise/. 
  8. "kernel/git/torvalds/linux.git - Linux kernel source tree". https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=08dbc7a66af2321661173c04d872eba44003cc13. 
  9. "Questions about AF_PACKET V4 and AF_XDP". https://lore.kernel.org/netdev/95aaafdc-ef8a-c4b9-6104-a1a753c81820@intel.com/T/. 
  10. "Accelerating networking with AF_XDP [LWN.net"]. https://lwn.net/Articles/750845/. 

External links