Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if.c
Show First 20 Lines • Show All 300 Lines • ▼ Show 20 Lines | |||||
/* Table of ifnet by index. */ | /* Table of ifnet by index. */ | ||||
VNET_DEFINE(struct ifnet **, ifindex_table); | VNET_DEFINE(struct ifnet **, ifindex_table); | ||||
#define V_if_indexlim VNET(if_indexlim) | #define V_if_indexlim VNET(if_indexlim) | ||||
#define V_ifindex_table VNET(ifindex_table) | #define V_ifindex_table VNET(ifindex_table) | ||||
/* | /* | ||||
* The global network interface list (V_ifnet) and related state (such as | * The global network interface list (V_ifnet) and related state (such as | ||||
* if_index, if_indexlim, and ifindex_table) are protected by an sxlock and | * if_index, if_indexlim, and ifindex_table) are protected by an sxlock. | ||||
* an rwlock. Either may be acquired shared to stablize the list, but both | * This may be acquired to stabilise the list, or we may rely on NET_EPOCH. | ||||
* must be acquired writable to modify the list. This model allows us to | |||||
* both stablize the interface list during interrupt thread processing, but | |||||
* also to stablize it over long-running ioctls, without introducing priority | |||||
* inversions and deadlocks. | |||||
*/ | */ | ||||
struct rwlock ifnet_rwlock; | |||||
RW_SYSINIT_FLAGS(ifnet_rw, &ifnet_rwlock, "ifnet_rw", RW_RECURSE); | |||||
struct sx ifnet_sxlock; | struct sx ifnet_sxlock; | ||||
SX_SYSINIT_FLAGS(ifnet_sx, &ifnet_sxlock, "ifnet_sx", SX_RECURSE); | SX_SYSINIT_FLAGS(ifnet_sx, &ifnet_sxlock, "ifnet_sx", SX_RECURSE); | ||||
/* | /* | ||||
* The allocation of network interfaces is a rather non-atomic affair; we | * The allocation of network interfaces is a rather non-atomic affair; we | ||||
* need to select an index before we are ready to expose the interface for | * need to select an index before we are ready to expose the interface for | ||||
* use, so will use this pointer value to indicate reservation. | * use, so will use this pointer value to indicate reservation. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 4,191 Lines • Show Last 20 Lines |