Commit ddcfd796 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by David S. Miller

netns xfrm: dst garbage-collecting in netns

Pass netns pointer to struct xfrm_policy_afinfo::garbage_collect()

	[This needs more thoughts on what to do with dst_ops]
	[Currently stub to init_net]
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3dd0b499
...@@ -265,7 +265,7 @@ struct xfrm_dst; ...@@ -265,7 +265,7 @@ struct xfrm_dst;
struct xfrm_policy_afinfo { struct xfrm_policy_afinfo {
unsigned short family; unsigned short family;
struct dst_ops *dst_ops; struct dst_ops *dst_ops;
void (*garbage_collect)(void); void (*garbage_collect)(struct net *net);
struct dst_entry *(*dst_lookup)(int tos, xfrm_address_t *saddr, struct dst_entry *(*dst_lookup)(int tos, xfrm_address_t *saddr,
xfrm_address_t *daddr); xfrm_address_t *daddr);
int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr);
......
...@@ -187,7 +187,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) ...@@ -187,7 +187,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
static inline int xfrm4_garbage_collect(struct dst_ops *ops) static inline int xfrm4_garbage_collect(struct dst_ops *ops)
{ {
xfrm4_policy_afinfo.garbage_collect(); xfrm4_policy_afinfo.garbage_collect(&init_net);
return (atomic_read(&xfrm4_dst_ops.entries) > xfrm4_dst_ops.gc_thresh*2); return (atomic_read(&xfrm4_dst_ops.entries) > xfrm4_dst_ops.gc_thresh*2);
} }
......
...@@ -220,7 +220,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) ...@@ -220,7 +220,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
static inline int xfrm6_garbage_collect(struct dst_ops *ops) static inline int xfrm6_garbage_collect(struct dst_ops *ops)
{ {
xfrm6_policy_afinfo.garbage_collect(); xfrm6_policy_afinfo.garbage_collect(&init_net);
return (atomic_read(&xfrm6_dst_ops.entries) > xfrm6_dst_ops.gc_thresh*2); return (atomic_read(&xfrm6_dst_ops.entries) > xfrm6_dst_ops.gc_thresh*2);
} }
......
...@@ -2173,9 +2173,9 @@ static int unused_bundle(struct dst_entry *dst) ...@@ -2173,9 +2173,9 @@ static int unused_bundle(struct dst_entry *dst)
return !atomic_read(&dst->__refcnt); return !atomic_read(&dst->__refcnt);
} }
static void __xfrm_garbage_collect(void) static void __xfrm_garbage_collect(struct net *net)
{ {
xfrm_prune_bundles(&init_net, unused_bundle); xfrm_prune_bundles(net, unused_bundle);
} }
static int xfrm_flush_bundles(struct net *net) static int xfrm_flush_bundles(struct net *net)
......
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