diff --git a/sys/netinet/cc/cc.h b/sys/netinet/cc/cc.h --- a/sys/netinet/cc/cc.h +++ b/sys/netinet/cc/cc.h @@ -97,11 +97,7 @@ 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 *tcp; 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.c b/sys/netinet/cc/cc.c --- a/sys/netinet/cc/cc.c +++ b/sys/netinet/cc/cc.c @@ -404,7 +404,7 @@ * 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->tcp); else pipe = CCV(ccv, snd_max) - ccv->curack; if (pipe < CCV(ccv, snd_ssthresh)) @@ -440,7 +440,7 @@ * 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->tcp)); CCV(ccv, snd_ssthresh) = max(CCV(ccv, snd_ssthresh), CCV(ccv, snd_cwnd)-(CCV(ccv, snd_cwnd)>>2)); @@ -457,7 +457,7 @@ uint32_t cwin, factor, mss, pipe; cwin = CCV(ccv, snd_cwnd); - mss = tcp_fixed_maxseg(ccv->ccvc.tcp); + mss = tcp_fixed_maxseg(ccv->tcp); /* * 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 @@ 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->tcp); } else { pipe = CCV(ccv, snd_max) - CCV(ccv, snd_fack) + diff --git a/sys/netinet/cc/cc_cdg.c b/sys/netinet/cc/cc_cdg.c --- a/sys/netinet/cc/cc_cdg.c +++ b/sys/netinet/cc/cc_cdg.c @@ -295,7 +295,7 @@ { struct cdg *cdg_data; - INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp)); + INP_WLOCK_ASSERT(tptoinpcb(ccv->tcp)); 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 --- a/sys/netinet/cc/cc_chd.c +++ b/sys/netinet/cc/cc_chd.c @@ -322,7 +322,7 @@ { struct chd *chd_data; - INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp)); + INP_WLOCK_ASSERT(tptoinpcb(ccv->tcp)); 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 --- a/sys/netinet/cc/cc_cubic.c +++ b/sys/netinet/cc/cc_cubic.c @@ -125,7 +125,7 @@ if (hystart_bblogs == 0) return; - tp = ccv->ccvc.tcp; + tp = ccv->tcp; if (tcp_bblogging_on(tp)) { union tcp_log_stackspecific log; struct timeval tv; @@ -385,7 +385,7 @@ { struct cubic *cubic_data; - INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp)); + INP_WLOCK_ASSERT(tptoinpcb(ccv->tcp)); if (ptr == NULL) { cubic_data = malloc(sizeof(struct cubic), M_CC_MEM, M_NOWAIT|M_ZERO); if (cubic_data == NULL) @@ -424,7 +424,7 @@ uint32_t mss, pipe; cubic_data = ccv->cc_data; - mss = tcp_fixed_maxseg(ccv->ccvc.tcp); + mss = tcp_fixed_maxseg(ccv->tcp); switch (type) { case CC_NDUPACK: @@ -478,7 +478,7 @@ 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->tcp); } else { pipe = CCV(ccv, snd_max) - CCV(ccv, snd_fack) + @@ -549,7 +549,7 @@ * 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->tcp); else pipe = CCV(ccv, snd_max) - ccv->curack; @@ -590,7 +590,7 @@ /* 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->tcp, 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 --- a/sys/netinet/cc/cc_dctcp.c +++ b/sys/netinet/cc/cc_dctcp.c @@ -201,7 +201,7 @@ { struct dctcp *dctcp_data; - INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp)); + INP_WLOCK_ASSERT(tptoinpcb(ccv->tcp)); if (ptr == NULL) { dctcp_data = malloc(sizeof(struct dctcp), M_CC_MEM, M_NOWAIT|M_ZERO); if (dctcp_data == NULL) @@ -245,7 +245,7 @@ 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->tcp); switch (type) { case CC_NDUPACK: @@ -294,7 +294,7 @@ 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->tcp); } 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 --- a/sys/netinet/cc/cc_htcp.c +++ b/sys/netinet/cc/cc_htcp.c @@ -253,7 +253,7 @@ { struct htcp *htcp_data; - INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp)); + INP_WLOCK_ASSERT(tptoinpcb(ccv->tcp)); if (ptr == NULL) { htcp_data = malloc(sizeof(struct htcp), M_CC_MEM, M_NOWAIT); if (htcp_data == NULL) @@ -284,7 +284,7 @@ uint32_t mss, pipe; htcp_data = ccv->cc_data; - mss = tcp_fixed_maxseg(ccv->ccvc.tcp); + mss = tcp_fixed_maxseg(ccv->tcp); switch (type) { case CC_NDUPACK: @@ -325,7 +325,7 @@ 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->tcp); } else { pipe = CCV(ccv, snd_max) - CCV(ccv, snd_fack) + @@ -383,7 +383,7 @@ * 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->tcp); else pipe = CCV(ccv, snd_max) - ccv->curack; @@ -451,7 +451,7 @@ */ 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->tcp, TCP_TMR_GRANULARITY_TICKS) << HTCP_SHIFT) / htcp_rtt_ref), HTCP_MAXROWE) * alpha) >> HTCP_SHIFT); @@ -502,18 +502,18 @@ * 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->tcp, 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->tcp, 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->tcp, 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->tcp, TCP_TMR_GRANULARITY_TICKS); } /* diff --git a/sys/netinet/cc/cc_module.h b/sys/netinet/cc/cc_module.h --- 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)->tcp->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 --- a/sys/netinet/cc/cc_newreno.c +++ b/sys/netinet/cc/cc_newreno.c @@ -135,7 +135,7 @@ if (hystart_bblogs == 0) return; - tp = ccv->ccvc.tcp; + tp = ccv->tcp; if (tcp_bblogging_on(tp)) { union tcp_log_stackspecific log; struct timeval tv; @@ -175,7 +175,7 @@ { struct newreno *nreno; - INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp)); + INP_WLOCK_ASSERT(tptoinpcb(ccv->tcp)); if (ptr == NULL) { ccv->cc_data = malloc(sizeof(struct newreno), M_CC_MEM, M_NOWAIT); if (ccv->cc_data == NULL) @@ -369,7 +369,7 @@ 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->tcp); 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 @@ 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->tcp); } else { pipe = CCV(ccv, snd_max) - CCV(ccv, snd_fack) + @@ -456,7 +456,7 @@ if (sopt->sopt_valsize != sizeof(struct cc_newreno_opts)) return (EMSGSIZE); - if (CC_ALGO(ccv->ccvc.tcp) != &newreno_cc_algo) + if (CC_ALGO(ccv->tcp) != &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 --- a/sys/netinet/cc/cc_vegas.c +++ b/sys/netinet/cc/cc_vegas.c @@ -184,7 +184,7 @@ { struct vegas *vegas_data; - INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp)); + INP_WLOCK_ASSERT(tptoinpcb(ccv->tcp)); 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 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2243,8 +2243,7 @@ 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.tcp = 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 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1957,7 +1957,7 @@ tp = intotcpcb(inp); if (ptr != NULL) memset(ptr, 0, mem_sz); - cc_mem.ccvc.tcp = tp; + cc_mem.tcp = tp; /* * We once again hold a write lock over the tcb so it's * safe to do these things without ordering concerns.