aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorFan Du <fan.du@windriver.com>2014-01-17 20:55:27 -0500
committerSteffen Klassert <steffen.klassert@secunet.com>2014-02-12 01:02:11 -0500
commitca925cf1534ebcec332c08719a7dee6ee1782ce4 (patch)
treeaed605af36fd62ad4c5daeeac095312c96f66996 /net/xfrm
parent01714109ea7e7ff4142f98a91114a97a91d34cdf (diff)
flowcache: Make flow cache name space aware
Inserting a entry into flowcache, or flushing flowcache should be based on per net scope. The reason to do so is flushing operation from fat netns crammed with flow entries will also making the slim netns with only a few flow cache entries go away in original implementation. Since flowcache is tightly coupled with IPsec, so it would be easier to put flow cache global parameters into xfrm namespace part. And one last thing needs to do is bumping flow cache genid, and flush flow cache should also be made in per net style. Signed-off-by: Fan Du <fan.du@windriver.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_policy.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 4b98b25793c5..2232c6f26aff 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -661,7 +661,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
661 hlist_add_head(&policy->bydst, chain); 661 hlist_add_head(&policy->bydst, chain);
662 xfrm_pol_hold(policy); 662 xfrm_pol_hold(policy);
663 net->xfrm.policy_count[dir]++; 663 net->xfrm.policy_count[dir]++;
664 atomic_inc(&flow_cache_genid); 664 atomic_inc(&net->xfrm.flow_cache_genid);
665 665
666 /* After previous checking, family can either be AF_INET or AF_INET6 */ 666 /* After previous checking, family can either be AF_INET or AF_INET6 */
667 if (policy->family == AF_INET) 667 if (policy->family == AF_INET)
@@ -2567,14 +2567,14 @@ static void __xfrm_garbage_collect(struct net *net)
2567 2567
2568void xfrm_garbage_collect(struct net *net) 2568void xfrm_garbage_collect(struct net *net)
2569{ 2569{
2570 flow_cache_flush(); 2570 flow_cache_flush(net);
2571 __xfrm_garbage_collect(net); 2571 __xfrm_garbage_collect(net);
2572} 2572}
2573EXPORT_SYMBOL(xfrm_garbage_collect); 2573EXPORT_SYMBOL(xfrm_garbage_collect);
2574 2574
2575static void xfrm_garbage_collect_deferred(struct net *net) 2575static void xfrm_garbage_collect_deferred(struct net *net)
2576{ 2576{
2577 flow_cache_flush_deferred(); 2577 flow_cache_flush_deferred(net);
2578 __xfrm_garbage_collect(net); 2578 __xfrm_garbage_collect(net);
2579} 2579}
2580 2580
@@ -2947,6 +2947,7 @@ static int __net_init xfrm_net_init(struct net *net)
2947 spin_lock_init(&net->xfrm.xfrm_policy_sk_bundle_lock); 2947 spin_lock_init(&net->xfrm.xfrm_policy_sk_bundle_lock);
2948 mutex_init(&net->xfrm.xfrm_cfg_mutex); 2948 mutex_init(&net->xfrm.xfrm_cfg_mutex);
2949 2949
2950 flow_cache_init(net);
2950 return 0; 2951 return 0;
2951 2952
2952out_sysctl: 2953out_sysctl: