diff options
author | Damian Lukowski <damian@tvk.rwth-aachen.de> | 2009-12-07 01:06:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-08 23:56:11 -0500 |
commit | 2f7de5710a4d394920405febc2a9937c69e16dda (patch) | |
tree | 8f038451b643f68ab399009e769a74678feb5546 /include | |
parent | 07f29bc5bbae4e53e982ab956fed7207990a7786 (diff) |
tcp: Stalling connections: Move timeout calculation routine
This patch moves retransmits_timed_out() from include/net/tcp.h
to tcp_timer.c, where it is used.
Reported-by: Frederic Leroy <fredo@starox.org>
Signed-off-by: Damian Lukowski <damian@tvk.rwth-aachen.de>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/tcp.h | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index e54bd85d9d40..0248c181a92c 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1261,34 +1261,6 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu | |||
1261 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ | 1261 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ |
1262 | skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) | 1262 | skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) |
1263 | 1263 | ||
1264 | /* This function calculates a "timeout" which is equivalent to the timeout of a | ||
1265 | * TCP connection after "boundary" unsucessful, exponentially backed-off | ||
1266 | * retransmissions with an initial RTO of TCP_RTO_MIN. | ||
1267 | */ | ||
1268 | static inline bool retransmits_timed_out(struct sock *sk, | ||
1269 | unsigned int boundary) | ||
1270 | { | ||
1271 | unsigned int timeout, linear_backoff_thresh; | ||
1272 | unsigned int start_ts; | ||
1273 | |||
1274 | if (!inet_csk(sk)->icsk_retransmits) | ||
1275 | return false; | ||
1276 | |||
1277 | if (unlikely(!tcp_sk(sk)->retrans_stamp)) | ||
1278 | start_ts = TCP_SKB_CB(tcp_write_queue_head(sk))->when; | ||
1279 | else | ||
1280 | start_ts = tcp_sk(sk)->retrans_stamp; | ||
1281 | |||
1282 | linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN); | ||
1283 | |||
1284 | if (boundary <= linear_backoff_thresh) | ||
1285 | timeout = ((2 << boundary) - 1) * TCP_RTO_MIN; | ||
1286 | else | ||
1287 | timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN + | ||
1288 | (boundary - linear_backoff_thresh) * TCP_RTO_MAX; | ||
1289 | |||
1290 | return (tcp_time_stamp - start_ts) >= timeout; | ||
1291 | } | ||
1292 | 1264 | ||
1293 | static inline struct sk_buff *tcp_send_head(struct sock *sk) | 1265 | static inline struct sk_buff *tcp_send_head(struct sock *sk) |
1294 | { | 1266 | { |