All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] tcp:elapsed variable calculated twice while keepalive working
@ 2013-08-06 12:38 Tingwei Liu
  2013-08-09 18:12 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Tingwei Liu @ 2013-08-06 12:38 UTC (permalink / raw)
  To: netdev, davem, kuznet, eric.dumazet; +Cc: Tingwei Liu

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH net-next] tcp:elapsed variable calculated twice while keepalive working
@ 2013-08-06 12:05 Tingwei Liu
  2013-08-06 12:23 ` Eric Dumazet
  0 siblings, 1 reply; 6+ messages in thread
From: Tingwei Liu @ 2013-08-06 12:05 UTC (permalink / raw)
  To: netdev, kuznet, davem; +Cc: Tingwei Liu

---
 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

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

end of thread, other threads:[~2013-08-09 21:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-06 12:38 [PATCH net-next] tcp:elapsed variable calculated twice while keepalive working Tingwei Liu
2013-08-09 18:12 ` 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

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.