Skip to content

xfrm: reduce xfrm_state_afinfo size

Florian Westphal netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6xfrm: remove init_tempsel indirection from xfrm_state_afinfoinclude/net/xfrm.h net/ipv4/xfrm4_state.c net/ipv6/xfrm6_state.c +1 more+49 -490 replies
2/6xfrm: remove init_temprop indirection from xfrm_state_afinfoinclude/net/xfrm.h net/ipv4/xfrm4_state.c net/ipv6/xfrm6_state.c +1 more+20 -430 replies
3/6xfrm: remove init_flags indirection from xfrm_state_afinfoinclude/net/xfrm.h net/ipv4/xfrm4_state.c net/xfrm/xfrm_state.c+3 -230 replies
4/6xfrm: remove state and template sort indirections from xfrm_state_afinfoinclude/net/xfrm.h net/ipv6/xfrm6_state.c net/xfrm/xfrm_policy.c +1 more+110 -1370 replies
5/6xfrm: remove eth_proto value from xfrm_state_afinfoinclude/net/xfrm.h net/ipv4/xfrm4_state.c net/ipv6/xfrm6_state.c +1 more+14 -200 replies
6/6xfrm: remove type and offload_type map from xfrm_state_afinfoinclude/net/xfrm.h net/ipv4/ah4.c net/ipv4/esp4.c +9 more+150 -810 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH ipsec-next 0/6] xfrm: reduce xfrm_state_afinfo size

xfrm_state_afinfo is a very large struct; its over 4kbyte on 64bit systems.

The size comes from two arrays to store the l4 protocol type pointers (esp, ah, ipcomp and so on).

There are only a handful of those, so just use pointers for protocols that we implement instead of mostly-empty arrays.

This also removes the template init/sort related indirections. Structure size goes down to 120 bytes on x86_64.

 include/net/xfrm.h      |   49 ++---
 net/ipv4/ah4.c          |    3 
 net/ipv4/esp4.c         |    3 
 net/ipv4/esp4_offload.c |    4 
 net/ipv4/ipcomp.c       |    3 
 net/ipv4/xfrm4_state.c  |   45 -----
 net/ipv4/xfrm4_tunnel.c |    3 
 net/ipv6/ah6.c          |    4 
 net/ipv6/esp6.c         |    3 
 net/ipv6/esp6_offload.c |    4 
 net/ipv6/ipcomp6.c      |    3 
 net/ipv6/mip6.c         |    6 
 net/ipv6/xfrm6_state.c  |  137 ----------------
 net/xfrm/xfrm_input.c   |   24 +-
 net/xfrm/xfrm_policy.c  |    2 
 net/xfrm/xfrm_state.c   |  400 +++++++++++++++++++++++++++++++++++-------------
 16 files changed, 343 insertions(+), 350 deletions(-)

Florian Westphal (6):
xfrm: remove init_tempsel indirection from xfrm_state_afinfo
xfrm: remove init_temprop indirection from xfrm_state_afinfo
xfrm: remove init_flags indirection from xfrm_state_afinfo
xfrm: remove state and template sort indirections from xfrm_state_afinfo
xfrm: remove eth_proto value from xfrm_state_afinfo
xfrm: remove type and offload_type map from xfrm_state_afinfo