xdp_build_skb_from_zc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:

  1. allocate an skb head ✨
  2. allocate a new buffer for that head
  3. copy the data over
  4. 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, xdp gets returned to the XSk pool's freelist. if it errors out, xdp is 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_buff on success πŸ’–
  • NULL on error 😭

πŸ”₯ SEE ALSO πŸ”₯

kernel file ./net/core/xdp.c β€” the whole friend group:


🌟 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