From owner-svn-src-head@freebsd.org Tue Mar 27 20:54:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCA64F5AD5A; Tue, 27 Mar 2018 20:54:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 83B6D803CE; Tue, 27 Mar 2018 20:54:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7EA4A214C2; Tue, 27 Mar 2018 20:54:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2RKswd9068542; Tue, 27 Mar 2018 20:54:58 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2RKsvam068536; Tue, 27 Mar 2018 20:54:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803272054.w2RKsvam068536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 27 Mar 2018 20:54:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331649 - in head/sys/dev/cxgbe: cxgbei tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/dev/cxgbe: cxgbei tom X-SVN-Commit-Revision: 331649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Mar 2018 20:54:59 -0000 Author: jhb Date: Tue Mar 27 20:54:57 2018 New Revision: 331649 URL: https://svnweb.freebsd.org/changeset/base/331649 Log: Use the offload transmit queue to set flags on TLS connections. Requests to modify the state of TLS connections need to be sent on the same queue as TLS record transmit requests to ensure ordering. However, in order to use the offload transmit queue in t4_set_tcb_field(), the function needs to be updated to do proper flow control / credit management when queueing a request to an offload queue. This required passing a pointer to the toepcb itself to this function, so while here remove the 'tid' and 'iqid' parameters and obtain those values from the toepcb in t4_set_tcb_field() itself. Submitted by: Harsh Jain @ Chelsio (original version) Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D14871 Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/dev/cxgbe/tom/t4_tls.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c ============================================================================== --- head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Tue Mar 27 20:51:49 2018 (r331648) +++ head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Tue Mar 27 20:54:57 2018 (r331649) @@ -589,9 +589,9 @@ set_ulp_mode_iscsi(struct adapter *sc, struct toepcb * 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); } /* Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Tue Mar 27 20:51:49 2018 (r331648) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Tue Mar 27 20:54:57 2018 (r331649) @@ -1934,14 +1934,14 @@ do_set_tcb_rpl(struct sge_iq *iq, const struct rss_hea } 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 @@ t4_set_tcb_field(struct adapter *sc, struct sge_wrq *w } 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); } Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Tue Mar 27 20:51:49 2018 (r331648) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Tue Mar 27 20:54:57 2018 (r331649) @@ -811,14 +811,13 @@ enable_ddp(struct adapter *sc, struct toepcb *toep) 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 @@ t4_aio_cancel_active(struct kaiocb *job) */ 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); Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Tue Mar 27 20:51:49 2018 (r331648) +++ head/sys/dev/cxgbe/tom/t4_tls.c Tue Mar 27 20:54:57 2018 (r331649) @@ -68,8 +68,7 @@ t4_set_tls_tcb_field(struct toepcb *toep, uint16_t wor { 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 */ Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Tue Mar 27 20:51:49 2018 (r331648) +++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Mar 27 20:54:57 2018 (r331649) @@ -392,9 +392,9 @@ t4_ctloutput(struct toedev *tod, struct tcpcb *tp, int 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; Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Tue Mar 27 20:51:49 2018 (r331648) +++ head/sys/dev/cxgbe/tom/t4_tom.h Tue Mar 27 20:54:57 2018 (r331649) @@ -384,8 +384,8 @@ void t4_rcvd_locked(struct toedev *, struct tcpcb *); 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 *);