Index: sys/dev/cxgbe/cxgbei/icl_cxgbei.c =================================================================== --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -589,9 +589,9 @@ CTR4(KTR_CXGBE, "%s: tid %u, ULP_MODE_ISCSI, CRC hdr=%d data=%d", __func__, toep->tid, hcrc, dcrc); - t4_set_tcb_field(sc, toep->ctrlq, toep->tid, W_TCB_ULP_TYPE, + t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_ULP_TYPE, V_TCB_ULP_TYPE(M_TCB_ULP_TYPE) | V_TCB_ULP_RAW(M_TCB_ULP_RAW), val, - 0, 0, toep->ofld_rxq->iq.abs_id); + 0, 0); } /* Index: sys/dev/cxgbe/tom/t4_cpl_io.c =================================================================== --- sys/dev/cxgbe/tom/t4_cpl_io.c +++ sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1934,14 +1934,14 @@ } void -t4_set_tcb_field(struct adapter *sc, struct sge_wrq *wrq, int tid, - uint16_t word, uint64_t mask, uint64_t val, int reply, int cookie, int iqid) +t4_set_tcb_field(struct adapter *sc, struct sge_wrq *wrq, struct toepcb *toep, + uint16_t word, uint64_t mask, uint64_t val, int reply, int cookie) { struct wrqe *wr; struct cpl_set_tcb_field *req; + struct ofld_tx_sdesc *txsd; MPASS((cookie & ~M_COOKIE) == 0); - MPASS((iqid & ~M_QUEUENO) == 0); wr = alloc_wrqe(sizeof(*req), wrq); if (wr == NULL) { @@ -1950,13 +1950,26 @@ } req = wrtod(wr); - INIT_TP_WR_MIT_CPL(req, CPL_SET_TCB_FIELD, tid); - req->reply_ctrl = htobe16(V_QUEUENO(iqid)); + INIT_TP_WR_MIT_CPL(req, CPL_SET_TCB_FIELD, toep->tid); + req->reply_ctrl = htobe16(V_QUEUENO(toep->ofld_rxq->iq.abs_id)); if (reply == 0) req->reply_ctrl |= htobe16(F_NO_REPLY); req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(cookie)); req->mask = htobe64(mask); req->val = htobe64(val); + if ((wrq->eq.flags & EQ_TYPEMASK) == EQ_OFLD) { + txsd = &toep->txsd[toep->txsd_pidx]; + txsd->tx_credits = howmany(sizeof(*req), 16); + txsd->plen = 0; + KASSERT(toep->tx_credits >= txsd->tx_credits && + toep->txsd_avail > 0, + ("%s: not enough credits (%d)", __func__, + toep->tx_credits)); + toep->tx_credits -= txsd->tx_credits; + if (__predict_false(++toep->txsd_pidx == toep->txsd_total)) + toep->txsd_pidx = 0; + toep->txsd_avail--; + } t4_wrq_tx(sc, wr); } Index: sys/dev/cxgbe/tom/t4_ddp.c =================================================================== --- sys/dev/cxgbe/tom/t4_ddp.c +++ sys/dev/cxgbe/tom/t4_ddp.c @@ -811,14 +811,13 @@ DDP_ASSERT_LOCKED(toep); toep->ddp.flags |= DDP_SC_REQ; - t4_set_tcb_field(sc, toep->ctrlq, toep->tid, W_TCB_RX_DDP_FLAGS, + t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_RX_DDP_FLAGS, V_TF_DDP_OFF(1) | V_TF_DDP_INDICATE_OUT(1) | V_TF_DDP_BUF0_INDICATE(1) | V_TF_DDP_BUF1_INDICATE(1) | V_TF_DDP_BUF0_VALID(1) | V_TF_DDP_BUF1_VALID(1), - V_TF_DDP_BUF0_INDICATE(1) | V_TF_DDP_BUF1_INDICATE(1), 0, 0, - toep->ofld_rxq->iq.abs_id); - t4_set_tcb_field(sc, toep->ctrlq, toep->tid, W_TCB_T_FLAGS, - V_TF_RCV_COALESCE_ENABLE(1), 0, 0, 0, toep->ofld_rxq->iq.abs_id); + V_TF_DDP_BUF0_INDICATE(1) | V_TF_DDP_BUF1_INDICATE(1), 0, 0); + t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_T_FLAGS, + V_TF_RCV_COALESCE_ENABLE(1), 0, 0, 0); } static int @@ -1868,10 +1867,9 @@ */ valid_flag = i == 0 ? V_TF_DDP_BUF0_VALID(1) : V_TF_DDP_BUF1_VALID(1); - t4_set_tcb_field(sc, toep->ctrlq, toep->tid, + t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_RX_DDP_FLAGS, valid_flag, 0, 1, - i + DDP_BUF0_INVALIDATED, - toep->ofld_rxq->iq.abs_id); + i + DDP_BUF0_INVALIDATED); toep->ddp.db[i].cancel_pending = 1; CTR2(KTR_CXGBE, "%s: request %p marked pending", __func__, job); Index: sys/dev/cxgbe/tom/t4_tls.c =================================================================== --- sys/dev/cxgbe/tom/t4_tls.c +++ sys/dev/cxgbe/tom/t4_tls.c @@ -68,8 +68,7 @@ { struct adapter *sc = td_adapter(toep->td); - t4_set_tcb_field(sc, toep->ctrlq, toep->tid, word, mask, val, 0, 0, - toep->ofld_rxq->iq.abs_id); + t4_set_tcb_field(sc, toep->ofld_txq, toep, word, mask, val, 0, 0); } /* TLS and DTLS common routines */ Index: sys/dev/cxgbe/tom/t4_tom.h =================================================================== --- sys/dev/cxgbe/tom/t4_tom.h +++ sys/dev/cxgbe/tom/t4_tom.h @@ -384,8 +384,8 @@ int t4_tod_output(struct toedev *, struct tcpcb *); int t4_send_fin(struct toedev *, struct tcpcb *); int t4_send_rst(struct toedev *, struct tcpcb *); -void t4_set_tcb_field(struct adapter *, struct sge_wrq *, int, uint16_t, - uint64_t, uint64_t, int, int, int); +void t4_set_tcb_field(struct adapter *, struct sge_wrq *, struct toepcb *, + uint16_t, uint64_t, uint64_t, int, int); void t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop); void t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop); int do_set_tcb_rpl(struct sge_iq *, const struct rss_header *, struct mbuf *); Index: sys/dev/cxgbe/tom/t4_tom.c =================================================================== --- sys/dev/cxgbe/tom/t4_tom.c +++ sys/dev/cxgbe/tom/t4_tom.c @@ -392,9 +392,9 @@ case TCP_NODELAY: if (tp->t_state != TCPS_ESTABLISHED) break; - t4_set_tcb_field(sc, toep->ctrlq, toep->tid, W_TCB_T_FLAGS, + t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_T_FLAGS, V_TF_NAGLE(1), V_TF_NAGLE(tp->t_flags & TF_NODELAY ? 0 : 1), - 0, 0, toep->ofld_rxq->iq.abs_id); + 0, 0); break; default: break;