Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/cc/cc_newreno.c
Show First 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | |||||
newreno_cong_signal(struct cc_var *ccv, uint32_t type) | newreno_cong_signal(struct cc_var *ccv, uint32_t type) | ||||
{ | { | ||||
struct newreno *nreno; | struct newreno *nreno; | ||||
uint32_t beta, beta_ecn, cwin, factor; | uint32_t beta, beta_ecn, cwin, factor; | ||||
u_int mss; | u_int mss; | ||||
cwin = CCV(ccv, snd_cwnd); | cwin = CCV(ccv, snd_cwnd); | ||||
mss = tcp_fixed_maxseg(ccv->ccvc.tcp); | mss = tcp_fixed_maxseg(ccv->ccvc.tcp); | ||||
nreno = ccv->cc_data; | /* | ||||
* Other TCP congestion controls use newreno_cong_signal(), but | |||||
* with their own private cc_data. Make sure the cc_data is used | |||||
* correctly. | |||||
*/ | |||||
nreno = (CC_ALGO(ccv->ccvc.tcp) == &newreno_cc_algo) ? ccv->cc_data : NULL; | |||||
beta = (nreno == NULL) ? V_newreno_beta : nreno->beta; | beta = (nreno == NULL) ? V_newreno_beta : nreno->beta; | ||||
beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn; | beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn; | ||||
/* | /* | ||||
* Note that we only change the backoff for ECN if the | * Note that we only change the backoff for ECN if the | ||||
* global sysctl V_cc_do_abe is set <or> the stack itself | * global sysctl V_cc_do_abe is set <or> the stack itself | ||||
* has set a flag in our newreno_flags (due to pacing) telling | * has set a flag in our newreno_flags (due to pacing) telling | ||||
* us to use the lower valued back-off. | * us to use the lower valued back-off. | ||||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf) | newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf) | ||||
{ | { | ||||
struct newreno *nreno; | struct newreno *nreno; | ||||
struct cc_newreno_opts *opt; | struct cc_newreno_opts *opt; | ||||
if (sopt->sopt_valsize != sizeof(struct cc_newreno_opts)) | if (sopt->sopt_valsize != sizeof(struct cc_newreno_opts)) | ||||
return (EMSGSIZE); | return (EMSGSIZE); | ||||
if (CC_ALGO(ccv->ccvc.tcp) != &newreno_cc_algo) | |||||
return (ENOPROTOOPT); | |||||
nreno = ccv->cc_data; | nreno = ccv->cc_data; | ||||
opt = buf; | opt = buf; | ||||
switch (sopt->sopt_dir) { | switch (sopt->sopt_dir) { | ||||
case SOPT_SET: | case SOPT_SET: | ||||
/* We cannot set without cc_data memory. */ | /* We cannot set without cc_data memory. */ | ||||
if (nreno == NULL) { | if (nreno == NULL) { | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |