aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
authorDamian Lukowski <damian@tvk.rwth-aachen.de>2009-08-25 20:16:34 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-01 05:45:47 -0400
commit6fa12c85031485dff38ce550c24f10da23b0adaa (patch)
tree73f6cac32302ab99381f38505a5dbe930cb28e44 /include/net/tcp.h
parentf1ecd5d9e7366609d640ff4040304ea197fbc618 (diff)
Revert Backoff [v3]: Calculate TCP's connection close threshold as a time value.
RFC 1122 specifies two threshold values R1 and R2 for connection timeouts, which may represent a number of allowed retransmissions or a timeout value. Currently linux uses sysctl_tcp_retries{1,2} to specify the thresholds in number of allowed retransmissions. For any desired threshold R2 (by means of time) one can specify tcp_retries2 (by means of number of retransmissions) such that TCP will not time out earlier than R2. This is the case, because the RTO schedule follows a fixed pattern, namely exponential backoff. However, the RTO behaviour is not predictable any more if RTO backoffs can be reverted, as it is the case in the draft "Make TCP more Robust to Long Connectivity Disruptions" (http://tools.ietf.org/html/draft-zimmermann-tcp-lcd). In the worst case TCP would time out a connection after 3.2 seconds, if the initial RTO equaled MIN_RTO and each backoff has been reverted. This patch introduces a function retransmits_timed_out(N), which calculates the timeout of a TCP connection, assuming an initial RTO of MIN_RTO and N unsuccessful, exponentially backed-off retransmissions. Whenever timeout decisions are made by comparing the retransmission counter to some value N, this function can be used, instead. The meaning of tcp_retries2 will be changed, as many more RTO retransmissions can occur than the value indicates. However, it yields a timeout which is similar to the one of an unpatched, exponentially backing off TCP in the same scenario. As no application could rely on an RTO greater than MIN_RTO, there should be no risk of a regression. 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/net/tcp.h')
-rw-r--r--include/net/tcp.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 54f212ce8aaf..e5319495f15e 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1252,6 +1252,24 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
1252#define tcp_for_write_queue_from_safe(skb, tmp, sk) \ 1252#define tcp_for_write_queue_from_safe(skb, tmp, sk) \
1253 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) 1253 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)
1254 1254
1255static inline bool retransmits_timed_out(const struct sock *sk,
1256 unsigned int boundary)
1257{
1258 int limit, K;
1259 if (!inet_csk(sk)->icsk_retransmits)
1260 return false;
1261
1262 K = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
1263
1264 if (boundary <= K)
1265 limit = ((2 << boundary) - 1) * TCP_RTO_MIN;
1266 else
1267 limit = ((2 << K) - 1) * TCP_RTO_MIN +
1268 (boundary - K) * TCP_RTO_MAX;
1269
1270 return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= limit;
1271}
1272
1255static inline struct sk_buff *tcp_send_head(struct sock *sk) 1273static inline struct sk_buff *tcp_send_head(struct sock *sk)
1256{ 1274{
1257 return sk->sk_send_head; 1275 return sk->sk_send_head;