Add sysctl variable net.inet.tcp.rexmit_initial for setting RTO.Initial

used by TCP.

Reviewed by:		rrs@, 0mp@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D19355
This commit is contained in:
Michael Tuexen 2019-03-23 21:36:59 +00:00
parent 557e162fe7
commit 0999766ddf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345458
5 changed files with 22 additions and 11 deletions

View File

@ -34,7 +34,7 @@
.\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd August 6, 2018 .Dd March 23, 2019
.Dt TCP 4 .Dt TCP 4
.Os .Os
.Sh NAME .Sh NAME
@ -459,7 +459,7 @@ The actual limit applied to a session's reassembly queue will be the lower of
the system-calculated automatic limit and the user-specified the system-calculated automatic limit and the user-specified
.Va reass.maxqueuelen .Va reass.maxqueuelen
limit. limit.
.It Va rexmit_min , rexmit_slop .It Va rexmit_initial , rexmit_min , rexmit_slop
Adjust the retransmit timer calculation for Adjust the retransmit timer calculation for
.Tn TCP . .Tn TCP .
The slop is The slop is
@ -481,6 +481,7 @@ code.
For this reason, we use 200ms of slop and a near-0 For this reason, we use 200ms of slop and a near-0
minimum, which gives us an effective minimum of 200ms (similar to minimum, which gives us an effective minimum of 200ms (similar to
.Tn Linux ) . .Tn Linux ) .
The initial value is used before an RTT measurement has been performed.
.It Va initcwnd_segments .It Va initcwnd_segments
Enable the ability to specify initial congestion window in number of segments. Enable the ability to specify initial congestion window in number of segments.
The default value is 10 as suggested by RFC 6928. The default value is 10 as suggested by RFC 6928.

View File

@ -1065,6 +1065,9 @@ tcp_init(void)
tcp_keepintvl = TCPTV_KEEPINTVL; tcp_keepintvl = TCPTV_KEEPINTVL;
tcp_maxpersistidle = TCPTV_KEEP_IDLE; tcp_maxpersistidle = TCPTV_KEEP_IDLE;
tcp_msl = TCPTV_MSL; tcp_msl = TCPTV_MSL;
tcp_rexmit_initial = TCPTV_RTOBASE;
if (tcp_rexmit_initial < 1)
tcp_rexmit_initial = 1;
tcp_rexmit_min = TCPTV_MIN; tcp_rexmit_min = TCPTV_MIN;
if (tcp_rexmit_min < 1) if (tcp_rexmit_min < 1)
tcp_rexmit_min = 1; tcp_rexmit_min = 1;
@ -1645,9 +1648,9 @@ tcp_newtcpcb(struct inpcb *inp)
* reasonable initial retransmit time. * reasonable initial retransmit time.
*/ */
tp->t_srtt = TCPTV_SRTTBASE; tp->t_srtt = TCPTV_SRTTBASE;
tp->t_rttvar = ((TCPTV_RTOBASE - TCPTV_SRTTBASE) << TCP_RTTVAR_SHIFT) / 4; tp->t_rttvar = ((tcp_rexmit_initial - TCPTV_SRTTBASE) << TCP_RTTVAR_SHIFT) / 4;
tp->t_rttmin = tcp_rexmit_min; tp->t_rttmin = tcp_rexmit_min;
tp->t_rxtcur = TCPTV_RTOBASE; tp->t_rxtcur = tcp_rexmit_initial;
tp->snd_cwnd = TCP_MAXWIN << TCP_MAX_WINSHIFT; tp->snd_cwnd = TCP_MAXWIN << TCP_MAX_WINSHIFT;
tp->snd_ssthresh = TCP_MAXWIN << TCP_MAX_WINSHIFT; tp->snd_ssthresh = TCP_MAXWIN << TCP_MAX_WINSHIFT;
tp->t_rcvtime = ticks; tp->t_rcvtime = ticks;

View File

