bpf_xdp_pull_data(9)
π 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β thexdp_mdthat'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β invalidlenπ
π SEE ALSO π
Kernel file ./net/core/filter.c, plus the whole friend group:
sk_filter_trim_cap(9)bpf_convert_filter(9)bpf_check_classic(9)sk_filter_release_rcu(9)sk_filter_release(9)bpf_prog_create(9)bpf_prog_create_from_user(9)sk_attach_filter(9)xdp redirect(9)bpf_skb_meta_pointer(9)bpf_dynptr_from_skb_meta(9)bpf_icmp_send(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms