Skip to content

Commit

Permalink
tcp: Add tcp_retransmit_stamp() helper routine
Browse files Browse the repository at this point in the history
Create a seperate helper routine as per Neal Cardwells suggestion. To
be used by the final commit in this series and retransmits_timed_out().

Signed-off-by: Jon Maxwell <jmaxwell37@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jon Maxwell authored and David S. Miller committed Jul 21, 2018
1 parent 9bcc66e commit a7fa377
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions net/ipv4/tcp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@
#include <linux/gfp.h>
#include <net/tcp.h>

u32 tcp_retransmit_stamp(const struct sock *sk)
{
u32 start_ts = tcp_sk(sk)->retrans_stamp;

if (unlikely(!start_ts)) {
struct sk_buff *head = tcp_rtx_queue_head(sk);

if (!head)
return 0;
start_ts = tcp_skb_timestamp(head);
}
return start_ts;
}

/**
* tcp_write_err() - close socket and save error info
* @sk: The socket the error has appeared on.
Expand Down Expand Up @@ -166,14 +180,9 @@ static bool retransmits_timed_out(struct sock *sk,
if (!inet_csk(sk)->icsk_retransmits)
return false;

start_ts = tcp_sk(sk)->retrans_stamp;
if (unlikely(!start_ts)) {
struct sk_buff *head = tcp_rtx_queue_head(sk);

if (!head)
return false;
start_ts = tcp_skb_timestamp(head);
}
start_ts = tcp_retransmit_stamp(sk);
if (!start_ts)
return false;

if (likely(timeout == 0)) {
linear_backoff_thresh = ilog2(TCP_RTO_MAX/rto_base);
Expand Down

0 comments on commit a7fa377

Please sign in to comment.