iptfs_alloc_skb(9)
π 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βtrueif 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 π
- Kernel file
./net/xfrm/xfrm_iptfs.c IPTFS_DEFAULT_DROP_TIME_USECS(9)IPTFS_DEFAULT_REORDER_WINDOW(9)IPTFS_DEFAULT_INIT_DELAY_USECS(9)IPTFS_DEFAULT_MAX_QUEUE_SIZE(9)struct xfrm_iptfs_config(9)struct xfrm_iptfs_data(9)iptfs_skb_head_to_frag(9)struct iptfs_skb_frag_walk(9)iptfs_skb_prepare_frag_walk(9)iptfs_skb_can_add_frags(9)iptfs_skb_add_frags(9)iptfs_pskb_add_frags(9)iptfs_pskb_extract_seq(9)iptfs_input_save_runt(9)__iptfs_iphlen(9)__iptfs_iplen(9)iptfs_complete_inner_skb(9)iptfs_reassem_abort(9)iptfs_reassem_done(9)iptfs_reassem_cont(9)iptfs_input_ordered(9)iptfs_drop_timer(9)iptfs_input(9)iptfs_enqueue(9)iptfs_copy_create_frag(9)iptfs_copy_create_frags(9)iptfs_first_skb(9)iptfs_encap_add_ipv4(9)iptfs_encap_add_ipv6(9)iptfs_prepare_output(9)__iptfs_get_inner_mtu(9)iptfs_get_inner_mtu(9)iptfs_user_init(9)
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
- 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