: [XFRM]: Move SPI hashing functions local to xfrm_state.c
Subsystems (3)
David Miller
maintainerPATCH 3/10 : [XFRM]: Move SPI hashing functions local to xfrm_state.c
[XFRM]: Move SPI hashing functions local to xfrm_state.c
Signed-off-by David S. Miller <[email protected]>
--- include/net/xfrm.h | 32 -------------------------------- net/xfrm/xfrm_state.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 32 deletions(-)
include/net/xfrm.h +0 -32
@@ -382,38 +382,6 @@ static inline void xfrm_pol_put(struct x__xfrm_policy_destroy (policy); } -#define XFRM_DST_HSIZE 1024 - -static __inline__ -unsigned __xfrm4_spi_hash (xfrm_address_t *addr,u32 spi,u8 proto) -{ -unsigned h; - h =ntohl (addr->a4^spi^proto); - h = (h ^ (h>>10 ) ^ (h>>20 )) %XFRM_DST_HSIZE ; -return h; -} - -static __inline__ -unsigned __xfrm6_spi_hash (xfrm_address_t *addr,u32 spi,u8 proto) -{ -unsigned h; - h =ntohl (addr->a6[2 ]^addr->a6[3 ]^spi^proto); - h = (h ^ (h>>10 ) ^ (h>>20 )) %XFRM_DST_HSIZE ; -return h; -} - -static __inline__ -unsigned xfrm_spi_hash (xfrm_address_t *addr,u32 spi,u8 proto,unsigned short family) -{ -switch (family) { -case AF_INET : -return __xfrm4_spi_hash (addr, spi, proto); -case AF_INET6 : -return __xfrm6_spi_hash (addr, spi, proto); - } -return 0 ;/*XXX*/ -} -extern void __xfrm_state_destroy (struct xfrm_state *);static inline void __xfrm_state_put (struct xfrm_state *x)
net/xfrm/xfrm_state.c +32 -0
@@ -38,6 +38,8 @@ EXPORT_SYMBOL(sysctl_xfrm_aevent_rseqth)static DEFINE_SPINLOCK (xfrm_state_lock); +#define XFRM_DST_HSIZE 1024 +/* Hash table to find appropriate SA towards given target (endpoint * of tunnel or destination of transport mode) allowed by selector. *
@@ -77,6 +79,36 @@ unsigned xfrm_dst_hash(xfrm_address_t *areturn 0 ; } +static __inline__ +unsigned __xfrm4_spi_hash (xfrm_address_t *addr,u32 spi,u8 proto) +{ +unsigned h; + h =ntohl (addr->a4^spi^proto); + h = (h ^ (h>>10 ) ^ (h>>20 )) %XFRM_DST_HSIZE ; +return h; +} + +static __inline__ +unsigned __xfrm6_spi_hash (xfrm_address_t *addr,u32 spi,u8 proto) +{ +unsigned h; + h =ntohl (addr->a6[2 ]^addr->a6[3 ]^spi^proto); + h = (h ^ (h>>10 ) ^ (h>>20 )) %XFRM_DST_HSIZE ; +return h; +} + +static __inline__ +unsigned xfrm_spi_hash (xfrm_address_t *addr,u32 spi,u8 proto,unsigned short family) +{ +switch (family) { +case AF_INET : +return __xfrm4_spi_hash (addr, spi, proto); +case AF_INET6 : +return __xfrm6_spi_hash (addr, spi, proto); + } +return 0 ;/*XXX*/ +} +DECLARE_WAIT_QUEUE_HEAD (km_waitq);EXPORT_SYMBOL (km_waitq);
Signature · 1 line
1.4.2.rc2.g3e042