Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/cc/cc_newreno.c
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/* | /* | ||||
* Perform any necessary tasks before we enter congestion recovery. | * Perform any necessary tasks before we enter congestion recovery. | ||||
*/ | */ | ||||
static void | static void | ||||
newreno_cong_signal(struct cc_var *ccv, uint32_t type) | newreno_cong_signal(struct cc_var *ccv, uint32_t type) | ||||
{ | { | ||||
uint32_t cwin; | uint32_t cwin, ssthresh_on_loss; | ||||
u_int mss; | u_int mss; | ||||
cwin = CCV(ccv, snd_cwnd); | cwin = CCV(ccv, snd_cwnd); | ||||
mss = CCV(ccv, t_maxseg); | mss = CCV(ccv, t_maxseg); | ||||
ssthresh_on_loss = max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2, | |||||
2 * mss); | |||||
/* Catch algos which mistakenly leak private signal types. */ | /* Catch algos which mistakenly leak private signal types. */ | ||||
KASSERT((type & CC_SIGPRIVMASK) == 0, | KASSERT((type & CC_SIGPRIVMASK) == 0, | ||||
("%s: congestion signal type 0x%08x is private\n", __func__, type)); | ("%s: congestion signal type 0x%08x is private\n", __func__, type)); | ||||
cwin = max(2*mss, cwin/2); | cwin = max(2*mss, cwin/2); | ||||
switch (type) { | switch (type) { | ||||
case CC_NDUPACK: | case CC_NDUPACK: | ||||
if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { | if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { | ||||
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { | if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { | ||||
CCV(ccv, snd_ssthresh) = cwin; | CCV(ccv, snd_ssthresh) = ssthresh_on_loss; | ||||
CCV(ccv, snd_cwnd) = cwin; | CCV(ccv, snd_cwnd) = cwin; | ||||
} | } | ||||
ENTER_RECOVERY(CCV(ccv, t_flags)); | ENTER_RECOVERY(CCV(ccv, t_flags)); | ||||
} | } | ||||
break; | break; | ||||
case CC_ECN: | case CC_ECN: | ||||
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { | if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { | ||||
CCV(ccv, snd_ssthresh) = cwin; | CCV(ccv, snd_ssthresh) = ssthresh_on_loss; | ||||
CCV(ccv, snd_cwnd) = cwin; | CCV(ccv, snd_cwnd) = cwin; | ||||
ENTER_CONGRECOVERY(CCV(ccv, t_flags)); | ENTER_CONGRECOVERY(CCV(ccv, t_flags)); | ||||
} | } | ||||
break; | break; | ||||
case CC_RTO: | case CC_RTO: | ||||
CCV(ccv, snd_ssthresh) = cwin; | CCV(ccv, snd_ssthresh) = ssthresh_on_loss; | ||||
CCV(ccv, snd_cwnd) = mss; | CCV(ccv, snd_cwnd) = mss; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Perform any necessary tasks before we exit congestion recovery. | * Perform any necessary tasks before we exit congestion recovery. | ||||
*/ | */ | ||||
Show All 30 Lines |