Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Jul 2024 20:29:47 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 00d3b74406db - main - tcp cc: remove non-working sctp support
Message-ID:  <202407282029.46SKTlKu051234@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tuexen:

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

commit 00d3b74406db80084e8939450c6b86326dd1de30
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-07-28 20:25:48 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-07-28 20:25:48 +0000

    tcp cc: remove non-working sctp support
    
    As suggested by lstewart, remove the non-working SCTP support in the
    TCP congestion control modules. SCTP has a similar functionality
    (although not using kernel loadable modules), on which the TCP stuff
    was built on, but the integration was never done.
    No functional change intended.
    
    Reviewed by:            Peter Lei, cc
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D46142
---
 sys/netinet/cc/cc.c         |  8 ++++----
 sys/netinet/cc/cc.h         | 11 +----------
 sys/netinet/cc/cc_cdg.c     |  2 +-
 sys/netinet/cc/cc_chd.c     |  2 +-
 sys/netinet/cc/cc_cubic.c   | 12 ++++++------
 sys/netinet/cc/cc_dctcp.c   |  6 +++---
 sys/netinet/cc/cc_htcp.c    | 18 +++++++++---------
 sys/netinet/cc/cc_module.h  | 13 +------------
 sys/netinet/cc/cc_newreno.c | 10 +++++-----
 sys/netinet/cc/cc_vegas.c   |  2 +-
 sys/netinet/tcp_subr.c      |  3 +--
 sys/netinet/tcp_usrreq.c    |  2 +-
 12 files changed, 34 insertions(+), 55 deletions(-)

diff --git a/sys/netinet/cc/cc.c b/sys/netinet/cc/cc.c
index 9a8ca760fa28..16d27a868bd3 100644
--- a/sys/netinet/cc/cc.c
+++ b/sys/netinet/cc/cc.c
@@ -404,7 +404,7 @@ newreno_cc_post_recovery(struct cc_var *ccv)
 		 * XXXLAS: Find a way to do this without needing curack
 		 */
 		if (V_tcp_do_newsack)
-			pipe = tcp_compute_pipe(ccv->ccvc.tcp);
+			pipe = tcp_compute_pipe(ccv->tp);
 		else
 			pipe = CCV(ccv, snd_max) - ccv->curack;
 		if (pipe < CCV(ccv, snd_ssthresh))
@@ -440,7 +440,7 @@ newreno_cc_after_idle(struct cc_var *ccv)
 	 * maximum of the former ssthresh or 3/4 of the old cwnd, to
 	 * not exit slow-start prematurely.
 	 */
-	rw = tcp_compute_initwnd(tcp_fixed_maxseg(ccv->ccvc.tcp));
+	rw = tcp_compute_initwnd(tcp_fixed_maxseg(ccv->tp));
 
 	CCV(ccv, snd_ssthresh) = max(CCV(ccv, snd_ssthresh),
 	    CCV(ccv, snd_cwnd)-(CCV(ccv, snd_cwnd)>>2));
@@ -457,7 +457,7 @@ newreno_cc_cong_signal(struct cc_var *ccv, ccsignal_t type)
 	uint32_t cwin, factor, mss, pipe;
 
 	cwin = CCV(ccv, snd_cwnd);
-	mss = tcp_fixed_maxseg(ccv->ccvc.tcp);
+	mss = tcp_fixed_maxseg(ccv->tp);
 	/*
 	 * Other TCP congestion controls use newreno_cong_signal(), but
 	 * with their own private cc_data. Make sure the cc_data is used
@@ -490,7 +490,7 @@ newreno_cc_cong_signal(struct cc_var *ccv, ccsignal_t type)
 	case CC_RTO:
 		if (CCV(ccv, t_rxtshift) == 1) {
 			if (V_tcp_do_newsack) {
-				pipe = tcp_compute_pipe(ccv->ccvc.tcp);
+				pipe = tcp_compute_pipe(ccv->tp);
 			} else {
 				pipe = CCV(ccv, snd_max) -
 					CCV(ccv, snd_fack) +
diff --git a/sys/netinet/cc/cc.h b/sys/netinet/cc/cc.h
index aac0825e5fe1..63381f4b5ca3 100644
--- a/sys/netinet/cc/cc.h
+++ b/sys/netinet/cc/cc.h
@@ -87,21 +87,12 @@ int	cc_deregister_algo(struct cc_algo *remove_cc);
 #endif /* _KERNEL */
 
 #if defined(_KERNEL) || defined(_WANT_TCPCB)
