aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/xfrm.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-02-22 17:47:13 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-02-23 19:10:53 -0500
commit21380b81ef8699179b535e197a95b891a7badac7 (patch)
tree1a6be9864cabbed59db6357b2f0244413acac4c4 /include/net/xfrm.h
parent85259878499d6c428cba191bb4e415a250dcd75a (diff)
[XFRM]: Eliminate refcounting confusion by creating __xfrm_state_put().
We often just do an atomic_dec(&x->refcnt) on an xfrm_state object because we know there is more than 1 reference remaining and thus we can elide the heavier xfrm_state_put() call. Do this behind an inline function called __xfrm_state_put() so that is more obvious and also to allow us to more cleanly add refcount debugging later. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r--include/net/xfrm.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index d6111a2f0a23..004e645f3e18 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -403,6 +403,11 @@ unsigned xfrm_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto, unsigned short f
403 403
404extern void __xfrm_state_destroy(struct xfrm_state *); 404extern void __xfrm_state_destroy(struct xfrm_state *);
405 405
406static inline void __xfrm_state_put(struct xfrm_state *x)
407{
408 atomic_dec(&x->refcnt);
409}
410
406static inline void xfrm_state_put(struct xfrm_state *x) 411static inline void xfrm_state_put(struct xfrm_state *x)
407{ 412{
408 if (atomic_dec_and_test(&x->refcnt)) 413 if (atomic_dec_and_test(&x->refcnt))