diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-07-14 22:48:30 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-07-14 22:48:30 +0000 |
commit | 57ca4583e728cab422fba8f15de10bd0b637b3dd (patch) | |
tree | 13848f891fb2f7a396281b31633563d0f764ff65 /sys/netinet/vinet.h | |
parent | ef443476d9706035ac219f0280ef0b817dda7a6d (diff) | |
download | FreeBSD-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/vinet.h')
-rw-r--r-- | sys/netinet/vinet.h | 422 |
1 files changed, 0 insertions, 422 deletions
diff --git a/sys/netinet/vinet.h b/sys/netinet/vinet.h deleted file mode 100644 index 495f797..0000000 --- a/sys/netinet/vinet.h +++ /dev/null @@ -1,422 +0,0 @@ -/*- - * Copyright (c) 2006-2008 University of Zagreb - * Copyright (c) 2006-2008 FreeBSD Foundation - * - * This software was developed by the University of Zagreb and the - * FreeBSD Foundation under sponsorship by the Stichting NLnet and the - * FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _NETINET_VINET_H_ -#define _NETINET_VINET_H_ - -#include <sys/sysctl.h> - -#include <netinet/in.h> -#include <netinet/in_var.h> -#include <netinet/in_pcb.h> -#include <netinet/ip_var.h> -#include <netinet/ip.h> -#include <netinet/ip_icmp.h> -#include <netinet/icmp_var.h> -#include <netinet/igmp_var.h> -#include <netinet/tcp.h> -#include <netinet/tcp_var.h> -#include <netinet/tcp_hostcache.h> -#include <netinet/tcp_syncache.h> -#include <netinet/udp.h> -#include <netinet/udp_var.h> - -struct vnet_inet { - struct in_ifaddrhashhead *_in_ifaddrhashtbl; - struct in_ifaddrhead _in_ifaddrhead; - u_long _in_ifaddrhmask; - - int _arpt_keep; - int _arp_maxtries; - int _useloopback; - int _arp_proxyall; - int _subnetsarelocal; - int _sameprefixcarponly; - - int _ipforwarding; - int _ipstealth; - int _ipfastforward_active; - int _ipsendredirects; - int _ip_defttl; - int _ip_keepfaith; - int _ip_sendsourcequench; - int _ip_do_randomid; - int _ip_checkinterface; - int _ip_output_flowtable_size; - u_short _ip_id; - - uma_zone_t _ipq_zone; - int _nipq; /* Total # of reass queues */ - int _maxnipq; /* Admin. limit on # reass queues. */ - int _maxfragsperpacket; - TAILQ_HEAD(ipqhead, ipq) _ipq[IPREASS_NHASH]; - - struct inpcbhead _tcb; /* head of queue of active tcpcb's */ - struct inpcbinfo _tcbinfo; - struct tcpstat _tcpstat; /* tcp statistics */ - struct tcp_hostcache _tcp_hostcache; - struct callout _tcp_hc_callout; - - uma_zone_t _tcp_reass_zone; - uma_zone_t _tcpcb_zone; - uma_zone_t _tcptw_zone; - uma_zone_t _sack_hole_zone; - - struct tcp_syncache _tcp_syncache; - int _tcp_syncookies; - int _tcp_syncookiesonly; - int _tcp_sc_rst_sock_fail; - - struct inpcbhead _divcb; - struct inpcbinfo _divcbinfo; - TAILQ_HEAD(, tcptw) _twq_2msl; - - int _tcp_mssdflt; - int _tcp_v6mssdflt; - int _tcp_minmss; - int _tcp_do_rfc1323; - int _icmp_may_rst; - int _tcp_isn_reseed_interval; - int _tcp_inflight_enable; - int _tcp_inflight_rttthresh; - int _tcp_inflight_min; - int _tcp_inflight_max; - int _tcp_inflight_stab; - int _nolocaltimewait; - int _path_mtu_discovery; - int _ss_fltsz; - int _ss_fltsz_local; - int _tcp_do_newreno; - int _tcp_do_tso; - int _tcp_do_autosndbuf; - int _tcp_autosndbuf_inc; - int _tcp_autosndbuf_max; - int _tcp_do_sack; - int _tcp_sack_maxholes; - int _tcp_sack_globalmaxholes; - int _tcp_sack_globalholes; - int _blackhole; - int _tcp_delack_enabled; - int _drop_synfin; - int _tcp_do_rfc3042; - int _tcp_do_rfc3390; - int _tcp_do_rfc3465; - int _tcp_abc_l_var; - int _tcp_do_ecn; - int _tcp_ecn_maxretries; - int _tcp_insecure_rst; - int _tcp_do_autorcvbuf; - int _tcp_autorcvbuf_inc; - int _tcp_autorcvbuf_max; - int _tcp_reass_maxseg; - int _tcp_reass_qsize; - int _tcp_reass_maxqlen; - int _tcp_reass_overflows; - - u_char _isn_secret[32]; - int _isn_last_reseed; - u_int32_t _isn_offset; - u_int32_t _isn_offset_old; - - struct inpcbhead _udb; - struct inpcbinfo _udbinfo; - uma_zone_t _udpcb_zone; - struct udpstat _udpstat; - int _udp_blackhole; - - struct inpcbhead _ripcb; - struct inpcbinfo _ripcbinfo; - struct socket * _ip_mrouter; - - struct socket * _ip_rsvpd; - int _ip_rsvp_on; - int _rsvp_on; - - struct icmpstat _icmpstat; - struct ipstat _ipstat; - - LIST_HEAD(, igmp_ifinfo) _igi_head; - struct igmpstat _igmpstat; - int _interface_timers_running; - int _state_change_timers_running; - int _current_state_timers_running; - int _igmp_recvifkludge; - int _igmp_sendra; - int _igmp_sendlocal; - int _igmp_v1enable; - int _igmp_v2enable; - int _igmp_legacysupp; - int _igmp_sgalloc; - int _igmp_default_version; - struct timeval _igmp_gsrdelay; - - int _rtq_timeout; - int _rtq_reallyold; - int _rtq_minreallyold; - int _rtq_toomany; - struct callout _rtq_timer; - - int _ipport_lowfirstauto; - int _ipport_lowlastauto; - int _ipport_firstauto; - int _ipport_lastauto; - int _ipport_hifirstauto; - int _ipport_hilastauto; - int _ipport_reservedhigh; - int _ipport_reservedlow; - int _ipport_randomized; - int _ipport_randomcps; - int _ipport_randomtime; - int _ipport_stoprandom; - int _ipport_tcpallocs; - int _ipport_tcplastcount; - - int _icmpmaskrepl; - u_int _icmpmaskfake; - int _drop_redirect; - int _log_redirect; - int _icmplim; - int _icmplim_output; - char _reply_src[IFNAMSIZ]; - int _icmp_rfi; - int _icmp_quotelen; - int _icmpbmcastecho; - - int _fw_one_pass; - - struct flowtable * _ip_ft; - struct flowtable * _flow_list_head; - uint32_t _flow_hashjitter; - uma_zone_t _flow_ipv4_zone; - uma_zone_t _flow_ipv6_zone; - int _flowtable_enable; - int _flowtable_hits; - int _flowtable_lookups; - int _flowtable_misses; - int _flowtable_frees; - int _flowtable_free_checks; - int _flowtable_max_depth; - int _flowtable_collisions; - int _flowtable_syn_expire; - int _flowtable_udp_expire; - int _flowtable_fin_wait_expire; - int _flowtable_tcp_expire; - int _flowtable_nmbflows; -}; - -/* Size guard. See sys/vimage.h. */ -VIMAGE_CTASSERT(SIZEOF_vnet_inet, sizeof(struct vnet_inet)); - -#ifndef VIMAGE -#ifndef VIMAGE_GLOBALS -extern struct vnet_inet vnet_inet_0; -#endif -#endif - -/* - * Symbol translation macros - */ -#define INIT_VNET_INET(vnet) \ - INIT_FROM_VNET(vnet, VNET_MOD_INET, struct vnet_inet, vnet_inet) - -#define VNET_INET(sym) VSYM(vnet_inet, sym) - -#define V_arp_maxtries VNET_INET(arp_maxtries) -#define V_arp_proxyall VNET_INET(arp_proxyall) -#define V_arpt_keep VNET_INET(arpt_keep) -#define V_blackhole VNET_INET(blackhole) -#define V_divcb VNET_INET(divcb) -#define V_divcbinfo VNET_INET(divcbinfo) -#define V_drop_redirect VNET_INET(drop_redirect) -#define V_drop_synfin VNET_INET(drop_synfin) -#define V_fw_one_pass VNET_INET(fw_one_pass) -#define V_flow_hashjitter VNET_INET(flow_hashjitter) -#define V_flow_ipv4_zone VNET_INET(flow_ipv4_zone) -#define V_flow_ipv6_zone VNET_INET(flow_ipv6_zone) -#define V_flow_list_head VNET_INET(flow_list_head) -#define V_flowtable_collisions VNET_INET(flowtable_collisions) -#define V_flowtable_enable VNET_INET(flowtable_enable) -#define V_flowtable_fin_wait_expire VNET_INET(flowtable_fin_wait_expire) -#define V_flowtable_free_checks VNET_INET(flowtable_free_checks) -#define V_flowtable_frees VNET_INET(flowtable_frees) -#define V_flowtable_hits VNET_INET(flowtable_hits) -#define V_flowtable_lookups VNET_INET(flowtable_lookups) -#define V_flowtable_max_depth VNET_INET(flowtable_max_depth) -#define V_flowtable_misses VNET_INET(flowtable_misses) -#define V_flowtable_nmbflows VNET_INET(flowtable_nmbflows) -#define V_flowtable_syn_expire VNET_INET(flowtable_syn_expire) -#define V_flowtable_tcp_expire VNET_INET(flowtable_tcp_expire) -#define V_flowtable_udp_expire VNET_INET(flowtable_udp_expire) -#define V_icmp_may_rst VNET_INET(icmp_may_rst) -#define V_icmp_quotelen VNET_INET(icmp_quotelen) -#define V_icmp_rfi VNET_INET(icmp_rfi) -#define V_icmpbmcastecho VNET_INET(icmpbmcastecho) -#define V_icmplim VNET_INET(icmplim) -#define V_icmplim_output VNET_INET(icmplim_output) -#define V_icmpmaskfake VNET_INET(icmpmaskfake) -#define V_icmpmaskrepl VNET_INET(icmpmaskrepl) -#define V_icmpstat VNET_INET(icmpstat) -#define V_igi_head VNET_INET(igi_head) -#define V_igmpstat VNET_INET(igmpstat) -#define V_interface_timers_running \ - VNET_INET(interface_timers_running) -#define V_state_change_timers_running \ - VNET_INET(state_change_timers_running) -#define V_current_state_timers_running \ - VNET_INET(current_state_timers_running) -#define V_igmp_recvifkludge VNET_INET(igmp_recvifkludge) -#define V_igmp_sendra VNET_INET(igmp_sendra) -#define V_igmp_sendlocal VNET_INET(igmp_sendlocal) -#define V_igmp_v1enable VNET_INET(igmp_v1enable) -#define V_igmp_v2enable VNET_INET(igmp_v2enable) -#define V_igmp_legacysupp VNET_INET(igmp_legacysupp) -#define V_igmp_sgalloc VNET_INET(igmp_sgalloc) -#define V_igmp_default_version VNET_INET(igmp_default_version) -#define V_igmp_gsrdelay VNET_INET(igmp_gsrdelay) -#define V_in_ifaddrhashtbl VNET_INET(in_ifaddrhashtbl) -#define V_in_ifaddrhead VNET_INET(in_ifaddrhead) -#define V_in_ifaddrhmask VNET_INET(in_ifaddrhmask) -#define V_ip_checkinterface VNET_INET(ip_checkinterface) -#define V_ip_defttl VNET_INET(ip_defttl) -#define V_ip_do_randomid VNET_INET(ip_do_randomid) -#define V_ip_ft VNET_INET(ip_ft) -#define V_ip_id VNET_INET(ip_id) -#define V_ip_keepfaith VNET_INET(ip_keepfaith) -#define V_ip_mrouter VNET_INET(ip_mrouter) -#define V_ip_output_flowtable_size VNET_INET(ip_output_flowtable_size) -#define V_ip_rsvp_on VNET_INET(ip_rsvp_on) -#define V_ip_rsvpd VNET_INET(ip_rsvpd) -#define V_ip_sendsourcequench VNET_INET(ip_sendsourcequench) -#define V_ipfastforward_active VNET_INET(ipfastforward_active) -#define V_ipforwarding VNET_INET(ipforwarding) -#define V_ipport_firstauto VNET_INET(ipport_firstauto) -#define V_ipport_hifirstauto VNET_INET(ipport_hifirstauto) -#define V_ipport_hilastauto VNET_INET(ipport_hilastauto) -#define V_ipport_lastauto VNET_INET(ipport_lastauto) -#define V_ipport_lowfirstauto VNET_INET(ipport_lowfirstauto) -#define V_ipport_lowlastauto VNET_INET(ipport_lowlastauto) -#define V_ipport_randomcps VNET_INET(ipport_randomcps) -#define V_ipport_randomized VNET_INET(ipport_randomized) -#define V_ipport_randomtime VNET_INET(ipport_randomtime) -#define V_ipport_reservedhigh VNET_INET(ipport_reservedhigh) -#define V_ipport_reservedlow VNET_INET(ipport_reservedlow) -#define V_ipport_stoprandom VNET_INET(ipport_stoprandom) -#define V_ipport_tcpallocs VNET_INET(ipport_tcpallocs) -#define V_ipport_tcplastcount VNET_INET(ipport_tcplastcount) -#define V_ipq VNET_INET(ipq) -#define V_ipq_zone VNET_INET(ipq_zone) -#define V_ipsendredirects VNET_INET(ipsendredirects) -#define V_ipstat VNET_INET(ipstat) -#define V_ipstealth VNET_INET(ipstealth) -#define V_isn_last_reseed VNET_INET(isn_last_reseed) -#define V_isn_offset VNET_INET(isn_offset) -#define V_isn_offset_old VNET_INET(isn_offset_old) -#define V_isn_secret VNET_INET(isn_secret) -#define V_llinfo_arp VNET_INET(llinfo_arp) -#define V_log_redirect VNET_INET(log_redirect) -#define V_maxfragsperpacket VNET_INET(maxfragsperpacket) -#define V_maxnipq VNET_INET(maxnipq) -#define V_nipq VNET_INET(nipq) -#define V_nolocaltimewait VNET_INET(nolocaltimewait) -#define V_path_mtu_discovery VNET_INET(path_mtu_discovery) -#define V_reply_src VNET_INET(reply_src) -#define V_ripcb VNET_INET(ripcb) -#define V_ripcbinfo VNET_INET(ripcbinfo) -#define V_router_info_head VNET_INET(router_info_head) -#define V_rsvp_on VNET_INET(rsvp_on) -#define V_rtq_minreallyold VNET_INET(rtq_minreallyold) -#define V_rtq_reallyold VNET_INET(rtq_reallyold) -#define V_rtq_timeout VNET_INET(rtq_timeout) -#define V_rtq_timer VNET_INET(rtq_timer) -#define V_rtq_toomany VNET_INET(rtq_toomany) -#define V_sack_hole_zone VNET_INET(sack_hole_zone) -#define V_sameprefixcarponly VNET_INET(sameprefixcarponly) -#define V_ss_fltsz VNET_INET(ss_fltsz) -#define V_ss_fltsz_local VNET_INET(ss_fltsz_local) -#define V_subnetsarelocal VNET_INET(subnetsarelocal) -#define V_tcb VNET_INET(tcb) -#define V_tcbinfo VNET_INET(tcbinfo) -#define V_tcpcb_zone VNET_INET(tcpcb_zone) -#define V_tcptw_zone VNET_INET(tcptw_zone) -#define V_tcp_abc_l_var VNET_INET(tcp_abc_l_var) -#define V_tcp_autorcvbuf_inc VNET_INET(tcp_autorcvbuf_inc) -#define V_tcp_autorcvbuf_max VNET_INET(tcp_autorcvbuf_max) -#define V_tcp_autosndbuf_inc VNET_INET(tcp_autosndbuf_inc) -#define V_tcp_autosndbuf_max VNET_INET(tcp_autosndbuf_max) -#define V_tcp_delack_enabled VNET_INET(tcp_delack_enabled) -#define V_tcp_do_autorcvbuf VNET_INET(tcp_do_autorcvbuf) -#define V_tcp_do_autosndbuf VNET_INET(tcp_do_autosndbuf) -#define V_tcp_do_ecn VNET_INET(tcp_do_ecn) -#define V_tcp_do_newreno VNET_INET(tcp_do_newreno) -#define V_tcp_do_rfc1323 VNET_INET(tcp_do_rfc1323) -#define V_tcp_do_rfc3042 VNET_INET(tcp_do_rfc3042) -#define V_tcp_do_rfc3390 VNET_INET(tcp_do_rfc3390) -#define V_tcp_do_rfc3465 VNET_INET(tcp_do_rfc3465) -#define V_tcp_do_sack VNET_INET(tcp_do_sack) -#define V_tcp_do_tso VNET_INET(tcp_do_tso) -#define V_tcp_ecn_maxretries VNET_INET(tcp_ecn_maxretries) -#define V_tcp_hc_callout VNET_INET(tcp_hc_callout) -#define V_tcp_hostcache VNET_INET(tcp_hostcache) -#define V_tcp_inflight_enable VNET_INET(tcp_inflight_enable) -#define V_tcp_inflight_max VNET_INET(tcp_inflight_max) -#define V_tcp_inflight_min VNET_INET(tcp_inflight_min) -#define V_tcp_inflight_rttthresh VNET_INET(tcp_inflight_rttthresh) -#define V_tcp_inflight_stab VNET_INET(tcp_inflight_stab) -#define V_tcp_insecure_rst VNET_INET(tcp_insecure_rst) -#define V_tcp_isn_reseed_interval VNET_INET(tcp_isn_reseed_interval) -#define V_tcp_minmss VNET_INET(tcp_minmss) -#define V_tcp_mssdflt VNET_INET(tcp_mssdflt) -#define V_tcp_reass_maxqlen VNET_INET(tcp_reass_maxqlen) -#define V_tcp_reass_maxseg VNET_INET(tcp_reass_maxseg) -#define V_tcp_reass_overflows VNET_INET(tcp_reass_overflows) -#define V_tcp_reass_qsize VNET_INET(tcp_reass_qsize) -#define V_tcp_reass_zone VNET_INET(tcp_reass_zone) -#define V_tcp_sack_globalholes VNET_INET(tcp_sack_globalholes) -#define V_tcp_sack_globalmaxholes VNET_INET(tcp_sack_globalmaxholes) -#define V_tcp_sack_maxholes VNET_INET(tcp_sack_maxholes) -#define V_tcp_sc_rst_sock_fail VNET_INET(tcp_sc_rst_sock_fail) -#define V_tcp_syncache VNET_INET(tcp_syncache) -#define V_tcp_syncookies VNET_INET(tcp_syncookies) -#define V_tcp_syncookiesonly VNET_INET(tcp_syncookiesonly) -#define V_tcp_v6mssdflt VNET_INET(tcp_v6mssdflt) -#define V_tcpstat VNET_INET(tcpstat) -#define V_twq_2msl VNET_INET(twq_2msl) -#define V_udb VNET_INET(udb) -#define V_udbinfo VNET_INET(udbinfo) -#define V_udpcb_zone VNET_INET(udpcb_zone) -#define V_udp_blackhole VNET_INET(udp_blackhole) -#define V_udpstat VNET_INET(udpstat) -#define V_useloopback VNET_INET(useloopback) - -#define ip_newid() ((V_ip_do_randomid != 0) ? ip_randomid() : htons(V_ip_id++)) - -#endif /* !_NETINET_VINET_H_ */ |