Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/cc/cc_cubic.c
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | cubic_ack_received(struct cc_var *ccv, uint16_t type) | ||||
struct cubic *cubic_data; | struct cubic *cubic_data; | ||||
unsigned long w_tf, w_cubic_next; | unsigned long w_tf, w_cubic_next; | ||||
int ticks_since_cong; | int ticks_since_cong; | ||||
cubic_data = ccv->cc_data; | cubic_data = ccv->cc_data; | ||||
cubic_record_rtt(ccv); | cubic_record_rtt(ccv); | ||||
/* | /* | ||||
* Regular ACK and we're not in cong/fast recovery and we're cwnd | * For a regular ACK and we're not in cong/fast recovery and | ||||
* limited and we're either not doing ABC or are just coming out | * we're cwnd limited, always recalculate cwnd. | ||||
* from slow-start or were application limited or are slow starting | |||||
* or are doing ABC and we've sent a cwnd's worth of bytes. | |||||
*/ | */ | ||||
if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) && | if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) && | ||||
(ccv->flags & CCF_CWND_LIMITED) && (!V_tcp_do_rfc3465 || | (ccv->flags & CCF_CWND_LIMITED)) { | ||||
(cubic_data->flags & (CUBICFLAG_IN_SLOWSTART | CUBICFLAG_IN_APPLIMIT)) || | |||||
CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) || | |||||
(V_tcp_do_rfc3465 && (ccv->flags & CCF_ABC_SENTAWND)))) { | |||||
/* Use the logic in NewReno ack_received() for slow start. */ | /* Use the logic in NewReno ack_received() for slow start. */ | ||||
if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) || | if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) || | ||||
cubic_data->min_rtt_ticks == TCPTV_SRTTBASE) { | cubic_data->min_rtt_ticks == TCPTV_SRTTBASE) { | ||||
cubic_data->flags |= CUBICFLAG_IN_SLOWSTART; | cubic_data->flags |= CUBICFLAG_IN_SLOWSTART; | ||||
newreno_cc_algo.ack_received(ccv, type); | newreno_cc_algo.ack_received(ccv, type); | ||||
} else { | } else { | ||||
if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART | | if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART | | ||||
CUBICFLAG_IN_APPLIMIT)) { | CUBICFLAG_IN_APPLIMIT)) { | ||||
Show All 36 Lines | if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) || | ||||
if (CCV(ccv, snd_cwnd) < w_tf) | if (CCV(ccv, snd_cwnd) < w_tf) | ||||
CCV(ccv, snd_cwnd) = ulmin(w_tf, INT_MAX); | CCV(ccv, snd_cwnd) = ulmin(w_tf, INT_MAX); | ||||
} else if (CCV(ccv, snd_cwnd) < w_cubic_next) { | } else if (CCV(ccv, snd_cwnd) < w_cubic_next) { | ||||
/* | /* | ||||
* Concave or convex region, follow CUBIC | * Concave or convex region, follow CUBIC | ||||
* cwnd growth. | * cwnd growth. | ||||
* Only update snd_cwnd, if it doesn't shrink. | * Only update snd_cwnd, if it doesn't shrink. | ||||
*/ | */ | ||||
if (V_tcp_do_rfc3465) | |||||
CCV(ccv, snd_cwnd) = ulmin(w_cubic_next, | CCV(ccv, snd_cwnd) = ulmin(w_cubic_next, | ||||
INT_MAX); | INT_MAX); | ||||
else | |||||
CCV(ccv, snd_cwnd) += ulmax(1, | |||||
((ulmin(w_cubic_next, INT_MAX) - | |||||
CCV(ccv, snd_cwnd)) * | |||||
CCV(ccv, t_maxseg)) / | |||||
CCV(ccv, snd_cwnd)); | |||||
} | } | ||||
/* | /* | ||||
* If we're not in slow start and we're probing for a | * If we're not in slow start and we're probing for a | ||||
* new cwnd limit at the start of a connection | * new cwnd limit at the start of a connection | ||||
* (happens when hostcache has a relevant entry), | * (happens when hostcache has a relevant entry), | ||||
* keep updating our current estimate of the | * keep updating our current estimate of the | ||||
* max_cwnd. | * max_cwnd. | ||||
▲ Show 20 Lines • Show All 269 Lines • Show Last 20 Lines |