From nobody Wed Jul 17 14:21:52 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WPJ685J3vz5RPRJ; Wed, 17 Jul 2024 14:21:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WPJ680yvzz4tNd; Wed, 17 Jul 2024 14:21:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721226112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f1WpAQLt/FbI719gM08cMTLAMDOjVfPsWjrJ4+Gmx+s=; b=TZ7GWdR/FfahaGCLwD7W+/hVU4toINup8dsXyXK2Fd3QKym6xTqr7lZBtQ1Vhx7DDMDugX SPvcrGpyeHGey0j61NdECUt3kT5nZTm+E1UPZU9dQSUTDi/eN1qGIdw5m7KaSGVmL+J9zt ZPA5vHQu4j7fjFDlcHqA492g3v3Nvyc+DZmdykJNB1DTiUXuVMsB3o59hjRjW/FIXWMUHa HqYOrs2Ziom4h86Y/E3KopsZ8aLvs5UgsZis6hqxm18gGpI+W+TskiGr+N0cZi8nEZgXGg +0bU3wxWBnDlgeFRDqQRH1kpWa3sgo3v44ytAQUbrwkq1CU3+qw/GV7abZzp6A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721226112; a=rsa-sha256; cv=none; b=W4EnmN3Fb5jd0HR8KPwAxNzV7i25BSAkEItBqoLgngDocOJcgMj4i5Mrx6iIMNCs50J5Nx RQasMc3No0cjrKS7ldH084BMjnQWLu+EGfS8wDYjw7Wo8qNGNIHpuq8rDw3ca3Qbs6BA78 nGGQQNLi84gX70fiXI9jt11uojWHbb9PYUm9Qqj16TGCiPBB5rSqSpFAFtomDcMEm6b0Pp q0OvB0CAt9dzM57CF4cLOlPHnqpbrK+iZcPAsdARqTyodJWvOX5qgkZB8Aehl3puNia4XF Cl27gDxJqhsEM9cyEdY8eSMBpAGunGO1VXFdoX+latqW/8pgZHBXRkj1b4mpkA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721226112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f1WpAQLt/FbI719gM08cMTLAMDOjVfPsWjrJ4+Gmx+s=; b=xl5QUYXenyjGWw1gJF9UP7I4+R5i8+capsyJSiMPCN824+auquZ578I7DWT2x+M1+/4Lfv Rb7AcCLJbVpzhJNGwmrhXK/CCgbkVZJhCmCsAtgvf1ZK3Kv0Qt6S4FQccYqbxnvLZTnosI OQb5xr0CVKmKabGEJehUpgBOzTQIiRdwhfb6xwVPhtXQxDHokP+6PjstYO1/39XpuAh7oI JFhj0Q/OHXrd0o9Hxbtj8v3gsiPlkRqIkZY+jYQ29p+sVop6iEFd8WZsOqU94RXwp7WLbu 8P+maIz+Zs1q2+Wi8k8blQZQrQygU+8nB25b4IlRq7GtqlYOQxqasSkvB+R7xQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WPJ680b6jz1N0g; Wed, 17 Jul 2024 14:21:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46HELqHu031119; Wed, 17 Jul 2024 14:21:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46HELqAY031116; Wed, 17 Jul 2024 14:21:52 GMT (envelope-from git) Date: Wed, 17 Jul 2024 14:21:52 GMT Message-Id: <202407171421.46HELqAY031116@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 8d214aa2c189 - stable/14 - cxgbe(4): Consolidate all mk_set_tcb_field_ulp in one place. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8d214aa2c18925c630495a66990d4e77c256a805 Auto-Submitted: auto-generated The branch stable/14 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=8d214aa2c18925c630495a66990d4e77c256a805 commit 8d214aa2c18925c630495a66990d4e77c256a805 Author: Navdeep Parhar AuthorDate: 2023-04-01 00:23:38 +0000 Commit: Navdeep Parhar CommitDate: 2024-07-17 06:39:43 +0000 cxgbe(4): Consolidate all mk_set_tcb_field_ulp in one place. Sponsored by: Chelsio Communications (cherry picked from commit 64a00f877fc23d904d5f4ca00471e09954eb9381) --- sys/dev/cxgbe/common/common.h | 42 ++++++++++++++++++++++++++++++++++ sys/dev/cxgbe/t4_filter.c | 43 +++++------------------------------ sys/dev/cxgbe/tom/t4_ddp.c | 52 +++++++++---------------------------------- sys/dev/cxgbe/tom/t4_tls.c | 50 ++++++----------------------------------- sys/dev/cxgbe/tom/t4_tom.c | 42 ++++------------------------------ 5 files changed, 68 insertions(+), 161 deletions(-) diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index 67bbf5e43b79..6e80ce40648b 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -964,4 +964,46 @@ port_top_speed(const struct port_info *pi) return (fwcap_to_speed(pi->link_cfg.pcaps) / 1000); } +/* SET_TCB_FIELD sent as a ULP command looks like this */ +#define LEN__SET_TCB_FIELD_ULP (sizeof(struct ulp_txpkt) + \ + sizeof(struct ulptx_idata) + sizeof(struct cpl_set_tcb_field_core)) + +static inline void * +mk_set_tcb_field_ulp(struct adapter *sc, void *cur, int tid, uint16_t word, + uint64_t mask, uint64_t val) +{ + struct ulp_txpkt *ulpmc; + struct ulptx_idata *ulpsc; + struct cpl_set_tcb_field_core *req; + + MPASS(((uintptr_t)cur & 7) == 0); + + ulpmc = cur; + ulpmc->cmd_dest = htobe32(V_ULPTX_CMD(ULP_TX_PKT) | + V_ULP_TXPKT_DEST(ULP_TXPKT_DEST_TP)); + ulpmc->len = htobe32(howmany(LEN__SET_TCB_FIELD_ULP, 16)); + + ulpsc = (struct ulptx_idata *)(ulpmc + 1); + ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_IMM)); + ulpsc->len = htobe32(sizeof(*req)); + + req = (struct cpl_set_tcb_field_core *)(ulpsc + 1); + OPCODE_TID(req) = htobe32(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); + req->reply_ctrl = htobe16(F_NO_REPLY); + req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(0)); + req->mask = htobe64(mask); + req->val = htobe64(val); + + /* + * ULP_TX is an 8B processor but the firmware transfers WRs in 16B + * chunks. The master command for set_tcb_field does not end at a 16B + * boundary so it needs to be padded with a no-op. + */ + MPASS((LEN__SET_TCB_FIELD_ULP & 0xf) != 0); + ulpsc = (struct ulptx_idata *)(req + 1); + ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_NOOP)); + ulpsc->len = htobe32(0); + + return (ulpsc + 1); +} #endif /* __CHELSIO_COMMON_H */ diff --git a/sys/dev/cxgbe/t4_filter.c b/sys/dev/cxgbe/t4_filter.c index 18fa1093800f..359aae6df24e 100644 --- a/sys/dev/cxgbe/t4_filter.c +++ b/sys/dev/cxgbe/t4_filter.c @@ -1698,40 +1698,6 @@ done: return (rc); } -/* SET_TCB_FIELD sent as a ULP command looks like this */ -#define LEN__SET_TCB_FIELD_ULP (sizeof(struct ulp_txpkt) + \ - sizeof(struct ulptx_idata) + sizeof(struct cpl_set_tcb_field_core)) - -static void * -mk_set_tcb_field_ulp(struct ulp_txpkt *ulpmc, uint64_t word, uint64_t mask, - uint64_t val, uint32_t tid, uint32_t qid) -{ - struct ulptx_idata *ulpsc; - struct cpl_set_tcb_field_core *req; - - ulpmc->cmd_dest = htonl(V_ULPTX_CMD(ULP_TX_PKT) | V_ULP_TXPKT_DEST(0)); - ulpmc->len = htobe32(howmany(LEN__SET_TCB_FIELD_ULP, 16)); - - ulpsc = (struct ulptx_idata *)(ulpmc + 1); - ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_IMM)); - ulpsc->len = htobe32(sizeof(*req)); - - req = (struct cpl_set_tcb_field_core *)(ulpsc + 1); - OPCODE_TID(req) = htobe32(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); - req->reply_ctrl = htobe16(V_NO_REPLY(1) | V_QUEUENO(qid)); - req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(0)); - req->mask = htobe64(mask); - req->val = htobe64(val); - - ulpsc = (struct ulptx_idata *)(req + 1); - if (LEN__SET_TCB_FIELD_ULP % 16) { - ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_NOOP)); - ulpsc->len = htobe32(0); - return (ulpsc + 1); - } - return (ulpsc); -} - /* ABORT_REQ sent as a ULP command looks like this */ #define LEN__ABORT_REQ_ULP (sizeof(struct ulp_txpkt) + \ sizeof(struct ulptx_idata) + sizeof(struct cpl_abort_req_core)) @@ -1807,14 +1773,15 @@ del_hashfilter_wrlen(void) } static void -mk_del_hashfilter_wr(int tid, struct work_request_hdr *wrh, int wrlen, int qid) +mk_del_hashfilter_wr(struct adapter *sc, int tid, struct work_request_hdr *wrh, + int wrlen, int qid) { struct ulp_txpkt *ulpmc; INIT_ULPTX_WRH(wrh, wrlen, 0, 0); ulpmc = (struct ulp_txpkt *)(wrh + 1); - ulpmc = mk_set_tcb_field_ulp(ulpmc, W_TCB_RSS_INFO, - V_TCB_RSS_INFO(M_TCB_RSS_INFO), V_TCB_RSS_INFO(qid), tid, 0); + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, tid, W_TCB_RSS_INFO, + V_TCB_RSS_INFO(M_TCB_RSS_INFO), V_TCB_RSS_INFO(qid)); ulpmc = mk_abort_req_ulp(ulpmc, tid); ulpmc = mk_abort_rpl_ulp(ulpmc, tid); } @@ -1857,7 +1824,7 @@ del_hashfilter(struct adapter *sc, struct t4_filter *t) goto done; } - mk_del_hashfilter_wr(t->idx, wr, wrlen, sc->sge.fwq.abs_id); + mk_del_hashfilter_wr(sc, t->idx, wr, wrlen, sc->sge.fwq.abs_id); f->locked = 1; f->pending = 1; commit_wrq_wr(&sc->sge.ctrlq[0], wr, &cookie); diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index c1d4af45fd70..a08ddea00d05 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -545,37 +545,6 @@ insert_ddp_data(struct toepcb *toep, uint32_t n) #define LEN__RX_DATA_ACK_ULP (sizeof(struct ulp_txpkt) + \ sizeof(struct ulptx_idata) + sizeof(struct cpl_rx_data_ack_core)) -static inline void * -mk_set_tcb_field_ulp(struct ulp_txpkt *ulpmc, struct toepcb *toep, - uint64_t word, uint64_t mask, uint64_t val) -{ - struct ulptx_idata *ulpsc; - struct cpl_set_tcb_field_core *req; - - ulpmc->cmd_dest = htonl(V_ULPTX_CMD(ULP_TX_PKT) | V_ULP_TXPKT_DEST(0)); - ulpmc->len = htobe32(howmany(LEN__SET_TCB_FIELD_ULP, 16)); - - ulpsc = (struct ulptx_idata *)(ulpmc + 1); - ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_IMM)); - ulpsc->len = htobe32(sizeof(*req)); - - req = (struct cpl_set_tcb_field_core *)(ulpsc + 1); - OPCODE_TID(req) = htobe32(MK_OPCODE_TID(CPL_SET_TCB_FIELD, toep->tid)); - req->reply_ctrl = htobe16(V_NO_REPLY(1) | - V_QUEUENO(toep->ofld_rxq->iq.abs_id)); - req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(0)); - req->mask = htobe64(mask); - req->val = htobe64(val); - - ulpsc = (struct ulptx_idata *)(req + 1); - if (LEN__SET_TCB_FIELD_ULP % 16) { - ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_NOOP)); - ulpsc->len = htobe32(0); - return (ulpsc + 1); - } - return (ulpsc); -} - static inline void * mk_rx_data_ack_ulp(struct ulp_txpkt *ulpmc, struct toepcb *toep) { @@ -634,21 +603,21 @@ mk_update_tcb_for_ddp(struct adapter *sc, struct toepcb *toep, int db_idx, ulpmc = (struct ulp_txpkt *)(wrh + 1); /* Write the buffer's tag */ - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_RX_DDP_BUF0_TAG + db_idx, V_TCB_RX_DDP_BUF0_TAG(M_TCB_RX_DDP_BUF0_TAG), V_TCB_RX_DDP_BUF0_TAG(prsv->prsv_tag)); /* Update the current offset in the DDP buffer and its total length */ if (db_idx == 0) - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_RX_DDP_BUF0_OFFSET, V_TCB_RX_DDP_BUF0_OFFSET(M_TCB_RX_DDP_BUF0_OFFSET) | V_TCB_RX_DDP_BUF0_LEN(M_TCB_RX_DDP_BUF0_LEN), V_TCB_RX_DDP_BUF0_OFFSET(offset) | V_TCB_RX_DDP_BUF0_LEN(len)); else - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_RX_DDP_BUF1_OFFSET, V_TCB_RX_DDP_BUF1_OFFSET(M_TCB_RX_DDP_BUF1_OFFSET) | V_TCB_RX_DDP_BUF1_LEN((u64)M_TCB_RX_DDP_BUF1_LEN << 32), @@ -656,7 +625,7 @@ mk_update_tcb_for_ddp(struct adapter *sc, struct toepcb *toep, int db_idx, V_TCB_RX_DDP_BUF1_LEN((u64)len << 32)); /* Update DDP flags */ - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, W_TCB_RX_DDP_FLAGS, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_RX_DDP_FLAGS, ddp_flags_mask, ddp_flags); /* Gratuitous RX_DATA_ACK with RX_MODULATE set to speed up delivery. */ @@ -1295,26 +1264,25 @@ set_ddp_ulp_mode(struct toepcb *toep) * Words 26/27 are zero except for the DDP_OFF flag in * W_TCB_RX_DDP_FLAGS (27). */ - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, 26, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, 26, 0xffffffffffffffff, (uint64_t)V_TF_DDP_OFF(1) << 32); /* Words 28/29 are zero. */ - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, 28, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, 28, 0xffffffffffffffff, 0); /* Words 30/31 are zero. */ - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, 30, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, 30, 0xffffffffffffffff, 0); /* Set the ULP mode to ULP_MODE_TCPDDP. */ toep->params.ulp_mode = ULP_MODE_TCPDDP; - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, W_TCB_ULP_TYPE, - V_TCB_ULP_TYPE(M_TCB_ULP_TYPE), - V_TCB_ULP_TYPE(ULP_MODE_TCPDDP)); + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_ULP_TYPE, + V_TCB_ULP_TYPE(M_TCB_ULP_TYPE), V_TCB_ULP_TYPE(ULP_MODE_TCPDDP)); #ifdef USE_DDP_RX_FLOW_CONTROL /* Set TF_RX_FLOW_CONTROL_DDP. */ - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, W_TCB_T_FLAGS, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_T_FLAGS, V_TF_RX_FLOW_CONTROL_DDP(1), V_TF_RX_FLOW_CONTROL_DDP(1)); #endif diff --git a/sys/dev/cxgbe/tom/t4_tls.c b/sys/dev/cxgbe/tom/t4_tls.c index bdd03edd3a6f..c6377980fca9 100644 --- a/sys/dev/cxgbe/tom/t4_tls.c +++ b/sys/dev/cxgbe/tom/t4_tls.c @@ -1075,41 +1075,6 @@ out: m_freem(m); } -/* SET_TCB_FIELD sent as a ULP command looks like this */ -#define LEN__SET_TCB_FIELD_ULP (sizeof(struct ulp_txpkt) + \ - sizeof(struct ulptx_idata) + sizeof(struct cpl_set_tcb_field_core)) - -static inline void * -mk_set_tcb_field_ulp(struct ulp_txpkt *ulpmc, struct toepcb *toep, - uint64_t word, uint64_t mask, uint64_t val) -{ - struct ulptx_idata *ulpsc; - struct cpl_set_tcb_field_core *req; - - ulpmc->cmd_dest = htonl(V_ULPTX_CMD(ULP_TX_PKT) | V_ULP_TXPKT_DEST(0)); - ulpmc->len = htobe32(howmany(LEN__SET_TCB_FIELD_ULP, 16)); - - ulpsc = (struct ulptx_idata *)(ulpmc + 1); - ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_IMM)); - ulpsc->len = htobe32(sizeof(*req)); - - req = (struct cpl_set_tcb_field_core *)(ulpsc + 1); - OPCODE_TID(req) = htobe32(MK_OPCODE_TID(CPL_SET_TCB_FIELD, toep->tid)); - req->reply_ctrl = htobe16(V_NO_REPLY(1) | - V_QUEUENO(toep->ofld_rxq->iq.abs_id)); - req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(0)); - req->mask = htobe64(mask); - req->val = htobe64(val); - - ulpsc = (struct ulptx_idata *)(req + 1); - if (LEN__SET_TCB_FIELD_ULP % 16) { - ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_NOOP)); - ulpsc->len = htobe32(0); - return (ulpsc + 1); - } - return (ulpsc); -} - /* * Send a work request setting multiple TCB fields to enable * ULP_MODE_TLS. @@ -1164,7 +1129,7 @@ tls_update_tcb(struct adapter *sc, struct toepcb *toep, uint64_t seqno) * decryption. Word 30 is zero and Word 31 contains * the keyid. */ - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, 26, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, 26, 0xffffffffffffffff, 0); /* @@ -1173,15 +1138,15 @@ tls_update_tcb(struct adapter *sc, struct toepcb *toep, uint64_t seqno) * units of 64 bytes. */ key_offset = toep->tls.rx_key_addr - sc->vres.key.start; - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, 30, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, 30, 0xffffffffffffffff, (uint64_t)V_TCB_RX_TLS_KEY_TAG(key_offset / 64) << 32); CTR3(KTR_CXGBE, "%s: tid %d enable TLS seqno %lu", __func__, toep->tid, seqno); - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, W_TCB_TLS_SEQ, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_TLS_SEQ, V_TCB_TLS_SEQ(M_TCB_TLS_SEQ), V_TCB_TLS_SEQ(seqno)); - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, W_TCB_ULP_RAW, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_ULP_RAW, V_TCB_ULP_RAW(M_TCB_ULP_RAW), V_TCB_ULP_RAW((V_TF_TLS_KEY_SIZE(3) | V_TF_TLS_CONTROL(1) | V_TF_TLS_ACTIVE(1) | V_TF_TLS_ENABLE(1)))); @@ -1191,12 +1156,11 @@ tls_update_tcb(struct adapter *sc, struct toepcb *toep, uint64_t seqno) /* Set the ULP mode to ULP_MODE_TLS. */ toep->params.ulp_mode = ULP_MODE_TLS; - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, W_TCB_ULP_TYPE, - V_TCB_ULP_TYPE(M_TCB_ULP_TYPE), - V_TCB_ULP_TYPE(ULP_MODE_TLS)); + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_ULP_TYPE, + V_TCB_ULP_TYPE(M_TCB_ULP_TYPE), V_TCB_ULP_TYPE(ULP_MODE_TLS)); /* Clear TF_RX_QUIESCE. */ - ulpmc = mk_set_tcb_field_ulp(ulpmc, toep, W_TCB_T_FLAGS, + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_T_FLAGS, V_TF_RX_QUIESCE(1), 0); t4_wrq_tx(sc, wr); diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index ac5bba75f904..3fe34c7c01a3 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -838,40 +838,6 @@ t4_alloc_tls_session(struct toedev *tod, struct tcpcb *tp, } #endif -/* SET_TCB_FIELD sent as a ULP command looks like this */ -#define LEN__SET_TCB_FIELD_ULP (sizeof(struct ulp_txpkt) + \ - sizeof(struct ulptx_idata) + sizeof(struct cpl_set_tcb_field_core)) - -static void * -mk_set_tcb_field_ulp(struct ulp_txpkt *ulpmc, uint64_t word, uint64_t mask, - uint64_t val, uint32_t tid) -{ - struct ulptx_idata *ulpsc; - struct cpl_set_tcb_field_core *req; - - ulpmc->cmd_dest = htonl(V_ULPTX_CMD(ULP_TX_PKT) | V_ULP_TXPKT_DEST(0)); - ulpmc->len = htobe32(howmany(LEN__SET_TCB_FIELD_ULP, 16)); - - ulpsc = (struct ulptx_idata *)(ulpmc + 1); - ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_IMM)); - ulpsc->len = htobe32(sizeof(*req)); - - req = (struct cpl_set_tcb_field_core *)(ulpsc + 1); - OPCODE_TID(req) = htobe32(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); - req->reply_ctrl = htobe16(V_NO_REPLY(1)); - req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(0)); - req->mask = htobe64(mask); - req->val = htobe64(val); - - ulpsc = (struct ulptx_idata *)(req + 1); - if (LEN__SET_TCB_FIELD_ULP % 16) { - ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_NOOP)); - ulpsc->len = htobe32(0); - return (ulpsc + 1); - } - return (ulpsc); -} - static void send_mss_flowc_wr(struct adapter *sc, struct toepcb *toep) { @@ -958,10 +924,10 @@ t4_pmtu_update(struct toedev *tod, struct tcpcb *tp, tcp_seq seq, int mtu) } INIT_ULPTX_WRH(wrh, len, 1, 0); /* atomic */ ulpmc = (struct ulp_txpkt *)(wrh + 1); - ulpmc = mk_set_tcb_field_ulp(ulpmc, W_TCB_T_MAXSEG, - V_TCB_T_MAXSEG(M_TCB_T_MAXSEG), V_TCB_T_MAXSEG(idx), toep->tid); - ulpmc = mk_set_tcb_field_ulp(ulpmc, W_TCB_TIMESTAMP, - V_TCB_TIMESTAMP(0x7FFFFULL << 11), 0, toep->tid); + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_T_MAXSEG, + V_TCB_T_MAXSEG(M_TCB_T_MAXSEG), V_TCB_T_MAXSEG(idx)); + ulpmc = mk_set_tcb_field_ulp(sc, ulpmc, toep->tid, W_TCB_TIMESTAMP, + V_TCB_TIMESTAMP(0x7FFFFULL << 11), 0); commit_wrq_wr(toep->ctrlq, wrh, &cookie); /* Update the software toepcb and tcpcb. */