Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_input.c
Show First 20 Lines • Show All 365 Lines • ▼ Show 20 Lines | if (metrics.rmx_ssthresh) { | ||||
*/ | */ | ||||
tp->snd_ssthresh = max(2 * maxseg, metrics.rmx_ssthresh); | tp->snd_ssthresh = max(2 * maxseg, metrics.rmx_ssthresh); | ||||
TCPSTAT_INC(tcps_usedssthresh); | TCPSTAT_INC(tcps_usedssthresh); | ||||
} | } | ||||
/* | /* | ||||
* Set the initial slow-start flight size. | * Set the initial slow-start flight size. | ||||
* | * | ||||
* RFC5681 Section 3.1 specifies the default conservative values. | |||||
* RFC3390 specifies slightly more aggressive values. | |||||
* RFC6928 increases it to ten segments. | |||||
* Support for user specified value for initial flight size. | |||||
* | |||||
* If a SYN or SYN/ACK was lost and retransmitted, we have to | * If a SYN or SYN/ACK was lost and retransmitted, we have to | ||||
* reduce the initial CWND to one segment as congestion is likely | * reduce the initial CWND to one segment as congestion is likely | ||||
* requiring us to be cautious. | * requiring us to be cautious. | ||||
*/ | */ | ||||
if (tp->snd_cwnd == 1) | if (tp->snd_cwnd == 1) | ||||
tp->snd_cwnd = maxseg; /* SYN(-ACK) lost */ | tp->snd_cwnd = maxseg; /* SYN(-ACK) lost */ | ||||
else if (V_tcp_initcwnd_segments) | |||||
tp->snd_cwnd = min(V_tcp_initcwnd_segments * maxseg, | |||||
max(2 * maxseg, V_tcp_initcwnd_segments * 1460)); | |||||
else if (V_tcp_do_rfc3390) | |||||
tp->snd_cwnd = min(4 * maxseg, max(2 * maxseg, 4380)); | |||||
else { | |||||
/* Per RFC5681 Section 3.1 */ | |||||
if (maxseg > 2190) | |||||
tp->snd_cwnd = 2 * maxseg; | |||||
else if (maxseg > 1095) | |||||
tp->snd_cwnd = 3 * maxseg; | |||||
else | else | ||||
tp->snd_cwnd = 4 * maxseg; | tp->snd_cwnd = tcp_compute_initwnd(maxseg); | ||||
} | |||||
if (CC_ALGO(tp)->conn_init != NULL) | if (CC_ALGO(tp)->conn_init != NULL) | ||||
CC_ALGO(tp)->conn_init(tp->ccv); | CC_ALGO(tp)->conn_init(tp->ccv); | ||||
} | } | ||||
void inline | void inline | ||||
cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type) | cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 3,405 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
int | int | ||||
tcp_compute_pipe(struct tcpcb *tp) | tcp_compute_pipe(struct tcpcb *tp) | ||||
{ | { | ||||
return (tp->snd_max - tp->snd_una + | return (tp->snd_max - tp->snd_una + | ||||
tp->sackhint.sack_bytes_rexmit - | tp->sackhint.sack_bytes_rexmit - | ||||
tp->sackhint.sacked_bytes); | tp->sackhint.sacked_bytes); | ||||
} | |||||
uint32_t | |||||
tcp_compute_initwnd(uint32_t maxseg) | |||||
{ | |||||
/* | |||||
* Calculate the Initial Window, also used as Restart Window | |||||
* | |||||
* RFC5681 Section 3.1 specifies the default conservative values. | |||||
* RFC3390 specifies slightly more aggressive values. | |||||
* RFC6928 increases it to ten segments. | |||||
* Support for user specified value for initial flight size. | |||||
*/ | |||||
if (V_tcp_initcwnd_segments) | |||||
return min(V_tcp_initcwnd_segments * maxseg, | |||||
max(2 * maxseg, V_tcp_initcwnd_segments * 1460)); | |||||
else if (V_tcp_do_rfc3390) | |||||
return min(4 * maxseg, max(2 * maxseg, 4380)); | |||||
else { | |||||
/* Per RFC5681 Section 3.1 */ | |||||
if (maxseg > 2190) | |||||
return (2 * maxseg); | |||||
else if (maxseg > 1095) | |||||
return (3 * maxseg); | |||||
else | |||||
return (4 * maxseg); | |||||
} | |||||
} | } |