Index: share/man/man4/tcp.4 =================================================================== --- share/man/man4/tcp.4 +++ share/man/man4/tcp.4 @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd August 26, 2019 +.Dd October 14, 2019 .Dt TCP 4 .Os .Sh NAME @@ -538,6 +538,15 @@ Start with small values for lower-capacity links. Large bursts can cause buffer overruns and packet drops if routers have small buffers or the link is experiencing congestion. +.It Va newcwd +Enable the New Congestion Window Validation mechanism as described in RFC 7661. +This gently reduces the congestion window during periods, where TCP is +application limited and the network bandwidth is not utilized completely. +That prevents self-infliced packet losses once the application starts to +transmit data at a higher speed. +.It Va rfc6675_pipe +Calculate the bytes in flight using the algorithm described in RFC 6675, and +is also a prerequisite to enable Proportional Rate Reduction. .It Va rfc3042 Enable the Limited Transmit algorithm as described in RFC 3042. It helps avoid timeouts on lossy links and also when the congestion window Index: sys/netinet/tcp_input.c =================================================================== --- sys/netinet/tcp_input.c +++ sys/netinet/tcp_input.c @@ -150,6 +150,11 @@ &VNET_NAME(drop_synfin), 0, "Drop TCP packets with SYN+FIN set"); +VNET_DEFINE(int, tcp_do_newcwv) = 0; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, newcwv, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_do_newcwv), 0, + "Enable New Congestion Window Validation per RFC7661"); + VNET_DEFINE(int, tcp_do_rfc6675_pipe) = 0; SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc6675_pipe, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_rfc6675_pipe), 0, @@ -297,7 +302,9 @@ tp->ccv->nsegs = nsegs; tp->ccv->bytes_this_ack = BYTES_THIS_ACK(tp, th); - if (tp->snd_cwnd <= tp->snd_wnd) + if ((!(V_tcp_do_newcwv) && (tp->snd_cwnd <= tp->snd_wnd)) || + ((V_tcp_do_newcwv) && (tp->snd_cwnd <= tp->snd_wnd) && + (tp->snd_cwnd < (tcp_compute_pipe(tp) * 2)))) tp->ccv->flags |= CCF_CWND_LIMITED; else tp->ccv->flags &= ~CCF_CWND_LIMITED; Index: sys/netinet/tcp_stacks/rack.c =================================================================== --- sys/netinet/tcp_stacks/rack.c +++ sys/netinet/tcp_stacks/rack.c @@ -1663,7 +1663,9 @@ tp->ccv->bytes_this_ack = max; } } - if (tp->snd_cwnd <= tp->snd_wnd) + if ((!(V_tcp_do_newcwv) && (tp->snd_cwnd <= tp->snd_wnd)) || + ((V_tcp_do_newcwv) && (tp->snd_cwnd <= tp->snd_wnd) && + (tp->snd_cwnd < (tcp_compute_pipe(tp) * 2)))) tp->ccv->flags |= CCF_CWND_LIMITED; else tp->ccv->flags &= ~CCF_CWND_LIMITED;