mbox series

[net-next,00/13] tcp: add optional usec resolution to TCP TS

Message ID 20231020125748.122792-1-edumazet@google.com (mailing list archive)
Headers show
Series tcp: add optional usec resolution to TCP TS | expand

Message

Eric Dumazet Oct. 20, 2023, 12:57 p.m. UTC
As discussed in various public places in 2016, Google adopted
usec resolution in RFC 7323 TS values, at Van Jacobson suggestion.

Goals were :

1) better observability of delays in networking stacks/fabrics.

2) better disambiguation of events based on TSval/ecr values.

3) building block for congestion control modules needing usec resolution.

Back then we implemented a schem based on private SYN options
to safely negotiate the feature.

For upstream submission, we chose to use a much simpler route
attribute because this feature is probably going to be used
in private networks.

ip route add 10/8 ... features tcp_usec_ts

References:

https://www.ietf.org/proceedings/97/slides/slides-97-tcpm-tcp-options-for-low-latency-00.pdf
https://datatracker.ietf.org/doc/draft-wang-tcpm-low-latency-opt/

First two patches are fixing old minor bugs and might be taken
by stable teams (thanks to appropriate Fixes: tags)

Eric Dumazet (13):
  chtls: fix tp->rcv_tstamp initialization
  tcp: fix cookie_init_timestamp() overflows
  tcp: add tcp_time_stamp_ms() helper
  tcp: introduce tcp_clock_ms()
  tcp: replace tcp_time_stamp_raw()
  tcp: rename tcp_skb_timestamp()
  tcp: move tcp_ns_to_ts() to net/ipv4/syncookies.c
  tcp: rename tcp_time_stamp() to tcp_time_stamp_ts()
  tcp: add tcp_rtt_tsopt_us()
  tcp: add RTAX_FEATURE_TCP_USEC_TS
  tcp: introduce TCP_PAWS_WRAP
  tcp: add support for usec resolution in TCP TS values
  tcp: add TCPI_OPT_USEC_TS

 .../chelsio/inline_crypto/chtls/chtls_cm.c    |  2 +-
 include/linux/tcp.h                           |  9 ++-
 include/net/inet_timewait_sock.h              |  3 +-
 include/net/tcp.h                             | 59 ++++++++++++++-----
 include/uapi/linux/rtnetlink.h                | 18 +++---
 include/uapi/linux/tcp.h                      |  1 +
 net/ipv4/syncookies.c                         | 32 ++++++----
 net/ipv4/tcp.c                                | 26 +++++---
 net/ipv4/tcp_input.c                          | 52 ++++++++--------
 net/ipv4/tcp_ipv4.c                           |  5 +-
 net/ipv4/tcp_lp.c                             |  2 +-
 net/ipv4/tcp_minisocks.c                      | 19 ++++--
 net/ipv4/tcp_output.c                         | 14 +++--
 net/ipv4/tcp_timer.c                          | 44 +++++++++-----
 net/ipv6/tcp_ipv6.c                           |  5 +-
 net/netfilter/nf_synproxy_core.c              |  2 +-
 .../selftests/bpf/progs/xdp_synproxy_kern.c   |  4 +-
 17 files changed, 193 insertions(+), 104 deletions(-)

Comments

Yuchung Cheng Oct. 20, 2023, 4:10 p.m. UTC | #1
On Fri, Oct 20, 2023 at 5:57 AM Eric Dumazet <edumazet@google.com> wrote:
>
> As discussed in various public places in 2016, Google adopted
> usec resolution in RFC 7323 TS values, at Van Jacobson suggestion.
>
> Goals were :
>
> 1) better observability of delays in networking stacks/fabrics.
>
> 2) better disambiguation of events based on TSval/ecr values.
>
> 3) building block for congestion control modules needing usec resolution.
>
> Back then we implemented a schem based on private SYN options
> to safely negotiate the feature.
>
> For upstream submission, we chose to use a much simpler route
> attribute because this feature is probably going to be used
> in private networks.
>
> ip route add 10/8 ... features tcp_usec_ts
>
> References:
>
> https://www.ietf.org/proceedings/97/slides/slides-97-tcpm-tcp-options-for-low-latency-00.pdf
> https://datatracker.ietf.org/doc/draft-wang-tcpm-low-latency-opt/
>
> First two patches are fixing old minor bugs and might be taken
> by stable teams (thanks to appropriate Fixes: tags)

