iptfs_alloc_skb(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… iptfs_alloc_skb β€” from the Kernel API Manual, bestie ✨

okay so you're reading the iptfs_alloc_skb(9) page, and honestly? it's a little baddie. it does exactly one thing and it does it cute: it hands you a fresh skb, no cap 🫢


🌸 NAME 🌸

iptfs_alloc_skb β€” allocate a new skb. that's it. that's the whole vibe πŸ’–


✨ SYNOPSIS ✨

struct sk_buff * iptfs_alloc_skb (struct sk_buff *tpl , u32 len , bool
l3resv );

like, one call, three args, main character energy πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • tpl β€” the skb you're copying the required meta-data from. think of it as the blueprint, the template, the moment πŸ¦‹
  • len β€” the linear length of the head data. and yes, zero is fine. zero is valid. zero ate πŸ’…
  • l3resv β€” true if the skb reserve needs to support pushing L3 headers. lowkey the most important bool in this function ngl

🧚 DESCRIPTION 🧚

so here's the tea β˜• β€” a new skb gets allocated, and the required meta-data is copied over from tpl. the head data gets sized to len, and the reserved space is set according to the l3resv boolean. that's the whole thing, periodt ✨

now let's talk about the reserve, because this is where it gets interesting πŸ‘€

when l3resv is false, resv is XFRM_IPTFS_MIN_L2HEADROOM, which arranges for skb->data - 16 β€” and that's a good guess for good cache alignment, placing the to-be-pushed L2 header at the start of a cacheline. cute, efficient, iconic πŸŽ€

otherwise, when l3resv is true, resv is set to the correct reserved space for dst->dev plus the calculated L3 overhead for the xfrm dst β€” or XFRM_IPTFS_MIN_L3HEADROOM, whichever is larger. and then it's cache aligned so that all the headers will commonly fall in a cacheline when possible. the way it just aligns πŸ˜­πŸ’–

and here's the why, bestie:

l3resv=true is used on tunnel ingress (tx), because we need to reserve for the new IPTFS packet (i.e., L2+L3 headers). on tunnel egress (rx) the data being copied into the skb includes the user L3 headers already, so we only need to reserve for L2. iykyk πŸ¦‹

πŸ”₯ RETURN πŸ”₯

the new skb, or NULL. that's it. either she slays or she doesn't πŸ’€


🌈 SEE ALSO 🌈


and that's the page, bestie!! 🌈✨ this lil gem lives in ./net/xfrm, it's dated October 2026, and it's filed under iptfs_alloc_skb(9) in the Kernel API Manual. go forth and allocate responsibly πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from