Date: Fri, 11 Nov 2022 00:39:07 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 56dad65305af - stable/13 - cxgbe TOE TLS: Simplify a few routines. Message-ID: <202211110039.2AB0d7Bs057377@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=56dad65305af5037d11f4cada43931def31b68cb commit 56dad65305af5037d11f4cada43931def31b68cb Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-08-08 18:21:54 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-11-11 00:36:01 +0000 cxgbe TOE TLS: Simplify a few routines. Remove a few more remnants from the old pre-KTLS support and instead assume that each work request sends a single TLS record. Sponsored by: Chelsio Communications (cherry picked from commit c6b3a3772c0872f625ebb43d6a334babc5def5f4) --- sys/dev/cxgbe/tom/t4_tls.c | 33 +++++++++++---------------------- sys/dev/cxgbe/tom/t4_tls.h | 1 - 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_tls.c b/sys/dev/cxgbe/tom/t4_tls.c index eb24e10289db..18b9857ad1dc 100644 --- a/sys/dev/cxgbe/tom/t4_tls.c +++ b/sys/dev/cxgbe/tom/t4_tls.c @@ -396,11 +396,7 @@ tls_alloc_ktls(struct toepcb *toep, struct ktls_session *tls, int direction) V_SCMD_KEY_CTX_INLINE(0) | V_SCMD_TLS_FRAG_ENABLE(1)); - if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) - toep->tls.iv_len = 8; - else - toep->tls.iv_len = AES_BLOCK_LEN; - + toep->tls.iv_len = explicit_iv_size; toep->tls.frag_size = tls->params.max_frame_len; toep->tls.fcplenmax = get_tp_plen_max(tls); toep->tls.expn_per_ulp = tls->params.tls_hlen + @@ -505,24 +501,23 @@ tls_uninit_toep(struct toepcb *toep) static void write_tlstx_wr(struct fw_tlstx_data_wr *txwr, struct toepcb *toep, - unsigned int immdlen, unsigned int plen, unsigned int expn, - unsigned int pdus, uint8_t credits, int shove, int imm_ivs) + unsigned int plen, unsigned int expn, uint8_t credits, int shove) { struct tls_ofld_info *tls_ofld = &toep->tls; unsigned int len = plen + expn; txwr->op_to_immdlen = htobe32(V_WR_OP(FW_TLSTX_DATA_WR) | V_FW_TLSTX_DATA_WR_COMPL(1) | - V_FW_TLSTX_DATA_WR_IMMDLEN(immdlen)); + V_FW_TLSTX_DATA_WR_IMMDLEN(0)); txwr->flowid_len16 = htobe32(V_FW_TLSTX_DATA_WR_FLOWID(toep->tid) | V_FW_TLSTX_DATA_WR_LEN16(credits)); txwr->plen = htobe32(len); txwr->lsodisable_to_flags = htobe32(V_TX_ULP_MODE(ULP_MODE_TLS) | V_TX_URG(0) | /* F_T6_TX_FORCE | */ V_TX_SHOVE(shove)); - txwr->ctxloc_to_exp = htobe32(V_FW_TLSTX_DATA_WR_NUMIVS(pdus) | + txwr->ctxloc_to_exp = htobe32(V_FW_TLSTX_DATA_WR_NUMIVS(1) | V_FW_TLSTX_DATA_WR_EXP(expn) | V_FW_TLSTX_DATA_WR_CTXLOC(TLS_SFO_WR_CONTEXTLOC_DDR) | - V_FW_TLSTX_DATA_WR_IVDSGL(!imm_ivs) | + V_FW_TLSTX_DATA_WR_IVDSGL(0) | V_FW_TLSTX_DATA_WR_KEYSIZE(tls_ofld->tx_key_info_size >> 4)); txwr->mfs = htobe16(tls_ofld->frag_size); txwr->adjustedplen_pkd = htobe16( @@ -535,15 +530,12 @@ write_tlstx_wr(struct fw_tlstx_data_wr *txwr, struct toepcb *toep, static void write_tlstx_cpl(struct cpl_tx_tls_sfo *cpl, struct toepcb *toep, - struct tls_hdr *tls_hdr, unsigned int plen, unsigned int pdus) + struct tls_hdr *tls_hdr, unsigned int plen, uint64_t seqno) { struct tls_ofld_info *tls_ofld = &toep->tls; int data_type, seglen; - if (plen < tls_ofld->frag_size) - seglen = plen; - else - seglen = tls_ofld->frag_size; + seglen = plen; data_type = tls_content_type(tls_hdr->type); cpl->op_to_seg_len = htobe32(V_CPL_TX_TLS_SFO_OPCODE(CPL_TX_TLS_SFO) | V_CPL_TX_TLS_SFO_DATA_TYPE(data_type) | @@ -553,10 +545,9 @@ write_tlstx_cpl(struct cpl_tx_tls_sfo *cpl, struct toepcb *toep, cpl->type_protover = htobe32( V_CPL_TX_TLS_SFO_TYPE(tls_hdr->type)); cpl->seqno_numivs = htobe32(tls_ofld->scmd0.seqno_numivs | - V_SCMD_NUM_IVS(pdus)); + V_SCMD_NUM_IVS(1)); cpl->ivgen_hdrlen = htobe32(tls_ofld->scmd0.ivgen_hdrlen); - cpl->scmd1 = htobe64(tls_ofld->tx_seq_no); - tls_ofld->tx_seq_no += pdus; + cpl->scmd1 = htobe64(seqno); } static int @@ -816,10 +807,8 @@ t4_push_ktls(struct adapter *sc, struct toepcb *toep, int drop) expn_size = m->m_epg_hdrlen + m->m_epg_trllen; tls_size = m->m_len - expn_size; - write_tlstx_wr(txwr, toep, 0, - tls_size, expn_size, 1, credits, shove, 1); - toep->tls.tx_seq_no = m->m_epg_seqno; - write_tlstx_cpl(cpl, toep, thdr, tls_size, 1); + write_tlstx_wr(txwr, toep, tls_size, expn_size, credits, shove); + write_tlstx_cpl(cpl, toep, thdr, tls_size, m->m_epg_seqno); idata = (struct ulptx_idata *)(cpl + 1); idata->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_NOOP)); diff --git a/sys/dev/cxgbe/tom/t4_tls.h b/sys/dev/cxgbe/tom/t4_tls.h index 955202b45078..51bf566091e7 100644 --- a/sys/dev/cxgbe/tom/t4_tls.h +++ b/sys/dev/cxgbe/tom/t4_tls.h @@ -76,7 +76,6 @@ struct tls_ofld_info { int key_location; int rx_key_addr; int tx_key_addr; - uint64_t tx_seq_no; uint16_t rx_version; unsigned short fcplenmax; unsigned short adjusted_plen;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202211110039.2AB0d7Bs057377>