diff options
author | Damian Lukowski <damian@tvk.rwth-aachen.de> | 2009-09-01 06:24:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-01 20:40:47 -0400 |
commit | 5152fc7de3ae31b46692022ea63ce0501280f5b1 (patch) | |
tree | 44aff7228b23b90ab42e0afea7178104b231d885 /include/net | |
parent | 72c60683282a6cd047db47d605eb96e2a6fac72c (diff) |
RTO connection timeout: coding style fixes and comments
This patch affects the retransmits_timed_out() function.
Changes:
1) Variables have more meaningful names
2) retransmits_timed_out() has an introductionary comment.
3) Small coding style changes.
Signed-off-by: Damian Lukowski <damian@tvk.rwth-aachen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/tcp.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index e5319495f15e..df50bc40b5fd 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1252,22 +1252,27 @@ 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 | ||
1255 | /* This function calculates a "timeout" which is equivalent to the timeout of a | ||
1256 | * TCP connection after "boundary" unsucessful, exponentially backed-off | ||
1257 | * retransmissions with an initial RTO of TCP_RTO_MIN. | ||
1258 | */ | ||
1255 | static inline bool retransmits_timed_out(const struct sock *sk, | 1259 | static inline bool retransmits_timed_out(const struct sock *sk, |
1256 | unsigned int boundary) | 1260 | unsigned int boundary) |
1257 | { | 1261 | { |
1258 | int limit, K; | 1262 | unsigned int timeout, linear_backoff_thresh; |
1263 | |||
1259 | if (!inet_csk(sk)->icsk_retransmits) | 1264 | if (!inet_csk(sk)->icsk_retransmits) |
1260 | return false; | 1265 | return false; |
1261 | 1266 | ||
1262 | K = ilog2(TCP_RTO_MAX/TCP_RTO_MIN); | 1267 | linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN); |
1263 | 1268 | ||
1264 | if (boundary <= K) | 1269 | if (boundary <= linear_backoff_thresh) |
1265 | limit = ((2 << boundary) - 1) * TCP_RTO_MIN; | 1270 | timeout = ((2 << boundary) - 1) * TCP_RTO_MIN; |
1266 | else | 1271 | else |
1267 | limit = ((2 << K) - 1) * TCP_RTO_MIN + | 1272 | timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN + |
1268 | (boundary - K) * TCP_RTO_MAX; | 1273 | (boundary - linear_backoff_thresh) * TCP_RTO_MAX; |
1269 | 1274 | ||
1270 | return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= limit; | 1275 | return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout; |
1271 | } | 1276 | } |
1272 | 1277 | ||
1273 | static inline struct sk_buff *tcp_send_head(struct sock *sk) | 1278 | static inline struct sk_buff *tcp_send_head(struct sock *sk) |