Skip to contentSkip to conversation

tcp: refactor tcp_retransmit_timer()

PATCH Applied Eric Dumazet 4 participants 11 messages Dec 3, 2019 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcp: refactor tcp_retransmit_timer()

It appears linux-4.14 stable needs a backport of commit 88f8598d0a30 ("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.

Cc Willem de Bruijn <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 net/ipv4/tcp_timer.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
net/ipv4/tcp_timer.c +8 -2
index dd5a6317a8018a45ad609f832ced6df2937ad453..1097b438befe14ae3f375f3dbcc1f2d375a93879 100644
@@ -434,6 +434,7 @@ void tcp_retransmit_timer(struct sock *sk)
 	struct net *net = sock_net(sk);
 	struct inet_connection_sock *icsk = inet_csk(sk);
 	struct request_sock *req;
+	struct sk_buff *skb;
 
 	req = rcu_dereference_protected(tp->fastopen_rsk,
 					lockdep_sock_is_held(sk));
@@ -446,7 +447,12 @@ void tcp_retransmit_timer(struct sock *sk)
 		 */
 		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;
 
 	tp->tlp_high_seq = 0;
@@ -480,7 +486,7 @@ void tcp_retransmit_timer(struct sock *sk)
 			goto out;
 		}
 		tcp_enter_loss(sk);
-		tcp_retransmit_skb(sk, tcp_rtx_queue_head(sk), 1);
+		tcp_retransmit_skb(sk, skb, 1);
 		__sk_dst_reset(sk);
 		goto out_reset_timer;
 	}
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Eric Dumazet

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

Quoted 8 lines

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.

Cc Willem de Bruijn <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

Thanks, Eric!

Quoted 42 lines
---
 net/ipv4/tcp_timer.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
net/ipv4/tcp_timer.c +8 -3
index dd5a6317a8018a45ad609f832ced6df2937ad453..1097b438befe14ae3f375f3dbcc1f2d375a93879 100644
@@ -434,6 +434,7 @@ void tcp_retransmit_timer(struct sock *sk)
        struct net *net = sock_net(sk);
        struct inet_connection_sock *icsk = inet_csk(sk);
        struct request_sock *req;
+       struct sk_buff *skb;
 
        req = rcu_dereference_protected(tp->fastopen_rsk,
                                        lockdep_sock_is_held(sk));
@@ -446,7 +447,12 @@ void tcp_retransmit_timer(struct sock *sk)
                 */
                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;
 
        tp->tlp_high_seq = 0;
@@ -480,7 +486,7 @@ void tcp_retransmit_timer(struct sock *sk)
                        goto out;
                }
                tcp_enter_loss(sk);
-               tcp_retransmit_skb(sk, tcp_rtx_queue_head(sk), 1);
+               tcp_retransmit_skb(sk, skb, 1);
                __sk_dst_reset(sk);
                goto out_reset_timer;
        }
--

2.24.0.393.g34dc348eaf-goog

#2 lore raw
In reply to Eric Dumazet
Quoted 5 lines · Eric Dumazet

