Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/cc/cc_cubic.c
Show First 20 Lines • Show All 219 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 | ||||
cubic_cong_signal(struct cc_var *ccv, uint32_t type) | cubic_cong_signal(struct cc_var *ccv, uint32_t type) | ||||
{ | { | ||||
struct cubic *cubic_data; | struct cubic *cubic_data; | ||||
uint32_t cwin; | |||||
u_int mss; | |||||
cubic_data = ccv->cc_data; | cubic_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))) { | ||||
cubic_ssthresh_update(ccv); | cubic_ssthresh_update(ccv); | ||||
cubic_data->num_cong_events++; | cubic_data->num_cong_events++; | ||||
cubic_data->prev_max_cwnd = cubic_data->max_cwnd; | cubic_data->prev_max_cwnd = cubic_data->max_cwnd; | ||||
cubic_data->max_cwnd = CCV(ccv, snd_cwnd); | cubic_data->max_cwnd = cwin; | ||||
CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); | |||||
} | } | ||||
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))) { | ||||
cubic_ssthresh_update(ccv); | cubic_ssthresh_update(ccv); | ||||
cubic_data->num_cong_events++; | cubic_data->num_cong_events++; | ||||
cubic_data->prev_max_cwnd = cubic_data->max_cwnd; | cubic_data->prev_max_cwnd = cubic_data->max_cwnd; | ||||
cubic_data->max_cwnd = CCV(ccv, snd_cwnd); | cubic_data->max_cwnd = cwin; | ||||
cubic_data->t_last_cong = ticks; | cubic_data->t_last_cong = ticks; | ||||
CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); | CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); | ||||
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) { | ||||
cubic_data->num_cong_events++; | cubic_data->num_cong_events++; | ||||
cubic_data->t_last_cong = ticks; | cubic_data->t_last_cong = ticks; | ||||
cubic_ssthresh_update(ccv); | |||||
cubic_data->max_cwnd = cwin; | |||||
CCV(ccv, snd_cwnd) = mss; | |||||
} | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
cubic_conn_init(struct cc_var *ccv) | cubic_conn_init(struct cc_var *ccv) | ||||
{ | { | ||||
struct cubic *cubic_data; | struct cubic *cubic_data; | ||||
▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines |