Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/tom/t4_ddp.c
Show First 20 Lines • Show All 603 Lines • ▼ Show 20 Lines | if (toep->ddp.waiting_count == 0) { | ||||
*/ | */ | ||||
return; | return; | ||||
} | } | ||||
CTR3(KTR_CXGBE, "%s: tid %d indicated (%d waiting)", __func__, | CTR3(KTR_CXGBE, "%s: tid %d indicated (%d waiting)", __func__, | ||||
toep->tid, toep->ddp.waiting_count); | toep->tid, toep->ddp.waiting_count); | ||||
ddp_queue_toep(toep); | ddp_queue_toep(toep); | ||||
} | } | ||||
enum { | CTASSERT(CPL_COOKIE_DDP0 + 1 == CPL_COOKIE_DDP1); | ||||
DDP_BUF0_INVALIDATED = 0x2, | |||||
DDP_BUF1_INVALIDATED | |||||
}; | |||||
CTASSERT(DDP_BUF0_INVALIDATED == CPL_COOKIE_DDP0); | |||||
static int | static int | ||||
do_ddp_tcb_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) | do_ddp_tcb_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) | ||||
{ | { | ||||
struct adapter *sc = iq->adapter; | struct adapter *sc = iq->adapter; | ||||
const struct cpl_set_tcb_rpl *cpl = (const void *)(rss + 1); | const struct cpl_set_tcb_rpl *cpl = (const void *)(rss + 1); | ||||
unsigned int tid = GET_TID(cpl); | unsigned int tid = GET_TID(cpl); | ||||
unsigned int db_idx; | unsigned int db_idx; | ||||
struct toepcb *toep; | struct toepcb *toep; | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
struct ddp_buffer *db; | struct ddp_buffer *db; | ||||
struct kaiocb *job; | struct kaiocb *job; | ||||
long copied; | long copied; | ||||
if (cpl->status != CPL_ERR_NONE) | if (cpl->status != CPL_ERR_NONE) | ||||
panic("XXX: tcp_rpl failed: %d", cpl->status); | panic("XXX: tcp_rpl failed: %d", cpl->status); | ||||
toep = lookup_tid(sc, tid); | toep = lookup_tid(sc, tid); | ||||
inp = toep->inp; | inp = toep->inp; | ||||
switch (cpl->cookie) { | switch (cpl->cookie) { | ||||
case V_WORD(W_TCB_RX_DDP_FLAGS) | V_COOKIE(DDP_BUF0_INVALIDATED): | case V_WORD(W_TCB_RX_DDP_FLAGS) | V_COOKIE(CPL_COOKIE_DDP0): | ||||
case V_WORD(W_TCB_RX_DDP_FLAGS) | V_COOKIE(DDP_BUF1_INVALIDATED): | case V_WORD(W_TCB_RX_DDP_FLAGS) | V_COOKIE(CPL_COOKIE_DDP1): | ||||
/* | /* | ||||
* XXX: This duplicates a lot of code with handle_ddp_data(). | * XXX: This duplicates a lot of code with handle_ddp_data(). | ||||
*/ | */ | ||||
db_idx = G_COOKIE(cpl->cookie) - DDP_BUF0_INVALIDATED; | db_idx = G_COOKIE(cpl->cookie) - CPL_COOKIE_DDP0; | ||||
MPASS(db_idx < nitems(toep->ddp.db)); | MPASS(db_idx < nitems(toep->ddp.db)); | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
DDP_LOCK(toep); | DDP_LOCK(toep); | ||||
db = &toep->ddp.db[db_idx]; | db = &toep->ddp.db[db_idx]; | ||||
/* | /* | ||||
* handle_ddp_data() should leave the job around until | * handle_ddp_data() should leave the job around until | ||||
* this callback runs once a cancel is pending. | * this callback runs once a cancel is pending. | ||||
▲ Show 20 Lines • Show All 1,188 Lines • ▼ Show 20 Lines | if (toep->ddp.db[i].job == job) { | ||||
* Invalidate this buffer. It will be | * Invalidate this buffer. It will be | ||||
* cancelled or partially completed once the | * cancelled or partially completed once the | ||||
* card ACKs the invalidate. | * card ACKs the invalidate. | ||||
*/ | */ | ||||
valid_flag = i == 0 ? V_TF_DDP_BUF0_VALID(1) : | valid_flag = i == 0 ? V_TF_DDP_BUF0_VALID(1) : | ||||
V_TF_DDP_BUF1_VALID(1); | V_TF_DDP_BUF1_VALID(1); | ||||
t4_set_tcb_field(sc, toep->ctrlq, toep, | t4_set_tcb_field(sc, toep->ctrlq, toep, | ||||
W_TCB_RX_DDP_FLAGS, valid_flag, 0, 1, | W_TCB_RX_DDP_FLAGS, valid_flag, 0, 1, | ||||
i + DDP_BUF0_INVALIDATED); | CPL_COOKIE_DDP0 + i); | ||||
toep->ddp.db[i].cancel_pending = 1; | toep->ddp.db[i].cancel_pending = 1; | ||||
CTR2(KTR_CXGBE, "%s: request %p marked pending", | CTR2(KTR_CXGBE, "%s: request %p marked pending", | ||||
__func__, job); | __func__, job); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
DDP_UNLOCK(toep); | DDP_UNLOCK(toep); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |