git: f42518ff1250 - main - tcp: for LRD move sysctl from tcp.do_lrd tp tcp.sack.lrd, remove sockopt

From: Richard Scheffenegger <rscheff_at_FreeBSD.org>
Date: Thu, 30 Nov 2023 20:40:42 UTC
The branch main has been updated by rscheff:

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

commit f42518ff1250fcc76a0a1eed9f411edbbb172541
Author:     Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2023-11-30 20:10:14 +0000
Commit:     Richard Scheffenegger <rscheff@FreeBSD.org>
CommitDate: 2023-11-30 20:11:45 +0000

    tcp: for LRD move sysctl from tcp.do_lrd tp tcp.sack.lrd, remove sockopt
    
    Moving lrd sysctl to the tcp.sack branch, since LRD only works with SACK.
    Remove the sockopt to programmatically control LRD per session.
    
    Reviewed By:           #transport, tuexen, rrs
    Sponsored by:          NetApp, Inc.
    Differential Revision: https://reviews.freebsd.org/D42851
---
 share/man/man4/tcp.4     | 14 +++++++-------
 sys/netinet/tcp.h        |  1 -
 sys/netinet/tcp_input.c  |  5 -----
 sys/netinet/tcp_sack.c   |  5 +++++
 sys/netinet/tcp_usrreq.c |  9 ---------
 5 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4
index 317ee818f3a4..4ebdbac3a3ca 100644
--- a/share/man/man4/tcp.4
+++ b/share/man/man4/tcp.4
@@ -464,13 +464,6 @@ See
 Maximum amount of time, in milliseconds, before a delayed ACK is sent.
 .It Va delayed_ack
 Delay ACK to try and piggyback it onto a data packet or another ACK.
-.It Va do_lrd
-Enable Lost Retransmission Detection for SACK-enabled sessions, enabled by
-default.
-Under severe congestion, a retransmission can be lost which then leads to a
-mandatory Retransmission Timeout (RTO), followed by slow-start.
-LRD will try to resend the repeatedly lost packet, preventing the time-consuming
-RTO and performance reducing slow-start.
 .It Va do_prr
 Perform SACK loss recovery using the Proportional Rate Reduction (PRR) algorithm
 described in RFC6937.
@@ -901,6 +894,13 @@ Global number of TCP SACK holes currently allocated.
 .It Va sack.globalmaxholes
 Maximum number of SACK holes per system, across all connections.
 Defaults to 65536.
+.It Va sack.lrd
+Enable Lost Retransmission Detection for SACK-enabled sessions, enabled by
+default.
+Under severe congestion, a retransmission can be lost which then leads to a
+mandatory Retransmission Timeout (RTO), followed by slow-start.
+LRD will try to resend the repeatedly lost packet, preventing the time-consuming
+RTO and performance reducing slow-start or purge of the SACK scoreboard.
 .It Va sack.maxholes
 Maximum number of SACK holes per connection.
 Defaults to 128.
diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h
index 70fab2c6a2d2..44f8a67a1e64 100644
--- a/sys/netinet/tcp.h
+++ b/sys/netinet/tcp.h
@@ -200,7 +200,6 @@ struct tcphdr {
 #define TCP_PROC_ACCOUNTING 76	/* Do accounting on tcp cpu usage and counts */
 #define TCP_USE_CMP_ACKS 77 	/* The transport can handle the Compressed mbuf acks */
 #define	TCP_PERF_INFO	78	/* retrieve accounting counters */
-#define	TCP_LRD		79	/* toggle Lost Retransmission Detection for A/B testing */
 #define	TCP_KEEPINIT	128	/* N, time to establish connection */
 #define	TCP_KEEPIDLE	256	/* L,N,X start keeplives after this period */
 #define	TCP_KEEPINTVL	512	/* L,N interval between keepalives */
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index a75dbd1547b0..b26ae92a767e 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -162,11 +162,6 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_prr, CTLFLAG_VNET | CTLFLAG_RW,
     &VNET_NAME(tcp_do_prr), 1,
     "Enable Proportional Rate Reduction per RFC 6937");
 
-VNET_DEFINE(int, tcp_do_lrd) = 1;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_lrd, CTLFLAG_VNET | CTLFLAG_RW,
-    &VNET_NAME(tcp_do_lrd), 1,
-    "Perform Lost Retransmission Detection");
-
 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,
diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c
index 2d2be7ff922f..e8ed3c52fd67 100644
--- a/sys/netinet/tcp_sack.c
+++ b/sys/netinet/tcp_sack.c
@@ -132,6 +132,11 @@ 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_do_lrd) = 1;
+SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, lrd, CTLFLAG_VNET | CTLFLAG_RW,
+    &VNET_NAME(tcp_do_lrd), 1,
+    "Perform Lost Retransmission Detection");
+
 VNET_DEFINE(int, tcp_sack_maxholes) = 128;
 SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, maxholes, CTLFLAG_VNET | CTLFLAG_RW,
     &VNET_NAME(tcp_sack_maxholes), 0,
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 14e0b814dec9..93fdedc03c7b 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -2118,7 +2118,6 @@ tcp_default_ctloutput(struct tcpcb *tp, struct sockopt *sopt)
 
 		case TCP_NODELAY:
 		case TCP_NOOPT:
-		case TCP_LRD:
 			INP_WUNLOCK(inp);
 			error = sooptcopyin(sopt, &optval, sizeof optval,
 			    sizeof optval);
@@ -2133,9 +2132,6 @@ tcp_default_ctloutput(struct tcpcb *tp, struct sockopt *sopt)
 			case TCP_NOOPT:
 				opt = TF_NOOPT;
 				break;
-			case TCP_LRD:
-				opt = TF_LRD;
-				break;
 			default:
 				opt = 0; /* dead code to fool gcc */
 				break;
@@ -2657,11 +2653,6 @@ unhold:
 				    sizeof(optval));
 			break;
 #endif
-		case TCP_LRD:
-			optval = tp->t_flags & TF_LRD;
-			INP_WUNLOCK(inp);
-			error = sooptcopyout(sopt, &optval, sizeof optval);
-			break;
 		default:
 			INP_WUNLOCK(inp);
 			error = ENOPROTOOPT;