Re: [PATCH net] drivers/net/wan/lapbether: Added needed_tailroom

From: Xie He
Date: Sat Aug 15 2020 - 22:28:40 EST

I took some time to look at the history of needed_tailroom. I found it
was added in this commit:
f5184d267c1a (net: Allow netdevices to specify needed head/tailroom)

The author tried to make use of needed_tailroom at various places in
the kernel by replacing the macro LL_RESERVED_SPACE with his new macro

However, the macro LL_ALLOCATED_SPACE was later found to have
problems. So it was removed 3 years later and was replaced by explicit
handling of needed_tailroom. See:

So maybe only those places considered by these two authors have taken
needed_tailroom into account.

Other places might not have taken needed_tailroom into account because
of the rarity of the usage of needed_tailroom.

The second author also said in the commit message of his Patch 5/6
(which changes af_packet.c), that:
While auditing LL_ALLOCATED_SPACE I noticed that packet_sendmsg_spkt
did not include needed_tailroom when allocating an skb. This isn't
a fatal error as we should always tolerate inadequate tail room but
it isn't optimal.

This shows not taking needed_tailroom into account is not a bug but
it'd be better to take it into account.