Huge thanks to Eric for making this happen for real :-) an immediate
benefit is enabling TCP timestamp based undos (Eifel) for short RTT
transactions. This allows datacenter TCP to use more aggressive
timeout w/o worrying too much of spurious timeout cwnd effect

Acked-by: Yuchung Cheng <ycheng@google.com>


>
> Eric Dumazet (13):
>   chtls: fix tp->rcv_tstamp initialization
>   tcp: fix cookie_init_timestamp() overflows
>   tcp: add tcp_time_stamp_ms() helper
>   tcp: introduce tcp_clock_ms()
>   tcp: replace tcp_time_stamp_raw()
>   tcp: rename tcp_skb_timestamp()
>   tcp: move tcp_ns_to_ts() to net/ipv4/syncookies.c
>   tcp: rename tcp_time_stamp() to tcp_time_stamp_ts()
>   tcp: add tcp_rtt_tsopt_us()
>   tcp: add RTAX_FEATURE_TCP_USEC_TS
>   tcp: introduce TCP_PAWS_WRAP
>   tcp: add support for usec resolution in TCP TS values
>   tcp: add TCPI_OPT_USEC_TS
>
>  .../chelsio/inline_crypto/chtls/chtls_cm.c    |  2 +-
>  include/linux/tcp.h                           |  9 ++-
>  include/net/inet_timewait_sock.h              |  3 +-
>  include/net/tcp.h                             | 59 ++++++++++++++-----
>  include/uapi/linux/rtnetlink.h                | 18 +++---
>  include/uapi/linux/tcp.h                      |  1 +
>  net/ipv4/syncookies.c                         | 32 ++++++----
>  net/ipv4/tcp.c                                | 26 +++++---
>  net/ipv4/tcp_input.c                          | 52 ++++++++--------
>  net/ipv4/tcp_ipv4.c                           |  5 +-
>  net/ipv4/tcp_lp.c                             |  2 +-
>  net/ipv4/tcp_minisocks.c                      | 19 ++++--
>  net/ipv4/tcp_output.c                         | 14 +++--
>  net/ipv4/tcp_timer.c                          | 44 +++++++++-----
>  net/ipv6/tcp_ipv6.c                           |  5 +-
>  net/netfilter/nf_synproxy_core.c              |  2 +-
>  .../selftests/bpf/progs/xdp_synproxy_kern.c   |  4 +-
>  17 files changed, 193 insertions(+), 104 deletions(-)
>
> --
> 2.42.0.655.g421f12c284-goog
>
Soheil Hassas Yeganeh Oct. 20, 2023, 4:19 p.m. UTC | #2
On Fri, Oct 20, 2023 at 12:11 PM Yuchung Cheng <ycheng@google.com> wrote:
>
> On Fri, Oct 20, 2023 at 5:57 AM Eric Dumazet <edumazet@google.com> wrote:
> >
> > As discussed in various public places in 2016, Google adopted
> > usec resolution in RFC 7323 TS values, at Van Jacobson suggestion.
> >
> > Goals were :
> >
> > 1) better observability of delays in networking stacks/fabrics.
> >
> > 2) better disambiguation of events based on TSval/ecr values.
> >
> > 3) building block for congestion control modules needing usec resolution.
> >
> > Back then we implemented a schem based on private SYN options
> > to safely negotiate the feature.
> >
> > For upstream submission, we chose to use a much simpler route
> > attribute because this feature is probably going to be used
> > in private networks.
> >
> > ip route add 10/8 ... features tcp_usec_ts
> >
> > References:
> >
> > https://www.ietf.org/proceedings/97/slides/slides-97-tcpm-tcp-options-for-low-latency-00.pdf
> > https://datatracker.ietf.org/doc/draft-wang-tcpm-low-latency-opt/
> >
> > First two patches are fixing old minor bugs and might be taken
> > by stable teams (thanks to appropriate Fixes: tags)
>
> Huge thanks to Eric for making this happen for real :-) an immediate
> benefit is enabling TCP timestamp based undos (Eifel) for short RTT
> transactions. This allows datacenter TCP to use more aggressive
> timeout w/o worrying too much of spurious timeout cwnd effect
>
> Acked-by: Yuchung Cheng <ycheng@google.com>

Thank you so much, Eric, for upstreaming the feature!  This is a major
milestone.

