Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_hpts.c
Show First 20 Lines • Show All 573 Lines • ▼ Show 20 Lines | if (hpts_num != inp->inp_input_cpu) { | ||||
goto again; | goto again; | ||||
} | } | ||||
return (hpts); | return (hpts); | ||||
} | } | ||||
static void | static void | ||||
tcp_remove_hpts_ref(struct inpcb *inp, struct tcp_hpts_entry *hpts, int line) | tcp_remove_hpts_ref(struct inpcb *inp, struct tcp_hpts_entry *hpts, int line) | ||||
{ | { | ||||
int32_t add_freed; | |||||
int32_t ret; | int32_t ret; | ||||
if (inp->inp_flags2 & INP_FREED) { | |||||
/* | |||||
* Need to play a special trick so that in_pcbrele_wlocked | |||||
* does not return 1 when it really should have returned 0. | |||||
*/ | |||||
add_freed = 1; | |||||
inp->inp_flags2 &= ~INP_FREED; | |||||
} else { | |||||
add_freed = 0; | |||||
} | |||||
#ifndef INP_REF_DEBUG | |||||
ret = in_pcbrele_wlocked(inp); | ret = in_pcbrele_wlocked(inp); | ||||
#else | |||||
ret = __in_pcbrele_wlocked(inp, line); | |||||
#endif | |||||
KASSERT(ret != 1, ("inpcb:%p release ret 1", inp)); | KASSERT(ret != 1, ("inpcb:%p release ret 1", inp)); | ||||
if (add_freed) { | |||||
inp->inp_flags2 |= INP_FREED; | |||||
} | } | ||||
} | |||||
static void | static void | ||||
tcp_hpts_remove_locked_output(struct tcp_hpts_entry *hpts, struct inpcb *inp, int32_t flags, int32_t line) | tcp_hpts_remove_locked_output(struct tcp_hpts_entry *hpts, struct inpcb *inp, int32_t flags, int32_t line) | ||||
{ | { | ||||
if (inp->inp_in_hpts) { | if (inp->inp_in_hpts) { | ||||
hpts_sane_pace_remove(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], 1); | hpts_sane_pace_remove(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], 1); | ||||
tcp_remove_hpts_ref(inp, hpts, line); | tcp_remove_hpts_ref(inp, hpts, line); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 673 Lines • ▼ Show 20 Lines | while ((inp = TAILQ_FIRST(&hpts->p_input)) != NULL) { | ||||
hpts->p_inp = inp; | hpts->p_inp = inp; | ||||
drop_reason = inp->inp_hpts_drop_reas; | drop_reason = inp->inp_hpts_drop_reas; | ||||
inp->inp_in_input = 0; | inp->inp_in_input = 0; | ||||
mtx_unlock(&hpts->p_mtx); | mtx_unlock(&hpts->p_mtx); | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
CURVNET_SET(inp->inp_vnet); | CURVNET_SET(inp->inp_vnet); | ||||
#endif | #endif | ||||
if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) || | if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED))) { | ||||
(inp->inp_flags2 & INP_FREED)) { | |||||
out: | out: | ||||
hpts->p_inp = NULL; | hpts->p_inp = NULL; | ||||
if (in_pcbrele_wlocked(inp) == 0) { | if (in_pcbrele_wlocked(inp) == 0) { | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
} | } | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | while ((inp = TAILQ_FIRST(&hpts->p_hptss[hpts->p_runningslot])) != NULL) { | ||||
inp->inp_in_hpts = 0; | inp->inp_in_hpts = 0; | ||||
mtx_unlock(&hpts->p_mtx); | mtx_unlock(&hpts->p_mtx); | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
if (in_pcbrele_wlocked(inp)) { | if (in_pcbrele_wlocked(inp)) { | ||||
mtx_lock(&hpts->p_mtx); | mtx_lock(&hpts->p_mtx); | ||||
hpts->p_inp = NULL; | hpts->p_inp = NULL; | ||||
continue; | continue; | ||||
} | } | ||||
if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) || | if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED))) { | ||||
(inp->inp_flags2 & INP_FREED)) { | |||||
out_now: | out_now: | ||||
KASSERT(mtx_owned(&hpts->p_mtx) == 0, | KASSERT(mtx_owned(&hpts->p_mtx) == 0, | ||||
("Hpts:%p owns mtx prior-to lock line:%d", | ("Hpts:%p owns mtx prior-to lock line:%d", | ||||
hpts, __LINE__)); | hpts, __LINE__)); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
mtx_lock(&hpts->p_mtx); | mtx_lock(&hpts->p_mtx); | ||||
hpts->p_inp = NULL; | hpts->p_inp = NULL; | ||||
continue; | continue; | ||||
▲ Show 20 Lines • Show All 694 Lines • Show Last 20 Lines |