Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/tom/t4_tom.c
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
#include "common/t4_regs.h" | #include "common/t4_regs.h" | ||||
#include "common/t4_regs_values.h" | #include "common/t4_regs_values.h" | ||||
#include "common/t4_tcb.h" | #include "common/t4_tcb.h" | ||||
#include "t4_clip.h" | #include "t4_clip.h" | ||||
#include "tom/t4_tom_l2t.h" | #include "tom/t4_tom_l2t.h" | ||||
#include "tom/t4_tom.h" | #include "tom/t4_tom.h" | ||||
#include "tom/t4_tls.h" | #include "tom/t4_tls.h" | ||||
static struct protosw *tcp_protosw; | |||||
static struct protosw toe_protosw; | static struct protosw toe_protosw; | ||||
static struct pr_usrreqs toe_usrreqs; | static struct pr_usrreqs toe_usrreqs; | ||||
static struct protosw *tcp6_protosw; | |||||
static struct protosw toe6_protosw; | static struct protosw toe6_protosw; | ||||
static struct pr_usrreqs toe6_usrreqs; | static struct pr_usrreqs toe6_usrreqs; | ||||
/* Module ops */ | /* Module ops */ | ||||
static int t4_tom_mod_load(void); | static int t4_tom_mod_load(void); | ||||
static int t4_tom_mod_unload(void); | static int t4_tom_mod_unload(void); | ||||
static int t4_tom_modevent(module_t, int, void *); | static int t4_tom_modevent(module_t, int, void *); | ||||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | offload_socket(struct socket *so, struct toepcb *toep) | ||||
in_pcbref(inp); | in_pcbref(inp); | ||||
/* Add the TOE PCB to the active list */ | /* Add the TOE PCB to the active list */ | ||||
mtx_lock(&td->toep_list_lock); | mtx_lock(&td->toep_list_lock); | ||||
TAILQ_INSERT_HEAD(&td->toep_list, toep, link); | TAILQ_INSERT_HEAD(&td->toep_list, toep, link); | ||||
mtx_unlock(&td->toep_list_lock); | mtx_unlock(&td->toep_list_lock); | ||||
} | } | ||||
void | |||||
restore_so_proto(struct socket *so, bool v6) | |||||
{ | |||||
if (v6) | |||||
so->so_proto = tcp6_protosw; | |||||
else | |||||
so->so_proto = tcp_protosw; | |||||
} | |||||
/* This is _not_ the normal way to "unoffload" a socket. */ | /* This is _not_ the normal way to "unoffload" a socket. */ | ||||
void | void | ||||
undo_offload_socket(struct socket *so) | undo_offload_socket(struct socket *so) | ||||
{ | { | ||||
struct inpcb *inp = sotoinpcb(so); | struct inpcb *inp = sotoinpcb(so); | ||||
struct tcpcb *tp = intotcpcb(inp); | struct tcpcb *tp = intotcpcb(inp); | ||||
struct toepcb *toep = tp->t_toe; | struct toepcb *toep = tp->t_toe; | ||||
struct tom_data *td = toep->td; | struct tom_data *td = toep->td; | ||||
struct sockbuf *sb; | struct sockbuf *sb; | ||||
INP_WLOCK_ASSERT(inp); | INP_WLOCK_ASSERT(inp); | ||||
sb = &so->so_snd; | sb = &so->so_snd; | ||||
SOCKBUF_LOCK(sb); | SOCKBUF_LOCK(sb); | ||||
sb->sb_flags &= ~SB_NOCOALESCE; | sb->sb_flags &= ~SB_NOCOALESCE; | ||||
SOCKBUF_UNLOCK(sb); | SOCKBUF_UNLOCK(sb); | ||||
sb = &so->so_rcv; | sb = &so->so_rcv; | ||||
SOCKBUF_LOCK(sb); | SOCKBUF_LOCK(sb); | ||||
sb->sb_flags &= ~SB_NOCOALESCE; | sb->sb_flags &= ~SB_NOCOALESCE; | ||||
restore_so_proto(so, inp->inp_vflag & INP_IPV6); | |||||
SOCKBUF_UNLOCK(sb); | SOCKBUF_UNLOCK(sb); | ||||
tp->tod = NULL; | tp->tod = NULL; | ||||
tp->t_toe = NULL; | tp->t_toe = NULL; | ||||
tp->t_flags &= ~TF_TOE; | tp->t_flags &= ~TF_TOE; | ||||
toep->inp = NULL; | toep->inp = NULL; | ||||
toep->flags &= ~TPF_ATTACHED; | toep->flags &= ~TPF_ATTACHED; | ||||
▲ Show 20 Lines • Show All 1,539 Lines • ▼ Show 20 Lines | t4_ctloutput_tom(struct socket *so, struct sockopt *sopt) | ||||
default: | default: | ||||
return (tcp_ctloutput(so, sopt)); | return (tcp_ctloutput(so, sopt)); | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
t4_tom_mod_load(void) | t4_tom_mod_load(void) | ||||
{ | { | ||||
struct protosw *tcp_protosw, *tcp6_protosw; | |||||
/* CPL handlers */ | /* CPL handlers */ | ||||
t4_register_cpl_handler(CPL_GET_TCB_RPL, do_get_tcb_rpl); | t4_register_cpl_handler(CPL_GET_TCB_RPL, do_get_tcb_rpl); | ||||
t4_register_shared_cpl_handler(CPL_L2T_WRITE_RPL, do_l2t_write_rpl2, | t4_register_shared_cpl_handler(CPL_L2T_WRITE_RPL, do_l2t_write_rpl2, | ||||
CPL_COOKIE_TOM); | CPL_COOKIE_TOM); | ||||
t4_init_connect_cpl_handlers(); | t4_init_connect_cpl_handlers(); | ||||
t4_init_listen_cpl_handlers(); | t4_init_listen_cpl_handlers(); | ||||
t4_init_cpl_io_handlers(); | t4_init_cpl_io_handlers(); | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |