All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tingwei Liu <tingw.liu@gmail.com>
To: netdev@vger.kernel.org, davem@davemloft.net,
	kuznet@ms2.inr.ac.ru, eric.dumazet@gmail.com
Cc: Tingwei Liu <tingw.liu@gmail.com>
Subject: [PATCH net-next] tcp:elapsed variable calculated twice while keepalive working
Date: Tue,  6 Aug 2013 20:38:58 +0800	[thread overview]
Message-ID: <1375792738-19099-1-git-send-email-tingw.liu@gmail.com> (raw)

When tcp keepalive working elapsed calculated twice while the first time is not needed!

CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: Tingwei Liu <tingw.liu@gmail.com>
---
 net/ipv4/tcp_timer.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 4b85e6f..03091d9 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -591,11 +591,11 @@ static void tcp_keepalive_timer (unsigned long data)
 	if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->sk_state == TCP_CLOSE)
 		goto out;
 
-	elapsed = keepalive_time_when(tp);
-
 	/* It is alive without keepalive 8) */
-	if (tp->packets_out || tcp_send_head(sk))
+	if (tp->packets_out || tcp_send_head(sk)) {
+		elapsed = keepalive_time_when(tp);
 		goto resched;
+	}
 
 	elapsed = keepalive_time_elapsed(tp);
 
-- 
1.6.0.2

             reply	other threads:[~2013-08-06 12:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 12:38 Tingwei Liu [this message]
2013-08-09 18:12 ` [PATCH net-next] tcp:elapsed variable calculated twice while keepalive working David Miller
2013-08-09 21:06   ` Eric Dumazet
  -- strict thread matches above, loose matches on Subject: below --
2013-08-06 12:05 Tingwei Liu
2013-08-06 12:23 ` Eric Dumazet
2013-08-06 12:29   ` tingwei liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375792738-19099-1-git-send-email-tingw.liu@gmail.com \
    --to=tingw.liu@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.