summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_var.h
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-07-14 22:48:30 +0000
committerrwatson <rwatson@FreeBSD.org>2009-07-14 22:48:30 +0000
commit57ca4583e728cab422fba8f15de10bd0b637b3dd (patch)
tree13848f891fb2f7a396281b31633563d0f764ff65 /sys/netinet/tcp_var.h
parentef443476d9706035ac219f0280ef0b817dda7a6d (diff)
downloadFreeBSD-src-57ca4583e728cab422fba8f15de10bd0b637b3dd.zip
FreeBSD-src-57ca4583e728cab422fba8f15de10bd0b637b3dd.tar.gz
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual network stack memory allocator. Modify vnet to use the allocator instead of monolithic global container structures (vinet, ...). This change solves many binary compatibility problems associated with VIMAGE, and restores ELF symbols for virtualized global variables. Each virtualized global variable exists as a "reference copy", and also once per virtual network stack. Virtualized global variables are tagged at compile-time, placing the in a special linker set, which is loaded into a contiguous region of kernel memory. Virtualized global variables in the base kernel are linked as normal, but those in modules are copied and relocated to a reserved portion of the kernel's vnet region with the help of a the kernel linker. Virtualized global variables exist in per-vnet memory set up when the network stack instance is created, and are initialized statically from the reference copy. Run-time access occurs via an accessor macro, which converts from the current vnet and requested symbol to a per-vnet address. When "options VIMAGE" is not compiled into the kernel, normal global ELF symbols will be used instead and indirection is avoided. This change restores static initialization for network stack global variables, restores support for non-global symbols and types, eliminates the need for many subsystem constructors, eliminates large per-subsystem structures that caused many binary compatibility issues both for monitoring applications (netstat) and kernel modules, removes the per-function INIT_VNET_*() macros throughout the stack, eliminates the need for vnet_symmap ksym(2) munging, and eliminates duplicate definitions of virtualized globals under VIMAGE_GLOBALS. Bump __FreeBSD_version and update UPDATING. Portions submitted by: bz Reviewed by: bz, zec Discussed with: gnn, jamie, jeff, jhb, julian, sam Suggested by: peter Approved by: re (kensmith)
Diffstat (limited to 'sys/netinet/tcp_var.h')
-rw-r--r--sys/netinet/tcp_var.h129
1 files changed, 83 insertions, 46 deletions
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index e802220..8c175f8 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -35,14 +35,20 @@
#include <netinet/tcp.h>
-struct vnet;
+#ifdef _KERNEL
+#include <net/vnet.h>
/*
* Kernel variables for tcp.
*/
-#ifdef VIMAGE_GLOBALS
-extern int tcp_do_rfc1323;
-#endif
+VNET_DECLARE(int, tcp_do_rfc1323);
+VNET_DECLARE(int, tcp_reass_qsize);
+VNET_DECLARE(struct uma_zone *, tcp_reass_zone);
+#define V_tcp_do_rfc1323 VNET_GET(tcp_do_rfc1323)
+#define V_tcp_reass_qsize VNET_GET(tcp_reass_qsize)
+#define V_tcp_reass_zone VNET_GET(tcp_reass_zone)
+
+#endif /* _KERNEL */
/* TCP segment queue entry */
struct tseg_qent {
@@ -52,10 +58,6 @@ struct tseg_qent {
struct mbuf *tqe_m; /* mbuf contains packet */
};
LIST_HEAD(tsegqe_head, tseg_qent);
-#ifdef VIMAGE_GLOBALS
-extern int tcp_reass_qsize;
-#endif
-extern struct uma_zone *tcp_reass_zone;
struct sackblk {
tcp_seq start; /* start seq no. of sack block */
@@ -538,44 +540,79 @@ MALLOC_DECLARE(M_TCPLOG);
extern int tcp_log_in_vain;
-#ifdef VIMAGE_GLOBALS
-extern struct inpcbhead tcb; /* head of queue of active tcpcb's */
-extern struct inpcbinfo tcbinfo;
-extern struct tcpstat tcpstat; /* tcp statistics */
-extern int tcp_mssdflt; /* XXX */
-extern int tcp_minmss;
-extern int tcp_delack_enabled;
-extern int tcp_do_newreno;
-extern int path_mtu_discovery;
-extern int ss_fltsz;
-extern int ss_fltsz_local;
-
-extern int blackhole;
-extern int drop_synfin;
-extern int tcp_do_rfc3042;
-extern int tcp_do_rfc3390;
-extern int tcp_insecure_rst;
-extern int tcp_do_autorcvbuf;
-extern int tcp_autorcvbuf_inc;
-extern int tcp_autorcvbuf_max;
-extern int tcp_do_rfc3465;
-extern int tcp_abc_l_var;
-
-extern int tcp_do_tso;
-extern int tcp_do_autosndbuf;
-extern int tcp_autosndbuf_inc;
-extern int tcp_autosndbuf_max;
-
-extern int nolocaltimewait;
-
-extern int tcp_do_sack; /* SACK enabled/disabled */
-extern int tcp_sack_maxholes;
-extern int tcp_sack_globalmaxholes;
-extern int tcp_sack_globalholes;
-extern int tcp_sc_rst_sock_fail; /* RST on sock alloc failure */
-extern int tcp_do_ecn; /* TCP ECN enabled/disabled */
-extern int tcp_ecn_maxretries;
-#endif /* VIMAGE_GLOBALS */
+VNET_DECLARE(struct inpcbhead, tcb); /* queue of active tcpcb's */
+VNET_DECLARE(struct inpcbinfo, tcbinfo);
+VNET_DECLARE(struct tcpstat, tcpstat); /* tcp statistics */
+VNET_DECLARE(int, tcp_mssdflt); /* XXX */
+VNET_DECLARE(int, tcp_minmss);
+VNET_DECLARE(int, tcp_delack_enabled);
+VNET_DECLARE(int, tcp_do_newreno);
+VNET_DECLARE(int, path_mtu_discovery);
+VNET_DECLARE(int, ss_fltsz);
+VNET_DECLARE(int, ss_fltsz_local);
+
+#define V_tcb VNET_GET(tcb)
+#define V_tcbinfo VNET_GET(tcbinfo)
+#define V_tcpstat VNET_GET(tcpstat)
+#define V_tcp_mssdflt VNET_GET(tcp_mssdflt)
+#define V_tcp_minmss VNET_GET(tcp_minmss)
+#define V_tcp_delack_enabled VNET_GET(tcp_delack_enabled)
+#define V_tcp_do_newreno VNET_GET(tcp_do_newreno)
+#define V_path_mtu_discovery VNET_GET(path_mtu_discovery)
+#define V_ss_fltsz VNET_GET(ss_fltsz)
+#define V_ss_fltsz_local VNET_GET(ss_fltsz_local)
+
+VNET_DECLARE(int, blackhole);
+VNET_DECLARE(int, drop_synfin);
+VNET_DECLARE(int, tcp_do_rfc3042);
+VNET_DECLARE(int, tcp_do_rfc3390);
+VNET_DECLARE(int, tcp_insecure_rst);
+VNET_DECLARE(int, tcp_do_autorcvbuf);
+VNET_DECLARE(int, tcp_autorcvbuf_inc);
+VNET_DECLARE(int, tcp_autorcvbuf_max);
+VNET_DECLARE(int, tcp_do_rfc3465);
+VNET_DECLARE(int, tcp_abc_l_var);
+
+#define V_blackhole VNET_GET(blackhole)
+#define V_drop_synfin VNET_GET(drop_synfin)
+#define V_tcp_do_rfc3042 VNET_GET(tcp_do_rfc3042)
+#define V_tcp_do_rfc3390 VNET_GET(tcp_do_rfc3390)
+#define V_tcp_insecure_rst VNET_GET(tcp_insecure_rst)
+#define V_tcp_do_autorcvbuf VNET_GET(tcp_do_autorcvbuf)
+#define V_tcp_autorcvbuf_inc VNET_GET(tcp_autorcvbuf_inc)
+#define V_tcp_autorcvbuf_max VNET_GET(tcp_autorcvbuf_max)
+#define V_tcp_do_rfc3465 VNET_GET(tcp_do_rfc3465)
+#define V_tcp_abc_l_var VNET_GET(tcp_abc_l_var)
+
+VNET_DECLARE(int, tcp_do_tso);
+VNET_DECLARE(int, tcp_do_autosndbuf);
+VNET_DECLARE(int, tcp_autosndbuf_inc);
+VNET_DECLARE(int, tcp_autosndbuf_max);
+
+#define V_tcp_do_tso VNET_GET(tcp_do_tso)
+#define V_tcp_do_autosndbuf VNET_GET(tcp_do_autosndbuf)
+#define V_tcp_autosndbuf_inc VNET_GET(tcp_autosndbuf_inc)
+#define V_tcp_autosndbuf_max VNET_GET(tcp_autosndbuf_max)
+
+VNET_DECLARE(int, nolocaltimewait);
+
+#define V_nolocaltimewait VNET_GET(nolocaltimewait)
+
+VNET_DECLARE(int, tcp_do_sack); /* SACK enabled/disabled */
+VNET_DECLARE(int, tcp_sack_maxholes);
+VNET_DECLARE(int, tcp_sack_globalmaxholes);
+VNET_DECLARE(int, tcp_sack_globalholes);
+VNET_DECLARE(int, tcp_sc_rst_sock_fail); /* RST on sock alloc failure */
+VNET_DECLARE(int, tcp_do_ecn); /* TCP ECN enabled/disabled */
+VNET_DECLARE(int, tcp_ecn_maxretries);
+
+#define V_tcp_do_sack VNET_GET(tcp_do_sack)
+#define V_tcp_sack_maxholes VNET_GET(tcp_sack_maxholes)
+#define V_tcp_sack_globalmaxholes VNET_GET(tcp_sack_globalmaxholes)
+#define V_tcp_sack_globalholes VNET_GET(tcp_sack_globalholes)
+#define V_tcp_sc_rst_sock_fail VNET_GET(tcp_sc_rst_sock_fail)
+#define V_tcp_do_ecn VNET_GET(tcp_do_ecn)
+#define V_tcp_ecn_maxretries VNET_GET(tcp_ecn_maxretries)
int tcp_addoptions(struct tcpopt *, u_char *);
struct tcpcb *
OpenPOWER on IntegriCloud