Acked-by: Soheil Hassas Yeganeh <soheil@google.com>

>
> >
> > Eric Dumazet (13):
> >   chtls: fix tp->rcv_tstamp initialization
> >   tcp: fix cookie_init_timestamp() overflows
> >   tcp: add tcp_time_stamp_ms() helper
> >   tcp: introduce tcp_clock_ms()
> >   tcp: replace tcp_time_stamp_raw()
> >   tcp: rename tcp_skb_timestamp()
> >   tcp: move tcp_ns_to_ts() to net/ipv4/syncookies.c
> >   tcp: rename tcp_time_stamp() to tcp_time_stamp_ts()
> >   tcp: add tcp_rtt_tsopt_us()
> >   tcp: add RTAX_FEATURE_TCP_USEC_TS
> >   tcp: introduce TCP_PAWS_WRAP
> >   tcp: add support for usec resolution in TCP TS values
> >   tcp: add TCPI_OPT_USEC_TS
> >
> >  .../chelsio/inline_crypto/chtls/chtls_cm.c    |  2 +-
> >  include/linux/tcp.h                           |  9 ++-
> >  include/net/inet_timewait_sock.h              |  3 +-
> >  include/net/tcp.h                             | 59 ++++++++++++++-----
> >  include/uapi/linux/rtnetlink.h                | 18 +++---
> >  include/uapi/linux/tcp.h                      |  1 +
> >  net/ipv4/syncookies.c                         | 32 ++++++----
> >  net/ipv4/tcp.c                                | 26 +++++---
> >  net/ipv4/tcp_input.c                          | 52 ++++++++--------
> >  net/ipv4/tcp_ipv4.c                           |  5 +-
> >  net/ipv4/tcp_lp.c                             |  2 +-
> >  net/ipv4/tcp_minisocks.c                      | 19 ++++--
> >  net/ipv4/tcp_output.c                         | 14 +++--
> >  net/ipv4/tcp_timer.c                          | 44 +++++++++-----
> >  net/ipv6/tcp_ipv6.c                           |  5 +-
> >  net/netfilter/nf_synproxy_core.c              |  2 +-
> >  .../selftests/bpf/progs/xdp_synproxy_kern.c   |  4 +-
> >  17 files changed, 193 insertions(+), 104 deletions(-)
> >
> > --
> > 2.42.0.655.g421f12c284-goog
> >
Kevin Yang Oct. 20, 2023, 4:29 p.m. UTC | #3
Thanks Eric, this nice feature has been beneficial to Google for so
many years and is finally happening upstream :)

Acked-by: Kevin Yang <yyd@google.com>


