FreeBSD/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
/*
 * Set up the socket for TCP offload.
 */
Set up the socket for TCP offload.
Set up the socket for TCP offload .
void
offload_socket(struct socket *so, struct toepcb *toep)
{
	struct toedev *tod = toep->tp_tod;
	struct tom_data *td = t3_tomdata(tod);
	struct inpcb *inp = sotoinpcb(so);
	struct tcpcb *tp = intotcpcb(inp);
	INP_WLOCK_ASSERT(inp);
	SOCKBUF_LOCK(&so->so_snd);
	so_sockbuf_snd(so)->sb_flags |= SB_NOCOALESCE;
	SOCKBUF_UNLOCK(&so->so_snd);
	SOCKBUF_LOCK(&so->so_rcv);
	so_sockbuf_rcv(so)->sb_flags |= SB_NOCOALESCE;
	SOCKBUF_UNLOCK(&so->so_rcv);
	tp->tod = toep->tp_tod;
	tp->t_toe = toep;
	tp->t_flags |= TF_TOE;
	toep->tp_inp = inp;
	toep->tp_flags |= TP_ATTACHED;
	in_pcbref(inp);
	mtx_lock(&td->toep_list_lock);
	TAILQ_INSERT_HEAD(&td->toep_list, toep, link);
	mtx_unlock(&td->toep_list_lock);
}
void offload_socket ( struct socket * so , struct toepcb * toep ) { struct toedev * tod = toep -> tp_tod ; struct tom_data * td = t3_tomdata ( tod ) ; struct inpcb * inp = sotoinpcb ( so ) ; struct tcpcb * tp = intotcpcb ( inp ) ; INP_WLOCK_ASSERT ( inp ) ; SOCKBUF_LOCK ( & so -> so_snd ) ; so_sockbuf_snd ( so ) -> sb_flags |= SB_NOCOALESCE ; SOCKBUF_UNLOCK ( & so -> so_snd ) ; SOCKBUF_LOCK ( & so -> so_rcv ) ; so_sockbuf_rcv ( so ) -> sb_flags |= SB_NOCOALESCE ; SOCKBUF_UNLOCK ( & so -> so_rcv ) ; tp -> tod = toep -> tp_tod ; tp -> t_toe = toep ; tp -> t_flags |= TF_TOE ; toep -> tp_inp = inp ; toep -> tp_flags |= TP_ATTACHED ; in_pcbref ( inp ) ; mtx_lock ( & td -> toep_list_lock ) ; TAILQ_INSERT_HEAD ( & td -> toep_list , toep , link ) ; mtx_unlock ( & td -> toep_list_lock ) ; }
Set up the socket for TCP offload.
Set up the socket for TCP offload .
/* Update socket */ /* Update TCP PCB */ /* Install an extra hold on inp */ /* Add the TOE PCB to the active list */