FreeBSD/sys/netinet/cc/cc_dctcp.c
/*
 * Execute an additional ECN processing using ECN field in IP header and the CWR
 * bit in TCP header.
 *
 * delay_ack == 0 - Delayed ACK disabled
 * delay_ack == 1 - Delayed ACK enabled
 */
Execute an additional ECN processing using ECN field in IP header and the CWR
bit in TCP header.

delay_ack == 0 - Delayed ACK disabled
delay_ack == 1 - Delayed ACK enabled
Execute an additional ECN processing using ECN field in IP header and the CWR bit in TCP header . delay_ack == 0 - Delayed ACK disabled delay_ack == 1 - Delayed ACK enabled
static void
dctcp_ecnpkt_handler(struct cc_var *ccv)
{
	struct dctcp *dctcp_data;
	uint32_t ccflag;
	int delay_ack;
	dctcp_data = ccv->cc_data;
	ccflag = ccv->flags;
	delay_ack = 1;
	if (ccflag & CCF_IPHDR_CE) {
		if (!dctcp_data->ce_prev && (ccflag & CCF_DELACK))
			delay_ack = 0;
		dctcp_data->ce_prev = 1;
		CCV(ccv, t_flags) |= TF_ECN_SND_ECE;
	} else {
		if (dctcp_data->ce_prev && (ccflag & CCF_DELACK))
			delay_ack = 0;
		dctcp_data->ce_prev = 0;
		CCV(ccv, t_flags) &= ~TF_ECN_SND_ECE;
	}
	if ((ccflag & CCF_DELACK) && (ccflag & CCF_TCPHDR_CWR))
		delay_ack = 1;
	if (delay_ack == 0)
		ccv->flags |= CCF_ACKNOW;
	else
		ccv->flags &= ~CCF_ACKNOW;
}
static void dctcp_ecnpkt_handler ( struct cc_var * ccv ) { struct dctcp * dctcp_data ; uint32_t ccflag ; int delay_ack ; dctcp_data = ccv -> cc_data ; ccflag = ccv -> flags ; delay_ack = 1 ; if ( ccflag & CCF_IPHDR_CE ) { if ( ! dctcp_data -> ce_prev && ( ccflag & CCF_DELACK ) ) delay_ack = 0 ; dctcp_data -> ce_prev = 1 ; CCV ( ccv , t_flags ) |= TF_ECN_SND_ECE ; } else { if ( dctcp_data -> ce_prev && ( ccflag & CCF_DELACK ) ) delay_ack = 0 ; dctcp_data -> ce_prev = 0 ; CCV ( ccv , t_flags ) &= ~ TF_ECN_SND_ECE ; } if ( ( ccflag & CCF_DELACK ) && ( ccflag & CCF_TCPHDR_CWR ) ) delay_ack = 1 ; if ( delay_ack == 0 ) ccv -> flags |= CCF_ACKNOW ; else ccv -> flags &= ~ CCF_ACKNOW ; }
Execute an additional ECN processing using ECN field in IP header and the CWR
 bit in TCP header.
Execute an additional ECN processing using ECN field in IP header and the CWR bit in TCP header .
/*
	 * DCTCP responses an ACK immediately when the CE state
	 * in between this segment and the last segment is not same.
	 */ /* DCTCP sets delayed ack when this segment sets the CWR flag. */