All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO
@ 2022-08-15 20:29 Jie Meng
  2022-08-16 13:36 ` Neal Cardwell
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jie Meng @ 2022-08-15 20:29 UTC (permalink / raw)
  To: netdev; +Cc: kafai, kuba, edumazet, bpf, Jie Meng

Instead of the hardcoded TCP_TIMEOUT_INIT, this diff calls tcp_timeout_init
to initiate req->timeout like the non TFO SYN ACK case.

Tested using the following packetdrill script, on a host with a BPF
program that sets the initial connect timeout to 10ms.

`../../common/defaults.sh`

// Initialize connection
    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
   +0 setsockopt(3, SOL_TCP, TCP_FASTOPEN, [1], 4) = 0
   +0 bind(3, ..., ...) = 0
   +0 listen(3, 1) = 0

   +0 < S 0:0(0) win 32792 <mss 1000,sackOK,FO TFO_COOKIE>
   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
   +.01 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
   +.02 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
   +.04 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
   +.01 < . 1:1(0) ack 1 win 32792

   +0 accept(3, ..., ...) = 4

Signed-off-by: Jie Meng <jmeng@fb.com>
---
 net/ipv4/tcp_fastopen.c | 3 ++-
 net/ipv4/tcp_timer.c    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index 825b216d11f5..45cc7f1ca296 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -272,8 +272,9 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk,
 	 * The request socket is not added to the ehash
 	 * because it's been added to the accept queue directly.
 	 */
+	req->timeout = tcp_timeout_init(child);
 	inet_csk_reset_xmit_timer(child, ICSK_TIME_RETRANS,
-				  TCP_TIMEOUT_INIT, TCP_RTO_MAX);
+				  req->timeout, TCP_RTO_MAX);
 
 	refcount_set(&req->rsk_refcnt, 2);
 
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index b4dfb82d6ecb..cb79127f45c3 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -428,7 +428,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk, struct request_sock *req)
 	if (!tp->retrans_stamp)
 		tp->retrans_stamp = tcp_time_stamp(tp);
 	inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
-			  TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX);
+			  req->timeout << req->num_timeout, TCP_RTO_MAX);
 }
 
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO
  2022-08-15 20:29 [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO Jie Meng
@ 2022-08-16 13:36 ` Neal Cardwell
  2022-08-16 16:11   ` Yuchung Cheng
  2022-08-16 16:59 ` Martin KaFai Lau
  2022-08-17  9:30 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 8+ messages in thread
From: Neal Cardwell @ 2022-08-16 13:36 UTC (permalink / raw)
  To: Jie Meng; +Cc: netdev, kafai, kuba, edumazet, bpf, Yuchung Cheng, Wei Wang

On Mon, Aug 15, 2022 at 8:30 PM Jie Meng <jmeng@fb.com> wrote:
>
> Instead of the hardcoded TCP_TIMEOUT_INIT, this diff calls tcp_timeout_init
> to initiate req->timeout like the non TFO SYN ACK case.
>
> Tested using the following packetdrill script, on a host with a BPF
> program that sets the initial connect timeout to 10ms.
>
> `../../common/defaults.sh`
>
> // Initialize connection
>     0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
>    +0 setsockopt(3, SOL_TCP, TCP_FASTOPEN, [1], 4) = 0
>    +0 bind(3, ..., ...) = 0
>    +0 listen(3, 1) = 0
>
>    +0 < S 0:0(0) win 32792 <mss 1000,sackOK,FO TFO_COOKIE>
>    +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
>    +.01 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
>    +.02 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
>    +.04 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
>    +.01 < . 1:1(0) ack 1 win 32792
>
>    +0 accept(3, ..., ...) = 4
>
> Signed-off-by: Jie Meng <jmeng@fb.com>
> ---
>  net/ipv4/tcp_fastopen.c | 3 ++-
>  net/ipv4/tcp_timer.c    | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
> index 825b216d11f5..45cc7f1ca296 100644
> --- a/net/ipv4/tcp_fastopen.c
> +++ b/net/ipv4/tcp_fastopen.c
> @@ -272,8 +272,9 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk,
>          * The request socket is not added to the ehash
>          * because it's been added to the accept queue directly.
>          */
> +       req->timeout = tcp_timeout_init(child);
>         inet_csk_reset_xmit_timer(child, ICSK_TIME_RETRANS,
> -                                 TCP_TIMEOUT_INIT, TCP_RTO_MAX);
> +                                 req->timeout, TCP_RTO_MAX);
>
>         refcount_set(&req->rsk_refcnt, 2);
>
> diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
> index b4dfb82d6ecb..cb79127f45c3 100644
> --- a/net/ipv4/tcp_timer.c
> +++ b/net/ipv4/tcp_timer.c
> @@ -428,7 +428,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk, struct request_sock *req)
>         if (!tp->retrans_stamp)
>                 tp->retrans_stamp = tcp_time_stamp(tp);
>         inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
> -                         TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX);
> +                         req->timeout << req->num_timeout, TCP_RTO_MAX);
>  }
>
>
> --

Looks good to me. Thanks for the feature!

Acked-by: Neal Cardwell <ncardwell@google.com>

