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 February 13, 2021 +.Dd March 28, 2021 .Dt TCP 4 .Os .Sh NAME @@ -557,17 +557,6 @@ Helpful when a misconfigured token bucket traffic policer causes persistent high losses leading to RTO, but reduces PRR effectiveness in more common settings (default is false). -.It Va rfc6675_pipe -Calculate the bytes in flight using the algorithm described in RFC 6675, and -is also an improvement when Proportional Rate Reduction is enabled. -Also enables two other mechanisms from RFC6675. -Rescue Retransmission helps timely loss recovery, when the trailing segments -of a transmission are lost, while no additional data is ready to be sent. -In case a partial ACK without a SACK block is received during SACK loss -recovery, the trailing segment is immediately resent, rather than waiting -for a Retransmission timeout. -SACK loss recovery is also engaged, once two segments plus one byte are -SACKed - even if no traditional duplicate ACKs were seen. .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 @@ -584,6 +573,17 @@ which allows the receiver to inform the sender about all successfully arrived segments, allowing the sender to retransmit the missing segments only. +.It Va sack.revised +Enables three updated mechanisms from RFC6675 (default is true). +Calculate the bytes in flight using the algorithm described in RFC 6675, and +is also an improvement when Proportional Rate Reduction is enabled. +Next, Rescue Retransmission helps timely loss recovery, when the trailing segments +of a transmission are lost, while no additional data is ready to be sent. +In case a partial ACK without a SACK block is received during SACK loss +recovery, the trailing segment is immediately resent, rather than waiting +for a Retransmission timeout. +Finally, SACK loss recovery is also engaged, once two segments plus one byte are +SACKed - even if no traditional duplicate ACKs were seen. .It Va sack.maxholes Maximum number of SACK holes per connection. Defaults to 128. Index: sys/netinet/cc/cc_cubic.c =================================================================== --- sys/netinet/cc/cc_cubic.c +++ sys/netinet/cc/cc_cubic.c @@ -373,7 +373,7 @@ * * XXXLAS: Find a way to do this without needing curack */ - if (V_tcp_do_rfc6675_pipe) + if (V_tcp_do_newsack) pipe = tcp_compute_pipe(ccv->ccvc.tcp); else pipe = CCV(ccv, snd_max) - ccv->curack; Index: sys/netinet/cc/cc_htcp.c =================================================================== --- sys/netinet/cc/cc_htcp.c +++ sys/netinet/cc/cc_htcp.c @@ -366,7 +366,7 @@ * * XXXLAS: Find a way to do this without needing curack */ - if (V_tcp_do_rfc6675_pipe) + if (V_tcp_do_newsack) pipe = tcp_compute_pipe(ccv->ccvc.tcp); else pipe = CCV(ccv, snd_max) - ccv->curack; Index: sys/netinet/cc/cc_newreno.c =================================================================== --- sys/netinet/cc/cc_newreno.c +++ sys/netinet/cc/cc_newreno.c @@ -302,7 +302,7 @@ * * XXXLAS: Find a way to do this without needing curack */ - if (V_tcp_do_rfc6675_pipe) + if (V_tcp_do_newsack) pipe = tcp_compute_pipe(ccv->ccvc.tcp); else pipe = CCV(ccv, snd_max) - ccv->curack; Index: sys/netinet/tcp_input.c =================================================================== --- sys/netinet/tcp_input.c +++ sys/netinet/tcp_input.c @@ -168,10 +168,11 @@ &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, - "Use calculated pipe/in-flight bytes per RFC 6675"); +static int sysctl_net_inet_tcp_rfc6675pipe(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rfc6675_pipe, + CTLTYPE_STRING | CTLFLAG_SKIP | CTLFLAG_VNET | CTLFLAG_RD | CTLFLAG_MPSAFE, + 0, 0, sysctl_net_inet_tcp_rfc6675pipe, "A", + "Deprecated: Use calculated pipe/in-flight bytes per RFC 6675"); VNET_DEFINE(int, tcp_do_rfc3042) = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc3042, CTLFLAG_VNET | CTLFLAG_RW, @@ -2588,7 +2589,7 @@ * we have less than 1/2 the original window's * worth of data in flight. */ - if (V_tcp_do_rfc6675_pipe) + if (V_tcp_do_newsack) awnd = tcp_compute_pipe(tp); else awnd = (tp->snd_nxt - tp->snd_fack) + @@ -2605,7 +2606,7 @@ goto drop; } else if (tp->t_dupacks == tcprexmtthresh || (tp->t_flags & TF_SACK_PERMIT && - V_tcp_do_rfc6675_pipe && + V_tcp_do_newsack && tp->sackhint.sacked_bytes > (tcprexmtthresh - 1) * maxseg)) { enter_recovery: @@ -3933,7 +3934,7 @@ * network. */ del_data = tp->sackhint.delivered_data; - if (V_tcp_do_rfc6675_pipe) + if (V_tcp_do_newsack) pipe = tcp_compute_pipe(tp); else pipe = (tp->snd_nxt - tp->snd_fack) + tp->sackhint.sack_bytes_rexmit; @@ -4045,3 +4046,19 @@ return (4 * maxseg); } } + +static int +sysctl_net_inet_tcp_rfc6675pipe(SYSCTL_HANDLER_ARGS) +{ + char sb[120] = {}; + char *p = (char *)&sb; + int error; + + error = snprintf(p, sizeof(p), "%d\n" + "Use of net.inet.tcp.rfc6675_pipe is deprecated.\n" + "Please use net.inet.tcp.sack.revised instead.", + V_tcp_do_newsack); + if (error > 0) + error = SYSCTL_OUT(req, p, strlen(p)); + return(error); +} Index: sys/netinet/tcp_sack.c =================================================================== --- sys/netinet/tcp_sack.c +++ sys/netinet/tcp_sack.c @@ -130,10 +130,16 @@ SYSCTL_NODE(_net_inet_tcp, OID_AUTO, sack, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "TCP SACK"); + VNET_DEFINE(int, tcp_do_sack) = 1; -#define V_tcp_do_sack VNET(tcp_do_sack) SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, enable, CTLFLAG_VNET | CTLFLAG_RW, - &VNET_NAME(tcp_do_sack), 0, "Enable/Disable TCP SACK support"); + &VNET_NAME(tcp_do_sack), 0, + "Enable/Disable TCP SACK support"); + +VNET_DEFINE(int, tcp_do_newsack) = 1; +SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, revised, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_do_newsack), 0, + "Use revised SACK loss recovery per RFC 6675"); VNET_DEFINE(int, tcp_sack_maxholes) = 128; SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, maxholes, CTLFLAG_VNET | CTLFLAG_RW, @@ -826,7 +832,7 @@ * the trailing packets of a window are lost and no further data * is available for sending. */ - if ((V_tcp_do_rfc6675_pipe) && + if ((V_tcp_do_newsack) && SEQ_LT(th->th_ack, tp->snd_recover) && (tp->snd_recover == tp->snd_max) && TAILQ_EMPTY(&tp->snd_holes) && Index: sys/netinet/tcp_var.h =================================================================== --- sys/netinet/tcp_var.h +++ sys/netinet/tcp_var.h @@ -844,7 +844,7 @@ VNET_DECLARE(int, tcp_do_rfc3042); VNET_DECLARE(int, tcp_do_rfc3390); VNET_DECLARE(int, tcp_do_rfc3465); -VNET_DECLARE(int, tcp_do_rfc6675_pipe); +VNET_DECLARE(int, tcp_do_newsack); VNET_DECLARE(int, tcp_do_sack); VNET_DECLARE(int, tcp_do_tso); VNET_DECLARE(int, tcp_ecn_maxretries); @@ -889,7 +889,7 @@ #define V_tcp_do_rfc3042 VNET(tcp_do_rfc3042) #define V_tcp_do_rfc3390 VNET(tcp_do_rfc3390) #define V_tcp_do_rfc3465 VNET(tcp_do_rfc3465) -#define V_tcp_do_rfc6675_pipe VNET(tcp_do_rfc6675_pipe) +#define V_tcp_do_newsack VNET(tcp_do_newsack) #define V_tcp_do_sack VNET(tcp_do_sack) #define V_tcp_do_tso VNET(tcp_do_tso) #define V_tcp_ecn_maxretries VNET(tcp_ecn_maxretries)