Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/cc/cc_htcp.c
Show First 20 Lines • Show All 265 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 | ||||
htcp_cong_signal(struct cc_var *ccv, uint32_t type) | htcp_cong_signal(struct cc_var *ccv, uint32_t type) | ||||
{ | { | ||||
struct htcp *htcp_data; | struct htcp *htcp_data; | ||||
uint32_t cwin; | |||||
u_int mss; | |||||
htcp_data = ccv->cc_data; | htcp_data = ccv->cc_data; | ||||
cwin = CCV(ccv, snd_cwnd); | |||||
mss = CCV(ccv, t_maxseg); | |||||
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))) { | ||||
/* | /* | ||||
* Apply hysteresis to maxrtt to ensure | * Apply hysteresis to maxrtt to ensure | ||||
* reductions in the RTT are reflected in our | * reductions in the RTT are reflected in our | ||||
* measurements. | * measurements. | ||||
*/ | */ | ||||
htcp_data->maxrtt = (htcp_data->minrtt + | htcp_data->maxrtt = (htcp_data->minrtt + | ||||
(htcp_data->maxrtt - htcp_data->minrtt) * | (htcp_data->maxrtt - htcp_data->minrtt) * | ||||
95) / 100; | 95) / 100; | ||||
htcp_ssthresh_update(ccv); | htcp_ssthresh_update(ccv); | ||||
CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); | |||||
htcp_data->t_last_cong = ticks; | htcp_data->t_last_cong = ticks; | ||||
htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); | htcp_data->prev_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))) { | ||||
/* | /* | ||||
* Apply hysteresis to maxrtt to ensure reductions in | * Apply hysteresis to maxrtt to ensure reductions in | ||||
* the RTT are reflected in our measurements. | * the RTT are reflected in our measurements. | ||||
*/ | */ | ||||
htcp_data->maxrtt = (htcp_data->minrtt + (htcp_data->maxrtt - | htcp_data->maxrtt = (htcp_data->minrtt + (htcp_data->maxrtt - | ||||
htcp_data->minrtt) * 95) / 100; | htcp_data->minrtt) * 95) / 100; | ||||
htcp_ssthresh_update(ccv); | htcp_ssthresh_update(ccv); | ||||
CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); | CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); | ||||
htcp_data->t_last_cong = ticks; | htcp_data->t_last_cong = ticks; | ||||
htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); | htcp_data->prev_cwnd = cwin; | ||||
ENTER_CONGRECOVERY(CCV(ccv, t_flags)); | ENTER_CONGRECOVERY(CCV(ccv, t_flags)); | ||||
} | } | ||||
break; | break; | ||||
case CC_RTO: | case CC_RTO: | ||||
/* | /* | ||||
* Grab the current time and record it so we know when the | * Grab the current time and record it so we know when the | ||||
* most recent congestion event was. Only record it when the | * most recent congestion event was. Only record it when the | ||||
* timeout has fired more than once, as there is a reasonable | * timeout has fired more than once, as there is a reasonable | ||||
* chance the first one is a false alarm and may not indicate | * chance the first one is a false alarm and may not indicate | ||||
* congestion. | * congestion. | ||||
*/ | */ | ||||
if (CCV(ccv, t_rxtshift) >= 2) | if (CCV(ccv, t_rxtshift) >= 2) | ||||
htcp_data->t_last_cong = ticks; | htcp_data->t_last_cong = ticks; | ||||
CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2); | |||||
CCV(ccv, snd_cwnd) = mss; | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
htcp_mod_init(void) | htcp_mod_init(void) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 197 Lines • Show Last 20 Lines |