Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/cc/cc_cubic.c
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | struct cubic { | ||||
/* cwnd at the most recent congestion event. */ | /* cwnd at the most recent congestion event. */ | ||||
unsigned long max_cwnd; | unsigned long max_cwnd; | ||||
/* cwnd at the previous congestion event. */ | /* cwnd at the previous congestion event. */ | ||||
unsigned long prev_max_cwnd; | unsigned long prev_max_cwnd; | ||||
/* various flags */ | /* various flags */ | ||||
uint32_t flags; | uint32_t flags; | ||||
#define CUBICFLAG_cong_event 0x01 /* congestion expirienced */ | #define CUBICFLAG_cong_event 0x01 /* congestion expirienced */ | ||||
#define CUBICFLAG_in_slowstart 0x02 /* in slow start */ | #define CUBICFLAG_in_slowstart 0x02 /* in slow start */ | ||||
#define CUBICFLAG_in_applimit 0x04 /* application limited */ | |||||
/* Minimum observed rtt in ticks. */ | /* Minimum observed rtt in ticks. */ | ||||
int min_rtt_ticks; | int min_rtt_ticks; | ||||
/* Mean observed rtt between congestion epochs. */ | /* Mean observed rtt between congestion epochs. */ | ||||
int mean_rtt_ticks; | int mean_rtt_ticks; | ||||
/* ACKs since last congestion event. */ | /* ACKs since last congestion event. */ | ||||
int epoch_ack_count; | int epoch_ack_count; | ||||
/* Time of last congestion event in ticks. */ | /* Time of last congestion event in ticks. */ | ||||
int t_last_cong; | int t_last_cong; | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) || | ||||
ticks - cubic_data->t_last_cong) < 0) { | ticks - cubic_data->t_last_cong) < 0) { | ||||
/* | /* | ||||
* dragging t_last_cong along | * dragging t_last_cong along | ||||
*/ | */ | ||||
ticks_since_cong = INT_MAX; | ticks_since_cong = INT_MAX; | ||||
cubic_data->t_last_cong = ticks - INT_MAX; | cubic_data->t_last_cong = ticks - INT_MAX; | ||||
} | } | ||||
if (cubic_data->flags & CUBICFLAG_in_slowstart) { | if (cubic_data->flags & (CUBICFLAG_in_slowstart | | ||||
cubic_data->flags &= ~CUBICFLAG_in_slowstart; | CUBICFLAG_in_applimit)) { | ||||
cubic_data->flags &= ~(CUBICFLAG_in_slowstart | | |||||
CUBICFLAG_in_applimit); | |||||
cubic_data->t_last_cong = ticks; | cubic_data->t_last_cong = ticks; | ||||
cubic_data->K = 0; | cubic_data->K = 0; | ||||
} | } | ||||
/* | /* | ||||
* The mean RTT is used to best reflect the equations in | * The mean RTT is used to best reflect the equations in | ||||
* the I-D. Using min_rtt in the tf_cwnd calculation | * the I-D. Using min_rtt in the tf_cwnd calculation | ||||
* causes w_tf to grow much faster than it should if the | * causes w_tf to grow much faster than it should if the | ||||
* RTT is dominated by network buffering rather than | * RTT is dominated by network buffering rather than | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) || | ||||
*/ | */ | ||||
if (((cubic_data->flags & CUBICFLAG_cong_event) == 0) && | if (((cubic_data->flags & CUBICFLAG_cong_event) == 0) && | ||||
cubic_data->max_cwnd < CCV(ccv, snd_cwnd)) { | cubic_data->max_cwnd < CCV(ccv, snd_cwnd)) { | ||||
cubic_data->max_cwnd = CCV(ccv, snd_cwnd); | cubic_data->max_cwnd = CCV(ccv, snd_cwnd); | ||||
cubic_data->K = cubic_k(cubic_data->max_cwnd / | cubic_data->K = cubic_k(cubic_data->max_cwnd / | ||||
CCV(ccv, t_maxseg)); | CCV(ccv, t_maxseg)); | ||||
} | } | ||||
} | } | ||||
} else if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) && | |||||
!(ccv->flags & CCF_CWND_LIMITED)) { | |||||
if (!(cubic_data->flags & CUBICFLAG_in_applimit)) | |||||
cubic_data->flags |= CUBICFLAG_in_applimit; | |||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* This is a Cubic specific implementation of after_idle. | * This is a Cubic specific implementation of after_idle. | ||||
* - Reset cwnd by calling New Reno implementation of after_idle. | * - Reset cwnd by calling New Reno implementation of after_idle. | ||||
* - Reset t_last_cong. | * - Reset t_last_cong. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 240 Lines • Show Last 20 Lines |