Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/tom/t4_listen.c
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | static struct listen_ctx *alloc_lctx(struct adapter *, struct inpcb *, | ||||
struct vi_info *); | struct vi_info *); | ||||
static int free_lctx(struct adapter *, struct listen_ctx *); | static int free_lctx(struct adapter *, struct listen_ctx *); | ||||
static void hold_lctx(struct listen_ctx *); | static void hold_lctx(struct listen_ctx *); | ||||
static void listen_hash_add(struct adapter *, struct listen_ctx *); | static void listen_hash_add(struct adapter *, struct listen_ctx *); | ||||
static struct listen_ctx *listen_hash_find(struct adapter *, struct inpcb *); | static struct listen_ctx *listen_hash_find(struct adapter *, struct inpcb *); | ||||
static struct listen_ctx *listen_hash_del(struct adapter *, struct inpcb *); | static struct listen_ctx *listen_hash_del(struct adapter *, struct inpcb *); | ||||
static struct inpcb *release_lctx(struct adapter *, struct listen_ctx *); | static struct inpcb *release_lctx(struct adapter *, struct listen_ctx *); | ||||
static void send_reset_synqe(struct toedev *, struct synq_entry *); | static void send_abort_rpl_synqe(struct toedev *, struct synq_entry *, int); | ||||
static int | static int | ||||
alloc_stid(struct adapter *sc, struct listen_ctx *lctx, int isipv6) | alloc_stid(struct adapter *sc, struct listen_ctx *lctx, int isipv6) | ||||
{ | { | ||||
struct tid_info *t = &sc->tids; | struct tid_info *t = &sc->tids; | ||||
u_int stid, n, f, mask; | u_int stid, n, f, mask; | ||||
struct stid_region *sr = &lctx->stid_region; | struct stid_region *sr = &lctx->stid_region; | ||||
▲ Show 20 Lines • Show All 286 Lines • ▼ Show 20 Lines | send_flowc_wr_synqe(struct adapter *sc, struct synq_entry *synqe) | ||||
flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_MSS; | flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_MSS; | ||||
flowc->mnemval[5].val = htobe32(512); | flowc->mnemval[5].val = htobe32(512); | ||||
synqe->flags |= TPF_FLOWC_WR_SENT; | synqe->flags |= TPF_FLOWC_WR_SENT; | ||||
t4_wrq_tx(sc, wr); | t4_wrq_tx(sc, wr); | ||||
} | } | ||||
static void | static void | ||||
send_reset_synqe(struct toedev *tod, struct synq_entry *synqe) | send_abort_rpl_synqe(struct toedev *tod, struct synq_entry *synqe, | ||||
int rst_status) | |||||
{ | { | ||||
struct adapter *sc = tod->tod_softc; | struct adapter *sc = tod->tod_softc; | ||||
struct wrqe *wr; | struct wrqe *wr; | ||||
struct cpl_abort_req *req; | struct cpl_abort_req *req; | ||||
INP_WLOCK_ASSERT(synqe->lctx->inp); | INP_WLOCK_ASSERT(synqe->lctx->inp); | ||||
CTR5(KTR_CXGBE, "%s: synqe %p (0x%x), tid %d%s", | CTR5(KTR_CXGBE, "%s: synqe %p (0x%x), tid %d%s", | ||||
Show All 11 Lines | send_abort_rpl_synqe(struct toedev *tod, struct synq_entry *synqe, | ||||
if (wr == NULL) { | if (wr == NULL) { | ||||
/* XXX */ | /* XXX */ | ||||
panic("%s: allocation failure.", __func__); | panic("%s: allocation failure.", __func__); | ||||
} | } | ||||
req = wrtod(wr); | req = wrtod(wr); | ||||
INIT_TP_WR_MIT_CPL(req, CPL_ABORT_REQ, synqe->tid); | INIT_TP_WR_MIT_CPL(req, CPL_ABORT_REQ, synqe->tid); | ||||
req->rsvd0 = 0; /* don't have a snd_nxt */ | req->rsvd0 = 0; /* don't have a snd_nxt */ | ||||
req->rsvd1 = 1; /* no data sent yet */ | req->rsvd1 = 1; /* no data sent yet */ | ||||
req->cmd = CPL_ABORT_SEND_RST; | req->cmd = rst_status; | ||||
t4_l2t_send(sc, wr, &sc->l2t->l2tab[synqe->params.l2t_idx]); | t4_l2t_send(sc, wr, &sc->l2t->l2tab[synqe->params.l2t_idx]); | ||||
} | } | ||||
static int | static int | ||||
create_server(struct adapter *sc, struct listen_ctx *lctx) | create_server(struct adapter *sc, struct listen_ctx *lctx) | ||||
{ | { | ||||
struct wrqe *wr; | struct wrqe *wr; | ||||
▲ Show 20 Lines • Show All 1,029 Lines • ▼ Show 20 Lines | #endif | ||||
struct listen_ctx *lctx = synqe->lctx; | struct listen_ctx *lctx = synqe->lctx; | ||||
struct inpcb *inp = lctx->inp, *new_inp; | struct inpcb *inp = lctx->inp, *new_inp; | ||||
struct socket *so; | struct socket *so; | ||||
struct tcphdr th; | struct tcphdr th; | ||||
struct tcpopt to; | struct tcpopt to; | ||||
struct in_conninfo inc; | struct in_conninfo inc; | ||||
struct toepcb *toep; | struct toepcb *toep; | ||||
struct epoch_tracker et; | struct epoch_tracker et; | ||||
int rstreason; | |||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl))); | unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl))); | ||||
#endif | #endif | ||||
KASSERT(opcode == CPL_PASS_ESTABLISH, | KASSERT(opcode == CPL_PASS_ESTABLISH, | ||||
("%s: unexpected opcode 0x%x", __func__, opcode)); | ("%s: unexpected opcode 0x%x", __func__, opcode)); | ||||
KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__)); | KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__)); | ||||
KASSERT(lctx->stid == stid, ("%s: lctx stid mismatch", __func__)); | KASSERT(lctx->stid == stid, ("%s: lctx stid mismatch", __func__)); | ||||
Show All 10 Lines | #endif | ||||
ifp = synqe->syn->m_pkthdr.rcvif; | ifp = synqe->syn->m_pkthdr.rcvif; | ||||
vi = ifp->if_softc; | vi = ifp->if_softc; | ||||
KASSERT(vi->adapter == sc, | KASSERT(vi->adapter == sc, | ||||
("%s: vi %p, sc %p mismatch", __func__, vi, sc)); | ("%s: vi %p, sc %p mismatch", __func__, vi, sc)); | ||||
if (__predict_false(inp->inp_flags & INP_DROPPED)) { | if (__predict_false(inp->inp_flags & INP_DROPPED)) { | ||||
reset: | reset: | ||||
send_reset_synqe(TOEDEV(ifp), synqe); | send_abort_rpl_synqe(TOEDEV(ifp), synqe, CPL_ABORT_SEND_RST); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
return (0); | return (0); | ||||
} | } | ||||
KASSERT(synqe->params.rxq_idx == iq_to_ofld_rxq(iq) - &sc->sge.ofld_rxq[0], | KASSERT(synqe->params.rxq_idx == iq_to_ofld_rxq(iq) - &sc->sge.ofld_rxq[0], | ||||
("%s: CPL arrived on unexpected rxq. %d %d", __func__, | ("%s: CPL arrived on unexpected rxq. %d %d", __func__, | ||||
Show All 16 Lines | reset: | ||||
/* Come up with something that syncache_expand should be ok with. */ | /* Come up with something that syncache_expand should be ok with. */ | ||||
synqe_to_protohdrs(sc, synqe, cpl, &inc, &th, &to); | synqe_to_protohdrs(sc, synqe, cpl, &inc, &th, &to); | ||||
if (inc.inc_flags & INC_ISIPV6) | if (inc.inc_flags & INC_ISIPV6) | ||||
toep->ce = t4_hold_lip(sc, &inc.inc6_laddr, lctx->ce); | toep->ce = t4_hold_lip(sc, &inc.inc6_laddr, lctx->ce); | ||||
so = inp->inp_socket; | so = inp->inp_socket; | ||||
KASSERT(so != NULL, ("%s: socket is NULL", __func__)); | KASSERT(so != NULL, ("%s: socket is NULL", __func__)); | ||||
if (!toe_syncache_expand(&inc, &to, &th, &so) || so == NULL) { | rstreason = toe_syncache_expand(&inc, &to, &th, &so); | ||||
if (rstreason < 0) { | |||||
free_toepcb(toep); | |||||
send_abort_rpl_synqe(TOEDEV(ifp), synqe, CPL_ABORT_NO_RST); | |||||
INP_WUNLOCK(inp); | |||||
NET_EPOCH_EXIT(et); | |||||
CURVNET_RESTORE(); | |||||
return (0); | |||||
} else if (rstreason == 0 || so == NULL) { | |||||
free_toepcb(toep); | free_toepcb(toep); | ||||
goto reset; | goto reset; | ||||
} | } | ||||
/* New connection inpcb is already locked by syncache_expand(). */ | /* New connection inpcb is already locked by syncache_expand(). */ | ||||
new_inp = sotoinpcb(so); | new_inp = sotoinpcb(so); | ||||
INP_WLOCK_ASSERT(new_inp); | INP_WLOCK_ASSERT(new_inp); | ||||
MPASS(so->so_vnet == lctx->vnet); | MPASS(so->so_vnet == lctx->vnet); | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |