Skip to content

skbuff: introduce pskb_realloc_headroom()

Vasily Averin bpf linux-hams lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7skbuff: introduce pskb_realloc_headroom()include/linux/skbuff.h net/core/skbuff.c+43 -072 replies
2/7ipv6: use pskb_realloc_headroom in ip6_finish_output2net/ipv6/ip6_output.c+16 -340 replies
3/7ipv6: use pskb_realloc_headroom in ip6_xmit refactoringnet/ipv6/ip6_output.c+12 -160 replies
4/7ipv4: use pskb_realloc_headroom in ip_finish_output2net/ipv4/ip_output.c+2 -100 replies
5/7vrf: use pskb_realloc_headroom in vrf_finish_outputdrivers/net/vrf.c+4 -100 replies
6/7ax25: use pskb_realloc_headroomnet/ax25/ax25_out.c net/ax25/ax25_route.c+8 -180 replies
7/7bpf: use pskb_realloc_headroom in bpf_out_neigh_v4/6net/core/filter.c+4 -180 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH NET 0/7] skbuff: introduce pskb_realloc_headroom()

currently if skb does not have enough headroom skb_realloc_headrom is called. It is not optimal because it creates new skb.

Unlike skb_realloc_headroom, new helper pskb_realloc_headroom does not allocate a new skb if possible;
copies skb->sk on new skb when as needed
and frees original skb in case of failures.

This helps to simplify ip[6]_finish_output2(), ip6_xmit() and a few other functions in vrf, ax25 and bpf.

There are few other cases where this helper can be used but they require an additional investigations.

NB: patch "ipv6: use pskb_realloc_headroom in ip6_finish_output2" depends on patch "ipv6: allocate enough headroom in ip6_finish_output2()" submitted separately
https://lkml.org/lkml/2021/7/12/732

Vasily Averin (7):
skbuff: introduce pskb_realloc_headroom()
ipv6: use pskb_realloc_headroom in ip6_finish_output2
ipv6: use pskb_realloc_headroom in ip6_xmit
ipv4: use pskb_realloc_headroom in ip_finish_output2
vrf: use pskb_realloc_headroom in vrf_finish_output
ax25: use pskb_realloc_headroom
bpf: use pskb_realloc_headroom in bpf_out_neigh_v4/6

 drivers/net/vrf.c      | 14 +++------
 include/linux/skbuff.h |  2 ++
 net/ax25/ax25_out.c    | 13 +++------
 net/ax25/ax25_route.c  | 13 +++------
 net/core/filter.c      | 22 +++-----------
 net/core/skbuff.c      | 41 ++++++++++++++++++++++++++
 net/ipv4/ip_output.c   | 12 ++------
 net/ipv6/ip6_output.c  | 78 ++++++++++++++++++--------------------------------
 8 files changed, 89 insertions(+), 106 deletions(-)
Signature · 1 line
1.8.3.1