bpf_xdp_pull_data(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… bpf_xdp_pull_data(9)

okay bestie, welcome to the Kernel API Manual ✨ β€” yes we're in the kernel API manual, it's giving "deep lore" and honestly? iconic. today's main character is bpf_xdp_pull_data, and she is fr fr about to pull some non-linear xdp data into your life πŸŽ€


✨ NAME ✨

bpf_xdp_pull_data β€” pull in non-linear xdp data πŸ’–


🌸 SYNOPSIS 🌸

__bpf_kfunc int bpf_xdp_pull_data (struct xdp_md *x , u32 len );

like, that's the whole signature, no cap 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • x β€” the xdp_md that's associated with the XDP buffer. your buffer's plus-one, basically πŸ’…
  • len β€” the length of data you want made directly accessible in the linear part. how much you're pulling in, periodt ✨

πŸ”₯ DESCRIPTION πŸ”₯

so here's the vibe: you call this to pull in data in case the XDP buffer associated with x is non-linear and not all of len is sitting in the linear data area. it's giving "bestie, let me get that for you" πŸ’œ

Direct packet access lets you read and write linear XDP data through packet pointers (i.e., xdp_md->data + offsets). the amount of data that actually ends up in the linear part of the xdp_buff depends on the NIC and its configuration β€” so it's literally not you, it's the hardware 🌈

when a frag-capable XDP program wants to directly access headers that may be in the non-linear area, call this kfunc to make sure the data is available in the linear area. alternatively, use dynptr or bpf_xdp_{load,store}_bytes to access data without pulling. options, queen πŸ‘‘

this kfunc can also be used with bpf_xdp_adjust_head to decapsulate headers in the non-linear data area. slay πŸŽ€

a call to this kfunc may reduce headroom. if there's not enough tailroom in the linear data area, metadata and data will be shifted down. heads up, babes 🫢
a call to this kfunc is susceptible to change the buffer geometry. therefore, at load time, all checks on pointers previously done by the verifier are invalidated and must be performed again, if the kfunc is used in combination with direct packet access. no cap, this one matters β€” the verifier's previous homework gets torn up and you're redoing it 😭

⭐ RETURN ⭐

  • 0 β€” success πŸ’–
  • -EINVAL β€” invalid len πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./net/core/filter.c, plus the whole friend group:


and that's the page, bestie πŸ§šπŸ’œ β€” brought to you by ./net/core, dated October 2026, filed under bpf_xdp_pull_data(9). go pull that data, you absolute icon πŸŒΈπŸ¦‹πŸ“

πŸ“¦ where this page comes from