
XDP Offload: What Actually Runs on the NIC
XDP offload runs an eBPF program on the network card, so the NIC can drop, redirect, or pass packets before the host reaches its own XDP hook. Native and generic XDP still run on the CPU. Run ethtool -i eth0 to identify the driver, then check bpftool net and ip -details link show dev eth0 before you assume hardware is involved. Most supposed offload problems are native XDP wearing the wrong label.
Last updated: 2026-11-05
What does xdp offload actually mean?
There are three XDP modes, and only one runs the program on the NIC. Mixing them together is why this subject gets muddy.
Generic mode, also called skb mode, runs after the driver has built a socket buffer. Native mode runs inside the driver's receive path, before that allocation. Hardware mode sends supported eBPF instructions to the NIC's own processor.
| Mode | Where the program runs | Packet path | Driver support | My verdict |
|---|---|---|---|---|
| Generic or skb | Host CPU | Generic stack path using socket buffers | No native XDP support required | Use for compatibility and testing |
| Native or driver | Host CPU | Driver receive path before socket-buffer allocation | Required | The right default for most systems |
| Hardware or hw | NIC processor | On the network card before the host XDP hook | Rare and device-specific | Use for simple filtering when CPU reclamation matters |
Native XDP is my pick for almost every deployment. It gives you the useful early hook without forcing the program through a hardware verifier with a shorter helper and map list.
Generic mode earns its place on unsupported drivers and virtual devices. However, it copies through the socket-buffer path, so don't use its results to predict production throughput.
Hardware mode has a narrow job. It works well when a simple rule can discard or redirect a large packet stream before the host spends CPU time on it.
Check the actual attachment like this:
ethtool -i eth0
bpftool net
ip -details link show dev eth0
ethtool tells you which driver owns the interface. bpftool net shows the programs attached to network hooks. Meanwhile, the detailed link output distinguishes labels such as xdp, xdpgeneric, and xdpoffload.
If the interface doesn't report an offloaded attachment, the program isn't running on the NIC. A loader flag is a request, not proof.
Which NICs and drivers support hardware mode
Assume your card lacks hardware offload until the driver proves otherwise. True XDP offload has remained closely associated with Netronome and Corigine Network Flow Processor hardware using the nfp driver.
That driver supports NFP3800, NFP4000, NFP5000, and NFP6000 devices, including Agilio SmartNIC implementations. However, the correct firmware must be loaded before the driver can offload an XDP program. The PCIe card alone doesn't settle it.
Netronome also claimed its Agilio CX cards could reclaim over 80% of server CPU previously used by Open vSwitch and deliver 5X or more packet throughput to applications. Treat those as product-specific claims. They don't describe arbitrary eBPF programs, other NICs, or your traffic.
Intel hardware causes more confusion because several Intel drivers support XDP without supporting eBPF execution on the card. For example, the Intel ice driver for Ethernet Controller 800 Series devices supports XDP and AF_XDP zero-copy. Its XDP path is native driver mode.
The ice driver supports XDP on Linux kernel 4.14 and later, plus AF_XDP zero-copy on kernel 4.18 and later. It also blocks XDP for frame sizes larger than 3KB. Those capabilities still don't turn native XDP into hardware offload.
Intel's older 700 Series hardware has other acceleration paths. The DPDK i40e poll mode driver supports adapters with 10, 25, and 40 Gbps links based on the X710, XL710, and XXV710 controllers. The X722 supports only part of those features. DPDK is a separate userspace packet-processing model, so don't report it as XDP running on the NIC.
Offloaded programs fail for specific reasons
Read the kernel message before changing the program. Run the load once, then inspect the kernel ring buffer immediately:
sudo xdp-loader load -m hw eth0 prog.o
sudo dmesg -T | tail -50
The load command demands hardware mode. The dmesg output tells you whether the eBPF verifier, offload verifier, firmware, or driver rejected it.
An offload verifier has fewer instructions, helpers, and map operations available than the normal kernel verifier. Therefore, a program that loads in native mode can fail in hardware mode. That result means the NIC cannot translate the program as written.
Maps deserve the same suspicion. Some hardware supports only selected map types or operations, and an offloaded program may require maps tied to that device. A normal host map isn't automatically usable from the NIC.
The second common failure happens during attachment. Native XDP requires driver support, while hardware mode needs an additional offload path in that driver. If the driver's ndo_bpf implementation lacks the hardware setup case, no loader can add it from user space.
Explicit hardware mode should fail instead of quietly becoming native. Silent fallback happens when you choose an unspecified mode and let the kernel select native mode where supported, then generic mode otherwise.
Pin the mode while diagnosing. Otherwise, you can spend an afternoon tuning code that never left the CPU.
Use xdp-loader without hiding the mode
xdp-loader is the loading utility from the xdp-tools and libxdp project. Its -m or --mode option decides where the program should attach.
The accepted values are:
nativefor in-driver XDP, which is the defaultskbfor generic XDPhwfor hardware offloadunspecifiedto let the kernel select native or fall back to generic
Use an explicit mode during testing:
sudo xdp-loader load -m hw eth0 prog.o
sudo xdp-loader status
The status output starts with fields like these:
CURRENT XDP PROGRAM STATUS:
Interface Prio Program name Mode ID Tag Chain actions
Check the Mode column. That tells you what was attached rather than what you intended to attach.
The other reason to use xdp-loader is libxdp's dispatcher. The dispatcher can chain programs in a defined order. That lets a firewall and monitor share the link without replacing each other.
However, don't assume the dispatcher can be offloaded. Its generated program and chain logic must also pass the hardware verifier. If the NIC rejects the dispatcher, load one small hardware program or move the chain to native mode.
The official xdp-tools project contains the loader and libxdp code. Read the loader version installed on your machine before copying commands from a release with different options.
Can AF_XDP sockets communicate across a veth pair?
Yes. AF_XDP works across a veth pair for intra-host communication, and it is useful for testing loaders, maps, and redirect logic.
A veth pair consists of two virtual interfaces connected inside the kernel. Attach XDP to one end, bind an AF_XDP socket there, and send traffic through the peer. This works well between containers or network namespaces.
There is no NIC processor in that path. Therefore, a veth test cannot prove XDP offload, hardware queue behavior, or physical receive performance.
I use veth for correctness tests because a stray XDP_DROP cannot take down the management interface. Then I repeat the queue and attachment tests on the real driver before believing any throughput result.
For a practical example of the earlier packet hook, see how eBPF intercepts packets before kernel routing.
AF_XDP has its own memory path
AF_XDP moves packets between an XDP program and a userspace socket. The program normally redirects packets through an XSKMAP, while userspace manages a shared memory area called UMEM.
The rings coordinate ownership:
- The fill ring gives the kernel empty UMEM frames for received packets.
- The receive ring gives completed packets to userspace.
- The transmit ring gives outgoing packets to the kernel.
- The completion ring returns transmitted frames for reuse.
If a driver lacks native XDP support, or you explicitly select XDP_SKB, AF_XDP uses generic mode with socket buffers and copies packet data to userspace. It still works, but it isn't the zero-copy path.
With native driver support, the XDP program runs just after packet reception and before the kernel allocates a socket buffer. A supported driver can then map its receive and transmit queues into UMEM for zero-copy operation.
The Linux AF_XDP documentation describes the rings, UMEM ownership, queue binding, and copy modes. Read that before blaming the socket API for a queue mismatch.
Hardware-offloaded XDP and AF_XDP are separate capabilities. Many deployments use native XDP with AF_XDP zero-copy because userspace needs access to the physical driver's queues. An offloaded program can use only the redirects and maps implemented by that NIC and driver.
Veth results do not predict physical NIC results
A veth interface has no physical receive ring and no hardware zero-copy path. Even where a kernel supports driver-style XDP handling on veth, the packet still travels through software on the host.
Check the selected mode instead of assuming it:
ip -details link show dev veth0
bpftool net
That output tells you where the program attached. It doesn't prove zero-copy, so inspect your AF_XDP bind result and driver capabilities as well.
Use strace if the AF_XDP setup succeeds but behaves differently from the physical interface:
sudo strace -f -e bpf,bind,setsockopt,mmap ./your-loader
The trace shows whether program loading, socket binding, queue selection, or memory mapping failed. This split matters because a working XDP attach doesn't guarantee a working AF_XDP queue.
Veth remains a good functional test bed. Treat its throughput figures as host software figures, because that is what they are.
Native mode is usually faster enough
Native XDP can process 10 to 40 million packets per second per core on the same hardware. That range explains why most systems don't need xdp offload at all.
The hardware mode's real gain is CPU reclamation. If the NIC drops a flood before direct memory access and host processing, the application keeps those CPU cycles and memory bandwidth.
However, the NIC's processor may have less compute capacity than a modern host core. Its verifier also accepts less code. Parsing several headers, maintaining large maps, or running complex policy usually fits native XDP better.
For simple high-volume drop and redirect rules, hardware mode can earn its cost. For richer logic, native XDP is the safer choice and usually the faster route to a reproducible deployment.
That includes denial-of-service filters. Start with native mode and measure CPU pressure before buying a SmartNIC. The XDP SYN flood protection path shows the kind of early drop logic that suits the driver hook.
Don't confuse XDP with segmentation offloads either. Hardware segmentation offload requires a corresponding software offload in Generic Segmentation Offload, or GSO. Partial GSO lets devices without complete tunnel offload support still use segmentation. Neither feature means the NIC can execute your eBPF program.
Intel acceleration on Xeon uses several paths
On a Xeon system, the practical eBPF network acceleration stack is native XDP, AF_XDP, and the NIC driver's queue support. The Xeon cores run the eBPF program unless the exact network card and driver implement hardware mode.
Native XDP removes most of the normal receive stack by running before socket-buffer allocation. AF_XDP then redirects selected traffic into userspace, with zero-copy available on supported physical drivers such as ice.
Intel Edge Controls for Industrial, commonly shortened to ECI, uses real-time Linux features alongside native XDP. Predictable latency there comes from the real-time kernel, CPU isolation, queue placement, and a short XDP program. Calling that NIC eBPF offload gets the mechanism wrong.
For industrial systems, keep the packet path boring. Pin queues and application threads deliberately, check interrupt placement, and measure latency under load. A hardware badge won't repair a noisy core or an oversized eBPF program.
Debug the loader, verifier, and driver
Reproduce the failure once, then read three layers in order. Randomly changing flags destroys the useful evidence.
- Trace the loader.
sudo strace -f -e bpf,sendmsg,setsockopt ./load-program
The failed syscall tells you whether the problem happened while loading the program or attaching it to the interface.
- Read the kernel log.
sudo journalctl -k --since "5 min ago"
sudo dmesg -T | tail -100
Look for verifier rejection, an unsupported helper, firmware errors, or a driver refusal. Read the first useful error, not only the final EINVAL.
- Confirm the attachment.
sudo xdp-loader status
bpftool net
ip -details link show dev eth0
These commands show what survived after the load attempt. An old native program can remain attached after a new hardware load fails, which makes a quick status check easy to misread.
- Read the driver implementation.
Search the driver source for ndo_bpf, XDP_SETUP_PROG, and the hardware offload setup path. If the case isn't implemented, another command-line flag won't help.
- Reduce the program.
Replace the body with one return action, then add maps, helpers, and parsing back in small steps. The first addition that fails identifies the unsupported feature.
This is also where XDP attach syntax for an eBPF filter helps. Keep loading, attachment, and packet policy as separate problems.
FAQ
Can I remove an XDP program without restarting the interface?
Yes. Use the same loader that attached it, then confirm the hook is empty with bpftool net and detailed ip link output. Don't restart networking to remove one program because that also disturbs addresses, routes, and unrelated traffic.
If libxdp has several programs in a dispatcher, remove the intended program rather than detaching the whole chain. Check program IDs first. Names are easier to misread than IDs.
Can TC hardware offload and hardware XDP run on the same card?
Possibly, but the driver and firmware decide how they share tables, queues, and instruction resources. A card supporting TC flower offload does not automatically support hardware XDP.
Load each feature separately, confirm it, then combine them. If the combined setup fails, read the driver log for exhausted or incompatible hardware resources.
Does hardware mode work inside a virtual machine?
Usually not through a normal virtual NIC because the guest doesn't control a programmable physical NIC. PCI passthrough can expose the device, but the passed-through card and guest driver still need explicit hardware XDP support.
A virtio interface is useful for software testing. It isn't evidence that the physical card executed the eBPF program.
Can an offloaded program update normal eBPF maps?
Only if the NIC, firmware, driver, and map type support that operation. Hardware programs don't gain unrestricted access to every map available to a host program.
Start with the smallest supported map and verify updates from both the control plane and packet path. If native mode works while hardware mode rejects the map, the offload feature set is the limit.
