Skip to contentSkip to conversation

: [XFRM]: Pull xfrm_state_byspi hash table knowledge out of afinfo.

PATCH In review David Miller 1 participant 1 message Aug 15, 2006

Subsystems (3)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 2/10 : [XFRM]: Pull xfrm_state_byspi hash table knowledge out of afinfo.

[XFRM]: Pull xfrm_state_byspi hash table knowledge out of afinfo.

---
 include/net/xfrm.h     |    2 -
 net/ipv4/xfrm4_state.c |   19 ------------
 net/ipv6/xfrm6_state.c |   19 ------------
 net/xfrm/xfrm_state.c  |   73 ++++++++++++++++++++++++++----------------------
 4 files changed, 39 insertions(+), 74 deletions(-)
include/net/xfrm.h +0 -2
index e53819f..00ae025 100644
@@ -235,12 +235,10 @@ extern int __xfrm_state_delete(struct xf
 
 struct xfrm_state_afinfo {
 	unsigned short		family;
-	struct list_head	*state_byspi;
 	int			(*init_flags)(struct xfrm_state *x);
 	void			(*init_tempsel)(struct xfrm_state *x, struct flowi *fl,
 						struct xfrm_tmpl *tmpl,
 						xfrm_address_t *daddr, xfrm_address_t *saddr);
-	struct xfrm_state	*(*state_lookup)(xfrm_address_t *daddr, u32 spi, u8 proto);
 };
 
 extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo);
net/ipv4/xfrm4_state.c +0 -19
index f0a77fc..097cb5d 100644
@@ -62,29 +62,10 @@ __xfrm4_init_tempsel(struct xfrm_state *
 	x->props.family = AF_INET;
 }
 
-static struct xfrm_state *
-__xfrm4_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto)
-{
-	unsigned h = __xfrm4_spi_hash(daddr, spi, proto);
-	struct xfrm_state *x;
-
-	list_for_each_entry(x, xfrm4_state_afinfo.state_byspi+h, byspi) {
-		if (x->props.family == AF_INET &&
-		    spi == x->id.spi &&
-		    daddr->a4 == x->id.daddr.a4 &&
-		    proto == x->id.proto) {
-			xfrm_state_hold(x);
-			return x;
-		}
-	}
-	return NULL;
-}
-
 static struct xfrm_state_afinfo xfrm4_state_afinfo = {
 	.family			= AF_INET,
 	.init_flags		= xfrm4_init_flags,
 	.init_tempsel		= __xfrm4_init_tempsel,
-	.state_lookup		= __xfrm4_state_lookup,
 };
 
 void __init xfrm4_state_init(void)
net/ipv6/xfrm6_state.c +0 -19
index c43e45d..90ad0a4 100644
@@ -63,28 +63,9 @@ __xfrm6_init_tempsel(struct xfrm_state *
 	x->props.family = AF_INET6;
 }
 
-static struct xfrm_state *
-__xfrm6_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto)
-{
-	unsigned h = __xfrm6_spi_hash(daddr, spi, proto);
-	struct xfrm_state *x;
-
-	list_for_each_entry(x, xfrm6_state_afinfo.state_byspi+h, byspi) {
-		if (x->props.family == AF_INET6 &&
-		    spi == x->id.spi &&
-		    ipv6_addr_equal((struct in6_addr *)daddr, (struct in6_addr *)x->id.daddr.a6) &&
-		    proto == x->id.proto) {
-			xfrm_state_hold(x);
-			return x;
-		}
-	}
-	return NULL;
-}
-
 static struct xfrm_state_afinfo xfrm6_state_afinfo = {
 	.family			= AF_INET6,
 	.init_tempsel		= __xfrm6_init_tempsel,
-	.state_lookup		= __xfrm6_state_lookup,
 };
 
 void __init xfrm6_state_init(void)
net/xfrm/xfrm_state.c +39 -34

157 lines not on this page · raw message

Signature · 1 line
1.4.2.rc2.g3e042