@ -155,7 +155,7 @@ static int syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch,
/* /*
* Transmit the SYN,ACK fewer times than TCP_MAXRXTSHIFT specifies. * Transmit the SYN,ACK fewer times than TCP_MAXRXTSHIFT specifies.
* 3 retransmits corresponds to a timeout with default values of * 3 retransmits corresponds to a timeout with default values of
* TCPTV_RTOBASE * ( 1 + * tcp_rexmit_initial * ( 1 +
* tcp_backoff[1] + * tcp_backoff[1] +
* tcp_backoff[2] + * tcp_backoff[2] +
* tcp_backoff[3]) + 3 * tcp_rexmit_slop, * tcp_backoff[3]) + 3 * tcp_rexmit_slop,
@ -424,9 +424,10 @@ syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout)
int rexmt; int rexmt;
if (sc->sc_rxmits == 0) if (sc->sc_rxmits == 0)
rexmt = TCPTV_RTOBASE; rexmt = tcp_rexmit_initial;
else else
TCPT_RANGESET(rexmt, TCPTV_RTOBASE * tcp_backoff[sc->sc_rxmits], TCPT_RANGESET(rexmt,
tcp_rexmit_initial * tcp_backoff[sc->sc_rxmits],
tcp_rexmit_min, TCPTV_REXMTMAX); tcp_rexmit_min, TCPTV_REXMTMAX);
sc->sc_rxttime = ticks + rexmt; sc->sc_rxttime = ticks + rexmt;
sc->sc_rxmits++; sc->sc_rxmits++;

View File

@ -110,6 +110,11 @@ int tcp_msl;
SYSCTL_PROC(_net_inet_tcp, OID_AUTO, msl, CTLTYPE_INT|CTLFLAG_RW, SYSCTL_PROC(_net_inet_tcp, OID_AUTO, msl, CTLTYPE_INT|CTLFLAG_RW,
&tcp_msl, 0, sysctl_msec_to_ticks, "I", "Maximum segment lifetime"); &tcp_msl, 0, sysctl_msec_to_ticks, "I", "Maximum segment lifetime");
int tcp_rexmit_initial;
SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_initial, CTLTYPE_INT|CTLFLAG_RW,
&tcp_rexmit_initial, 0, sysctl_msec_to_ticks, "I",
"Initial Retransmission Timeout");
int tcp_rexmit_min; int tcp_rexmit_min;
SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_min, CTLTYPE_INT|CTLFLAG_RW, SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_min, CTLTYPE_INT|CTLFLAG_RW,
&tcp_rexmit_min, 0, sysctl_msec_to_ticks, "I", &tcp_rexmit_min, 0, sysctl_msec_to_ticks, "I",
@ -668,7 +673,7 @@ tcp_timer_rexmt(void * xtp)
TCPSTAT_INC(tcps_rexmttimeo); TCPSTAT_INC(tcps_rexmttimeo);
if ((tp->t_state == TCPS_SYN_SENT) || if ((tp->t_state == TCPS_SYN_SENT) ||
(tp->t_state == TCPS_SYN_RECEIVED)) (tp->t_state == TCPS_SYN_RECEIVED))
rexmt = TCPTV_RTOBASE * tcp_backoff[tp->t_rxtshift]; rexmt = tcp_rexmit_initial * tcp_backoff[tp->t_rxtshift];
else else
rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
TCPT_RANGESET(tp->t_rxtcur, rexmt, TCPT_RANGESET(tp->t_rxtcur, rexmt,

View File

@ -194,6 +194,7 @@ extern int tcp_keepintvl; /* time between keepalive probes */
extern int tcp_keepcnt; /* number of keepalives */ extern int tcp_keepcnt; /* number of keepalives */
extern int tcp_delacktime; /* time before sending a delayed ACK */ extern int tcp_delacktime; /* time before sending a delayed ACK */
extern int tcp_maxpersistidle; extern int tcp_maxpersistidle;
extern int tcp_rexmit_initial;
extern int tcp_rexmit_min; extern int tcp_rexmit_min;
extern int tcp_rexmit_slop; extern int tcp_rexmit_slop;
extern int tcp_msl; extern int tcp_msl;