Commit 0d580fbd authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tcp: refactor tcp_retransmit_timer()

It appears linux-4.14 stable needs a backport of commit
88f8598d ("tcp: exit if nothing to retransmit on RTO timeout")

Since tcp_rtx_queue_empty() is not in pre 4.15 kernels,
let's refactor tcp_retransmit_timer() to only use tcp_rtx_queue_head()

I will provide to stable teams the squashed patches.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9385973f
...@@ -434,6 +434,7 @@ void tcp_retransmit_timer(struct sock *sk) ...@@ -434,6 +434,7 @@ void tcp_retransmit_timer(struct sock *sk)
struct net *net = sock_net(sk); struct net *net = sock_net(sk);
struct inet_connection_sock *icsk = inet_csk(sk); struct inet_connection_sock *icsk = inet_csk(sk);
struct request_sock *req; struct request_sock *req;
struct sk_buff *skb;
req = rcu_dereference_protected(tp->fastopen_rsk, req = rcu_dereference_protected(tp->fastopen_rsk,
lockdep_sock_is_held(sk)); lockdep_sock_is_held(sk));
...@@ -446,7 +447,12 @@ void tcp_retransmit_timer(struct sock *sk) ...@@ -446,7 +447,12 @@ void tcp_retransmit_timer(struct sock *sk)
*/ */
return; return;
} }
if (!tp->packets_out || WARN_ON_ONCE(tcp_rtx_queue_empty(sk)))
if (!tp->packets_out)
return;
skb = tcp_rtx_queue_head(sk);
if (WARN_ON_ONCE(!skb))
return; return;
tp->tlp_high_seq = 0; tp->tlp_high_seq = 0;
...@@ -480,7 +486,7 @@ void tcp_retransmit_timer(struct sock *sk) ...@@ -480,7 +486,7 @@ void tcp_retransmit_timer(struct sock *sk)
goto out; goto out;
} }
tcp_enter_loss(sk); tcp_enter_loss(sk);
tcp_retransmit_skb(sk, tcp_rtx_queue_head(sk), 1); tcp_retransmit_skb(sk, skb, 1);
__sk_dst_reset(sk); __sk_dst_reset(sk);
goto out_reset_timer; goto out_reset_timer;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment