Jump to content

Express Data Path

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Teknoraver (talk | contribs) at 22:22, 14 May 2019 (add XDP page). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
XDP
Original author(s)Tom Herbert, Alexei Starovoitov
Initial release2016
Written inC
Operating systemLinux
TypePacket filtering
LicenseGPL

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.

The eBPF program passes by a preverifier[2] before being loaded, to avoid executing malicious code in kernel space. The preveifier checks that the program contains no out-of-bounds accesses, loops or global variables.

The eBPF 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

XDP requires support in the NIC driver but, as not all drivers supports it, it can fallback to a generic implementation, which does the eBPF processing in the network stack, though with slower performances.

  1. ^ "[GIT] Networking - David Miller". lore.kernel.org. Retrieved 2019-05-14.
  2. ^ "A thorough introduction to eBPF [LWN.net]". lwn.net. Retrieved 2019-05-14.