Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/ip_reass.c
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
int count; | int count; | ||||
}; | }; | ||||
VNET_DEFINE_STATIC(struct ipqbucket *, ipq); | VNET_DEFINE_STATIC(struct ipqbucket *, ipq); | ||||
#define V_ipq VNET(ipq) | #define V_ipq VNET(ipq) | ||||
VNET_DEFINE_STATIC(uint32_t, ipq_hashseed); | VNET_DEFINE_STATIC(uint32_t, ipq_hashseed); | ||||
#define V_ipq_hashseed VNET(ipq_hashseed) | #define V_ipq_hashseed VNET(ipq_hashseed) | ||||
VNET_DEFINE_STATIC(uint32_t, ipq_hashsize); | VNET_DEFINE_STATIC(uint32_t, ipq_hashsize) = IPREASS_NHASH; | ||||
#define V_ipq_hashsize VNET(ipq_hashsize) | #define V_ipq_hashsize VNET(ipq_hashsize) | ||||
#define IPQ_LOCK(i) mtx_lock(&V_ipq[i].lock) | #define IPQ_LOCK(i) mtx_lock(&V_ipq[i].lock) | ||||
#define IPQ_TRYLOCK(i) mtx_trylock(&V_ipq[i].lock) | #define IPQ_TRYLOCK(i) mtx_trylock(&V_ipq[i].lock) | ||||
#define IPQ_UNLOCK(i) mtx_unlock(&V_ipq[i].lock) | #define IPQ_UNLOCK(i) mtx_unlock(&V_ipq[i].lock) | ||||
#define IPQ_LOCK_ASSERT(i) mtx_assert(&V_ipq[i].lock, MA_OWNED) | #define IPQ_LOCK_ASSERT(i) mtx_assert(&V_ipq[i].lock, MA_OWNED) | ||||
#define IPQ_BUCKET_LOCK_ASSERT(b) mtx_assert(&(b)->lock, MA_OWNED) | #define IPQ_BUCKET_LOCK_ASSERT(b) mtx_assert(&(b)->lock, MA_OWNED) | ||||
▲ Show 20 Lines • Show All 578 Lines • ▼ Show 20 Lines | |||||
* Initialize IP reassembly structures. | * Initialize IP reassembly structures. | ||||
*/ | */ | ||||
MALLOC_DEFINE(M_IPREASS_HASH, "IP reass", "IP packet reassembly hash headers"); | MALLOC_DEFINE(M_IPREASS_HASH, "IP reass", "IP packet reassembly hash headers"); | ||||
void | void | ||||
ipreass_vnet_init(void) | ipreass_vnet_init(void) | ||||
{ | { | ||||
int max; | int max; | ||||
V_ipq_hashsize = IPREASS_NHASH; | |||||
TUNABLE_INT_FETCH("net.inet.ip.reass_hashsize", &V_ipq_hashsize); | |||||
V_ipq = malloc(sizeof(struct ipqbucket) * V_ipq_hashsize, | V_ipq = malloc(sizeof(struct ipqbucket) * V_ipq_hashsize, | ||||
M_IPREASS_HASH, M_WAITOK); | M_IPREASS_HASH, M_WAITOK); | ||||
for (int i = 0; i < V_ipq_hashsize; i++) { | for (int i = 0; i < V_ipq_hashsize; i++) { | ||||
TAILQ_INIT(&V_ipq[i].head); | TAILQ_INIT(&V_ipq[i].head); | ||||
mtx_init(&V_ipq[i].lock, "IP reassembly", NULL, | mtx_init(&V_ipq[i].lock, "IP reassembly", NULL, | ||||
MTX_DEF | MTX_DUPOK | MTX_NEW); | MTX_DEF | MTX_DUPOK | MTX_NEW); | ||||
callout_init_mtx(&V_ipq[i].timer, &V_ipq[i].lock, 0); | callout_init_mtx(&V_ipq[i].timer, &V_ipq[i].lock, 0); | ||||
▲ Show 20 Lines • Show All 287 Lines • Show Last 20 Lines |