opnsense-src/sys/dev/cxgb/ulp/tom
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
..
cxgb_cpl_io.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
cxgb_cpl_socket.c update callers of vm_fault_hold_user_pages 2008-09-30 23:45:22 +00:00
cxgb_ddp.c update callers of vm_fault_hold_user_pages 2008-09-30 23:45:22 +00:00
cxgb_defs.h Fix issue with tom loading by moving cxgb_log_tcb in to tom 2008-09-19 21:12:19 +00:00
cxgb_l2t.c This main goals of this project are: 2008-12-15 06:10:57 +00:00
cxgb_l2t.h This main goals of this project are: 2008-12-15 06:10:57 +00:00
cxgb_listen.c - Remove default NIC dependency on ulp headers 2008-09-24 01:19:08 +00:00
cxgb_t3_ddp.h Update cxgb include paths to not require prefixing with dev/cxgb 2008-09-23 03:16:54 +00:00
cxgb_tcp.h Fix loading for case where we don't overload tcp_usrreqs by calling tcp_drop directly 2008-01-27 04:39:38 +00:00
cxgb_tcp_offload.c Update cxgb include paths to not require prefixing with dev/cxgb 2008-09-23 03:16:54 +00:00
cxgb_tcp_offload.h fix includes for post sockbuf re-factor 2008-07-30 20:08:34 +00:00
cxgb_toepcb.h Update cxgb include paths to not require prefixing with dev/cxgb 2008-09-23 03:16:54 +00:00
cxgb_tom.c Update firmware version check 2008-11-12 04:45:09 +00:00
cxgb_tom.h - Remove default NIC dependency on ulp headers 2008-09-24 01:19:08 +00:00
cxgb_tom_sysctl.c Update firmware version check 2008-11-12 04:45:09 +00:00
cxgb_vm.c Refactor vm_fault_hold_user_pages: 2008-09-30 23:44:44 +00:00
cxgb_vm.h Refactor vm_fault_hold_user_pages: 2008-09-30 23:44:44 +00:00