It appears linux-4.14 stable needs a backport of commit 88f8598d0a30 ("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()

So does that mean that 4.19.y should get 88f8598d0a30 ("tcp: exit if nothing to retransmit on RTO timeout") as-is?

Quoted 1 line

I will provide to stable teams the squashed patches.

This is that squashed patch, right?

thanks,

greg k-h

#3 lore raw
Quoted 11 lines · Greg Kroah-Hartman
Quoted 5 lines · Eric Dumazet

It appears linux-4.14 stable needs a backport of commit 88f8598d0a30 ("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()

So does that mean that 4.19.y should get 88f8598d0a30 ("tcp: exit if nothing to retransmit on RTO timeout") as-is?

Yes indeed. All stable versions need it.

Quoted 3 lines
Quoted 1 line

I will provide to stable teams the squashed patches.

This is that squashed patch, right?

Yes, both patches squashed to avoid breaking future bisections.

#4 lore raw
Quoted 7 lines · Eric Dumazet
Quoted 5 lines · Greg Kroah-Hartman
Quoted 3 lines · Eric Dumazet

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

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

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()

So does that mean that 4.19.y should get 88f8598d0a30 ("tcp: exit if nothing to retransmit on RTO timeout") as-is?

Yes indeed. All stable versions need it.

So 4.4.y and 4.9.y as well?

thanks,

greg k-h

#5 lore raw
Quoted 12 lines · Greg Kroah-Hartman
Quoted 10 lines · Eric Dumazet
Quoted 8 lines · Greg Kroah-Hartman
Quoted 5 lines · Eric Dumazet

It appears linux-4.14 stable needs a backport of commit 88f8598d0a30 ("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()

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

So does that mean that 4.19.y should get 88f8598d0a30 ("tcp: exit if nothing to retransmit on RTO timeout") as-is?

Yes indeed. All stable versions need it.

So 4.4.y and 4.9.y as well?

They should be fine, since they do not have yet :

ba2ddb43f270e6492ccce4fc42fc32c611de8f68 tcp: Don't dequeue SYN/FIN-segments from write-queue f1dcc5ed4bea3f2d63b74ad86617ec12b1e5e9d4 tcp: Reset send_head when removing skb from write-queue 8e6521f6404e704fac313ab2479923be1f741f73 tcp: remove empty skb from write queue in error cases

I would leave them untouched, to limit further problems :/

#6 lore raw
Quoted 24 lines · Eric Dumazet
Quoted 12 lines · Greg Kroah-Hartman
Quoted 10 lines · Eric Dumazet
Quoted 8 lines · Greg Kroah-Hartman
Quoted 5 lines · Eric Dumazet

It appears linux-4.14 stable needs a backport of commit 88f8598d0a30 ("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()

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

So does that mean that 4.19.y should get 88f8598d0a30 ("tcp: exit if nothing to retransmit on RTO timeout") as-is?

Yes indeed. All stable versions need it.

So 4.4.y and 4.9.y as well?

They should be fine, since they do not have yet :

Quoted 8 lines

ba2ddb43f270e6492ccce4fc42fc32c611de8f68 tcp: Don't dequeue SYN/FIN-segments from write-queue f1dcc5ed4bea3f2d63b74ad86617ec12b1e5e9d4 tcp: Reset send_head when removing skb from write-queue 8e6521f6404e704fac313ab2479923be1f741f73 tcp: remove empty skb from write queue in error cases

I would leave them untouched, to limit further problems :/

Great, thanks for letting me know.

greg k-h

maintainer Applied
#7 lore raw
In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Tue, 3 Dec 2019 08:05:52 -0800

Quoted 9 lines

It appears linux-4.14 stable needs a backport of commit 88f8598d0a30 ("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.

Applied, thanks Eric.

#8 lore raw
Quoted 6 lines · David Miller

From: Eric Dumazet <[email protected]>
Date: Tue, 3 Dec 2019 08:05:52 -0800

Quoted 3 lines

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

Quoted 8 lines
Quoted 6 lines

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.

Applied, thanks Eric.

Applied where, do you have a 4.14-stable queue too? :)

I can just take this directly to my 4.14.y tree now if you don't object.

thanks,

greg k-h

A message that is not in the archive (sent off-list or not yet received): CANn89iKP7EZZRBtdcvFZVWP5-zs6uUWTgvo_Az+W+PKyA=rvxw@mail.gmail.com

#10 lore raw
Quoted 16 lines · Eric Dumazet
Quoted 14 lines · Greg KH
Quoted 13 lines · David Miller

From: Eric Dumazet <[email protected]>
Date: Tue, 3 Dec 2019 08:05:52 -0800

Quoted 9 lines

It appears linux-4.14 stable needs a backport of commit 88f8598d0a30 ("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.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Applied, thanks Eric.

Applied where, do you have a 4.14-stable queue too? :)

I can just take this directly to my 4.14.y tree now if you don't object.

Sure, please do, I will double-check it ;)

Ah, nevermind, I see now that your patch does apply to Dave's tree. I thought this was a 4.14-only thing here.

sorry for the confusion, I'll just ignore this for now then.

greg k-h

maintainer Applied
#11 lore raw
In reply to Greg KH

From: Greg KH <[email protected]>
Date: Tue, 3 Dec 2019 21:23:58 +0100

Quoted 10 lines · David Miller
Quoted 9 lines

From: Eric Dumazet <[email protected]>
Date: Tue, 3 Dec 2019 08:05:52 -0800

Quoted 6 lines

It appears linux-4.14 stable needs a backport of commit 88f8598d0a30 ("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()

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I will provide to stable teams the squashed patches.

Applied, thanks Eric.

Applied where, do you have a 4.14-stable queue too? :)

Applied to my net GIT tree, I do not have a 4.14 -stable queue :-)

Quoted 1 line

I can just take this directly to my 4.14.y tree now if you don't object.

Please integrate all of the -stable parts, yes.

Thanks.