Skip to content

Commit

Permalink
xfrm: Remove xfrm_state_genid
Browse files Browse the repository at this point in the history
The xfrm state genid only needs to be matched against the copy
saved in xfrm_dst.  So we don't need a global genid at all.  In
fact, we don't even need to initialise it.

Based on observation by Timo Teräs.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
herbertx authored and davem330 committed Apr 2, 2010
1 parent bd2c77a commit 34996cb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions net/xfrm/xfrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
static DEFINE_SPINLOCK(xfrm_state_lock);

static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024;
static unsigned int xfrm_state_genid;

static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family);
static void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo);
Expand Down Expand Up @@ -923,8 +922,6 @@ static void __xfrm_state_insert(struct xfrm_state *x)
struct net *net = xs_net(x);
unsigned int h;

x->genid = ++xfrm_state_genid;

list_add(&x->km.all, &net->xfrm.state_all);

h = xfrm_dst_hash(net, &x->id.daddr, &x->props.saddr,
Expand Down Expand Up @@ -970,7 +967,7 @@ static void __xfrm_state_bump_genids(struct xfrm_state *xnew)
(mark & x->mark.m) == x->mark.v &&
!xfrm_addr_cmp(&x->id.daddr, &xnew->id.daddr, family) &&
!xfrm_addr_cmp(&x->props.saddr, &xnew->props.saddr, family))
x->genid = xfrm_state_genid;
x->genid++;
}
}

Expand Down

0 comments on commit 34996cb

Please sign in to comment.