xdp_build_skb_from_zc(9)
π xdp_build_skb_from_zc β kernel API manual, bestie edition
okay so real talk, this is a page from the Kernel API Manual, and the star of the show is xdp_build_skb_from_zc. she's like xdp_build_skb_from_buff's cooler cousin who only hangs out with XSk frames. let's get into it π«Ά
β¨ NAME β¨
xdp_build_skb_from_zc β create an skb from an XSk &xdp_buff. that's the whole vibe. π
π¦ SYNOPSIS π¦
struct sk_buff * xdp_build_skb_from_zc (struct xdp_buff *xdp );
π ARGUMENTS π
xdpβ the source XSk buff. that's the one, the main character, the input π§
πΈ DESCRIPTION πΈ
so basically xdp_build_skb_from_zc is lowkey the same idea as xdp_build_skb_from_buff, but for XSk frames. same energy, different crowd.
here's the whole glow-up process:
- allocate an skb head β¨
- allocate a new buffer for that head
- copy the data over
- initialize the skb fields
and if there are frags? not me forgetting the frags π she allocates new buffers for them too and copies them. no frag left behind. periodt.
those buffers get allocated from the system percpu pools β because we're trying to recycle them, eco-friendly queen πβ»οΈ
okay and here's the important part, so listen up π
if the new skb was built successfully,xdpgets returned to the XSk pool's freelist. if it errors out,xdpis left untouched, and the caller has to take care of it. so like. you own that cleanup. it's giving responsibility. don't leave her on read π
π RETURN π
- new
sk_buffon success π NULLon error π
π₯ SEE ALSO π₯
kernel file ./net/core/xdp.c β the whole friend group:
xdp_reg_page_pool(9)xdp_unreg_page_pool(9)xdp_rxq_info_attach_page_pool(9)xdp_return_frag(9)xdp_build_skb_from_buff(9)xdp_copy_frags_from_zc(9)bpf_xdp_metadata_rx_timestamp(9)bpf_xdp_metadata_rx_hash(9)bpf_xdp_metadata_rx_vlan_tag(9)
π bestie sign-off π
this page lives under ./net/core, dated October 2026, and yes she's officially xdp_build_skb_from_zc(9) β iconic, no notes, iykyk ππ
π¦ 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