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
bpf_buffer.h
bpf_filter.c
bpf_jitter.c
bpf_jitter.h
bpf_zerocopy.c
bpf_zerocopy.h
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
bridgestp.c replace IFQ_ENQUEUE + if_start with if_transmit 2009-04-27 22:46:26 +00:00
bridgestp.h
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
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
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
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
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
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
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
pfil.c
pfil.h
pfkeyv2.h
ppp_defs.h
radix_mpath.c Extend route command: 2009-04-14 23:05:36 +00:00
radix_mpath.h
radix.c
radix.h
raw_cb.c
raw_cb.h
raw_usrreq.c
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