Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/in_pcb.c
Show First 20 Lines • Show All 623 Lines • ▼ Show 20 Lines | #endif | ||||
* to be cleaned up. | * to be cleaned up. | ||||
*/ | */ | ||||
inp->inp_route.ro_flags = RT_LLE_CACHE; | inp->inp_route.ro_flags = RT_LLE_CACHE; | ||||
#ifdef TCPHPTS | #ifdef TCPHPTS | ||||
/* | /* | ||||
* If using hpts lets drop a random number in so | * If using hpts lets drop a random number in so | ||||
* not all new connections fall on the same CPU. | * not all new connections fall on the same CPU. | ||||
*/ | */ | ||||
inp->inp_hpts_cpu = inp->inp_input_cpu = hpts_random_cpu(inp); | inp->inp_hpts_cpu = inp->inp_dropq_cpu = hpts_random_cpu(inp); | ||||
#endif | #endif | ||||
refcount_init(&inp->inp_refcount, 1); /* Reference from socket. */ | refcount_init(&inp->inp_refcount, 1); /* Reference from socket. */ | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
INP_INFO_WLOCK(pcbinfo); | INP_INFO_WLOCK(pcbinfo); | ||||
pcbinfo->ipi_count++; | pcbinfo->ipi_count++; | ||||
inp->inp_gencnt = ++pcbinfo->ipi_gencnt; | inp->inp_gencnt = ++pcbinfo->ipi_gencnt; | ||||
CK_LIST_INSERT_HEAD(&pcbinfo->ipi_listhead, inp, inp_list); | CK_LIST_INSERT_HEAD(&pcbinfo->ipi_listhead, inp, inp_list); | ||||
INP_INFO_WUNLOCK(pcbinfo); | INP_INFO_WUNLOCK(pcbinfo); | ||||
▲ Show 20 Lines • Show All 1,114 Lines • ▼ Show 20 Lines | in_pcbrele_rlocked(struct inpcb *inp) | ||||
INP_RLOCK_ASSERT(inp); | INP_RLOCK_ASSERT(inp); | ||||
if (refcount_release(&inp->inp_refcount) == 0) | if (refcount_release(&inp->inp_refcount) == 0) | ||||
return (false); | return (false); | ||||
MPASS(inp->inp_flags & INP_FREED); | MPASS(inp->inp_flags & INP_FREED); | ||||
MPASS(inp->inp_socket == NULL); | MPASS(inp->inp_socket == NULL); | ||||
MPASS(inp->inp_in_hpts == 0); | MPASS(inp->inp_in_hpts == 0); | ||||
MPASS(inp->inp_in_input == 0); | MPASS(inp->inp_in_dropq == 0); | ||||
INP_RUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
uma_zfree_smr(inp->inp_pcbinfo->ipi_zone, inp); | uma_zfree_smr(inp->inp_pcbinfo->ipi_zone, inp); | ||||
return (true); | return (true); | ||||
} | } | ||||
bool | bool | ||||
in_pcbrele_wlocked(struct inpcb *inp) | in_pcbrele_wlocked(struct inpcb *inp) | ||||
{ | { | ||||
INP_WLOCK_ASSERT(inp); | INP_WLOCK_ASSERT(inp); | ||||
if (refcount_release(&inp->inp_refcount) == 0) | if (refcount_release(&inp->inp_refcount) == 0) | ||||
return (false); | return (false); | ||||
MPASS(inp->inp_flags & INP_FREED); | MPASS(inp->inp_flags & INP_FREED); | ||||
MPASS(inp->inp_socket == NULL); | MPASS(inp->inp_socket == NULL); | ||||
MPASS(inp->inp_in_hpts == 0); | MPASS(inp->inp_in_hpts == 0); | ||||
MPASS(inp->inp_in_input == 0); | MPASS(inp->inp_in_dropq == 0); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
uma_zfree_smr(inp->inp_pcbinfo->ipi_zone, inp); | uma_zfree_smr(inp->inp_pcbinfo->ipi_zone, inp); | ||||
return (true); | return (true); | ||||
} | } | ||||
/* | /* | ||||
* Unconditionally schedule an inpcb to be freed by decrementing its | * Unconditionally schedule an inpcb to be freed by decrementing its | ||||
* reference count, which should occur only after the inpcb has been detached | * reference count, which should occur only after the inpcb has been detached | ||||
▲ Show 20 Lines • Show All 1,522 Lines • Show Last 20 Lines |