static DEFINE_SPINLOCK(xfrm_state_lock);
static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024;
-static unsigned int xfrm_state_num;
static unsigned int xfrm_state_genid;
static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family);
hlist_del(&x->bysrc);
if (x->id.spi)
hlist_del(&x->byspi);
- xfrm_state_num--;
+ init_net.xfrm.state_num--;
spin_unlock(&xfrm_state_lock);
/* All xfrm_state objects are created by xfrm_state_alloc.
void xfrm_sad_getinfo(struct xfrmk_sadinfo *si)
{
spin_lock_bh(&xfrm_state_lock);
- si->sadcnt = xfrm_state_num;
+ si->sadcnt = init_net.xfrm.state_num;
si->sadhcnt = init_net.xfrm.state_hmask;
si->sadhmcnt = xfrm_state_hashmax;
spin_unlock_bh(&xfrm_state_lock);
{
if (have_hash_collision &&
(init_net.xfrm.state_hmask + 1) < xfrm_state_hashmax &&
- xfrm_state_num > init_net.xfrm.state_hmask)
+ init_net.xfrm.state_num > init_net.xfrm.state_hmask)
schedule_work(&xfrm_hash_work);
}
x->lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires;
x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ;
add_timer(&x->timer);
- xfrm_state_num++;
+ init_net.xfrm.state_num++;
xfrm_hash_grow_check(x->bydst.next != NULL);
} else {
x->km.state = XFRM_STATE_DEAD;
wake_up(&km_waitq);
- xfrm_state_num++;
+ init_net.xfrm.state_num++;
xfrm_hash_grow_check(x->bydst.next != NULL);
}
h = xfrm_src_hash(daddr, saddr, family);
hlist_add_head(&x->bysrc, init_net.xfrm.state_bysrc+h);
- xfrm_state_num++;
+ init_net.xfrm.state_num++;
xfrm_hash_grow_check(x->bydst.next != NULL);
}
goto out_byspi;
net->xfrm.state_hmask = ((sz / sizeof(struct hlist_head)) - 1);
+ net->xfrm.state_num = 0;
INIT_WORK(&xfrm_state_gc_work, xfrm_state_gc_task);
return 0;