Skip to content

Commit 0d580fb

Browse files
Eric Dumazetdavem330
authored andcommitted
tcp: refactor tcp_retransmit_timer()
It appears linux-4.14 stable needs a backport of commit 88f8598 ("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: Eric Dumazet <[email protected]> Cc: Willem de Bruijn <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Acked-by: Soheil Hassas Yeganeh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9385973 commit 0d580fb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

net/ipv4/tcp_timer.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ void tcp_retransmit_timer(struct sock *sk)
434434
struct net *net = sock_net(sk);
435435
struct inet_connection_sock *icsk = inet_csk(sk);
436436
struct request_sock *req;
437+
struct sk_buff *skb;
437438

438439
req = rcu_dereference_protected(tp->fastopen_rsk,
439440
lockdep_sock_is_held(sk));
@@ -446,7 +447,12 @@ void tcp_retransmit_timer(struct sock *sk)
446447
*/
447448
return;
448449
}
449-
if (!tp->packets_out || WARN_ON_ONCE(tcp_rtx_queue_empty(sk)))
450+
451+
if (!tp->packets_out)
452+
return;
453+
454+
skb = tcp_rtx_queue_head(sk);
455+
if (WARN_ON_ONCE(!skb))
450456
return;
451457

452458
tp->tlp_high_seq = 0;
@@ -480,7 +486,7 @@ void tcp_retransmit_timer(struct sock *sk)
480486
goto out;
481487
}
482488
tcp_enter_loss(sk);
483-
tcp_retransmit_skb(sk, tcp_rtx_queue_head(sk), 1);
489+
tcp_retransmit_skb(sk, skb, 1);
484490
__sk_dst_reset(sk);
485491
goto out_reset_timer;
486492
}

0 commit comments

Comments
 (0)