freebsd-dev/sys/net
Marko Zec 21ca7b57bd Change the curvnet variable from a global const struct vnet *,
previously always pointing to the default vnet context, to a
dynamically changing thread-local one.  The currvnet context
should be set on entry to networking code via CURVNET_SET() macros,
and reverted to previous state via CURVNET_RESTORE().  Recursions
on curvnet are permitted, though strongly discuouraged.

This change should have no functional impact on nooptions VIMAGE
kernel builds, where CURVNET_* macros expand to whitespace.

The curthread->td_vnet (aka curvnet) variable's purpose is to be an
indicator of the vnet context in which the current network-related
operation takes place, in case we cannot deduce the current vnet
context from any other source, such as by looking at mbuf's
m->m_pkthdr.rcvif->if_vnet, sockets's so->so_vnet etc.  Moreover, so
far curvnet has turned out to be an invaluable consistency checking
aid: it helps to catch cases when sockets, ifnets or any other
vnet-aware structures may have leaked from one vnet to another.

The exact placement of the CURVNET_SET() / CURVNET_RESTORE() macros
was a result of an empirical iterative process, whith an aim to
reduce recursions on CURVNET_SET() to a minimum, while still reducing
the scope of CURVNET_SET() to networking only operations - the
alternative would be calling CURVNET_SET() on each system call entry.
In general, curvnet has to be set in three typicall cases: when
processing socket-related requests from userspace or from within the
kernel; when processing inbound traffic flowing from device drivers
to upper layers of the networking stack, and when executing
timer-driven networking functions.

This change also introduces a DDB subcommand to show the list of all
vnet instances.

