Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/tom/t4_listen.c
Show First 20 Lines • Show All 637 Lines • ▼ Show 20 Lines | t4_listen_stop(struct toedev *tod, struct tcpcb *tp) | ||||
return (0); | return (0); | ||||
} | } | ||||
static inline struct synq_entry * | static inline struct synq_entry * | ||||
alloc_synqe(struct adapter *sc __unused, struct listen_ctx *lctx, int flags) | alloc_synqe(struct adapter *sc __unused, struct listen_ctx *lctx, int flags) | ||||
{ | { | ||||
struct synq_entry *synqe; | struct synq_entry *synqe; | ||||
INP_WLOCK_ASSERT(lctx->inp); | INP_RLOCK_ASSERT(lctx->inp); | ||||
MPASS(flags == M_WAITOK || flags == M_NOWAIT); | MPASS(flags == M_WAITOK || flags == M_NOWAIT); | ||||
synqe = malloc(sizeof(*synqe), M_CXGBE, flags); | synqe = malloc(sizeof(*synqe), M_CXGBE, flags); | ||||
if (__predict_true(synqe != NULL)) { | if (__predict_true(synqe != NULL)) { | ||||
synqe->flags = TPF_SYNQE; | synqe->flags = TPF_SYNQE; | ||||
refcount_init(&synqe->refcnt, 1); | refcount_init(&synqe->refcnt, 1); | ||||
synqe->lctx = lctx; | synqe->lctx = lctx; | ||||
hold_lctx(lctx); /* Every synqe has a ref on its lctx. */ | hold_lctx(lctx); /* Every synqe has a ref on its lctx. */ | ||||
▲ Show 20 Lines • Show All 663 Lines • ▼ Show 20 Lines | found: | ||||
/* Don't offload if the 4-tuple is already in use */ | /* Don't offload if the 4-tuple is already in use */ | ||||
if (toe_4tuple_check(&inc, &th, ifp) != 0) { | if (toe_4tuple_check(&inc, &th, ifp) != 0) { | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
REJECT_PASS_ACCEPT_REQ(false); | REJECT_PASS_ACCEPT_REQ(false); | ||||
} | } | ||||
inp = lctx->inp; /* listening socket, not owned by TOE */ | inp = lctx->inp; /* listening socket, not owned by TOE */ | ||||
INP_WLOCK(inp); | INP_RLOCK(inp); | ||||
/* Don't offload if the listening socket has closed */ | /* Don't offload if the listening socket has closed */ | ||||
if (__predict_false(inp->inp_flags & INP_DROPPED)) { | if (__predict_false(inp->inp_flags & INP_DROPPED)) { | ||||
INP_WUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
REJECT_PASS_ACCEPT_REQ(false); | REJECT_PASS_ACCEPT_REQ(false); | ||||
} | } | ||||
so = inp->inp_socket; | so = inp->inp_socket; | ||||
rw_rlock(&sc->policy_lock); | rw_rlock(&sc->policy_lock); | ||||
settings = *lookup_offload_policy(sc, OPEN_TYPE_PASSIVE, m, | settings = *lookup_offload_policy(sc, OPEN_TYPE_PASSIVE, m, | ||||
EVL_MAKETAG(0xfff, 0, 0), inp); | EVL_MAKETAG(0xfff, 0, 0), inp); | ||||
rw_runlock(&sc->policy_lock); | rw_runlock(&sc->policy_lock); | ||||
if (!settings.offload) { | if (!settings.offload) { | ||||
INP_WUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
REJECT_PASS_ACCEPT_REQ(true); /* Rejected by COP. */ | REJECT_PASS_ACCEPT_REQ(true); /* Rejected by COP. */ | ||||
} | } | ||||
synqe = alloc_synqe(sc, lctx, M_NOWAIT); | synqe = alloc_synqe(sc, lctx, M_NOWAIT); | ||||
if (synqe == NULL) { | if (synqe == NULL) { | ||||
INP_WUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
REJECT_PASS_ACCEPT_REQ(true); | REJECT_PASS_ACCEPT_REQ(true); | ||||
} | } | ||||
MPASS(rss->hash_type == RSS_HASH_TCP); | MPASS(rss->hash_type == RSS_HASH_TCP); | ||||
synqe->rss_hash = be32toh(rss->hash_val); | synqe->rss_hash = be32toh(rss->hash_val); | ||||
atomic_store_int(&synqe->ok_to_respond, 0); | atomic_store_int(&synqe->ok_to_respond, 0); | ||||
init_conn_params(vi, &settings, &inc, so, &cpl->tcpopt, e->idx, | init_conn_params(vi, &settings, &inc, so, &cpl->tcpopt, e->idx, | ||||
▲ Show 20 Lines • Show All 236 Lines • Show Last 20 Lines |