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 15,735 Lines • ▼ Show 20 Lines | if (udp) { | ||||
if (rack->r_is_v6) | if (rack->r_is_v6) | ||||
ulen = hdrlen + len - sizeof(struct ip6_hdr); | ulen = hdrlen + len - sizeof(struct ip6_hdr); | ||||
else | else | ||||
ulen = hdrlen + len - sizeof(struct ip); | ulen = hdrlen + len - sizeof(struct ip); | ||||
udp->uh_ulen = htons(ulen); | udp->uh_ulen = htons(ulen); | ||||
} | } | ||||
m->m_pkthdr.rcvif = (struct ifnet *)0; | m->m_pkthdr.rcvif = (struct ifnet *)0; | ||||
if (TCPS_HAVERCVDSYN(tp->t_state) && | if (TCPS_HAVERCVDSYN(tp->t_state) && | ||||
(tp->t_flags2 & TF2_ECN_PERMIT)) { | (tp->t_flags2 & (TF2_ECN_PERMIT | TF2_ACE_PERMIT))) { | ||||
int ect = tcp_ecn_output_established(tp, &flags, len); | int ect = tcp_ecn_output_established(tp, &flags, len); | ||||
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)) | ||||
tp->t_flags2 &= ~TF2_ECN_SND_ECE; | tp->t_flags2 &= ~TF2_ECN_SND_ECE; | ||||
#ifdef INET6 | #ifdef INET6 | ||||
if (rack->r_is_v6) { | if (rack->r_is_v6) { | ||||
ip6->ip6_flow &= ~htonl(IPTOS_ECN_MASK << 20); | ip6->ip6_flow &= ~htonl(IPTOS_ECN_MASK << 20); | ||||
ip6->ip6_flow |= htonl(ect << 20); | ip6->ip6_flow |= htonl(ect << 20); | ||||
▲ Show 20 Lines • Show All 474 Lines • ▼ Show 20 Lines | if (udp) { | ||||
if (rack->r_is_v6) | if (rack->r_is_v6) | ||||
ulen = hdrlen + len - sizeof(struct ip6_hdr); | ulen = hdrlen + len - sizeof(struct ip6_hdr); | ||||
else | else | ||||
ulen = hdrlen + len - sizeof(struct ip); | ulen = hdrlen + len - sizeof(struct ip); | ||||
udp->uh_ulen = htons(ulen); | udp->uh_ulen = htons(ulen); | ||||
} | } | ||||
m->m_pkthdr.rcvif = (struct ifnet *)0; | m->m_pkthdr.rcvif = (struct ifnet *)0; | ||||
if (TCPS_HAVERCVDSYN(tp->t_state) && | if (TCPS_HAVERCVDSYN(tp->t_state) && | ||||
(tp->t_flags2 & TF2_ECN_PERMIT)) { | (tp->t_flags2 & (TF2_ECN_PERMIT | TF2_ACE_PERMIT))) { | ||||
int ect = tcp_ecn_output_established(tp, &flags, len); | int ect = tcp_ecn_output_established(tp, &flags, len); | ||||
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)) | ||||
tp->t_flags2 &= ~TF2_ECN_SND_ECE; | tp->t_flags2 &= ~TF2_ECN_SND_ECE; | ||||
#ifdef INET6 | #ifdef INET6 | ||||
if (rack->r_is_v6) { | if (rack->r_is_v6) { | ||||
ip6->ip6_flow &= ~htonl(IPTOS_ECN_MASK << 20); | ip6->ip6_flow &= ~htonl(IPTOS_ECN_MASK << 20); | ||||
ip6->ip6_flow |= htonl(ect << 20); | ip6->ip6_flow |= htonl(ect << 20); | ||||
▲ Show 20 Lines • Show All 2,028 Lines • ▼ Show 20 Lines | #endif | ||||
* are on a retransmit, we may resend those bits a number of times | * are on a retransmit, we may resend those bits a number of times | ||||
* as per RFC 3168. | * as per RFC 3168. | ||||
*/ | */ | ||||
if (tp->t_state == TCPS_SYN_SENT && V_tcp_do_ecn) { | if (tp->t_state == TCPS_SYN_SENT && V_tcp_do_ecn) { | ||||
flags |= tcp_ecn_output_syn_sent(tp); | flags |= tcp_ecn_output_syn_sent(tp); | ||||
} | } | ||||
/* Also handle parallel SYN for ECN */ | /* Also handle parallel SYN for ECN */ | ||||
if (TCPS_HAVERCVDSYN(tp->t_state) && | if (TCPS_HAVERCVDSYN(tp->t_state) && | ||||
(tp->t_flags2 & TF2_ECN_PERMIT)) { | (tp->t_flags2 & (TF2_ECN_PERMIT | TF2_ACE_PERMIT))) { | ||||
int ect = tcp_ecn_output_established(tp, &flags, len); | int ect = tcp_ecn_output_established(tp, &flags, len); | ||||
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)) | ||||
tp->t_flags2 &= ~TF2_ECN_SND_ECE; | tp->t_flags2 &= ~TF2_ECN_SND_ECE; | ||||
#ifdef INET6 | #ifdef INET6 | ||||
if (isipv6) { | if (isipv6) { | ||||
ip6->ip6_flow &= ~htonl(IPTOS_ECN_MASK << 20); | ip6->ip6_flow &= ~htonl(IPTOS_ECN_MASK << 20); | ||||
ip6->ip6_flow |= htonl(ect << 20); | ip6->ip6_flow |= htonl(ect << 20); | ||||
▲ Show 20 Lines • Show All 1,979 Lines • ▼ Show 20 Lines | if ((tp->t_flags & TF_REQ_TSTMP) && (tp->t_flags & TF_RCVD_TSTMP)) | ||||
ti->tcpi_options |= TCPI_OPT_TIMESTAMPS; | ti->tcpi_options |= TCPI_OPT_TIMESTAMPS; | ||||
if (tp->t_flags & TF_SACK_PERMIT) | if (tp->t_flags & TF_SACK_PERMIT) | ||||
ti->tcpi_options |= TCPI_OPT_SACK; | ti->tcpi_options |= TCPI_OPT_SACK; | ||||
if ((tp->t_flags & TF_REQ_SCALE) && (tp->t_flags & TF_RCVD_SCALE)) { | if ((tp->t_flags & TF_REQ_SCALE) && (tp->t_flags & TF_RCVD_SCALE)) { | ||||
ti->tcpi_options |= TCPI_OPT_WSCALE; | ti->tcpi_options |= TCPI_OPT_WSCALE; | ||||
ti->tcpi_snd_wscale = tp->snd_scale; | ti->tcpi_snd_wscale = tp->snd_scale; | ||||
ti->tcpi_rcv_wscale = tp->rcv_scale; | ti->tcpi_rcv_wscale = tp->rcv_scale; | ||||
} | } | ||||
if (tp->t_flags2 & TF2_ECN_PERMIT) | if (tp->t_flags2 & (TF2_ECN_PERMIT | TF2_ACE_PERMIT)) | ||||
ti->tcpi_options |= TCPI_OPT_ECN; | ti->tcpi_options |= TCPI_OPT_ECN; | ||||
if (tp->t_flags & TF_FASTOPEN) | if (tp->t_flags & TF_FASTOPEN) | ||||
ti->tcpi_options |= TCPI_OPT_TFO; | ti->tcpi_options |= TCPI_OPT_TFO; | ||||
/* still kept in ticks is t_rcvtime */ | /* still kept in ticks is t_rcvtime */ | ||||
ti->tcpi_last_data_recv = ((uint32_t)ticks - tp->t_rcvtime) * tick; | ti->tcpi_last_data_recv = ((uint32_t)ticks - tp->t_rcvtime) * tick; | ||||
/* Since we hold everything in precise useconds this is easy */ | /* Since we hold everything in precise useconds this is easy */ | ||||
ti->tcpi_rtt = tp->t_srtt; | ti->tcpi_rtt = tp->t_srtt; | ||||
ti->tcpi_rttvar = tp->t_rttvar; | ti->tcpi_rttvar = tp->t_rttvar; | ||||
▲ Show 20 Lines • Show All 418 Lines • Show Last 20 Lines |