On Mon, 30 Nov 2020 11:09:45 +0100 Julian Wiedmann wrote:
> From: Sebastian Andrzej Siewior <bige...@linutronix.de>
> 
> The size of struct th_header is 8 byte and the size of struct th_sweep
> is 16 byte. The memory for is allocated, initialized, used and
> deallocated a few lines later.
> 
> It is more efficient to avoid the allocation/free dance and assign the
> values directly to skb's data part instead of using memcpy() for it.
> 
> Avoid an allocation of struct th_sweep/th_header and use the resulting
> skb pointer instead.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
> [jwi: use skb_put_zero(), instead of skb_put() + memset to 0]
> Signed-off-by: Julian Wiedmann <j...@linux.ibm.com>

Stuff like that is usually done when skb data cannot be assumed to be
aligned. I don't see where the skbs are allocated here, so fingers
crossed :)

Reply via email to