netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Damian Lukowski <damian@tvk.rwth-aachen.de>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Netdev <netdev@vger.kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>,
	"Frederic Leroy" <fredo@starox.org>,
	"David Miller" <davem@davemloft.net>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"Greg KH" <gregkh@suse.de>
Subject: [PATCHv3 2/2] tcp: Stalling connections: Move timeout calculation routine
Date: Mon, 07 Dec 2009 17:06:16 +0100	[thread overview]
Message-ID: <4B1D27F8.2000603@tvk.rwth-aachen.de> (raw)
In-Reply-To: <4B1CE45A.9010908@tvk.rwth-aachen.de>

This patch moves retransmits_timed_out() from include/net/tcp.h
to tcp_timer.c, where it is used.

Signed-off-by: Damian Lukowski <damian@tvk.rwth-aachen.de>
---
 include/net/tcp.h    |   28 ----------------------------
 net/ipv4/tcp_timer.c |   29 +++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 842ac4d..ffab98a 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1259,34 +1259,6 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
 #define tcp_for_write_queue_from_safe(skb, tmp, sk)			\
 	skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)
 
-/* This function calculates a "timeout" which is equivalent to the timeout of a
- * TCP connection after "boundary" unsucessful, exponentially backed-off
- * retransmissions with an initial RTO of TCP_RTO_MIN.
- */
-static inline bool retransmits_timed_out(struct sock *sk,
-					 unsigned int boundary)
-{
-	unsigned int timeout, linear_backoff_thresh;
-	unsigned int start_ts;
-
-	if (!inet_csk(sk)->icsk_retransmits)
-		return false;
-
-	if (unlikely(!tcp_sk(sk)->retrans_stamp))
-		start_ts = TCP_SKB_CB(tcp_write_queue_head(sk))->when;
-	else
-		start_ts = tcp_sk(sk)->retrans_stamp;
-
-	linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
-
-	if (boundary <= linear_backoff_thresh)
-		timeout = ((2 << boundary) - 1) * TCP_RTO_MIN;
-	else
-		timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
-			  (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
-
-	return (tcp_time_stamp - start_ts) >= timeout;
-}
 
 static inline struct sk_buff *tcp_send_head(struct sock *sk)
 {
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index cdb2ca7..dfa0c37 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -132,6 +132,35 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk)
 	}
 }
 
+/* This function calculates a "timeout" which is equivalent to the timeout of a
+ * TCP connection after "boundary" unsucessful, exponentially backed-off
+ * retransmissions with an initial RTO of TCP_RTO_MIN.
+ */
+static bool retransmits_timed_out(struct sock *sk,
+				  unsigned int boundary)
+{
+	unsigned int timeout, linear_backoff_thresh;
+	unsigned int start_ts;
+
+	if (!inet_csk(sk)->icsk_retransmits)
+		return false;
+
+	if (unlikely(!tcp_sk(sk)->retrans_stamp))
+		start_ts = TCP_SKB_CB(tcp_write_queue_head(sk))->when;
+	else
+		start_ts = tcp_sk(sk)->retrans_stamp;
+
+	linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
+
+	if (boundary <= linear_backoff_thresh)
+		timeout = ((2 << boundary) - 1) * TCP_RTO_MIN;
+	else
+		timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
+			  (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
+
+	return (tcp_time_stamp - start_ts) >= timeout;
+}
+
 /* A write timeout has occurred. Process the after effects. */
 static int tcp_write_timeout(struct sock *sk)
 {
-- 
1.6.4.4

      parent reply	other threads:[~2009-12-07 16:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07  0:28 [PATCH] tcp: Fix for stalling connections Damian Lukowski
2009-12-07  0:32 ` Damian Lukowski
2009-12-07  6:15 ` Eric Dumazet
2009-12-07 11:17   ` Damian Lukowski
2009-12-07 11:22     ` David Miller
2009-12-07 11:41     ` [PATCHv2 0/2] tcp: Stalling connections Damian Lukowski
2009-12-07 11:41     ` [PATCHv2 1/2] tcp: Stalling connections: Move timeout calculation routine Damian Lukowski
2009-12-07 12:01       ` Frederic Leroy
2009-12-07 16:11         ` Damian Lukowski
2009-12-07 11:41     ` [PATCHv2 2/2] tcp: Stalling connections: Fix " Damian Lukowski
2009-12-07 12:08       ` Ilpo Järvinen
2009-12-07 12:27         ` Damian Lukowski
2009-12-07 12:32           ` Ilpo Järvinen
2009-12-07 16:06     ` [PATCHv3 0/2] tcp: Stalling connections Damian Lukowski
2009-12-07 16:06     ` [PATCHv3 1/2] tcp: Stalling connections: Fix timeout calculation routine Damian Lukowski
2009-12-07 18:50       ` Ilpo Järvinen
2009-12-07 19:09         ` Frederic Leroy
2009-12-10 13:24           ` TCP not retransmitting Ilpo Järvinen
2009-12-11 12:57             ` Frederic Leroy
2009-12-09  4:53         ` [PATCHv3 1/2] tcp: Stalling connections: Fix timeout calculation routine David Miller
2009-12-07 16:06     ` Damian Lukowski [this message]

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=4B1D27F8.2000603@tvk.rwth-aachen.de \
    --to=damian@tvk.rwth-aachen.de \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=fredo@starox.org \
    --cc=gregkh@suse.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=ilpo.jarvinen@helsinki.fi \
    --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 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).