summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_subr.c
diff options
context:
space:
mode:
authorzec <zec@FreeBSD.org>2008-11-19 09:39:34 +0000
committerzec <zec@FreeBSD.org>2008-11-19 09:39:34 +0000
commit815d52c5df6a76286604478e5223d2f2c87b2c04 (patch)
tree3d398563f1e14b804a0558dd3dda1de9a42b9970 /sys/netinet/tcp_subr.c
parent881f5acc93790d49318ffde65d52c6f45ca9c1f8 (diff)
downloadFreeBSD-src-815d52c5df6a76286604478e5223d2f2c87b2c04.zip
FreeBSD-src-815d52c5df6a76286604478e5223d2f2c87b2c04.tar.gz
Change the initialization methodology for global variables scheduled
for virtualization. Instead of initializing the affected global variables at instatiation, assign initial values to them in initializer functions. As a rule, initialization at instatiation for such variables should never be introduced again from now on. Furthermore, enclose all instantiations of such global variables in #ifdef VIMAGE_GLOBALS blocks. Essentialy, this change should have zero functional impact. In the next phase of merging network stack virtualization infrastructure from p4/vimage branch, the new initialization methology will allow us to switch between using global variables and their counterparts residing in virtualization containers with minimum code churn, and in the long run allow us to intialize multiple instances of such container structures. Discussed at: devsummit Strassburg Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r--sys/netinet/tcp_subr.c70
1 files changed, 58 insertions, 12 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 02d654b..e28d40c 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -111,9 +111,20 @@ __FBSDID("$FreeBSD$");
#include <security/mac/mac_framework.h>
-int tcp_mssdflt = TCP_MSS;
+#ifdef VIMAGE_GLOBALS
+int tcp_mssdflt;
#ifdef INET6
-int tcp_v6mssdflt = TCP6_MSS;
+int tcp_v6mssdflt;
+#endif
+int tcp_minmss;
+int tcp_do_rfc1323;
+static int icmp_may_rst;
+static int tcp_isn_reseed_interval;
+static int tcp_inflight_enable;
+static int tcp_inflight_rttthresh;
+static int tcp_inflight_min;
+static int tcp_inflight_max;
+static int tcp_inflight_stab;
#endif
static int
@@ -168,11 +179,9 @@ SYSCTL_PROC(_net_inet_tcp, TCPCTL_V6MSSDFLT, v6mssdflt, CTLTYPE_INT|CTLFLAG_RW,
* with packet generation and sending. Set to zero to disable MINMSS
* checking. This setting prevents us from sending too small packets.
*/
-int tcp_minmss = TCP_MINMSS;
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, minmss,
CTLFLAG_RW, tcp_minmss , 0, "Minmum TCP Maximum Segment Size");
-int tcp_do_rfc1323 = 1;
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323,
CTLFLAG_RW, tcp_do_rfc1323, 0,
"Enable rfc1323 (high performance TCP) extensions");
@@ -192,12 +201,10 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_tcpdrain, CTLFLAG_RW, &do_tcpdrain, 0,
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, pcbcount,
CTLFLAG_RD, tcbinfo.ipi_count, 0, "Number of active PCBs");
-static int icmp_may_rst = 1;
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, icmp_may_rst,
CTLFLAG_RW, icmp_may_rst, 0,
"Certain ICMP unreachable messages may abort connections in SYN_SENT");
-static int tcp_isn_reseed_interval = 0;
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, isn_reseed_interval,
CTLFLAG_RW, tcp_isn_reseed_interval, 0,
"Seconds between reseeding of ISN secret");
@@ -210,7 +217,6 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, isn_reseed_interval,
SYSCTL_NODE(_net_inet_tcp, OID_AUTO, inflight, CTLFLAG_RW, 0,
"TCP inflight data limiting");
-static int tcp_inflight_enable = 1;
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_inflight, OID_AUTO, enable,
CTLFLAG_RW, tcp_inflight_enable, 0,
"Enable automatic TCP inflight data limiting");
@@ -219,20 +225,16 @@ static int tcp_inflight_debug = 0;
SYSCTL_INT(_net_inet_tcp_inflight, OID_AUTO, debug, CTLFLAG_RW,
&tcp_inflight_debug, 0, "Debug TCP inflight calculations");
-static int tcp_inflight_rttthresh;
SYSCTL_PROC(_net_inet_tcp_inflight, OID_AUTO, rttthresh, CTLTYPE_INT|CTLFLAG_RW,
&tcp_inflight_rttthresh, 0, sysctl_msec_to_ticks, "I",
"RTT threshold below which inflight will deactivate itself");
-static int tcp_inflight_min = 6144;
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_inflight, OID_AUTO, min,
CTLFLAG_RW, tcp_inflight_min, 0, "Lower-bound for TCP inflight window");
-static int tcp_inflight_max = TCP_MAXWIN << TCP_MAX_WINSHIFT;
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_inflight, OID_AUTO, max,
CTLFLAG_RW, tcp_inflight_max, 0, "Upper-bound for TCP inflight window");
-static int tcp_inflight_stab = 20;
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_inflight, OID_AUTO, stab,
CTLFLAG_RW, tcp_inflight_stab, 0,
"Inflight Algorithm Stabilization 20 = 2 packets");
@@ -297,8 +299,49 @@ void
tcp_init(void)
{
INIT_VNET_INET(curvnet);
+ int hashsize;
+
+ V_blackhole = 0;
+ V_tcp_delack_enabled = 1;
+ V_drop_synfin = 0;
+ V_tcp_do_rfc3042 = 1;
+ V_tcp_do_rfc3390 = 1;
+ V_tcp_do_ecn = 0;
+ V_tcp_ecn_maxretries = 1;
+ V_tcp_insecure_rst = 0;
+ V_tcp_do_autorcvbuf = 1;
+ V_tcp_autorcvbuf_inc = 16*1024;
+ V_tcp_autorcvbuf_max = 256*1024;
+
+ V_tcp_mssdflt = TCP_MSS;
+#ifdef INET6
+ V_tcp_v6mssdflt = TCP6_MSS;
+#endif
+ V_tcp_minmss = TCP_MINMSS;
+ V_tcp_do_rfc1323 = 1;
+ V_icmp_may_rst = 1;
+ V_tcp_isn_reseed_interval = 0;
+ V_tcp_inflight_enable = 1;
+ V_tcp_inflight_min = 6144;
+ V_tcp_inflight_max = TCP_MAXWIN << TCP_MAX_WINSHIFT;
+ V_tcp_inflight_stab = 20;
+
+ V_path_mtu_discovery = 1;
+ V_ss_fltsz = 1;
+ V_ss_fltsz_local = 4;
+ V_tcp_do_newreno = 1;
+ V_tcp_do_tso = 1;
+ V_tcp_do_autosndbuf = 1;
+ V_tcp_autosndbuf_inc = 8*1024;
+ V_tcp_autosndbuf_max = 256*1024;
+
+ V_nolocaltimewait = 0;
+
+ V_tcp_do_sack = 1;
+ V_tcp_sack_maxholes = 128;
+ V_tcp_sack_globalmaxholes = 65536;
+ V_tcp_sack_globalholes = 0;
- int hashsize = TCBHASHSIZE;
tcp_delacktime = TCPTV_DELACK;
tcp_keepinit = TCPTV_KEEP_INIT;
tcp_keepidle = TCPTV_KEEP_IDLE;
@@ -315,6 +358,7 @@ tcp_init(void)
INP_INFO_LOCK_INIT(&V_tcbinfo, "tcp");
LIST_INIT(&V_tcb);
V_tcbinfo.ipi_listhead = &V_tcb;
+ hashsize = TCBHASHSIZE;
TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &hashsize);
if (!powerof2(hashsize)) {
printf("WARNING: TCB hash size not a power of 2\n");
@@ -1429,10 +1473,12 @@ tcp6_ctlinput(int cmd, struct sockaddr *sa, void *d)
#define ISN_STATIC_INCREMENT 4096
#define ISN_RANDOM_INCREMENT (4096 - 1)
+#ifdef VIMAGE_GLOBALS
static u_char isn_secret[32];
static int isn_last_reseed;
static u_int32_t isn_offset, isn_offset_old;
static MD5_CTX isn_ctx;
+#endif
tcp_seq
tcp_new_isn(struct tcpcb *tp)
OpenPOWER on IntegriCloud