From owner-svn-src-head@freebsd.org Wed Oct 11 20:36:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D66CDE36907; Wed, 11 Oct 2017 20:36:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B27B47732F; Wed, 11 Oct 2017 20:36:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9BKa9NC073118; Wed, 11 Oct 2017 20:36:09 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9BKa9hE073113; Wed, 11 Oct 2017 20:36:09 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201710112036.v9BKa9hE073113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 11 Oct 2017 20:36:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324539 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 324539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Oct 2017 20:36:11 -0000 Author: glebius Date: Wed Oct 11 20:36:09 2017 New Revision: 324539 URL: https://svnweb.freebsd.org/changeset/base/324539 Log: Declare more TCP globals in tcp_var.h, so that alternative TCP stacks can use them. Gather all TCP tunables in tcp_var.h in one place and alphabetically sort them, to ease maintainance of the list. Don't copy and paste declarations in tcp_stacks/fastpath.c. Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_sack.c head/sys/netinet/tcp_stacks/fastpath.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Wed Oct 11 20:22:01 2017 (r324538) +++ head/sys/netinet/tcp_input.c Wed Oct 11 20:36:09 2017 (r324539) @@ -145,7 +145,6 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, delayed_ack, CTLFL "Delay ACK to try and piggyback it onto a data packet"); VNET_DEFINE(int, drop_synfin) = 0; -#define V_drop_synfin VNET(drop_synfin) SYSCTL_INT(_net_inet_tcp, OID_AUTO, drop_synfin, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(drop_synfin), 0, "Drop TCP packets with SYN+FIN set"); @@ -156,7 +155,6 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc6675_pipe, CTLF "Use calculated pipe/in-flight bytes per RFC 6675"); VNET_DEFINE(int, tcp_do_rfc3042) = 1; -#define V_tcp_do_rfc3042 VNET(tcp_do_rfc3042) SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc3042, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_rfc3042), 0, "Enable RFC 3042 (Limited Transmit)"); @@ -194,13 +192,11 @@ SYSCTL_INT(_net_inet_tcp_ecn, OID_AUTO, maxretries, CT "Max retries before giving up on ECN"); VNET_DEFINE(int, tcp_insecure_syn) = 0; -#define V_tcp_insecure_syn VNET(tcp_insecure_syn) SYSCTL_INT(_net_inet_tcp, OID_AUTO, insecure_syn, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_insecure_syn), 0, "Follow RFC793 instead of RFC5961 criteria for accepting SYN packets"); VNET_DEFINE(int, tcp_insecure_rst) = 0; -#define V_tcp_insecure_rst VNET(tcp_insecure_rst) SYSCTL_INT(_net_inet_tcp, OID_AUTO, insecure_rst, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_insecure_rst), 0, "Follow RFC793 instead of RFC5961 criteria for accepting RST packets"); @@ -211,19 +207,16 @@ SYSCTL_INT(_net_inet_tcp, TCPCTL_RECVSPACE, recvspace, &VNET_NAME(tcp_recvspace), 0, "Initial receive socket buffer size"); VNET_DEFINE(int, tcp_do_autorcvbuf) = 1; -#define V_tcp_do_autorcvbuf VNET(tcp_do_autorcvbuf) SYSCTL_INT(_net_inet_tcp, OID_AUTO, recvbuf_auto, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_autorcvbuf), 0, "Enable automatic receive buffer sizing"); VNET_DEFINE(int, tcp_autorcvbuf_inc) = 16*1024; -#define V_tcp_autorcvbuf_inc VNET(tcp_autorcvbuf_inc) SYSCTL_INT(_net_inet_tcp, OID_AUTO, recvbuf_inc, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_autorcvbuf_inc), 0, "Incrementor step size of automatic receive buffer"); VNET_DEFINE(int, tcp_autorcvbuf_max) = 2*1024*1024; -#define V_tcp_autorcvbuf_max VNET(tcp_autorcvbuf_max) SYSCTL_INT(_net_inet_tcp, OID_AUTO, recvbuf_max, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_autorcvbuf_max), 0, "Max size of automatic receive buffer"); Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Wed Oct 11 20:22:01 2017 (r324538) +++ head/sys/netinet/tcp_output.c Wed Oct 11 20:36:09 2017 (r324539) @@ -102,7 +102,6 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, path_mtu_discovery "Enable Path MTU Discovery"); VNET_DEFINE(int, tcp_do_tso) = 1; -#define V_tcp_do_tso VNET(tcp_do_tso) SYSCTL_INT(_net_inet_tcp, OID_AUTO, tso, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_tso), 0, "Enable TCP Segmentation Offload"); @@ -113,19 +112,16 @@ SYSCTL_INT(_net_inet_tcp, TCPCTL_SENDSPACE, sendspace, &VNET_NAME(tcp_sendspace), 0, "Initial send socket buffer size"); VNET_DEFINE(int, tcp_do_autosndbuf) = 1; -#define V_tcp_do_autosndbuf VNET(tcp_do_autosndbuf) SYSCTL_INT(_net_inet_tcp, OID_AUTO, sendbuf_auto, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_autosndbuf), 0, "Enable automatic send buffer sizing"); VNET_DEFINE(int, tcp_autosndbuf_inc) = 8*1024; -#define V_tcp_autosndbuf_inc VNET(tcp_autosndbuf_inc) SYSCTL_INT(_net_inet_tcp, OID_AUTO, sendbuf_inc, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_autosndbuf_inc), 0, "Incrementor step size of automatic send buffer"); VNET_DEFINE(int, tcp_autosndbuf_max) = 2*1024*1024; -#define V_tcp_autosndbuf_max VNET(tcp_autosndbuf_max) SYSCTL_INT(_net_inet_tcp, OID_AUTO, sendbuf_max, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_autosndbuf_max), 0, "Max size of automatic send buffer"); Modified: head/sys/netinet/tcp_sack.c ============================================================================== --- head/sys/netinet/tcp_sack.c Wed Oct 11 20:22:01 2017 (r324538) +++ head/sys/netinet/tcp_sack.c Wed Oct 11 20:36:09 2017 (r324539) @@ -133,19 +133,16 @@ SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, enable, CTLFL &VNET_NAME(tcp_do_sack), 0, "Enable/Disable TCP SACK support"); VNET_DEFINE(int, tcp_sack_maxholes) = 128; -#define V_tcp_sack_maxholes VNET(tcp_sack_maxholes) SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, maxholes, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_sack_maxholes), 0, "Maximum number of TCP SACK holes allowed per connection"); VNET_DEFINE(int, tcp_sack_globalmaxholes) = 65536; -#define V_tcp_sack_globalmaxholes VNET(tcp_sack_globalmaxholes) SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, globalmaxholes, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_sack_globalmaxholes), 0, "Global maximum number of TCP SACK holes"); VNET_DEFINE(int, tcp_sack_globalholes) = 0; -#define V_tcp_sack_globalholes VNET(tcp_sack_globalholes) SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, globalholes, CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(tcp_sack_globalholes), 0, "Global number of TCP SACK holes currently allocated"); Modified: head/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- head/sys/netinet/tcp_stacks/fastpath.c Wed Oct 11 20:22:01 2017 (r324538) +++ head/sys/netinet/tcp_stacks/fastpath.c Wed Oct 11 20:36:09 2017 (r324539) @@ -120,21 +120,6 @@ __FBSDID("$FreeBSD$"); #include -VNET_DECLARE(int, tcp_autorcvbuf_inc); -#define V_tcp_autorcvbuf_inc VNET(tcp_autorcvbuf_inc) -VNET_DECLARE(int, tcp_autorcvbuf_max); -#define V_tcp_autorcvbuf_max VNET(tcp_autorcvbuf_max) -VNET_DECLARE(int, tcp_do_rfc3042); -#define V_tcp_do_rfc3042 VNET(tcp_do_rfc3042) -VNET_DECLARE(int, tcp_do_autorcvbuf); -#define V_tcp_do_autorcvbuf VNET(tcp_do_autorcvbuf) -VNET_DECLARE(int, tcp_insecure_rst); -#define V_tcp_insecure_rst VNET(tcp_insecure_rst) -VNET_DECLARE(int, tcp_insecure_syn); -#define V_tcp_insecure_syn VNET(tcp_insecure_syn) -VNET_DECLARE(int, drop_synfin); -#define V_drop_synfin VNET(drop_synfin) - static void tcp_do_segment_fastslow(struct mbuf *, struct tcphdr *, struct socket *, struct tcpcb *, int, int, uint8_t, int); Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Wed Oct 11 20:22:01 2017 (r324538) +++ head/sys/netinet/tcp_var.h Wed Oct 11 20:36:09 2017 (r324539) @@ -201,12 +201,6 @@ struct tcpcb { #endif /* _KERNEL || _WANT_TCPCB */ #ifdef _KERNEL -/* - * Kernel variables for tcp. - */ -VNET_DECLARE(int, tcp_do_rfc1323); -#define V_tcp_do_rfc1323 VNET(tcp_do_rfc1323) - struct tcptemp { u_char tt_ipgen[40]; /* the size must be of max ip header, now IPv6 */ struct tcphdr tt_t; @@ -701,49 +695,82 @@ SYSCTL_DECL(_net_inet_tcp_sack); MALLOC_DECLARE(M_TCPLOG); #endif -VNET_DECLARE(struct inpcbhead, tcb); /* queue of active tcpcb's */ -VNET_DECLARE(struct inpcbinfo, tcbinfo); extern int tcp_log_in_vain; -VNET_DECLARE(int, tcp_mssdflt); /* XXX */ -VNET_DECLARE(int, tcp_minmss); + +/* + * Global TCP tunables shared between different stacks. + * Please keep the list sorted. + */ +VNET_DECLARE(int, drop_synfin); +VNET_DECLARE(int, path_mtu_discovery); +VNET_DECLARE(int, tcp_abc_l_var); +VNET_DECLARE(int, tcp_autorcvbuf_inc); +VNET_DECLARE(int, tcp_autorcvbuf_max); +VNET_DECLARE(int, tcp_autosndbuf_inc); +VNET_DECLARE(int, tcp_autosndbuf_max); VNET_DECLARE(int, tcp_delack_enabled); +VNET_DECLARE(int, tcp_do_autorcvbuf); +VNET_DECLARE(int, tcp_do_autosndbuf); +VNET_DECLARE(int, tcp_do_ecn); +VNET_DECLARE(int, tcp_do_rfc1323); +VNET_DECLARE(int, tcp_do_rfc3042); VNET_DECLARE(int, tcp_do_rfc3390); +VNET_DECLARE(int, tcp_do_rfc3465); +VNET_DECLARE(int, tcp_do_rfc6675_pipe); +VNET_DECLARE(int, tcp_do_sack); +VNET_DECLARE(int, tcp_do_tso); +VNET_DECLARE(int, tcp_ecn_maxretries); VNET_DECLARE(int, tcp_initcwnd_segments); -VNET_DECLARE(int, tcp_sendspace); +VNET_DECLARE(int, tcp_insecure_rst); +VNET_DECLARE(int, tcp_insecure_syn); +VNET_DECLARE(int, tcp_minmss); +VNET_DECLARE(int, tcp_mssdflt); VNET_DECLARE(int, tcp_recvspace); -VNET_DECLARE(int, path_mtu_discovery); -VNET_DECLARE(int, tcp_do_rfc3465); -VNET_DECLARE(int, tcp_abc_l_var); -#define V_tcb VNET(tcb) -#define V_tcbinfo VNET(tcbinfo) -#define V_tcp_mssdflt VNET(tcp_mssdflt) -#define V_tcp_minmss VNET(tcp_minmss) -#define V_tcp_delack_enabled VNET(tcp_delack_enabled) -#define V_tcp_do_rfc3390 VNET(tcp_do_rfc3390) -#define V_tcp_initcwnd_segments VNET(tcp_initcwnd_segments) -#define V_tcp_sendspace VNET(tcp_sendspace) -#define V_tcp_recvspace VNET(tcp_recvspace) -#define V_path_mtu_discovery VNET(path_mtu_discovery) -#define V_tcp_do_rfc3465 VNET(tcp_do_rfc3465) -#define V_tcp_abc_l_var VNET(tcp_abc_l_var) +VNET_DECLARE(int, tcp_sack_globalholes); +VNET_DECLARE(int, tcp_sack_globalmaxholes); +VNET_DECLARE(int, tcp_sack_maxholes); +VNET_DECLARE(int, tcp_sc_rst_sock_fail); +VNET_DECLARE(int, tcp_sendspace); +VNET_DECLARE(struct inpcbhead, tcb); +VNET_DECLARE(struct inpcbinfo, tcbinfo); -VNET_DECLARE(int, tcp_do_sack); /* SACK enabled/disabled */ -VNET_DECLARE(int, tcp_sc_rst_sock_fail); /* RST on sock alloc failure */ -#define V_tcp_do_sack VNET(tcp_do_sack) -#define V_tcp_sc_rst_sock_fail VNET(tcp_sc_rst_sock_fail) +#define V_drop_synfin VNET(drop_synfin) +#define V_path_mtu_discovery VNET(path_mtu_discovery) +#define V_tcb VNET(tcb) +#define V_tcbinfo VNET(tcbinfo) +#define V_tcp_abc_l_var VNET(tcp_abc_l_var) +#define V_tcp_autorcvbuf_inc VNET(tcp_autorcvbuf_inc) +#define V_tcp_autorcvbuf_max VNET(tcp_autorcvbuf_max) +#define V_tcp_autosndbuf_inc VNET(tcp_autosndbuf_inc) +#define V_tcp_autosndbuf_max VNET(tcp_autosndbuf_max) +#define V_tcp_delack_enabled VNET(tcp_delack_enabled) +#define V_tcp_do_autorcvbuf VNET(tcp_do_autorcvbuf) +#define V_tcp_do_autosndbuf VNET(tcp_do_autosndbuf) +#define V_tcp_do_ecn VNET(tcp_do_ecn) +#define V_tcp_do_rfc1323 VNET(tcp_do_rfc1323) +#define V_tcp_do_rfc3042 VNET(tcp_do_rfc3042) +#define V_tcp_do_rfc3390 VNET(tcp_do_rfc3390) +#define V_tcp_do_rfc3465 VNET(tcp_do_rfc3465) +#define V_tcp_do_rfc6675_pipe VNET(tcp_do_rfc6675_pipe) +#define V_tcp_do_sack VNET(tcp_do_sack) +#define V_tcp_do_tso VNET(tcp_do_tso) +#define V_tcp_ecn_maxretries VNET(tcp_ecn_maxretries) +#define V_tcp_initcwnd_segments VNET(tcp_initcwnd_segments) +#define V_tcp_insecure_rst VNET(tcp_insecure_rst) +#define V_tcp_insecure_syn VNET(tcp_insecure_syn) +#define V_tcp_minmss VNET(tcp_minmss) +#define V_tcp_mssdflt VNET(tcp_mssdflt) +#define V_tcp_recvspace VNET(tcp_recvspace) +#define V_tcp_sack_globalholes VNET(tcp_sack_globalholes) +#define V_tcp_sack_globalmaxholes VNET(tcp_sack_globalmaxholes) +#define V_tcp_sack_maxholes VNET(tcp_sack_maxholes) +#define V_tcp_sc_rst_sock_fail VNET(tcp_sc_rst_sock_fail) +#define V_tcp_sendspace VNET(tcp_sendspace) -VNET_DECLARE(int, tcp_do_ecn); /* TCP ECN enabled/disabled */ -VNET_DECLARE(int, tcp_ecn_maxretries); -#define V_tcp_do_ecn VNET(tcp_do_ecn) -#define V_tcp_ecn_maxretries VNET(tcp_ecn_maxretries) - #ifdef TCP_HHOOK VNET_DECLARE(struct hhook_head *, tcp_hhh[HHOOK_TCP_LAST + 1]); #define V_tcp_hhh VNET(tcp_hhh) #endif - -VNET_DECLARE(int, tcp_do_rfc6675_pipe); -#define V_tcp_do_rfc6675_pipe VNET(tcp_do_rfc6675_pipe) int tcp_addoptions(struct tcpopt *, u_char *); int tcp_ccalgounload(struct cc_algo *unload_algo);