Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/cc/cc_dctcp.c
Show First 20 Lines • Show All 312 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
newreno_cc_algo.post_recovery(ccv); | newreno_cc_algo.post_recovery(ccv); | ||||
if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) | if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) | ||||
dctcp_update_alpha(ccv); | dctcp_update_alpha(ccv); | ||||
} | } | ||||
/* | /* | ||||
* Execute an additional ECN processing using ECN field in IP header and the CWR | * Execute an additional ECN processing using ECN field in IP header | ||||
* bit in TCP header. | * and the CWR bit in TCP header. | ||||
* | |||||
* delay_ack == 0 - Delayed ACK disabled | |||||
* delay_ack == 1 - Delayed ACK enabled | |||||
*/ | */ | ||||
static void | static void | ||||
dctcp_ecnpkt_handler(struct cc_var *ccv) | dctcp_ecnpkt_handler(struct cc_var *ccv) | ||||
{ | { | ||||
struct dctcp *dctcp_data; | struct dctcp *dctcp_data; | ||||
uint32_t ccflag; | uint32_t ccflag; | ||||
int delay_ack; | int acknow; | ||||
dctcp_data = ccv->cc_data; | dctcp_data = ccv->cc_data; | ||||
ccflag = ccv->flags; | ccflag = ccv->flags; | ||||
delay_ack = 1; | acknow = 0; | ||||
/* | /* | ||||
* DCTCP responds with an ACK immediately when the CE state | * DCTCP responds with an ACK immediately when the CE state | ||||
* in between this segment and the last segment has changed. | * in between this segment and the last segment has changed. | ||||
*/ | */ | ||||
if (ccflag & CCF_IPHDR_CE) { | if (ccflag & CCF_IPHDR_CE) { | ||||
if (!dctcp_data->ce_prev && (ccflag & CCF_DELACK)) | if (!dctcp_data->ce_prev) { | ||||
delay_ack = 0; | acknow = 1; | ||||
dctcp_data->ce_prev = 1; | dctcp_data->ce_prev = 1; | ||||
CCV(ccv, t_flags2) |= TF2_ECN_SND_ECE; | CCV(ccv, t_flags2) |= TF2_ECN_SND_ECE; | ||||
} | |||||
} else { | } else { | ||||
if (dctcp_data->ce_prev && (ccflag & CCF_DELACK)) | if (dctcp_data->ce_prev) { | ||||
delay_ack = 0; | acknow = 1; | ||||
dctcp_data->ce_prev = 0; | dctcp_data->ce_prev = 0; | ||||
CCV(ccv, t_flags2) &= ~TF2_ECN_SND_ECE; | CCV(ccv, t_flags2) &= ~TF2_ECN_SND_ECE; | ||||
} | } | ||||
} | |||||
/* DCTCP sets delayed ack when this segment sets the CWR flag. */ | if ((acknow) || (ccflag & CCF_TCPHDR_CWR)) { | ||||
if ((ccflag & CCF_DELACK) && (ccflag & CCF_TCPHDR_CWR)) | |||||
delay_ack = 1; | |||||
if (delay_ack == 0) | |||||
ccv->flags |= CCF_ACKNOW; | ccv->flags |= CCF_ACKNOW; | ||||
} else { | |||||
ccv->flags &= ~CCF_ACKNOW; | |||||
} | |||||
} | } | ||||
/* | /* | ||||
* Update the fraction of marked bytes represented as 'alpha'. | * Update the fraction of marked bytes represented as 'alpha'. | ||||
* Also initialize several internal parameters at the end of this function. | * Also initialize several internal parameters at the end of this function. | ||||
*/ | */ | ||||
static void | static void | ||||
dctcp_update_alpha(struct cc_var *ccv) | dctcp_update_alpha(struct cc_var *ccv) | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |