Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/uipc_ktls.c
Show First 20 Lines • Show All 837 Lines • ▼ Show 20 Lines | |||||
ktls_try_toe(struct socket *so, struct ktls_session *tls, int direction) | ktls_try_toe(struct socket *so, struct ktls_session *tls, int direction) | ||||
{ | { | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
struct tcpcb *tp; | struct tcpcb *tp; | ||||
int error; | int error; | ||||
inp = so->so_pcb; | inp = so->so_pcb; | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
if (inp->inp_flags2 & INP_FREED) { | |||||
INP_WUNLOCK(inp); | |||||
return (ECONNRESET); | |||||
} | |||||
if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { | if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
return (ECONNRESET); | return (ECONNRESET); | ||||
} | } | ||||
if (inp->inp_socket == NULL) { | if (inp->inp_socket == NULL) { | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
return (ECONNRESET); | return (ECONNRESET); | ||||
} | } | ||||
Show All 35 Lines | |||||
{ | { | ||||
union if_snd_tag_alloc_params params; | union if_snd_tag_alloc_params params; | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
struct nhop_object *nh; | struct nhop_object *nh; | ||||
struct tcpcb *tp; | struct tcpcb *tp; | ||||
int error; | int error; | ||||
INP_RLOCK(inp); | INP_RLOCK(inp); | ||||
if (inp->inp_flags2 & INP_FREED) { | |||||
INP_RUNLOCK(inp); | |||||
return (ECONNRESET); | |||||
} | |||||
if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { | if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { | ||||
INP_RUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
return (ECONNRESET); | return (ECONNRESET); | ||||
} | } | ||||
if (inp->inp_socket == NULL) { | if (inp->inp_socket == NULL) { | ||||
INP_RUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
return (ECONNRESET); | return (ECONNRESET); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,792 Lines • ▼ Show 20 Lines | ktls_disable_ifnet_help(void *context, int pending __unused) | ||||
tls = context; | tls = context; | ||||
inp = tls->inp; | inp = tls->inp; | ||||
if (inp == NULL) | if (inp == NULL) | ||||
return; | return; | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
so = inp->inp_socket; | so = inp->inp_socket; | ||||
MPASS(so != NULL); | MPASS(so != NULL); | ||||
if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) || | if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { | ||||
(inp->inp_flags2 & INP_FREED)) { | |||||
goto out; | goto out; | ||||
} | } | ||||
if (so->so_snd.sb_tls_info != NULL) | if (so->so_snd.sb_tls_info != NULL) | ||||
err = ktls_set_tx_mode(so, TCP_TLS_MODE_SW); | err = ktls_set_tx_mode(so, TCP_TLS_MODE_SW); | ||||
else | else | ||||
err = ENXIO; | err = ENXIO; | ||||
if (err == 0) { | if (err == 0) { | ||||
counter_u64_add(ktls_ifnet_disable_ok, 1); | counter_u64_add(ktls_ifnet_disable_ok, 1); | ||||
/* ktls_set_tx_mode() drops inp wlock, so recheck flags */ | /* ktls_set_tx_mode() drops inp wlock, so recheck flags */ | ||||
if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0 && | if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0 && | ||||
(inp->inp_flags2 & INP_FREED) == 0 && | |||||
(tp = intotcpcb(inp)) != NULL && | (tp = intotcpcb(inp)) != NULL && | ||||
tp->t_fb->tfb_hwtls_change != NULL) | tp->t_fb->tfb_hwtls_change != NULL) | ||||
(*tp->t_fb->tfb_hwtls_change)(tp, 0); | (*tp->t_fb->tfb_hwtls_change)(tp, 0); | ||||
} else { | } else { | ||||
counter_u64_add(ktls_ifnet_disable_fail, 1); | counter_u64_add(ktls_ifnet_disable_fail, 1); | ||||
} | } | ||||
out: | out: | ||||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |