Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_ecn.c
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | tcp_ecn_input_syn_sent(struct tcpcb *tp, uint16_t thflags, int iptos) | ||||
if (V_tcp_do_ecn == 0) | if (V_tcp_do_ecn == 0) | ||||
return; | return; | ||||
if ((V_tcp_do_ecn == 1) || | if ((V_tcp_do_ecn == 1) || | ||||
(V_tcp_do_ecn == 2)) { | (V_tcp_do_ecn == 2)) { | ||||
/* RFC3168 ECN handling */ | /* RFC3168 ECN handling */ | ||||
if ((thflags & (TH_CWR | TH_ECE)) == (0 | TH_ECE)) { | if ((thflags & (TH_CWR | TH_ECE)) == (0 | TH_ECE)) { | ||||
tp->t_flags2 |= TF2_ECN_PERMIT; | tp->t_flags2 |= TF2_ECN_PERMIT; | ||||
tp->t_flags2 &= ~TF2_ACE_PERMIT; | |||||
TCPSTAT_INC(tcps_ecn_shs); | TCPSTAT_INC(tcps_ecn_shs); | ||||
} | } | ||||
} else | } else | ||||
/* decoding Accurate ECN according to table in section 3.1.1 */ | /* decoding Accurate ECN according to table in section 3.1.1 */ | ||||
if ((V_tcp_do_ecn == 3) || | if ((V_tcp_do_ecn == 3) || | ||||
(V_tcp_do_ecn == 4)) { | (V_tcp_do_ecn == 4)) { | ||||
/* | /* | ||||
* on the SYN,ACK, process the AccECN | * on the SYN,ACK, process the AccECN | ||||
* flags indicating the state the SYN | * flags indicating the state the SYN | ||||
* was delivered. | * was delivered. | ||||
* Reactions to Path ECN mangling can | * Reactions to Path ECN mangling can | ||||
* come here. | * come here. | ||||
*/ | */ | ||||
switch (thflags & (TH_AE | TH_CWR | TH_ECE)) { | switch (thflags & (TH_AE | TH_CWR | TH_ECE)) { | ||||
/* RFC3168 SYN */ | /* RFC3168 SYN */ | ||||
case (0|0|TH_ECE): | case (0|0|TH_ECE): | ||||
tp->t_flags2 |= TF2_ECN_PERMIT; | tp->t_flags2 |= TF2_ECN_PERMIT; | ||||
tp->t_flags2 &= ~TF2_ACE_PERMIT; | |||||
TCPSTAT_INC(tcps_ecn_shs); | TCPSTAT_INC(tcps_ecn_shs); | ||||
break; | break; | ||||
/* non-ECT SYN */ | /* non-ECT SYN */ | ||||
case (0|TH_CWR|0): | case (0|TH_CWR|0): | ||||
tp->t_flags2 |= TF2_ACE_PERMIT; | tp->t_flags2 |= TF2_ACE_PERMIT; | ||||
tp->t_flags2 &= ~TF2_ECN_PERMIT; | |||||
tp->t_scep = 5; | tp->t_scep = 5; | ||||
TCPSTAT_INC(tcps_ecn_shs); | TCPSTAT_INC(tcps_ecn_shs); | ||||
TCPSTAT_INC(tcps_ace_nect); | TCPSTAT_INC(tcps_ace_nect); | ||||
break; | break; | ||||
/* ECT0 SYN */ | /* ECT0 SYN */ | ||||
case (TH_AE|0|0): | case (TH_AE|0|0): | ||||
tp->t_flags2 |= TF2_ACE_PERMIT; | tp->t_flags2 |= TF2_ACE_PERMIT; | ||||
tp->t_flags2 &= ~TF2_ECN_PERMIT; | |||||
tp->t_scep = 5; | tp->t_scep = 5; | ||||
TCPSTAT_INC(tcps_ecn_shs); | TCPSTAT_INC(tcps_ecn_shs); | ||||
TCPSTAT_INC(tcps_ace_ect0); | TCPSTAT_INC(tcps_ace_ect0); | ||||
break; | break; | ||||
/* ECT1 SYN */ | /* ECT1 SYN */ | ||||
case (0|TH_CWR|TH_ECE): | case (0|TH_CWR|TH_ECE): | ||||
tp->t_flags2 |= TF2_ACE_PERMIT; | tp->t_flags2 |= TF2_ACE_PERMIT; | ||||
tp->t_flags2 &= ~TF2_ECN_PERMIT; | |||||
tp->t_scep = 5; | tp->t_scep = 5; | ||||
TCPSTAT_INC(tcps_ecn_shs); | TCPSTAT_INC(tcps_ecn_shs); | ||||
TCPSTAT_INC(tcps_ace_ect1); | TCPSTAT_INC(tcps_ace_ect1); | ||||
break; | break; | ||||
/* CE SYN */ | /* CE SYN */ | ||||
case (TH_AE|TH_CWR|0): | case (TH_AE|TH_CWR|0): | ||||
tp->t_flags2 |= TF2_ACE_PERMIT; | tp->t_flags2 |= TF2_ACE_PERMIT; | ||||
tp->t_flags2 &= ~TF2_ECN_PERMIT; | |||||
tp->t_scep = 6; | tp->t_scep = 6; | ||||
/* | /* | ||||
* reduce the IW to 2 MSS (to | * reduce the IW to 2 MSS (to | ||||
* account for delayed acks) if | * account for delayed acks) if | ||||
* the SYN,ACK was CE marked | * the SYN,ACK was CE marked | ||||
*/ | */ | ||||
tp->snd_cwnd = 2 * tcp_maxseg(tp); | tp->snd_cwnd = 2 * tcp_maxseg(tp); | ||||
TCPSTAT_INC(tcps_ecn_shs); | TCPSTAT_INC(tcps_ecn_shs); | ||||
TCPSTAT_INC(tcps_ace_nect); | TCPSTAT_INC(tcps_ace_nect); | ||||
break; | break; | ||||
default: | default: | ||||
tp->t_flags2 &= ~(TF2_ECN_PERMIT | TF2_ACE_PERMIT); | |||||
break; | break; | ||||
} | } | ||||
/* | /* | ||||
* Set the AccECN Codepoints on | * Set the AccECN Codepoints on | ||||
* the outgoing <ACK> to the ECN | * the outgoing <ACK> to the ECN | ||||
* state of the <SYN,ACK> | * state of the <SYN,ACK> | ||||
* according to table 3 in the | * according to table 3 in the | ||||
* AccECN draft | * AccECN draft | ||||
Show All 25 Lines | if (thflags & TH_ACK) | ||||
return; | return; | ||||
if (V_tcp_do_ecn == 0) | if (V_tcp_do_ecn == 0) | ||||
return; | return; | ||||
if ((V_tcp_do_ecn == 1) || | if ((V_tcp_do_ecn == 1) || | ||||
(V_tcp_do_ecn == 2)) { | (V_tcp_do_ecn == 2)) { | ||||
/* RFC3168 ECN handling */ | /* RFC3168 ECN handling */ | ||||
if ((thflags & (TH_CWR | TH_ECE)) == (TH_CWR | TH_ECE)) { | if ((thflags & (TH_CWR | TH_ECE)) == (TH_CWR | TH_ECE)) { | ||||
tp->t_flags2 |= TF2_ECN_PERMIT; | tp->t_flags2 |= TF2_ECN_PERMIT; | ||||
tp->t_flags2 &= ~TF2_ACE_PERMIT; | |||||
tp->t_flags2 |= TF2_ECN_SND_ECE; | tp->t_flags2 |= TF2_ECN_SND_ECE; | ||||
TCPSTAT_INC(tcps_ecn_shs); | TCPSTAT_INC(tcps_ecn_shs); | ||||
} | } | ||||
} else | } else | ||||
if ((V_tcp_do_ecn == 3) || | if ((V_tcp_do_ecn == 3) || | ||||
(V_tcp_do_ecn == 4)) { | (V_tcp_do_ecn == 4)) { | ||||
/* AccECN handling */ | /* AccECN handling */ | ||||
switch (thflags & (TH_AE | TH_CWR | TH_ECE)) { | switch (thflags & (TH_AE | TH_CWR | TH_ECE)) { | ||||
default: | default: | ||||
case (0|0|0): | case (0|0|0): | ||||
tp->t_flags2 &= ~(TF2_ECN_PERMIT | TF2_ACE_PERMIT); | |||||
break; | break; | ||||
case (0|TH_CWR|TH_ECE): | case (0|TH_CWR|TH_ECE): | ||||
tp->t_flags2 |= TF2_ECN_PERMIT; | tp->t_flags2 |= TF2_ECN_PERMIT; | ||||
tp->t_flags2 &= ~TF2_ACE_PERMIT; | |||||
tp->t_flags2 |= TF2_ECN_SND_ECE; | tp->t_flags2 |= TF2_ECN_SND_ECE; | ||||
TCPSTAT_INC(tcps_ecn_shs); | TCPSTAT_INC(tcps_ecn_shs); | ||||
break; | break; | ||||
case (TH_AE|TH_CWR|TH_ECE): | case (TH_AE|TH_CWR|TH_ECE): | ||||
tp->t_flags2 |= TF2_ACE_PERMIT; | tp->t_flags2 |= TF2_ACE_PERMIT; | ||||
tp->t_flags2 &= ~TF2_ECN_PERMIT; | |||||
TCPSTAT_INC(tcps_ecn_shs); | TCPSTAT_INC(tcps_ecn_shs); | ||||
/* | /* | ||||
* Set the AccECN Codepoints on | * Set the AccECN Codepoints on | ||||
* the outgoing <ACK> to the ECN | * the outgoing <ACK> to the ECN | ||||
* state of the <SYN,ACK> | * state of the <SYN,ACK> | ||||
* according to table 3 in the | * according to table 3 in the | ||||
* AccECN draft | * AccECN draft | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 334 Lines • Show Last 20 Lines |