All systems operational · 40+ PoPsHosting since 2010
INTERKVM HOST SRL·AS 25198
Home/Blog/XDP vs DPDK: two ways to process packets fast on Linux
Network 29 November 2026

XDP vs DPDK: two ways to process packets fast on Linux

Two ways past the Linux network stack: XDP runs eBPF inside the kernel driver and leaves everything else working; DPDK takes the NIC into userspace and polls it with dedicated cores. Packet-rate arithmetic, AF_XDP, hugepages, who uses which, and the pick for a DDoS filter, load balancer, VPN gateway or capture box.

Published
Read
7 min
Three lanes from the NIC: XDP runs eBPF inside the kernel driver, AF_XDP redirects frames to a process, and DPDK binds vfio-pci and polls with dedicated cores.

XDP vs DPDK is a choice between two ways of moving packets faster than the normal Linux network stack can: run a small eBPF program inside the kernel's network driver, or take the network card away from the kernel and poll it from a userspace process. Both exist because the time available per packet shrinks to single-digit nanoseconds at 100 Gbps, and they pay for speed in different currencies. Below: the arithmetic, both designs, who uses which, and which fits four common jobs.

The budget both are fighting

A minimum Ethernet frame is 64 bytes, and each one takes another 20 bytes of wire time: an 8-byte preamble and a 12-byte inter-frame gap. That is 84 bytes, or 672 bits, per packet:

10 Gbps:   10e9 / 672 =  14.88 Mpps  →  67.2 ns per packet
25 Gbps:   25e9 / 672 =  37.20 Mpps  →  26.9 ns per packet
100 Gbps: 100e9 / 672 = 148.81 Mpps  →  6.72 ns per packet

100 Gbps of 1500-byte packets: 100e9 / (1538 × 8) = 8.13 Mpps → 123 ns
(1538 = 1500 + 14-byte header + 4-byte checksum + 20 preamble and gap)

At 6.72 ns, a 3 GHz core has about 20 cycles per packet, so no single core keeps up with minimum-size frames at 100 Gbps. Both frameworks scale the same way: the NIC hashes each flow to one of many receive queues, and each queue gets its own core. Over 16 cores, 148.81 Mpps is 9.30 Mpps each, or 107.5 ns (about 323 cycles) per packet. Large packets, the easy end of the table, are covered in saturating a 100 Gbps port.

Sizing is one division: cores needed = target Mpps ÷ the Mpps one core sustains on your hardware. Only the second figure needs measuring, and both projects ship a tool for it.

How XDP works

XDP, the eXpress Data Path, has been in the kernel since Linux 4.8 in 2016. An eBPF program attaches to the driver's receive path and runs on each packet straight out of the RX ring, before the kernel allocates the socket buffer (skb) the rest of the stack uses. It is not kernel bypass: the NIC keeps its normal driver, and ip, ethtool and the TCP stack keep working.

The program returns one of five verdicts, defined in the kernel's bpf.h:

Action What happens
XDP_DROP Discarded, before any allocation
XDP_PASS Handed on to the normal network stack
XDP_TX Sent back out of the interface it arrived on
XDP_REDIRECT Sent to another interface, another CPU or an AF_XDP socket
XDP_ABORTED Program error: dropped, and a tracepoint fires

Every program must first pass the kernel's verifier, which simulates every path and bounds-checks every memory access, so XDP code stays small.

Native or generic. Native mode runs inside the driver. Generic mode, a "non-optimized" path in the words of the commit that added it, runs after the skb exists and works with any driver: fine for testing, not for production. xdp-tools 1.6.3 checks a driver and measures a core:

ethtool -i eth0              # which driver
xdp-loader features eth0     # basic, redirect, xsk-zerocopy …
xdp-bench drop eth0          # rx/s with a drop-everything program

AF_XDP, added in 4.18, is the bridge to userspace: an XDP program redirects frames into a socket whose memory, the UMEM, is shared with a process, one socket per interface queue. The kernel tries zero-copy first and falls back to copying every packet, so check the xsk-zerocopy flag.

How DPDK works

DPDK moves the driver itself into userspace. Its poll mode drivers (PMDs) read RX and TX descriptors directly, without interrupts, and each receive queue is polled by a single core, so the fast path needs no locks:

dpdk-hugepages.py -p 1G --setup 4G             # reserve 1 GB hugepages
dpdk-devbind.py --bind=vfio-pci 0000:41:00.1   # take the port from the kernel
dpdk-testpmd -l 2-6 -a 0000:41:00.1 -- --nb-cores=4 --forward-mode=rxonly --stats-period 1

Hugepages hold the packet-buffer pools. vfio-pci replaces the kernel driver on most NICs, and from then on Linux ignores the port: no ip, no tcpdump, no kernel TCP. Do that step from the IPMI console, not over SSH on the same port. Some PMDs are "bifurcated" and coexist with the kernel driver instead. Dedicated cores spin whether or not packets arrive; DPDK's power-management guide says polling keeps cores "running at the highest frequency".

The long-term-support branch is 25.11, at 25.11.4 and supported to December 2028; the newest feature release is 26.07, and 26.11 is scheduled for 25 November 2026. DPDK needs kernel 5.4 or later.

XDP vs DPDK side by side

XDP and AF_XDP DPDK
Who owns the NIC The kernel driver Your process, via vfio-pci
Packets you don't handle XDP_PASS to the stack Yours to deal with
CPU when idle Next to none Polling cores busy-wait
Code eBPF, limited by the verifier Any C, any library
Driver support Native XDP, per driver A poll mode driver in DPDK's NIC matrix

XDP adds a fast path in front of a kernel that keeps doing everything else. DPDK replaces the kernel on that port and makes everything your problem, in exchange for every cycle of the cores you give it.

Who runs which, in public

  • Katran, the layer 4 load balancer Meta publishes on GitHub, "leverages XDP infrastructure from the kernel" and needs no busy-looping on the receive path.
  • Cloudflare runs arriving packets through an XDP chain in driver mode: l4drop for DDoS rules, then Unimog, its layer 4 load balancer (April 2026). Its 2018 L4Drop post explains leaving a kernel-bypass tool: XDP does not busy-poll, so the filter can stay on permanently.
  • FD.io VPP, at 26.10, is a userspace layer 2–4 stack whose DPDK plugin "provides some important features and drivers"; it also has an AF_XDP driver and a WireGuard plugin.
  • Suricata 8, the intrusion detection engine, documents both AF_XDP and DPDK capture modes.

XDP or DPDK for four common jobs

DDoS filter: XDP. Stateless drop rules belong at the earliest hook, and whatever survives continues to nftables unchanged; Linux DDoS mitigation covers those kernel layers. Neither helps once the port itself is full; that takes upstream filtering, and every ZetServers VPS and dedicated server includes 100 Gbps of it at L3/L4.

Layer 4 load balancer: XDP first. Katran and Unimog show the pattern: pick a backend, encapsulate, XDP_TX the packet back out. Choose DPDK, usually through VPP, for a dedicated router or NAT that must do more per packet than an eBPF program comfortably can.

VPN gateway: usually neither. Bulk tunnel traffic is mostly full-size packets: 10 Gbps of 1500-byte packets is 10e9 ÷ (1538 × 8) ≈ 0.81 Mpps, about 1.23 µs each, so the cost is encryption per byte, not packet handling. Start with kernel WireGuard. One catch: a site-to-site tunnel is a single outer UDP flow, so RSS delivers all of it to one receive queue, the way a LACP bond keeps a flow on one link; watch that queue's core in mpstat -P ALL 1.

Packet capture: AF_XDP, then DPDK. AF_XDP keeps the port on its kernel driver; DPDK suits a dedicated sensor that gives every core to capture. Give capture its own port either way: Suricata's documentation notes that an interface in AF_XDP mode cannot carry regular traffic. And packets XDP drops or redirects never reach tcpdump; xdp-dump captures at the XDP layer instead.

Matching it to hardware

The NIC driver often settles XDP vs DPDK before the CPU does. We do not publish NIC models, so ask which NIC a build ships with, then check its driver in DPDK's supported-NIC matrix and for native XDP and zero-copy AF_XDP. Keep polling cores and AF_XDP queues on the NIC's NUMA node (cat /sys/class/net/eth0/device/numa_node); queues and interrupt spreading are in Linux 10 Gbps tuning.

Cores are the other budget, because DPDK holds whole cores permanently. 100 Gbps dedicated servers start at €4,499 a month with 40 Xeon Gold cores, or €7,379 with 128 EPYC 9554 cores; 200 Gbps servers start at €12,879 (excluding VAT). Every build has full root and IPMI, which a vfio-pci experiment needs.

Frequently asked questions

Is XDP faster than DPDK?

Neither wins in general. DPDK gives the application every cycle and skips the kernel; XDP keeps the kernel in the path but needs no dedicated cores and costs almost nothing when idle. Measure yours: xdp-bench drop and dpdk-testpmd in rxonly mode both report packets per second.

Can XDP and DPDK run on the same server?

Yes, on different ports: one NIC bound to vfio-pci for DPDK while another keeps its kernel driver and an XDP program. DPDK's AF_XDP poll mode driver also lets a DPDK application read a kernel-owned interface through AF_XDP sockets, keeping that port under Linux.

Does DPDK need hugepages?

For normal operation, yes. DPDK's system requirements say hugepage support is required for the memory pools holding packet buffers; 2 MB and 1 GB pages both work. The --no-huge option uses ordinary memory, which suits testing but drops secondary-process support. dpdk-hugepages.py reserves them.

Which NICs support XDP and DPDK?

It depends on the driver, not the brand. ethtool -i names the driver; xdp-loader features shows whether it supports native XDP, redirect and zero-copy AF_XDP; DPDK's NIC feature matrix lists the poll mode drivers. Ask a host which NIC a build ships with before ordering.

Tweaksv1
Theme