Changeset View
Changeset View
Standalone View
Standalone View
sys/net/vnet.c
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
* - Virtual network stack memory allocator, which virtualizes global | * - Virtual network stack memory allocator, which virtualizes global | ||||
* variables in the network stack | * variables in the network stack | ||||
* | * | ||||
* - Virtualized SYSINIT's/SYSUNINIT's, which allow network stack subsystems | * - Virtualized SYSINIT's/SYSUNINIT's, which allow network stack subsystems | ||||
* to register startup/shutdown events to be run for each virtual network | * to register startup/shutdown events to be run for each virtual network | ||||
* stack instance. | * stack instance. | ||||
*/ | */ | ||||
FEATURE(vimage, "VIMAGE kernel virtualization"); | |||||
static MALLOC_DEFINE(M_VNET, "vnet", "network stack control block"); | static MALLOC_DEFINE(M_VNET, "vnet", "network stack control block"); | ||||
/* | /* | ||||
* The virtual network stack list has two read-write locks, one sleepable and | * The virtual network stack list has two read-write locks, one sleepable and | ||||
* the other not, so that the list can be stablized and walked in a variety | * the other not, so that the list can be stablized and walked in a variety | ||||
* of network stack contexts. Both must be acquired exclusively to modify | * of network stack contexts. Both must be acquired exclusively to modify | ||||
* the list, but a read lock of either lock is sufficient to walk the list. | * the list, but a read lock of either lock is sufficient to walk the list. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | |||||
vnet_init_prelink(void *arg __unused) | vnet_init_prelink(void *arg __unused) | ||||
{ | { | ||||
rw_init(&vnet_rwlock, "vnet_rwlock"); | rw_init(&vnet_rwlock, "vnet_rwlock"); | ||||
sx_init(&vnet_sxlock, "vnet_sxlock"); | sx_init(&vnet_sxlock, "vnet_sxlock"); | ||||
sx_init(&vnet_sysinit_sxlock, "vnet_sysinit_sxlock"); | sx_init(&vnet_sysinit_sxlock, "vnet_sysinit_sxlock"); | ||||
LIST_INIT(&vnet_head); | LIST_INIT(&vnet_head); | ||||
} | } | ||||
SYSINIT(vnet_init_prelink, SI_SUB_VNET_PRELINK, SI_ORDER_FIRST, | SYSINIT(vnet_init_prelink, SI_SUB_VIMAGE_PRELINK, SI_ORDER_FIRST, | ||||
vnet_init_prelink, NULL); | vnet_init_prelink, NULL); | ||||
static void | static void | ||||
vnet0_init(void *arg __unused) | vnet0_init(void *arg __unused) | ||||
{ | { | ||||
if (bootverbose) | if (bootverbose) | ||||
printf("VIMAGE (virtualized network stack) enabled\n"); | printf("VIMAGE (virtualized network stack) enabled\n"); | ||||
▲ Show 20 Lines • Show All 487 Lines • Show Last 20 Lines |