neal

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO
  2022-08-16 13:36 ` Neal Cardwell
@ 2022-08-16 16:11   ` Yuchung Cheng
  0 siblings, 0 replies; 8+ messages in thread
From: Yuchung Cheng @ 2022-08-16 16:11 UTC (permalink / raw)
  To: Neal Cardwell; +Cc: Jie Meng, netdev, kafai, kuba, edumazet, bpf, Wei Wang

On Tue, Aug 16, 2022 at 6:37 AM Neal Cardwell <ncardwell@google.com> wrote:
>
> On Mon, Aug 15, 2022 at 8:30 PM Jie Meng <jmeng@fb.com> wrote:
> >
> > Instead of the hardcoded TCP_TIMEOUT_INIT, this diff calls tcp_timeout_init
> > to initiate req->timeout like the non TFO SYN ACK case.
> >
> > Tested using the following packetdrill script, on a host with a BPF
> > program that sets the initial connect timeout to 10ms.
> >
> > `../../common/defaults.sh`
> >
> > // Initialize connection
> >     0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
> >    +0 setsockopt(3, SOL_TCP, TCP_FASTOPEN, [1], 4) = 0
> >    +0 bind(3, ..., ...) = 0
> >    +0 listen(3, 1) = 0
> >
> >    +0 < S 0:0(0) win 32792 <mss 1000,sackOK,FO TFO_COOKIE>
> >    +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
> >    +.01 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
> >    +.02 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
> >    +.04 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
> >    +.01 < . 1:1(0) ack 1 win 32792
> >
> >    +0 accept(3, ..., ...) = 4
> >
> > Signed-off-by: Jie Meng <jmeng@fb.com>
> > ---
> >  net/ipv4/tcp_fastopen.c | 3 ++-
> >  net/ipv4/tcp_timer.c    | 2 +-
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
> > index 825b216d11f5..45cc7f1ca296 100644
> > --- a/net/ipv4/tcp_fastopen.c
> > +++ b/net/ipv4/tcp_fastopen.c
> > @@ -272,8 +272,9 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk,
> >          * The request socket is not added to the ehash
> >          * because it's been added to the accept queue directly.
> >          */
> > +       req->timeout = tcp_timeout_init(child);
> >         inet_csk_reset_xmit_timer(child, ICSK_TIME_RETRANS,
> > -                                 TCP_TIMEOUT_INIT, TCP_RTO_MAX);
> > +                                 req->timeout, TCP_RTO_MAX);
> >
> >         refcount_set(&req->rsk_refcnt, 2);
> >
> > diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
> > index b4dfb82d6ecb..cb79127f45c3 100644
> > --- a/net/ipv4/tcp_timer.c
> > +++ b/net/ipv4/tcp_timer.c
> > @@ -428,7 +428,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk, struct request_sock *req)
> >         if (!tp->retrans_stamp)
> >                 tp->retrans_stamp = tcp_time_stamp(tp);
> >         inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
> > -                         TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX);
> > +                         req->timeout << req->num_timeout, TCP_RTO_MAX);
> >  }
> >
> >
> > --
>
> Looks good to me. Thanks for the feature!
>
> Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Would be great to have a companion patch on SYN timeout as well.

