tcp: move cwnd and ssthresh updates into cc modules
This will pave the way of setting ssthresh differently in TCP CUBIC, according to RFC8312 section 4.7. No functional change, only code movement. Submitted by: chengc_netapp.com Reviewed by: rrs, tuexen, rscheff MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D26807
This commit is contained in:
parent
8077b9bc60
commit
39a12f0178
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367007
@ -264,8 +264,10 @@ static void
|
||||
cubic_cong_signal(struct cc_var *ccv, uint32_t type)
|
||||
{
|
||||
struct cubic *cubic_data;
|
||||
u_int mss;
|
||||
|
||||
cubic_data = ccv->cc_data;
|
||||
mss = tcp_maxseg(ccv->ccvc.tcp);
|
||||
|
||||
switch (type) {
|
||||
case CC_NDUPACK:
|
||||
@ -292,6 +294,10 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
|
||||
break;
|
||||
|
||||
case CC_RTO:
|
||||
CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd),
|
||||
CCV(ccv, snd_cwnd)) / 2 / mss,
|
||||
2) * mss;
|
||||
CCV(ccv, snd_cwnd) = mss;
|
||||
/*
|
||||
* Grab the current time and record it so we know when the
|
||||
* most recent congestion event was. Only record it when the
|
||||
|
@ -235,7 +235,7 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
|
||||
if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) {
|
||||
dctcp_data = ccv->cc_data;
|
||||
cwin = CCV(ccv, snd_cwnd);
|
||||
mss = CCV(ccv, t_maxseg);
|
||||
mss = tcp_maxseg(ccv->ccvc.tcp);
|
||||
|
||||
switch (type) {
|
||||
case CC_NDUPACK:
|
||||
@ -282,6 +282,10 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
|
||||
dctcp_data->ece_curr = 1;
|
||||
break;
|
||||
case CC_RTO:
|
||||
CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd),
|
||||
CCV(ccv, snd_cwnd)) / 2 / mss,
|
||||
2) * mss;
|
||||
CCV(ccv, snd_cwnd) = mss;
|
||||
dctcp_update_alpha(ccv);
|
||||
dctcp_data->save_sndnxt += CCV(ccv, t_maxseg);
|
||||
dctcp_data->num_cong_events++;
|
||||
|
@ -271,8 +271,10 @@ static void
|
||||
htcp_cong_signal(struct cc_var *ccv, uint32_t type)
|
||||
{
|
||||
struct htcp *htcp_data;
|
||||
u_int mss;
|
||||
|
||||
htcp_data = ccv->cc_data;
|
||||
mss = tcp_maxseg(ccv->ccvc.tcp);
|
||||
|
||||
switch (type) {
|
||||
case CC_NDUPACK:
|
||||
@ -311,6 +313,10 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type)
|
||||
break;
|
||||
|
||||
case CC_RTO:
|
||||
CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd),
|
||||
CCV(ccv, snd_cwnd)) / 2 / mss,
|
||||
2) * mss;
|
||||
CCV(ccv, snd_cwnd) = mss;
|
||||
/*
|
||||
* Grab the current time and record it so we know when the
|
||||
* most recent congestion event was. Only record it when the
|
||||
|
@ -237,7 +237,7 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type)
|
||||
u_int mss;
|
||||
|
||||
cwin = CCV(ccv, snd_cwnd);
|
||||
mss = CCV(ccv, t_maxseg);
|
||||
mss = tcp_maxseg(ccv->ccvc.tcp);
|
||||
nreno = ccv->cc_data;
|
||||
beta = (nreno == NULL) ? V_newreno_beta : nreno->beta;
|
||||
beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn;
|
||||
@ -275,6 +275,12 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type)
|
||||
ENTER_CONGRECOVERY(CCV(ccv, t_flags));
|
||||
}
|
||||
break;
|
||||
case CC_RTO:
|
||||
CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd),
|
||||
CCV(ccv, snd_cwnd)) / 2 / mss,
|
||||
2) * mss;
|
||||
CCV(ccv, snd_cwnd) = mss;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,8 +429,6 @@ cc_conn_init(struct tcpcb *tp)
|
||||
void inline
|
||||
cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type)
|
||||
{
|
||||
u_int maxseg;
|
||||
|
||||
INP_WLOCK_ASSERT(tp->t_inpcb);
|
||||
|
||||
#ifdef STATS
|
||||
@ -460,13 +458,9 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type)
|
||||
}
|
||||
break;
|
||||
case CC_RTO:
|
||||
maxseg = tcp_maxseg(tp);
|
||||
tp->t_dupacks = 0;
|
||||
tp->t_bytes_acked = 0;
|
||||
EXIT_RECOVERY(tp->t_flags);
|
||||
tp->snd_ssthresh = max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 /
|
||||
maxseg) * maxseg;
|
||||
tp->snd_cwnd = maxseg;
|
||||
if (tp->t_flags2 & TF2_ECN_PERMIT)
|
||||
tp->t_flags2 |= TF2_ECN_SND_CWR;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user