Approved by:	julian (mentor)
2009-05-05 10:56:12 +00:00
..
bpf_buffer.c Fill in BPF sysctl descriptions. 2008-07-25 23:58:09 +00:00
bpf_buffer.h Introduce support for zero-copy BPF buffering, which reduces the 2008-03-24 13:49:17 +00:00
bpf_filter.c Fix the last missing parentheses for a return statement in bpf_filter.c. 2008-08-29 20:00:55 +00:00
bpf_jitter.c Initialize scratch memory for JIT-compiled filter when it is allocated. 2008-08-28 16:40:51 +00:00
bpf_jitter.h Fix a typo in copyrights. 2008-08-25 20:43:13 +00:00
bpf_zerocopy.c Clarify some comments, fix some types, and rename ZBUF_FLAG_IMMUTABLE to 2009-03-07 10:21:37 +00:00
bpf_zerocopy.h Make sure we are clearing the ZBUF_FLAG_IMMUTABLE any time a free buffer 2008-07-05 20:11:28 +00:00
bpf.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
bpf.h Sync DLTs with latest libpcap version. 2009-04-02 13:02:12 +00:00
bpfdesc.h Remove trailing ';' in BPFD_LOCK_ASSERT macro. 2008-08-01 22:08:14 +00:00
bridgestp.c replace IFQ_ENQUEUE + if_start with if_transmit 2009-04-27 22:46:26 +00:00
bridgestp.h Fix spelling. 2007-12-09 20:47:12 +00:00
ethernet.h Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
fddi.h
firewire.h
flowtable.c remove gratuitous memory barrier, a remnant of unified L2 / L3 2009-04-27 22:45:19 +00:00
flowtable.h - Import infrastructure for caching flows as a means of accelerating L3 and L2 lookups 2009-04-19 00:16:04 +00:00
ieee8023ad_lacp.c Use the flowid if its available for selecting the tx port. 2009-04-30 14:25:44 +00:00
ieee8023ad_lacp.h
if_arc.h Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_arcsubr.c remove call to IFQ_HANDOFF is it called by if_transmit in the default case 2009-04-27 22:44:26 +00:00
if_arp.h
if_atm.h Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_atmsubr.c Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_bridge.c Reorder the bridge add and delete routines to avoid calling ifpromisc() with 2009-05-01 19:46:42 +00:00
if_bridgevar.h
if_clone.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
if_clone.h Fix clone destruction, can't use the simple api because that does not remove 2008-09-20 19:38:37 +00:00
if_dead.c During if_detach(), invoke if_dead() to set the ifnet's function 2009-04-23 11:51:53 +00:00
if_disc.c Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_dl.h
if_edsc.c Give a hint that softc can contain many things besides ifp. 2007-03-26 09:05:10 +00:00
if_ef.c replace IFQ_HANDOFF with if_transmit 2009-04-27 22:45:56 +00:00
if_enc.c Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_enc.h Increase statistic counters for enc0 interface when enabled 2008-08-12 09:05:01 +00:00
if_ethersubr.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
if_faith.c Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_fddisubr.c Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_fwsubr.c Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_gif.c Permit buiding kernels with options VIMAGE, restricted to only a single 2009-04-30 13:36:26 +00:00
if_gif.h Make indentation more uniform accross vnet container structs. 2009-05-02 08:16:26 +00:00
if_gre.c Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_gre.h Add support for the optional key in the GRE header. 2008-06-20 17:26:34 +00:00
if_iso88025subr.c Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_lagg.c Use the flowid if its available for selecting the tx port. 2009-04-30 14:25:44 +00:00
if_lagg.h Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_llatbl.c clarify state of llentry that is passed back 2009-04-17 18:48:50 +00:00
if_llatbl.h add utility routine for updating an struct llentry * 2009-04-16 22:04:07 +00:00
if_llc.h
if_loop.c In preparation for turning on options VIMAGE in next commits, 2009-04-26 22:06:42 +00:00
if_media.c
if_media.h Add TWINAX (Twin Axial Copper for 10G networking) media types. 2008-12-17 22:59:29 +00:00
if_mib.c Permit buiding kernels with options VIMAGE, restricted to only a single 2009-04-30 13:36:26 +00:00
if_mib.h
if_sppp.h
if_spppfr.c
if_spppsubr.c Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
if_stf.c Prefer ifa_link (structure field) to ifa_list (macro alias for it). 2009-04-20 22:41:19 +00:00
if_stf.h
if_tap.c Remove the splimp()/splx() calls around the setting of the MTU. They are 2009-03-17 02:32:36 +00:00
if_tap.h Add new TAPGIFNAME tap(4) character device ioctl. This is a 2008-09-08 22:43:55 +00:00
if_tapvar.h
if_tun.c Acquire interfce address list lock while walking the interface address 2009-04-20 23:25:38 +00:00
if_tun.h
if_types.h
if_var.h Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
if_vlan_var.h
if_vlan.c The vlan code has not required the miibus code since 6.0 when 2009-04-17 17:40:47 +00:00
if.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
if.h Add a new interface flag, IFF_DYING, which is set when a device driver 2009-04-23 09:32:30 +00:00
iso88025.h Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
netisr.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
netisr.h Reserve a netisr slot for the IGMPv3 output queue. 2009-03-04 02:54:11 +00:00
pfil.c A few locking fixes and cleanups to pfil hook registration, 2008-12-16 17:03:22 +00:00
pfil.h Line wrap very long line in struct packet_filter_hook definition. 2008-12-13 12:03:21 +00:00
pfkeyv2.h
ppp_defs.h
radix_mpath.c Extend route command: 2009-04-14 23:05:36 +00:00
radix_mpath.h When RADIX_MPATH is enabled, the route selection is not rotating 2008-05-30 09:34:35 +00:00
radix.c remove assertion checks for now - ipfw uses its own lock for protecting its radix tree instance 2008-12-16 11:01:36 +00:00
radix.h - convert radix node head lock from mutex to rwlock 2008-12-07 21:15:43 +00:00
raw_cb.c For all files including net/vnet.h directly include opt_route.h and 2009-02-27 14:12:05 +00:00
raw_cb.h Put a global variables, which were virtualized but formerly 2008-12-11 16:26:38 +00:00
raw_usrreq.c For all files including net/vnet.h directly include opt_route.h and 2009-02-27 14:12:05 +00:00
route.c Unbreak options VIMAGE + nooptions INVARIANTS kernel builds. 2009-05-02 05:02:28 +00:00
route.h Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
rtsock.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
slcompress.c
slcompress.h
vnet.h Make indentation more uniform accross vnet container structs. 2009-05-02 08:16:26 +00:00
zlib.c
zlib.h