git: e8ec28047df5 - main - TCP RACK: fix TCP_RACK_PACING_BETA socket option

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Mon, 06 Jan 2025 20:44:30 UTC
The branch main has been updated by tuexen:

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

commit e8ec28047df5185582a95c5211ed75682fad5ec5
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-01-06 20:38:34 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-01-06 20:38:34 +0000

    TCP RACK: fix TCP_RACK_PACING_BETA socket option
    
    Bring back the code, which was accidentally removed. While there,
    indent a comment correctly.
    
    Reviewed by:            rrs
    CID:                    1540026
    Fixes:                  e18b97bd63a8 ("Update to bring the rack stack with all its fixes in.")
    MFC after:              1 week
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D48340
---
 sys/netinet/tcp_stacks/rack.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c
index 7baf1a626787..f590edd71d9d 100644
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -24486,15 +24486,29 @@ rack_get_sockopt(struct tcpcb *tp, struct sockopt *sopt)
 	 * when you exit recovery.
 	 */
 	case TCP_RACK_PACING_BETA:
+		if (strcmp(tp->t_cc->name, CCALGONAME_NEWRENO) != 0)
+			error = EINVAL;
+		else if (rack->rc_pacing_cc_set == 0)
+			optval = rack->r_ctl.rc_saved_beta.beta;
+		else {
+			/*
+			 * Reach out into the CC data and report back what
+			 * I have previously set. Yeah it looks hackish but
+			 * we don't want to report the saved values.
+			 */
+			if (tp->t_ccv.cc_data)
+				optval = ((struct newreno *)tp->t_ccv.cc_data)->beta;
+			else
+				error = EINVAL;
+		}
 		break;
-		/*
-		 * Beta_ecn is the congestion control value for NewReno that influences how
-		 * much of a backoff happens when a ECN mark is detected. It is normally set
-		 * to 80 for 80% i.e. the cwnd is reduced by 20% of its previous value when
-		 * you exit recovery. Note that classic ECN has a beta of 50, it is only
-		 * ABE Ecn that uses this "less" value, but we do too with pacing :)
-		 */
-
+	/*
+	 * Beta_ecn is the congestion control value for NewReno that influences how
+	 * much of a backoff happens when a ECN mark is detected. It is normally set
+	 * to 80 for 80% i.e. the cwnd is reduced by 20% of its previous value when
+	 * you exit recovery. Note that classic ECN has a beta of 50, it is only
+	 * ABE Ecn that uses this "less" value, but we do too with pacing :)
+	 */
 	case TCP_RACK_PACING_BETA_ECN:
 		if (strcmp(tp->t_cc->name, CCALGONAME_NEWRENO) != 0)
 			error = EINVAL;