Linux Kernel Network Programming - struct sk_buff data-structure - skb_put() APILinux Kernel Network Programming - struct sk_buff data-structure - skb_put() API

Refer:
skb_put() – add data to a buffer ↗

Here is the copy paste of skb_put() API (/net/core/skbuff.c) from the Kernel-source version 6.5.8 for quick reference:

/**
 *	skb_put - add data to a buffer
 *	@skb: buffer to use
 *	@len: amount of data to add
 *
 *	This function extends the used data area of the buffer. If this would
 *	exceed the total buffer size the kernel will panic. A pointer to the
 *	first byte of the extra data is returned.
 */
void *skb_put(struct sk_buff *skb, unsigned int len)
{
	void *tmp = skb_tail_pointer(skb);
	SKB_LINEAR_ASSERT(skb);
	skb->tail += len;
	skb->len  += len;
	if (unlikely(skb->tail > skb->end))
		skb_over_panic(skb, len, __builtin_return_address(0));
	return tmp;
}
EXPORT_SYMBOL(skb_put);