aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_timer.c
diff options
context:
space:
mode:
authorJon Maxwell <jmaxwell37@gmail.com>2018-07-18 21:14:43 -0400
committerDavid S. Miller <davem@davemloft.net>2018-07-21 13:28:55 -0400
commita7fa37703d495310819d0a6747e5b32362305374 (patch)
treef404c246257679386ce9b81aa0c8e13b1f85a567 /net/ipv4/tcp_timer.c
parent9bcc66e1983d10861deb6920fb0c151c5b01772a (diff)
tcp: Add tcp_retransmit_stamp() helper routine
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>
Diffstat (limited to 'net/ipv4/tcp_timer.c')
-rw-r--r--net/ipv4/tcp_timer.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index fa34984d0b12..d212f183dd2d 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -22,6 +22,20 @@
22#include <linux/gfp.h> 22#include <linux/gfp.h>
23#include <net/tcp.h> 23#include <net/tcp.h>
24 24
25u32 tcp_retransmit_stamp(const struct sock *sk)
26{
27 u32 start_ts = tcp_sk(sk)->retrans_stamp;
28
29 if (unlikely(!start_ts)) {
30 struct sk_buff *head = tcp_rtx_queue_head(sk);
31
32 if (!head)
33 return 0;
34 start_ts = tcp_skb_timestamp(head);
35 }
36 return start_ts;
37}
38
25/** 39/**
26 * tcp_write_err() - close socket and save error info 40 * tcp_write_err() - close socket and save error info
27 * @sk: The socket the error has appeared on. 41 * @sk: The socket the error has appeared on.
@@ -166,14 +180,9 @@ static bool retransmits_timed_out(struct sock *sk,
166 if (!inet_csk(sk)->icsk_retransmits) 180 if (!inet_csk(sk)->icsk_retransmits)
167 return false; 181 return false;
168 182
169 start_ts = tcp_sk(sk)->retrans_stamp; 183 start_ts = tcp_retransmit_stamp(sk);
170 if (unlikely(!start_ts)) { 184 if (!start_ts)
171 struct sk_buff *head = tcp_rtx_queue_head(sk); 185 return false;
172
173 if (!head)
174 return false;
175 start_ts = tcp_skb_timestamp(head);
176 }
177 186
178 if (likely(timeout == 0)) { 187 if (likely(timeout == 0)) {
179 linear_backoff_thresh = ilog2(TCP_RTO_MAX/rto_base); 188 linear_backoff_thresh = ilog2(TCP_RTO_MAX/rto_base);