xfrm: add state hashtable keyed by seq
authorSabrina Dubroca <sd@queasysnail.net>
Sun, 25 Apr 2021 19:47:12 +0000 (21:47 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Fri, 14 May 2021 11:52:01 +0000 (13:52 +0200)
commitfe9f1d8779cb47046e76ea209b6eece7ec56d1b4
tree489289550003383fbb8c5d82b031ce9761643315
parent335a2a1fcefc948927e8c15636d9dc5d983b8f50
xfrm: add state hashtable keyed by seq

When creating new states with seq set in xfrm_usersa_info, we walk
through all the states already installed in that netns to find a
matching ACQUIRE state (__xfrm_find_acq_byseq, called from
xfrm_state_add). This causes severe slowdowns on systems with a large
number of states.

This patch introduces a hashtable using x->km.seq as key, so that the
corresponding state can be found in a reasonable time.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
include/net/netns/xfrm.h
include/net/xfrm.h
net/xfrm/xfrm_hash.h
net/xfrm/xfrm_state.c