netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][net-next] xfrm: slightly optimise xfrm_input
@ 2015-04-24  8:49 roy.qing.li
  2015-04-27 10:39 ` Steffen Klassert
  0 siblings, 1 reply; 2+ messages in thread
From: roy.qing.li @ 2015-04-24  8:49 UTC (permalink / raw)
  To: netdev; +Cc: steffen.klassert

From: Li RongQing <roy.qing.li@gmail.com>

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>
---
 net/xfrm/xfrm_input.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 459796a..1858a45f 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;
 		}
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][net-next] xfrm: slightly optimise xfrm_input
  2015-04-24  8:49 [PATCH][net-next] xfrm: slightly optimise xfrm_input roy.qing.li
@ 2015-04-27 10:39 ` Steffen Klassert
  0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2015-04-27 10:39 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev

On Fri, Apr 24, 2015 at 04:49:31PM +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> 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>

Applied to ipsec-next, thanks a lot Li!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-27 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-24  8:49 [PATCH][net-next] xfrm: slightly optimise xfrm_input roy.qing.li
2015-04-27 10:39 ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).