-/*
- * Wrapper around transport structs that contain same-named congestion
- * control variables. Allows algos to be shared amongst multiple CC aware
- * transprots.
- */
 struct cc_var {
 	void		*cc_data; /* Per-connection private CC algorithm data. */
 	int		bytes_this_ack; /* # bytes acked by the current ACK. */
 	tcp_seq		curack; /* Most recent ACK. */
 	uint32_t	flags; /* Flags for cc_var (see below) */
-	int		type; /* Indicates which ptr is valid in ccvc. */
-	union ccv_container {
-		struct tcpcb		*tcp;
-		struct sctp_nets	*sctp;
-	} ccvc;
+	struct tcpcb	*tp; /* Pointer to tcpcb */
 	uint16_t	nsegs; /* # segments coalesced into current chain. */
 	uint8_t		labc;  /* Dont use system abc use passed in */
 };
diff --git a/sys/netinet/cc/cc_cdg.c b/sys/netinet/cc/cc_cdg.c
index 7ec9e8ca3ccc..997d9435870f 100644
--- a/sys/netinet/cc/cc_cdg.c
+++ b/sys/netinet/cc/cc_cdg.c
@@ -295,7 +295,7 @@ cdg_cb_init(struct cc_var *ccv, void *ptr)
 {
 	struct cdg *cdg_data;
 
-	INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp));
+	INP_WLOCK_ASSERT(tptoinpcb(ccv->tp));
 	if (ptr == NULL) {
 		cdg_data = malloc(sizeof(struct cdg), M_CC_MEM, M_NOWAIT);
 		if (cdg_data == NULL)
diff --git a/sys/netinet/cc/cc_chd.c b/sys/netinet/cc/cc_chd.c
index 92fcf68c41f1..f48d1f0066e2 100644
--- a/sys/netinet/cc/cc_chd.c
+++ b/sys/netinet/cc/cc_chd.c
@@ -322,7 +322,7 @@ chd_cb_init(struct cc_var *ccv, void *ptr)
 {
 	struct chd *chd_data;
 
-	INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp));
+	INP_WLOCK_ASSERT(tptoinpcb(ccv->tp));
 	if (ptr == NULL) {
 		chd_data = malloc(sizeof(struct chd), M_CC_MEM, M_NOWAIT);
 		if (chd_data == NULL)
diff --git a/sys/netinet/cc/cc_cubic.c b/sys/netinet/cc/cc_cubic.c
index 5141de86ef85..45f75efe5ae7 100644
--- a/sys/netinet/cc/cc_cubic.c
+++ b/sys/netinet/cc/cc_cubic.c
@@ -125,7 +125,7 @@ cubic_log_hystart_event(struct cc_var *ccv, struct cubic *cubicd, uint8_t mod, u
 
 	if (hystart_bblogs == 0)
 		return;
-	tp = ccv->ccvc.tcp;
+	tp = ccv->tp;
 	if (tcp_bblogging_on(tp)) {
 		union tcp_log_stackspecific log;
 		struct timeval tv;
@@ -385,7 +385,7 @@ cubic_cb_init(struct cc_var *ccv, void *ptr)
 {
 	struct cubic *cubic_data;
 
-	INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp));
+	INP_WLOCK_ASSERT(tptoinpcb(ccv->tp));
 	if (ptr == NULL) {
 		cubic_data = malloc(sizeof(struct cubic), M_CC_MEM, M_NOWAIT|M_ZERO);
 		if (cubic_data == NULL)
@@ -424,7 +424,7 @@ cubic_cong_signal(struct cc_var *ccv, ccsignal_t type)
 	uint32_t mss, pipe;
 
 	cubic_data = ccv->cc_data;
-	mss = tcp_fixed_maxseg(ccv->ccvc.tcp);
+	mss = tcp_fixed_maxseg(ccv->tp);
 
 	switch (type) {
 	case CC_NDUPACK:
@@ -478,7 +478,7 @@ cubic_cong_signal(struct cc_var *ccv, ccsignal_t type)
 			cubic_data->undo_W_max = cubic_data->W_max;
 			cubic_data->undo_K = cubic_data->K;
 			if (V_tcp_do_newsack) {
-				pipe = tcp_compute_pipe(ccv->ccvc.tcp);
+				pipe = tcp_compute_pipe(ccv->tp);
 			} else {
 				pipe = CCV(ccv, snd_max) -
 					CCV(ccv, snd_fack) +
@@ -549,7 +549,7 @@ cubic_post_recovery(struct cc_var *ccv)
 		 * XXXLAS: Find a way to do this without needing curack
 		 */
 		if (V_tcp_do_newsack)
-			pipe = tcp_compute_pipe(ccv->ccvc.tcp);
+			pipe = tcp_compute_pipe(ccv->tp);
 		else
 			pipe = CCV(ccv, snd_max) - ccv->curack;
 
@@ -590,7 +590,7 @@ cubic_record_rtt(struct cc_var *ccv)
 	/* Ignore srtt until a min number of samples have been taken. */
 	if (CCV(ccv, t_rttupdated) >= CUBIC_MIN_RTT_SAMPLES) {
 		cubic_data = ccv->cc_data;
-		t_srtt_usecs = tcp_get_srtt(ccv->ccvc.tcp,
+		t_srtt_usecs = tcp_get_srtt(ccv->tp,
 					    TCP_TMR_GRANULARITY_USEC);
 		/*
 		 * Record the current SRTT as our minrtt if it's the smallest
diff --git a/sys/netinet/cc/cc_dctcp.c b/sys/netinet/cc/cc_dctcp.c
index 374db98c5e60..06b2de11fd46 100644
--- a/sys/netinet/cc/cc_dctcp.c
+++ b/sys/netinet/cc/cc_dctcp.c
@@ -201,7 +201,7 @@ dctcp_cb_init(struct cc_var *ccv, void *ptr)
 {
 	struct dctcp *dctcp_data;
 
-	INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp));
+	INP_WLOCK_ASSERT(tptoinpcb(ccv->tp));
 	if (ptr == NULL) {
 		dctcp_data = malloc(sizeof(struct dctcp), M_CC_MEM, M_NOWAIT|M_ZERO);
 		if (dctcp_data == NULL)
@@ -245,7 +245,7 @@ dctcp_cong_signal(struct cc_var *ccv, ccsignal_t type)
 	if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) {
 		dctcp_data = ccv->cc_data;
 		cwin = CCV(ccv, snd_cwnd);
-		mss = tcp_fixed_maxseg(ccv->ccvc.tcp);
+		mss = tcp_fixed_maxseg(ccv->tp);
 
 		switch (type) {
 		case CC_NDUPACK:
@@ -294,7 +294,7 @@ dctcp_cong_signal(struct cc_var *ccv, ccsignal_t type)
 		case CC_RTO:
 			if (CCV(ccv, t_rxtshift) == 1) {
 				if (V_tcp_do_newsack) {
-					pipe = tcp_compute_pipe(ccv->ccvc.tcp);
+					pipe = tcp_compute_pipe(ccv->tp);
 				} else {
 					pipe = CCV(ccv, snd_max) -
 						CCV(ccv, snd_fack) +
diff --git a/sys/netinet/cc/cc_htcp.c b/sys/netinet/cc/cc_htcp.c
index 41c552a3bfa0..49bf4d6142f1 100644
--- a/sys/netinet/cc/cc_htcp.c
+++ b/sys/netinet/cc/cc_htcp.c
@@ -253,7 +253,7 @@ htcp_cb_init(struct cc_var *ccv, void *ptr)
 {
 	struct htcp *htcp_data;
 
-	INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp));
+	INP_WLOCK_ASSERT(tptoinpcb(ccv->tp));
 	if (ptr == NULL) {
 		htcp_data = malloc(sizeof(struct htcp), M_CC_MEM, M_NOWAIT);
 		if (htcp_data == NULL)
@@ -284,7 +284,7 @@ htcp_cong_signal(struct cc_var *ccv, ccsignal_t type)
 	uint32_t mss, pipe;
 
 	htcp_data = ccv->cc_data;
-	mss = tcp_fixed_maxseg(ccv->ccvc.tcp);
+	mss = tcp_fixed_maxseg(ccv->tp);
 
 	switch (type) {
 	case CC_NDUPACK:
@@ -325,7 +325,7 @@ htcp_cong_signal(struct cc_var *ccv, ccsignal_t type)
 	case CC_RTO:
 		if (CCV(ccv, t_rxtshift) == 1) {
 			if (V_tcp_do_newsack) {
-				pipe = tcp_compute_pipe(ccv->ccvc.tcp);
+				pipe = tcp_compute_pipe(ccv->tp);
 			} else {
 				pipe = CCV(ccv, snd_max) -
 					CCV(ccv, snd_fack) +
@@ -383,7 +383,7 @@ htcp_post_recovery(struct cc_var *ccv)
 		 * XXXLAS: Find a way to do this without needing curack
 		 */
 		if (V_tcp_do_newsack)
-			pipe = tcp_compute_pipe(ccv->ccvc.tcp);
+			pipe = tcp_compute_pipe(ccv->tp);
 		else
 			pipe = CCV(ccv, snd_max) - ccv->curack;
 
@@ -451,7 +451,7 @@ htcp_recalc_alpha(struct cc_var *ccv)
 			 */
 			if (V_htcp_rtt_scaling)
 				alpha = max(1, (min(max(HTCP_MINROWE,
-				    (tcp_get_srtt(ccv->ccvc.tcp, TCP_TMR_GRANULARITY_TICKS) << HTCP_SHIFT) /
+				    (tcp_get_srtt(ccv->tp, TCP_TMR_GRANULARITY_TICKS) << HTCP_SHIFT) /
 				    htcp_rtt_ref), HTCP_MAXROWE) * alpha)
 				    >> HTCP_SHIFT);
 
@@ -502,18 +502,18 @@ htcp_record_rtt(struct cc_var *ccv)
 	 * or minrtt is currently equal to its initialised value. Ignore SRTT
 	 * until a min number of samples have been taken.
 	 */
-	if ((tcp_get_srtt(ccv->ccvc.tcp, TCP_TMR_GRANULARITY_TICKS) < htcp_data->minrtt ||
+	if ((tcp_get_srtt(ccv->tp, TCP_TMR_GRANULARITY_TICKS) < htcp_data->minrtt ||
 	    htcp_data->minrtt == TCPTV_SRTTBASE) &&
 	    (CCV(ccv, t_rttupdated) >= HTCP_MIN_RTT_SAMPLES))
-		htcp_data->minrtt = tcp_get_srtt(ccv->ccvc.tcp, TCP_TMR_GRANULARITY_TICKS);
+		htcp_data->minrtt = tcp_get_srtt(ccv->tp, TCP_TMR_GRANULARITY_TICKS);
 
 	/*
 	 * Record the current SRTT as our maxrtt if it's the largest we've
 	 * seen. Ignore SRTT until a min number of samples have been taken.
 	 */
-	if (tcp_get_srtt(ccv->ccvc.tcp, TCP_TMR_GRANULARITY_TICKS) > htcp_data->maxrtt
+	if (tcp_get_srtt(ccv->tp, TCP_TMR_GRANULARITY_TICKS) > htcp_data->maxrtt
 	    && CCV(ccv, t_rttupdated) >= HTCP_MIN_RTT_SAMPLES)
-		htcp_data->maxrtt = tcp_get_srtt(ccv->ccvc.tcp, TCP_TMR_GRANULARITY_TICKS);
+		htcp_data->maxrtt = tcp_get_srtt(ccv->tp, TCP_TMR_GRANULARITY_TICKS);
 }
 
 /*
diff --git a/sys/netinet/cc/cc_module.h b/sys/netinet/cc/cc_module.h
index e01d7a124ad4..606b2b66e7e5 100644
--- a/sys/netinet/cc/cc_module.h
+++ b/sys/netinet/cc/cc_module.h
@@ -43,18 +43,7 @@
 #ifndef _NETINET_CC_MODULE_H_
 #define _NETINET_CC_MODULE_H_
 
-/*
- * Allows a CC algorithm to manipulate a commonly named CC variable regardless
- * of the transport protocol and associated C struct.
- * XXXLAS: Out of action until the work to support SCTP is done.
- *
-#define	CCV(ccv, what)							\
-(*(									\
-	(ccv)->type == IPPROTO_TCP ?	&(ccv)->ccvc.tcp->what :	\
-					&(ccv)->ccvc.sctp->what		\
-))
- */
-#define	CCV(ccv, what) (ccv)->ccvc.tcp->what
+#define	CCV(ccv, what) (ccv)->tp->what
 
 #define	DECLARE_CC_MODULE(ccname, ccalgo) 				\
 	static moduledata_t cc_##ccname = {				\
diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c
index aa20e2c64f7d..56adb2d17601 100644
--- a/sys/netinet/cc/cc_newreno.c
+++ b/sys/netinet/cc/cc_newreno.c
@@ -135,7 +135,7 @@ newreno_log_hystart_event(struct cc_var *ccv, struct newreno *nreno, uint8_t mod
 
 	if (hystart_bblogs == 0)
 		return;
-	tp = ccv->ccvc.tcp;
+	tp = ccv->tp;
 	if (tcp_bblogging_on(tp)) {
 		union tcp_log_stackspecific log;
 		struct timeval tv;
@@ -175,7 +175,7 @@ newreno_cb_init(struct cc_var *ccv, void *ptr)
 {
 	struct newreno *nreno;
 
-	INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp));
+	INP_WLOCK_ASSERT(tptoinpcb(ccv->tp));
 	if (ptr == NULL) {
 		ccv->cc_data = malloc(sizeof(struct newreno), M_CC_MEM, M_NOWAIT);
 		if (ccv->cc_data == NULL)
@@ -369,7 +369,7 @@ newreno_cong_signal(struct cc_var *ccv, ccsignal_t type)
 	uint32_t beta, beta_ecn, cwin, factor, mss, pipe;
 
 	cwin = CCV(ccv, snd_cwnd);
-	mss = tcp_fixed_maxseg(ccv->ccvc.tcp);
+	mss = tcp_fixed_maxseg(ccv->tp);
 	nreno = ccv->cc_data;
 	beta = (nreno == NULL) ? V_newreno_beta : nreno->beta;;
 	beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn;
@@ -429,7 +429,7 @@ newreno_cong_signal(struct cc_var *ccv, ccsignal_t type)
 	case CC_RTO:
 		if (CCV(ccv, t_rxtshift) == 1) {
 			if (V_tcp_do_newsack) {
-				pipe = tcp_compute_pipe(ccv->ccvc.tcp);
+				pipe = tcp_compute_pipe(ccv->tp);
 			} else {
 				pipe = CCV(ccv, snd_max) -
 					CCV(ccv, snd_fack) +
@@ -456,7 +456,7 @@ newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf)
 	if (sopt->sopt_valsize != sizeof(struct cc_newreno_opts))
 		return (EMSGSIZE);
 
-	if (CC_ALGO(ccv->ccvc.tcp) != &newreno_cc_algo)
+	if (CC_ALGO(ccv->tp) != &newreno_cc_algo)
 		return (ENOPROTOOPT);
 
 	nreno = (struct newreno *)ccv->cc_data;
diff --git a/sys/netinet/cc/cc_vegas.c b/sys/netinet/cc/cc_vegas.c
index ecd42c1a0f53..45d6b646bcba 100644
--- a/sys/netinet/cc/cc_vegas.c
+++ b/sys/netinet/cc/cc_vegas.c
@@ -184,7 +184,7 @@ vegas_cb_init(struct cc_var *ccv, void *ptr)
 {
 	struct vegas *vegas_data;
 
-	INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp));
+	INP_WLOCK_ASSERT(tptoinpcb(ccv->tp));
 	if (ptr == NULL) {
 		vegas_data = malloc(sizeof(struct vegas), M_CC_MEM, M_NOWAIT);
 		if (vegas_data == NULL)
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 0665564955d2..cc9020f89a3a 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -2243,8 +2243,7 @@ tcp_newtcpcb(struct inpcb *inp, struct tcpcb *listening_tcb)
 	bzero(&tp->t_start_zero, t_zero_size);
 
 	/* Initialise cc_var struct for this tcpcb. */
-	tp->t_ccv.type = IPPROTO_TCP;
-	tp->t_ccv.ccvc.tcp = tp;
+	tp->t_ccv.tp = tp;
 	rw_rlock(&tcp_function_lock);
 	if (listening_tcb != NULL) {
 		INP_LOCK_ASSERT(tptoinpcb(listening_tcb));
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index c43e4523f358..2ff7737a573b 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1957,7 +1957,7 @@ no_mem_needed:
 	tp = intotcpcb(inp);
 	if (ptr != NULL)
 		memset(ptr, 0, mem_sz);
-	cc_mem.ccvc.tcp = tp;
+	cc_mem.tp = tp;
 	/*
 	 * We once again hold a write lock over the tcb so it's
 	 * safe to do these things without ordering concerns.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407282029.46SKTlKu051234>