Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_stacks/rack.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 11,408 Lines • ▼ Show 20 Lines | #endif | ||||
} else { | } else { | ||||
rack->r_wanted_output = 1; | rack->r_wanted_output = 1; | ||||
tp->t_flags |= TF_ACKNOW; | tp->t_flags |= TF_ACKNOW; | ||||
rack->rc_dack_toggle = 0; | rack->rc_dack_toggle = 0; | ||||
} | } | ||||
if (((thflags & (TH_CWR | TH_ECE)) == TH_ECE) && | if (((thflags & (TH_CWR | TH_ECE)) == TH_ECE) && | ||||
(V_tcp_do_ecn == 1)) { | (V_tcp_do_ecn == 1)) { | ||||
tp->t_flags2 |= TF2_ECN_PERMIT; | tp->t_flags2 |= TF2_ECN_PERMIT; | ||||
if (V_tcp_ecn_generalized) | |||||
tp->t_flags2 |= TF2_ECN_PLUSPLUS; | |||||
KMOD_TCPSTAT_INC(tcps_ecn_shs); | KMOD_TCPSTAT_INC(tcps_ecn_shs); | ||||
} | } | ||||
if (SEQ_GT(th->th_ack, tp->snd_una)) { | if (SEQ_GT(th->th_ack, tp->snd_una)) { | ||||
/* | /* | ||||
* We advance snd_una for the | * We advance snd_una for the | ||||
* fast open case. If th_ack is | * fast open case. If th_ack is | ||||
* acknowledging data beyond | * acknowledging data beyond | ||||
* snd_una we can't just call | * snd_una we can't just call | ||||
▲ Show 20 Lines • Show All 3,096 Lines • ▼ Show 20 Lines | if (rack->r_state == 0) { | ||||
*/ | */ | ||||
if (tp->t_state == TCPS_SYN_SENT && (thflags & TH_SYN)) { | if (tp->t_state == TCPS_SYN_SENT && (thflags & TH_SYN)) { | ||||
/* Handle parallel SYN for ECN */ | /* Handle parallel SYN for ECN */ | ||||
if (!(thflags & TH_ACK) && | if (!(thflags & TH_ACK) && | ||||
((thflags & (TH_CWR | TH_ECE)) == (TH_CWR | TH_ECE)) && | ((thflags & (TH_CWR | TH_ECE)) == (TH_CWR | TH_ECE)) && | ||||
((V_tcp_do_ecn == 1) || (V_tcp_do_ecn == 2))) { | ((V_tcp_do_ecn == 1) || (V_tcp_do_ecn == 2))) { | ||||
tp->t_flags2 |= TF2_ECN_PERMIT; | tp->t_flags2 |= TF2_ECN_PERMIT; | ||||
tp->t_flags2 |= TF2_ECN_SND_ECE; | tp->t_flags2 |= TF2_ECN_SND_ECE; | ||||
if (V_tcp_ecn_generalized) | |||||
tp->t_flags2 |= TF2_ECN_PLUSPLUS; | |||||
TCPSTAT_INC(tcps_ecn_shs); | TCPSTAT_INC(tcps_ecn_shs); | ||||
} | } | ||||
if ((to.to_flags & TOF_SCALE) && | if ((to.to_flags & TOF_SCALE) && | ||||
(tp->t_flags & TF_REQ_SCALE)) { | (tp->t_flags & TF_REQ_SCALE)) { | ||||
tp->t_flags |= TF_RCVD_SCALE; | tp->t_flags |= TF_RCVD_SCALE; | ||||
tp->snd_scale = to.to_wscale; | tp->snd_scale = to.to_wscale; | ||||
} else | } else | ||||
tp->t_flags &= ~TF_REQ_SCALE; | tp->t_flags &= ~TF_REQ_SCALE; | ||||
▲ Show 20 Lines • Show All 4,067 Lines • ▼ Show 20 Lines | if (tp->t_rxtshift >= 1) { | ||||
flags |= TH_ECE | TH_CWR; | flags |= TH_ECE | TH_CWR; | ||||
} | } | ||||
/* Handle parallel SYN for ECN */ | /* Handle parallel SYN for ECN */ | ||||
if ((tp->t_state == TCPS_SYN_RECEIVED) && | if ((tp->t_state == TCPS_SYN_RECEIVED) && | ||||
(tp->t_flags2 & TF2_ECN_SND_ECE)) { | (tp->t_flags2 & TF2_ECN_SND_ECE)) { | ||||
flags |= TH_ECE; | flags |= TH_ECE; | ||||
tp->t_flags2 &= ~TF2_ECN_SND_ECE; | tp->t_flags2 &= ~TF2_ECN_SND_ECE; | ||||
} | } | ||||
if (TCPS_HAVEESTABLISHED(tp->t_state) && | if ((TCPS_HAVEESTABLISHED(tp->t_state) && | ||||
(tp->t_flags2 & TF2_ECN_PERMIT)) { | (tp->t_flags2 & TF2_ECN_PERMIT)) || | ||||
/* | /* | ||||
* Send ECN SYN segments as ECN-capable transport | |||||
* when ecn.generalized is set. This can not be | |||||
* futher simplified, as a fall-back to non-ECN | |||||
* may occur. | |||||
*/ | |||||
((tp->t_flags2 & TF2_ECN_PLUSPLUS) && | |||||
(((flags & (TH_SYN|TH_ACK|TH_ECE|TH_CWR)) == | |||||
(TH_SYN| TH_ECE|TH_CWR)) || | |||||
((flags & (TH_SYN|TH_ACK|TH_ECE|TH_CWR)) == | |||||
(TH_SYN|TH_ACK| TH_CWR)) || | |||||
((flags & (TH_SYN|TH_ACK|TH_ECE|TH_CWR)) == | |||||
(TH_SYN|TH_ACK|TH_ECE ))))) { | |||||
/* | |||||
* If the peer has ECN, mark data packets with ECN capable | * If the peer has ECN, mark data packets with ECN capable | ||||
* transmission (ECT). Ignore pure ack packets, | * transmission (ECT). Ignore pure ack packets, | ||||
* retransmissions. | * retransmissions unless doing generalized ECN. | ||||
*/ | */ | ||||
if (len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max) && | if ((tp->t_flags2 & TF2_ECN_PLUSPLUS) || | ||||
(sack_rxmit == 0)) { | ((len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max) && | ||||
(sack_rxmit == 0)))) { | |||||
#ifdef INET6 | #ifdef INET6 | ||||
if (isipv6) | if (isipv6) | ||||
ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20); | ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20); | ||||
else | else | ||||
#endif | #endif | ||||
ip->ip_tos |= IPTOS_ECN_ECT0; | ip->ip_tos |= IPTOS_ECN_ECT0; | ||||
KMOD_TCPSTAT_INC(tcps_ecn_ect0); | KMOD_TCPSTAT_INC(tcps_ecn_ect0); | ||||
/* | /* | ||||
* Reply with proper ECN notifications. | * Reply with proper ECN notifications. | ||||
* Only set CWR on new data segments. | * Only set CWR on new data segments. | ||||
*/ | */ | ||||
if (tp->t_flags2 & TF2_ECN_SND_CWR) { | if ((tp->t_flags2 & TF2_ECN_SND_CWR) && | ||||
(len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max) && | |||||
(sack_rxmit == 0))) { | |||||
flags |= TH_CWR; | flags |= TH_CWR; | ||||
tp->t_flags2 &= ~TF2_ECN_SND_CWR; | tp->t_flags2 &= ~TF2_ECN_SND_CWR; | ||||
} | } | ||||
} | } | ||||
if (tp->t_flags2 & TF2_ECN_SND_ECE) | if (tp->t_flags2 & TF2_ECN_SND_ECE) | ||||
flags |= TH_ECE; | flags |= TH_ECE; | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 2,402 Lines • Show Last 20 Lines |