>
> neal

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO
  2022-08-15 20:29 [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO Jie Meng
  2022-08-16 13:36 ` Neal Cardwell
@ 2022-08-16 16:59 ` Martin KaFai Lau
  2022-08-17  9:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 8+ messages in thread
From: Martin KaFai Lau @ 2022-08-16 16:59 UTC (permalink / raw)
  To: Jie Meng; +Cc: netdev, kuba, edumazet, bpf

On Mon, Aug 15, 2022 at 01:29:00PM -0700, Jie Meng wrote:
> Instead of the hardcoded TCP_TIMEOUT_INIT, this diff calls tcp_timeout_init
> to initiate req->timeout like the non TFO SYN ACK case.
> 
> Tested using the following packetdrill script, on a host with a BPF
> program that sets the initial connect timeout to 10ms.
> 
> `../../common/defaults.sh`
> 
> // Initialize connection
>     0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
>    +0 setsockopt(3, SOL_TCP, TCP_FASTOPEN, [1], 4) = 0
>    +0 bind(3, ..., ...) = 0
>    +0 listen(3, 1) = 0
> 
>    +0 < S 0:0(0) win 32792 <mss 1000,sackOK,FO TFO_COOKIE>
>    +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
>    +.01 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
>    +.02 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
>    +.04 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
>    +.01 < . 1:1(0) ack 1 win 32792
> 
>    +0 accept(3, ..., ...) = 4
Acked-by: Martin KaFai Lau <kafai@fb.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO
  2022-08-15 20:29 [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO Jie Meng
  2022-08-16 13:36 ` Neal Cardwell
  2022-08-16 16:59 ` Martin KaFai Lau
@ 2022-08-17  9:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-17  9:30 UTC (permalink / raw)
  To: Jie Meng; +Cc: netdev, kafai, kuba, edumazet, bpf

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon, 15 Aug 2022 13:29:00 -0700 you wrote:
> Instead of the hardcoded TCP_TIMEOUT_INIT, this diff calls tcp_timeout_init
> to initiate req->timeout like the non TFO SYN ACK case.
> 
> Tested using the following packetdrill script, on a host with a BPF
> program that sets the initial connect timeout to 10ms.
> 
> `../../common/defaults.sh`
> 
> [...]

Here is the summary with links:
  - [net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO
    https://git.kernel.org/netdev/net-next/c/8ea731d4c2ce

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO
  2022-08-06  0:06 Jie Meng
  2022-08-10  5:11 ` Jakub Kicinski
@ 2022-08-10 22:30 ` Martin KaFai Lau
  1 sibling, 0 replies; 8+ messages in thread
From: Martin KaFai Lau @ 2022-08-10 22:30 UTC (permalink / raw)
  To: Jie Meng; +Cc: netdev, bpf

On Fri, Aug 05, 2022 at 05:06:35PM -0700, Jie Meng wrote:
> Instead of the hardcoded TCP_TIMEOUT_INIT, this diff calls tcp_timeout_init
> to initiate req->timeout like the non TFO SYN ACK case.
> 
> Tested using the following packetdrill script, on a host with a BPF
> program that sets the initial connect timeout to 10ms.
Please also cc the bpf mailing list.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO
  2022-08-06  0:06 Jie Meng
@ 2022-08-10  5:11 ` Jakub Kicinski
  2022-08-10 22:30 ` Martin KaFai Lau
  1 sibling, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2022-08-10  5:11 UTC (permalink / raw)
  To: Jie Meng; +Cc: netdev, kafai

On Fri, 5 Aug 2022 17:06:35 -0700 Jie Meng wrote:
> Instead of the hardcoded TCP_TIMEOUT_INIT, this diff calls tcp_timeout_init
> to initiate req->timeout like the non TFO SYN ACK case.
> 
> Tested using the following packetdrill script, on a host with a BPF
> program that sets the initial connect timeout to 10ms.

Please make sure to CC the relevant maintainers
(./scripts/get_maintainer.pl). Apart from that:


# Form letter - net-next is closed

We have already sent the networking pull request for 6.0
and therefore net-next is closed for new drivers, features,
code refactoring and optimizations. We are currently accepting
bug fixes only.

Please repost when net-next reopens after 6.0-rc1 is cut.

RFC patches sent for review only are obviously welcome at any time.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO
@ 2022-08-06  0:06 Jie Meng
  2022-08-10  5:11 ` Jakub Kicinski
  2022-08-10 22:30 ` Martin KaFai Lau
  0 siblings, 2 replies; 8+ messages in thread
From: Jie Meng @ 2022-08-06  0:06 UTC (permalink / raw)
  To: netdev; +Cc: kafai, Jie Meng

Instead of the hardcoded TCP_TIMEOUT_INIT, this diff calls tcp_timeout_init
to initiate req->timeout like the non TFO SYN ACK case.

Tested using the following packetdrill script, on a host with a BPF
program that sets the initial connect timeout to 10ms.

`../../common/defaults.sh`

// Initialize connection
    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
   +0 setsockopt(3, SOL_TCP, TCP_FASTOPEN, [1], 4) = 0
   +0 bind(3, ..., ...) = 0
   +0 listen(3, 1) = 0

   +0 < S 0:0(0) win 32792 <mss 1000,sackOK,FO TFO_COOKIE>
   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
   +.01 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
   +.02 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
   +.04 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
   +.01 < . 1:1(0) ack 1 win 32792

   +0 accept(3, ..., ...) = 4

Signed-off-by: Jie Meng <jmeng@fb.com>
---
 net/ipv4/tcp_fastopen.c | 3 ++-
 net/ipv4/tcp_timer.c    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index 825b216d11f5..45cc7f1ca296 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -272,8 +272,9 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk,
 	 * The request socket is not added to the ehash
 	 * because it's been added to the accept queue directly.
 	 */
+	req->timeout = tcp_timeout_init(child);
 	inet_csk_reset_xmit_timer(child, ICSK_TIME_RETRANS,
-				  TCP_TIMEOUT_INIT, TCP_RTO_MAX);
+				  req->timeout, TCP_RTO_MAX);
 
 	refcount_set(&req->rsk_refcnt, 2);
 
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index b4dfb82d6ecb..cb79127f45c3 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -428,7 +428,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk, struct request_sock *req)
 	if (!tp->retrans_stamp)
 		tp->retrans_stamp = tcp_time_stamp(tp);
 	inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
-			  TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX);
+			  req->timeout << req->num_timeout, TCP_RTO_MAX);
 }
 
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-08-17  9:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 20:29 [PATCH net-next] tcp: Make SYN ACK RTO tunable by BPF programs with TFO Jie Meng
2022-08-16 13:36 ` Neal Cardwell
2022-08-16 16:11   ` Yuchung Cheng
2022-08-16 16:59 ` Martin KaFai Lau
2022-08-17  9:30 ` patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2022-08-06  0:06 Jie Meng
2022-08-10  5:11 ` Jakub Kicinski
2022-08-10 22:30 ` Martin KaFai Lau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.