summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLi RongQing <roy.qing.li@gmail.com>2015-04-24 16:49:31 +0800
committerSteffen Klassert <steffen.klassert@secunet.com>2015-04-24 12:17:16 +0200
commitdc0565ce6e34be06730312e79b226b7408a543c8 (patch)
treef6c42ccbc1a1ef431ff970b231ba5ea6fe22cd66 /net
parentf31e8d4f7b44092b6b2ab3a6b1d4079836b6955a (diff)
downloadlinux-stable-dc0565ce6e34be06730312e79b226b7408a543c8.tar.gz
linux-stable-dc0565ce6e34be06730312e79b226b7408a543c8.tar.bz2
linux-stable-dc0565ce6e34be06730312e79b226b7408a543c8.zip
xfrm: slightly optimise xfrm_input
Check x->km.state with XFRM_STATE_ACQ only when state is not XFRM_STAT_VALID, not everytime Signed-off-by: Li RongQing <roy.qing.li@gmail.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net')
-rw-r--r--net/xfrm/xfrm_input.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 459796a78ab0..1858a45f008b 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -239,13 +239,13 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
skb->sp->xvec[skb->sp->len++] = x;
spin_lock(&x->lock);
- if (unlikely(x->km.state == XFRM_STATE_ACQ)) {
- XFRM_INC_STATS(net, LINUX_MIB_XFRMACQUIREERROR);
- goto drop_unlock;
- }
if (unlikely(x->km.state != XFRM_STATE_VALID)) {
- XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATEINVALID);
+ if (x->km.state == XFRM_STATE_ACQ)
+ XFRM_INC_STATS(net, LINUX_MIB_XFRMACQUIREERROR);
+ else
+ XFRM_INC_STATS(net,
+ LINUX_MIB_XFRMINSTATEINVALID);
goto drop_unlock;
}