Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175545
b: refs/heads/master
c: 2f7de57
h: refs/heads/master
i:
  175543: c1785c1
v: v3
  • Loading branch information
Damian Lukowski authored and David S. Miller committed Dec 9, 2009
1 parent 1617392 commit a06144e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 07f29bc5bbae4e53e982ab956fed7207990a7786
refs/heads/master: 2f7de5710a4d394920405febc2a9937c69e16dda
28 changes: 0 additions & 28 deletions trunk/include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1261,34 +1261,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)
{
Expand Down
29 changes: 29 additions & 0 deletions trunk/net/ipv4/tcp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit a06144e

Please sign in to comment.