The branch main has been updated by rscheff:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9155d4b273ffc07e81e2cb0bcedfac570d14a303

commit 9155d4b273ffc07e81e2cb0bcedfac570d14a303
Author:     Richard Scheffenegger <[email protected]>
AuthorDate: 2025-12-05 11:29:15 +0000
Commit:     Richard Scheffenegger <[email protected]>
CommitDate: 2025-12-05 13:10:37 +0000

    tcp: retire do_newsack - always adhere to RFC6675 SACK
    
    Depreciation notice for net.inet.tcp.newsack is in 15.0.
    Remove this tunable for HEAD, streamlining the code slightly.
    
    Reviewed by:    tuexen, cc, nickbanks_netflix.com, #transport
    Sponsored by:   NetApp, Inc.
    Differential Revision: https://reviews.freebsd.org/D54072
---
 sys/netinet/tcp_input.c       | 11 +++--------
 sys/netinet/tcp_sack.c        | 41 +----------------------------------------
 sys/netinet/tcp_stacks/rack.c |  4 ++--
 sys/netinet/tcp_var.h         |  2 --
 4 files changed, 6 insertions(+), 52 deletions(-)

diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 0036a07384ae..c015995ffc7a 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -2535,8 +2535,7 @@ tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct 
tcphdr *th,
                }
                if (th->th_ack == tp->snd_una) {
                        /* Check if this is a duplicate ACK. */
-                       if ((tp->t_flags & TF_SACK_PERMIT) &&
-                           V_tcp_do_newsack) {
+                       if (tp->t_flags & TF_SACK_PERMIT) {
                                /*
                                 * If SEG.ACK == SND.UNA, RFC 6675 requires a
                                 * duplicate ACK to selectively acknowledge
@@ -2613,7 +2612,6 @@ tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct 
tcphdr *th,
                                goto drop;
                        } else if (tp->t_dupacks == tcprexmtthresh ||
                                    (tp->t_flags & TF_SACK_PERMIT &&
-                                    V_tcp_do_newsack &&
                                     tp->sackhint.sacked_bytes >
                                     (tcprexmtthresh - 1) * maxseg)) {
 enter_recovery:
@@ -2780,8 +2778,7 @@ enter_recovery:
                 * from the left side. Such partial ACKs should not be
                 * counted as dupacks here.
                 */
-               if (V_tcp_do_newsack &&
-                   tcp_is_sack_recovery(tp, &to) &&
+               if (tcp_is_sack_recovery(tp, &to) &&
                    (((tp->t_rxtshift == 0) && (sack_changed != SACK_NOCHANGE)) 
||
                     ((tp->t_rxtshift > 0) && (sack_changed == SACK_NEWLOSS))) 
&&
                    (tp->snd_nxt == tp->snd_max)) {
@@ -4120,13 +4117,11 @@ tcp_compute_pipe(struct tcpcb *tp)
 
        if (tp->t_fb->tfb_compute_pipe != NULL) {
                pipe = (*tp->t_fb->tfb_compute_pipe)(tp);
-       } else if (V_tcp_do_newsack) {
+       } else {
                pipe = tp->snd_max - tp->snd_una +
                        tp->sackhint.sack_bytes_rexmit -
                        tp->sackhint.sacked_bytes -
                        tp->sackhint.lost_bytes;
-       } else {
-               pipe = tp->snd_nxt - tp->snd_fack + 
tp->sackhint.sack_bytes_rexmit;
        }
        return (imax(pipe, 0));
 }
diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c
index 13cc7b0de157..f31e88eda41a 100644
--- a/sys/netinet/tcp_sack.c
+++ b/sys/netinet/tcp_sack.c
@@ -126,28 +126,6 @@ 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_DEFINE(int, tcp_do_newsack) = 1;
-
-static int
-sysctl_net_inet_tcp_sack_revised(SYSCTL_HANDLER_ARGS)
-{
-       int error;
-       int new;
-
-       new = V_tcp_do_newsack;
-       error = sysctl_handle_int(oidp, &new, 0, req);
-       if (error == 0 && req->newptr) {
-               V_tcp_do_newsack = new;
-               gone_in(16, "net.inet.tcp.sack.revised will be deprecated."
-                   " net.inet.tcp.sack.enable will always follow RFC6675 
SACK.\n");
-       }
-       return (error);
-}
-
-SYSCTL_PROC(_net_inet_tcp_sack, OID_AUTO, revised, CTLFLAG_VNET | CTLFLAG_RW | 
CTLTYPE_INT,
-    &VNET_NAME(tcp_do_newsack), 0, sysctl_net_inet_tcp_sack_revised, "CU",
-    "Use revised SACK loss recovery per RFC 6675");
-
 VNET_DEFINE(int, tcp_do_lrd) = 1;
 SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, lrd, CTLFLAG_VNET | CTLFLAG_RW,
     &VNET_NAME(tcp_do_lrd), 1,
@@ -1013,8 +991,7 @@ tcp_sack_partialack(struct tcpcb *tp, struct tcphdr *th, 
u_int *maxsegp)
         * the trailing packets of a window are lost and no further data
         * is available for sending.
         */
-       if ((V_tcp_do_newsack) &&
-           SEQ_LT(th->th_ack, tp->snd_recover) &&
+       if (SEQ_LT(th->th_ack, tp->snd_recover) &&
            TAILQ_EMPTY(&tp->snd_holes) &&
            (tp->sackhint.delivered_data > 0)) {
                /*
@@ -1079,22 +1056,6 @@ tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt)
        }
        KASSERT(SEQ_LT(hole->start, hole->end),
            ("%s: SEQ_GEQ(hole.start, hole.end)", __func__));
-       if (!(V_tcp_do_newsack)) {
-               KASSERT(SEQ_LT(hole->start, tp->snd_fack),
-                   ("%s: SEG_GEQ(hole.start, snd.fack)", __func__));
-               KASSERT(SEQ_LT(hole->end, tp->snd_fack),
-                   ("%s: SEG_GEQ(hole.end, snd.fack)", __func__));
-               KASSERT(SEQ_LT(hole->rxmit, tp->snd_fack),
-                   ("%s: SEQ_GEQ(hole.rxmit, snd.fack)", __func__));
-               if (SEQ_GEQ(hole->start, hole->end) ||
-                   SEQ_GEQ(hole->start, tp->snd_fack) ||
-                   SEQ_GEQ(hole->end, tp->snd_fack) ||
-                   SEQ_GEQ(hole->rxmit, tp->snd_fack)) {
-                       log(LOG_CRIT,"tcp: invalid SACK hole (%u-%u,%u) vs fwd 
ack %u, ignoring.\n",
-                                       hole->start, hole->end, hole->rxmit, 
tp->snd_fack);
-                       return (NULL);
-               }
-       }
        return (hole);
 }
 
diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c
index 9ed26d5a617b..76bf8f2e3b17 100644
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -5393,7 +5393,7 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack 
*rack, uint32_t th_ack, uint
                log.u_bbr.flex4 = tp->t_ccv.nsegs;
                log.u_bbr.flex5 = labc_to_use;
                log.u_bbr.flex6 = prior_cwnd;
-               log.u_bbr.flex7 = V_tcp_do_newsack;
+               log.u_bbr.flex7 = 1;  /* always doing RFC6675 SACK */
                log.u_bbr.flex8 = 1;
                lgb = tcp_log_event(tp, NULL, NULL, NULL, BBR_LOG_CWND, 0,
                                     0, &log, false, NULL, __func__, 
__LINE__,&tv);
@@ -5508,7 +5508,7 @@ rack_post_recovery(struct tcpcb *tp, uint32_t th_ack)
                log.u_bbr.flex4 = tp->t_ccv.nsegs;
                log.u_bbr.flex5 = V_tcp_abc_l_var;
                log.u_bbr.flex6 = orig_cwnd;
-               log.u_bbr.flex7 = V_tcp_do_newsack;
+               log.u_bbr.flex7 = 1;  /* always doing RFC6675 SACK */
                log.u_bbr.pkts_out = rack->r_ctl.rc_prr_sndcnt;
                log.u_bbr.flex8 = 2;
                tcp_log_event(tp, NULL, NULL, NULL, BBR_LOG_CWND, 0,
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index f9297be46af7..7f836f5a1df4 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1308,7 +1308,6 @@ VNET_DECLARE(int, tcp_tolerate_missing_ts);
 VNET_DECLARE(int, tcp_do_rfc3042);
 VNET_DECLARE(int, tcp_do_rfc3390);
 VNET_DECLARE(int, tcp_do_rfc3465);
-VNET_DECLARE(int, tcp_do_newsack);
 VNET_DECLARE(int, tcp_do_sack);
 VNET_DECLARE(int, tcp_do_tso);
 VNET_DECLARE(int, tcp_ecn_maxretries);
@@ -1359,7 +1358,6 @@ VNET_DECLARE(struct inpcbinfo, tcbinfo);
 #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_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)

Reply via email to