Refer:
skb_headroom() – bytes at buffer head ↗
skb_tailroom() – bytes at buffer end ↗
Here is the copy paste of skb_headroom() and skb_tailroom() APIs (/include/linux/skbuff.h) from the Kernel-source version 6.5.8 for quick reference:
/**
* skb_headroom - bytes at buffer head
* @skb: buffer to check
*
* Return the number of bytes of free space at the head of an &sk_buff.
*/
static inline unsigned int skb_headroom(const struct sk_buff *skb)
{
return skb->data - skb->head;
}
/**
* skb_tailroom - bytes at buffer end
* @skb: buffer to check
*
* Return the number of bytes of free space at the tail of an sk_buff
*/
static inline int skb_tailroom(const struct sk_buff *skb)
{
return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail;
}