XDP REDIRECT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ xdp redirect ✨

Okay bestie, welcome to xdp redirect(9) from the Kernel API Manual β€” we're doing kernel networking today, and honestly? It's giving main-character energy πŸ’….

So XDP_REDIRECT works by a three-step process, implemented in the functions below:

  1. The bpf_redirect and bpf_redirect_map helpers will lookup the target of the redirect and store it (along with some other metadata) in a per-CPU struct bpf_redirect_info πŸŽ€.
  2. When the program returns the XDP_REDIRECT return code, the driver will call xdp_do_redirect, which will use the information in struct bpf_redirect_info to actually enqueue the frame into a map type-specific bulk queue structure πŸ’–.
  3. Before exiting its NAPI poll loop, the driver will call xdp_do_flush, which will flush all the different bulk queues, thus completing the redirect ✨.
⚠️ Important note, bestie: xdp_do_flush must be called before napi_complete_done in the driver, as the XDP_REDIRECT logic relies on being inside a single NAPI instance through to the xdp_do_flush call for RCU protection of all in-kernel data structures 😭. Like, do not mess with that ordering, fr fr.

πŸ” SEE ALSO πŸ”


πŸ’– Cute little sign-off: this icon came from source ./net/core, dated October 2026, and it's filed under xdp redirect(9) β€” slay, go read those see-alsos πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from