Commit 575f9c43 authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next

Steffen Klassert says:

====================
ipsec-next 2016-09-08

1) Constify the xfrm_replay structures. From Julia Lawall

2) Protect xfrm state hash tables with rcu, lookups
   can be done now without acquiring xfrm_state_lock.
   From Florian Westphal.

3) Protect xfrm policy hash tables with rcu, lookups
   can be done now without acquiring xfrm_policy_lock.
   From Florian Westphal.

4) We don't need to have a garbage collector list per
   namespace anymore, so use a global one instead.
   From Florian Westphal.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0f76d256 35db57bb
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
struct ctl_table_header; struct ctl_table_header;
struct xfrm_policy_hash { struct xfrm_policy_hash {
struct hlist_head *table; struct hlist_head __rcu *table;
unsigned int hmask; unsigned int hmask;
u8 dbits4; u8 dbits4;
u8 sbits4; u8 sbits4;
...@@ -38,14 +38,12 @@ struct netns_xfrm { ...@@ -38,14 +38,12 @@ struct netns_xfrm {
* mode. Also, it can be used by ah/esp icmp error handler to find * mode. Also, it can be used by ah/esp icmp error handler to find
* offending SA. * offending SA.
*/ */
struct hlist_head *state_bydst; struct hlist_head __rcu *state_bydst;
struct hlist_head *state_bysrc; struct hlist_head __rcu *state_bysrc;
struct hlist_head *state_byspi; struct hlist_head __rcu *state_byspi;
unsigned int state_hmask; unsigned int state_hmask;
unsigned int state_num; unsigned int state_num;
struct work_struct state_hash_work; struct work_struct state_hash_work;
struct hlist_head state_gc_list;
struct work_struct state_gc_work;
struct list_head policy_all; struct list_head policy_all;
struct hlist_head *policy_byidx; struct hlist_head *policy_byidx;
...@@ -73,7 +71,7 @@ struct netns_xfrm { ...@@ -73,7 +71,7 @@ struct netns_xfrm {
struct dst_ops xfrm6_dst_ops; struct dst_ops xfrm6_dst_ops;
#endif #endif
spinlock_t xfrm_state_lock; spinlock_t xfrm_state_lock;
rwlock_t xfrm_policy_lock; spinlock_t xfrm_policy_lock;
struct mutex xfrm_cfg_mutex; struct mutex xfrm_cfg_mutex;
/* flow cache part */ /* flow cache part */
......
...@@ -187,7 +187,7 @@ struct xfrm_state { ...@@ -187,7 +187,7 @@ struct xfrm_state {
struct xfrm_replay_state_esn *preplay_esn; struct xfrm_replay_state_esn *preplay_esn;
/* The functions for replay detection. */ /* The functions for replay detection. */
struct xfrm_replay *repl; const struct xfrm_replay *repl;
/* internal flag that only holds state for delayed aevent at the /* internal flag that only holds state for delayed aevent at the
* moment * moment
......
This diff is collapsed.
...@@ -558,7 +558,7 @@ static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq) ...@@ -558,7 +558,7 @@ static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq)
x->repl->notify(x, XFRM_REPLAY_UPDATE); x->repl->notify(x, XFRM_REPLAY_UPDATE);
} }
static struct xfrm_replay xfrm_replay_legacy = { static const struct xfrm_replay xfrm_replay_legacy = {
.advance = xfrm_replay_advance, .advance = xfrm_replay_advance,
.check = xfrm_replay_check, .check = xfrm_replay_check,
.recheck = xfrm_replay_check, .recheck = xfrm_replay_check,
...@@ -566,7 +566,7 @@ static struct xfrm_replay xfrm_replay_legacy = { ...@@ -566,7 +566,7 @@ static struct xfrm_replay xfrm_replay_legacy = {
.overflow = xfrm_replay_overflow, .overflow = xfrm_replay_overflow,
}; };
static struct xfrm_replay xfrm_replay_bmp = { static const struct xfrm_replay xfrm_replay_bmp = {
.advance = xfrm_replay_advance_bmp, .advance = xfrm_replay_advance_bmp,
.check = xfrm_replay_check_bmp, .check = xfrm_replay_check_bmp,
.recheck = xfrm_replay_check_bmp, .recheck = xfrm_replay_check_bmp,
...@@ -574,7 +574,7 @@ static struct xfrm_replay xfrm_replay_bmp = { ...@@ -574,7 +574,7 @@ static struct xfrm_replay xfrm_replay_bmp = {
.overflow = xfrm_replay_overflow_bmp, .overflow = xfrm_replay_overflow_bmp,
}; };
static struct xfrm_replay xfrm_replay_esn = { static const struct xfrm_replay xfrm_replay_esn = {
.advance = xfrm_replay_advance_esn, .advance = xfrm_replay_advance_esn,
.check = xfrm_replay_check_esn, .check = xfrm_replay_check_esn,
.recheck = xfrm_replay_recheck_esn, .recheck = xfrm_replay_recheck_esn,
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment