summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2021-04-25 21:47:12 +0200
committerSteffen Klassert <steffen.klassert@secunet.com>2021-05-14 13:52:01 +0200
commitfe9f1d8779cb47046e76ea209b6eece7ec56d1b4 (patch)
tree489289550003383fbb8c5d82b031ce9761643315 /include/net
parent335a2a1fcefc948927e8c15636d9dc5d983b8f50 (diff)
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>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/netns/xfrm.h1
-rw-r--r--include/net/xfrm.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index e816b6a3ef2b..e946366e8ba5 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -42,6 +42,7 @@ struct netns_xfrm {
struct hlist_head __rcu *state_bydst;
struct hlist_head __rcu *state_bysrc;
struct hlist_head __rcu *state_byspi;
+ struct hlist_head __rcu *state_byseq;
unsigned int state_hmask;
unsigned int state_num;
struct work_struct state_hash_work;
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index c58a6d4eb610..6e11db6fa0ab 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -154,6 +154,7 @@ struct xfrm_state {
};
struct hlist_node bysrc;
struct hlist_node byspi;
+ struct hlist_node byseq;
refcount_t refcnt;
spinlock_t lock;