On Fri, Oct 20, 2023 at 12:20 PM Soheil Hassas Yeganeh
<soheil@google.com> wrote:
>
> On Fri, Oct 20, 2023 at 12:11 PM Yuchung Cheng <ycheng@google.com> wrote:
> >
> > On Fri, Oct 20, 2023 at 5:57 AM Eric Dumazet <edumazet@google.com> wrote:
> > >
> > > As discussed in various public places in 2016, Google adopted
> > > usec resolution in RFC 7323 TS values, at Van Jacobson suggestion.
> > >
> > > Goals were :
> > >
> > > 1) better observability of delays in networking stacks/fabrics.
> > >
> > > 2) better disambiguation of events based on TSval/ecr values.
> > >
> > > 3) building block for congestion control modules needing usec resolution.
> > >
> > > Back then we implemented a schem based on private SYN options
> > > to safely negotiate the feature.
> > >
> > > For upstream submission, we chose to use a much simpler route
> > > attribute because this feature is probably going to be used
> > > in private networks.
> > >
> > > ip route add 10/8 ... features tcp_usec_ts
> > >
> > > References:
> > >
> > > https://www.ietf.org/proceedings/97/slides/slides-97-tcpm-tcp-options-for-low-latency-00.pdf
> > > https://datatracker.ietf.org/doc/draft-wang-tcpm-low-latency-opt/
> > >
> > > First two patches are fixing old minor bugs and might be taken
> > > by stable teams (thanks to appropriate Fixes: tags)
> >
> > Huge thanks to Eric for making this happen for real :-) an immediate
> > benefit is enabling TCP timestamp based undos (Eifel) for short RTT
> > transactions. This allows datacenter TCP to use more aggressive
> > timeout w/o worrying too much of spurious timeout cwnd effect
> >
> > Acked-by: Yuchung Cheng <ycheng@google.com>
>
> Thank you so much, Eric, for upstreaming the feature!  This is a major
> milestone.
>
> Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
>
> >
> > >
> > > Eric Dumazet (13):
> > >   chtls: fix tp->rcv_tstamp initialization
> > >   tcp: fix cookie_init_timestamp() overflows
> > >   tcp: add tcp_time_stamp_ms() helper
> > >   tcp: introduce tcp_clock_ms()
> > >   tcp: replace tcp_time_stamp_raw()
> > >   tcp: rename tcp_skb_timestamp()
> > >   tcp: move tcp_ns_to_ts() to net/ipv4/syncookies.c
> > >   tcp: rename tcp_time_stamp() to tcp_time_stamp_ts()
> > >   tcp: add tcp_rtt_tsopt_us()
> > >   tcp: add RTAX_FEATURE_TCP_USEC_TS
> > >   tcp: introduce TCP_PAWS_WRAP
> > >   tcp: add support for usec resolution in TCP TS values
> > >   tcp: add TCPI_OPT_USEC_TS
> > >
> > >  .../chelsio/inline_crypto/chtls/chtls_cm.c    |  2 +-
> > >  include/linux/tcp.h                           |  9 ++-
> > >  include/net/inet_timewait_sock.h              |  3 +-
> > >  include/net/tcp.h                             | 59 ++++++++++++++-----
> > >  include/uapi/linux/rtnetlink.h                | 18 +++---
> > >  include/uapi/linux/tcp.h                      |  1 +
> > >  net/ipv4/syncookies.c                         | 32 ++++++----
> > >  net/ipv4/tcp.c                                | 26 +++++---
> > >  net/ipv4/tcp_input.c                          | 52 ++++++++--------
> > >  net/ipv4/tcp_ipv4.c                           |  5 +-
> > >  net/ipv4/tcp_lp.c                             |  2 +-
> > >  net/ipv4/tcp_minisocks.c                      | 19 ++++--
> > >  net/ipv4/tcp_output.c                         | 14 +++--
> > >  net/ipv4/tcp_timer.c                          | 44 +++++++++-----
> > >  net/ipv6/tcp_ipv6.c                           |  5 +-
> > >  net/netfilter/nf_synproxy_core.c              |  2 +-
> > >  .../selftests/bpf/progs/xdp_synproxy_kern.c   |  4 +-
> > >  17 files changed, 193 insertions(+), 104 deletions(-)
> > >
> > > --
> > > 2.42.0.655.g421f12c284-goog
> > >
Neal Cardwell Oct. 20, 2023, 6:41 p.m. UTC | #4
On Fri, Oct 20, 2023 at 8:57 AM Eric Dumazet <edumazet@google.com> wrote:
>
> As discussed in various public places in 2016, Google adopted
> usec resolution in RFC 7323 TS values, at Van Jacobson suggestion.
>
> Goals were :
>
> 1) better observability of delays in networking stacks/fabrics.
>
> 2) better disambiguation of events based on TSval/ecr values.
>
> 3) building block for congestion control modules needing usec resolution.
>
> Back then we implemented a schem based on private SYN options
> to safely negotiate the feature.
>
> For upstream submission, we chose to use a much simpler route
> attribute because this feature is probably going to be used
> in private networks.
>
> ip route add 10/8 ... features tcp_usec_ts
>
> References:
>
> https://www.ietf.org/proceedings/97/slides/slides-97-tcpm-tcp-options-for-low-latency-00.pdf
> https://datatracker.ietf.org/doc/draft-wang-tcpm-low-latency-opt/
>
> First two patches are fixing old minor bugs and might be taken
> by stable teams (thanks to appropriate Fixes: tags)
>
> Eric Dumazet (13):
>   chtls: fix tp->rcv_tstamp initialization
>   tcp: fix cookie_init_timestamp() overflows
>   tcp: add tcp_time_stamp_ms() helper
>   tcp: introduce tcp_clock_ms()
>   tcp: replace tcp_time_stamp_raw()
>   tcp: rename tcp_skb_timestamp()
>   tcp: move tcp_ns_to_ts() to net/ipv4/syncookies.c
>   tcp: rename tcp_time_stamp() to tcp_time_stamp_ts()
>   tcp: add tcp_rtt_tsopt_us()
>   tcp: add RTAX_FEATURE_TCP_USEC_TS
>   tcp: introduce TCP_PAWS_WRAP
>   tcp: add support for usec resolution in TCP TS values
>   tcp: add TCPI_OPT_USEC_TS
>
>  .../chelsio/inline_crypto/chtls/chtls_cm.c    |  2 +-
>  include/linux/tcp.h                           |  9 ++-
>  include/net/inet_timewait_sock.h              |  3 +-
>  include/net/tcp.h                             | 59 ++++++++++++++-----
>  include/uapi/linux/rtnetlink.h                | 18 +++---
>  include/uapi/linux/tcp.h                      |  1 +
>  net/ipv4/syncookies.c                         | 32 ++++++----
>  net/ipv4/tcp.c                                | 26 +++++---
>  net/ipv4/tcp_input.c                          | 52 ++++++++--------
>  net/ipv4/tcp_ipv4.c                           |  5 +-
>  net/ipv4/tcp_lp.c                             |  2 +-
>  net/ipv4/tcp_minisocks.c                      | 19 ++++--
>  net/ipv4/tcp_output.c                         | 14 +++--
>  net/ipv4/tcp_timer.c                          | 44 +++++++++-----
>  net/ipv6/tcp_ipv6.c                           |  5 +-
>  net/netfilter/nf_synproxy_core.c              |  2 +-
>  .../selftests/bpf/progs/xdp_synproxy_kern.c   |  4 +-
>  17 files changed, 193 insertions(+), 104 deletions(-)
>
> --

Thanks for sending this upstream, Eric! Great to have this upstream.
+1 to the nice benefits mentioned by Yuchung and Van.

The whole patch series looks great to me.

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

thanks,
neal
patchwork-bot+netdevbpf@kernel.org Oct. 23, 2023, 8:50 a.m. UTC | #5
Hello:

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

On Fri, 20 Oct 2023 12:57:35 +0000 you wrote:
> As discussed in various public places in 2016, Google adopted
> usec resolution in RFC 7323 TS values, at Van Jacobson suggestion.
> 
> Goals were :
> 
> 1) better observability of delays in networking stacks/fabrics.
> 
> [...]

Here is the summary with links:
  - [net-next,01/13] chtls: fix tp->rcv_tstamp initialization
    https://git.kernel.org/netdev/net-next/c/225d9ddbacb1
  - [net-next,02/13] tcp: fix cookie_init_timestamp() overflows
    https://git.kernel.org/netdev/net-next/c/73ed8e03388d
  - [net-next,03/13] tcp: add tcp_time_stamp_ms() helper
    https://git.kernel.org/netdev/net-next/c/99d679556d73
  - [net-next,04/13] tcp: introduce tcp_clock_ms()
    https://git.kernel.org/netdev/net-next/c/2a7c8d291ffe
  - [net-next,05/13] tcp: replace tcp_time_stamp_raw()
    https://git.kernel.org/netdev/net-next/c/16cf6477741b
  - [net-next,06/13] tcp: rename tcp_skb_timestamp()
    https://git.kernel.org/netdev/net-next/c/d1a02ed66fe6
  - [net-next,07/13] tcp: move tcp_ns_to_ts() to net/ipv4/syncookies.c
    https://git.kernel.org/netdev/net-next/c/003e07a1e48e
  - [net-next,08/13] tcp: rename tcp_time_stamp() to tcp_time_stamp_ts()
    https://git.kernel.org/netdev/net-next/c/9d0c00f5ca05
  - [net-next,09/13] tcp: add tcp_rtt_tsopt_us()
    https://git.kernel.org/netdev/net-next/c/b04c3320885a
  - [net-next,10/13] tcp: add RTAX_FEATURE_TCP_USEC_TS
    https://git.kernel.org/netdev/net-next/c/3d44de9a10ea
  - [net-next,11/13] tcp: introduce TCP_PAWS_WRAP
    https://git.kernel.org/netdev/net-next/c/af7721448a60
  - [net-next,12/13] tcp: add support for usec resolution in TCP TS values
    https://git.kernel.org/netdev/net-next/c/614e8316aa4c
  - [net-next,13/13] tcp: add TCPI_OPT_USEC_TS
    https://git.kernel.org/netdev/net-next/c/a77a0f5c7f23

You are awesome, thank you!