diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index bd515ce..9381f71 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -164,6 +164,19 @@ SYSCTL_INT(_net_inet_tcp_experimental, OID_AUTO, initcwnd10, CTLFLAG_VNET | CTLF &VNET_NAME(tcp_do_initcwnd10), 0, "Enable RFC 6928 (Increasing initial CWND to 10)"); +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, nonstandard, CTLFLAG_RW, 0, + "Nonstandard TCP extensions"); + +VNET_DEFINE(int, tcp_nonstandard_allowed) = 0; +SYSCTL_INT(_net_inet_tcp_nonstandard, OID_AUTO, allowed, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_nonstandard_allowed), 0, + "Allow nonstandard TCP extensions"); + +VNET_DEFINE(int, tcp_nonstandard_initcwnd) = 0; +SYSCTL_INT(_net_inet_tcp_nonstandard, OID_AUTO, initcwnd, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_nonstandard_initcwnd), 0, + "Slow-start flight size (initial congestion window)"); + VNET_DEFINE(int, tcp_do_rfc3465) = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc3465, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_rfc3465), 0, @@ -361,6 +374,7 @@ cc_conn_init(struct tcpcb *tp) * 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 flight size. * * If a SYN or SYN/ACK was lost and retransmitted, we have to * reduce the initial CWND to one segment as congestion is likely @@ -368,6 +382,9 @@ cc_conn_init(struct tcpcb *tp) */ if (tp->snd_cwnd == 1) tp->snd_cwnd = tp->t_maxseg; /* SYN(-ACK) lost */ + else if (V_tcp_nonstandard_allowed && V_tcp_nonstandard_initcwnd) + tp->snd_cwnd = min(V_tcp_nonstandard_initcwnd * tp->t_maxseg, + max(2 * tp->t_maxseg, V_tcp_nonstandard_initcwnd * 1460)); else if (V_tcp_do_initcwnd10) tp->snd_cwnd = min(10 * tp->t_maxseg, max(2 * tp->t_maxseg, 14600)); diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index df01735..96742c4 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -614,6 +614,8 @@ VNET_DECLARE(int, tcp_minmss); VNET_DECLARE(int, tcp_delack_enabled); VNET_DECLARE(int, tcp_do_rfc3390); VNET_DECLARE(int, tcp_do_initcwnd10); +VNET_DECLARE(int, tcp_nonstandard_allowed); +VNET_DECLARE(int, tcp_nonstandard_initcwnd); VNET_DECLARE(int, tcp_sendspace); VNET_DECLARE(int, tcp_recvspace); VNET_DECLARE(int, path_mtu_discovery); @@ -626,6 +628,8 @@ VNET_DECLARE(int, tcp_abc_l_var); #define V_tcp_delack_enabled VNET(tcp_delack_enabled) #define V_tcp_do_rfc3390 VNET(tcp_do_rfc3390) #define V_tcp_do_initcwnd10 VNET(tcp_do_initcwnd10) +#define V_tcp_nonstandard_allowed VNET(tcp_nonstandard_allowed) +#define V_tcp_nonstandard_initcwnd VNET(tcp_nonstandard_initcwnd) #define V_tcp_sendspace VNET(tcp_sendspace) #define V_tcp_recvspace VNET(tcp_recvspace) #define V_path_mtu_discovery VNET(path_mtu_discovery)