diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/xfrm/xfrm_state.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index de08ed9a4775..7ecf6eeff84a 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -45,7 +45,6 @@ u32 sysctl_xfrm_acq_expires __read_mostly = 30; | |||
45 | static DEFINE_SPINLOCK(xfrm_state_lock); | 45 | static DEFINE_SPINLOCK(xfrm_state_lock); |
46 | 46 | ||
47 | static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024; | 47 | static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024; |
48 | static unsigned int xfrm_state_num; | ||
49 | static unsigned int xfrm_state_genid; | 48 | static unsigned int xfrm_state_genid; |
50 | 49 | ||
51 | static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family); | 50 | static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family); |
@@ -548,7 +547,7 @@ int __xfrm_state_delete(struct xfrm_state *x) | |||
548 | hlist_del(&x->bysrc); | 547 | hlist_del(&x->bysrc); |
549 | if (x->id.spi) | 548 | if (x->id.spi) |
550 | hlist_del(&x->byspi); | 549 | hlist_del(&x->byspi); |
551 | xfrm_state_num--; | 550 | init_net.xfrm.state_num--; |
552 | spin_unlock(&xfrm_state_lock); | 551 | spin_unlock(&xfrm_state_lock); |
553 | 552 | ||
554 | /* All xfrm_state objects are created by xfrm_state_alloc. | 553 | /* All xfrm_state objects are created by xfrm_state_alloc. |
@@ -650,7 +649,7 @@ EXPORT_SYMBOL(xfrm_state_flush); | |||
650 | void xfrm_sad_getinfo(struct xfrmk_sadinfo *si) | 649 | void xfrm_sad_getinfo(struct xfrmk_sadinfo *si) |
651 | { | 650 | { |
652 | spin_lock_bh(&xfrm_state_lock); | 651 | spin_lock_bh(&xfrm_state_lock); |
653 | si->sadcnt = xfrm_state_num; | 652 | si->sadcnt = init_net.xfrm.state_num; |
654 | si->sadhcnt = init_net.xfrm.state_hmask; | 653 | si->sadhcnt = init_net.xfrm.state_hmask; |
655 | si->sadhmcnt = xfrm_state_hashmax; | 654 | si->sadhmcnt = xfrm_state_hashmax; |
656 | spin_unlock_bh(&xfrm_state_lock); | 655 | spin_unlock_bh(&xfrm_state_lock); |
@@ -754,7 +753,7 @@ static void xfrm_hash_grow_check(int have_hash_collision) | |||
754 | { | 753 | { |
755 | if (have_hash_collision && | 754 | if (have_hash_collision && |
756 | (init_net.xfrm.state_hmask + 1) < xfrm_state_hashmax && | 755 | (init_net.xfrm.state_hmask + 1) < xfrm_state_hashmax && |
757 | xfrm_state_num > init_net.xfrm.state_hmask) | 756 | init_net.xfrm.state_num > init_net.xfrm.state_hmask) |
758 | schedule_work(&xfrm_hash_work); | 757 | schedule_work(&xfrm_hash_work); |
759 | } | 758 | } |
760 | 759 | ||
@@ -855,7 +854,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
855 | x->lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires; | 854 | x->lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires; |
856 | x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ; | 855 | x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ; |
857 | add_timer(&x->timer); | 856 | add_timer(&x->timer); |
858 | xfrm_state_num++; | 857 | init_net.xfrm.state_num++; |
859 | xfrm_hash_grow_check(x->bydst.next != NULL); | 858 | xfrm_hash_grow_check(x->bydst.next != NULL); |
860 | } else { | 859 | } else { |
861 | x->km.state = XFRM_STATE_DEAD; | 860 | x->km.state = XFRM_STATE_DEAD; |
@@ -935,7 +934,7 @@ static void __xfrm_state_insert(struct xfrm_state *x) | |||
935 | 934 | ||
936 | wake_up(&km_waitq); | 935 | wake_up(&km_waitq); |
937 | 936 | ||
938 | xfrm_state_num++; | 937 | init_net.xfrm.state_num++; |
939 | 938 | ||
940 | xfrm_hash_grow_check(x->bydst.next != NULL); | 939 | xfrm_hash_grow_check(x->bydst.next != NULL); |
941 | } | 940 | } |
@@ -1047,7 +1046,7 @@ static struct xfrm_state *__find_acq_core(unsigned short family, u8 mode, u32 re | |||
1047 | h = xfrm_src_hash(daddr, saddr, family); | 1046 | h = xfrm_src_hash(daddr, saddr, family); |
1048 | hlist_add_head(&x->bysrc, init_net.xfrm.state_bysrc+h); | 1047 | hlist_add_head(&x->bysrc, init_net.xfrm.state_bysrc+h); |
1049 | 1048 | ||
1050 | xfrm_state_num++; | 1049 | init_net.xfrm.state_num++; |
1051 | 1050 | ||
1052 | xfrm_hash_grow_check(x->bydst.next != NULL); | 1051 | xfrm_hash_grow_check(x->bydst.next != NULL); |
1053 | } | 1052 | } |
@@ -2089,6 +2088,7 @@ int __net_init xfrm_state_init(struct net *net) | |||
2089 | goto out_byspi; | 2088 | goto out_byspi; |
2090 | net->xfrm.state_hmask = ((sz / sizeof(struct hlist_head)) - 1); | 2089 | net->xfrm.state_hmask = ((sz / sizeof(struct hlist_head)) - 1); |
2091 | 2090 | ||
2091 | net->xfrm.state_num = 0; | ||
2092 | INIT_WORK(&xfrm_state_gc_work, xfrm_state_gc_task); | 2092 | INIT_WORK(&xfrm_state_gc_work, xfrm_state_gc_task); |
2093 | return 0; | 2093 | return 0; |
2094 | 2094 | ||