From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23AB1A00C2; Tue, 9 Aug 2022 12:55:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 766C742C7C; Tue, 9 Aug 2022 12:54:39 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 81F9942C77 for ; Tue, 9 Aug 2022 12:54:38 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2791TKcB017274 for ; Tue, 9 Aug 2022 03:54:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=G9+4OASF4f4mKbD48Et0mGVaWH51wKm4v6VDnHglbaE=; b=XaNBezPkHzqfe9kaKkWM30gpwGAInYPgl3zwy2qdzLPUim0krdO/PKnVkQ+iTrroHnjQ HOgK3UmNB4ApzzGmsiAaJO/0/H2q7ISKOkkjtgixLhBhrHjrnD+JBDPQWAuQMffyCZCv zk/Kixc8e+87Gu3cM3ryHd5vX6Wum7AlKyxHqk+Ic+qa9tkzZovGh1YkytRawOLlabFr egytPGUFkyXhrOg3MWi+/OiojYQ9qmELUCVKb0ySRM+a7pGeGU3aHKe8HCC5fgZtK0ye ofrih+SC0tatMQ5BwbVrCgTkvUT8LgfYaPOtfNY7gAelDZs0wifkBhhG4mQ7GRmoVznL dQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3hudy6spk0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 09 Aug 2022 03:54:37 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 9 Aug 2022 03:54:35 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 9 Aug 2022 03:54:36 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.193.69.70]) by maili.marvell.com (Postfix) with ESMTP id E35F83F7048; Tue, 9 Aug 2022 03:54:33 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Jerin Jacob CC: Archana Muniganti , Tejasree Kondoj , Subject: [PATCH v2 14/18] crypto/cnxk: use dedicated dp threads depending on operation Date: Tue, 9 Aug 2022 16:23:52 +0530 Message-ID: <20220809105356.561-15-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220809105356.561-1-anoobj@marvell.com> References: <20220808080606.220-1-anoobj@marvell.com> <20220809105356.561-1-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: OVTw0YSR7thvEVuNAv4qVZgIAKMrUcU_ X-Proofpoint-ORIG-GUID: OVTw0YSR7thvEVuNAv4qVZgIAKMrUcU_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-09_03,2022-08-09_02,2022-06-22_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Identify the datapath thread to be used during session create. This can be used to call right function early on to avoid multiple session specific checks in datapath functions. Signed-off-by: Anoob Joseph --- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 29 +++++++++++++ drivers/crypto/cnxk/cnxk_se.h | 53 +++++++++++++++--------- 2 files changed, 62 insertions(+), 20 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c index 85bb1d27a1..cf91b92c2c 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c @@ -625,6 +625,7 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id, struct rte_cryptodev_sym_session *sess, struct rte_mempool *pool) { + enum cpt_dp_thread_type thr_type; struct cnxk_se_sess *sess_priv; void *priv; int ret; @@ -642,6 +643,34 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id, if (ret) goto priv_put; + if (sess_priv->cpt_op & ROC_SE_OP_CIPHER_MASK) { + switch (sess_priv->roc_se_ctx.fc_type) { + case ROC_SE_FC_GEN: + if (sess_priv->aes_gcm || sess_priv->chacha_poly) + thr_type = CPT_DP_THREAD_TYPE_FC_AEAD; + else + thr_type = CPT_DP_THREAD_TYPE_FC_CHAIN; + break; + case ROC_SE_PDCP: + thr_type = CPT_DP_THREAD_TYPE_PDCP; + break; + case ROC_SE_KASUMI: + thr_type = CPT_DP_THREAD_TYPE_KASUMI; + break; + case ROC_SE_PDCP_CHAIN: + thr_type = CPT_DP_THREAD_TYPE_PDCP_CHAIN; + break; + default: + plt_err("Invalid op type"); + ret = -ENOTSUP; + goto priv_put; + } + } else { + thr_type = CPT_DP_THREAD_AUTH_ONLY; + } + + sess_priv->dp_thr_type = thr_type; + if ((sess_priv->roc_se_ctx.fc_type == ROC_SE_HASH_HMAC) && cpt_mac_len_verify(&xform->auth)) { plt_dp_err("MAC length is not supported"); diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index d8126567f9..99fb3b899e 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -16,6 +16,15 @@ (sizeof(struct roc_se_iov_ptr) + \ (sizeof(struct roc_se_buf_ptr) * ROC_SE_MAX_SG_CNT)) +enum cpt_dp_thread_type { + CPT_DP_THREAD_TYPE_FC_CHAIN = 0x1, + CPT_DP_THREAD_TYPE_FC_AEAD, + CPT_DP_THREAD_TYPE_PDCP, + CPT_DP_THREAD_TYPE_PDCP_CHAIN, + CPT_DP_THREAD_TYPE_KASUMI, + CPT_DP_THREAD_AUTH_ONLY, +}; + struct cnxk_se_sess { uint16_t cpt_op : 4; uint16_t zsk_flag : 4; @@ -29,7 +38,7 @@ struct cnxk_se_sess { uint16_t aes_ctr_eea2 : 1; uint16_t zs_cipher : 4; uint16_t zs_auth : 4; - uint16_t rsvd2 : 8; + uint16_t dp_thr_type : 8; uint16_t aad_length; uint8_t mac_len; uint8_t iv_length; @@ -2370,7 +2379,7 @@ prepare_iov_from_pkt_inplace(struct rte_mbuf *pkt, static __rte_always_inline int fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, struct cpt_qp_meta_info *m_info, struct cpt_inflight_req *infl_req, - struct cpt_inst_s *inst, const bool is_kasumi) + struct cpt_inst_s *inst, const bool is_kasumi, const bool is_aead) { struct rte_crypto_sym_op *sym_op = cop->sym; void *mdata = NULL; @@ -2418,7 +2427,7 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, m_src = sym_op->m_src; m_dst = sym_op->m_dst; - if (sess->aes_gcm || sess->chacha_poly) { + if (is_aead) { struct rte_mbuf *m; uint8_t *salt; uint8_t *aad_data; @@ -2567,6 +2576,7 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, } } + fc_params.meta_buf.vaddr = NULL; if (unlikely(is_kasumi || !((flags & ROC_SE_SINGLE_BUF_INPLACE) && (flags & ROC_SE_SINGLE_BUF_HEADROOM)))) { mdata = alloc_op_meta(&fc_params.meta_buf, m_info->mlen, m_info->pool, infl_req); @@ -3057,26 +3067,29 @@ static __rte_always_inline int __rte_hot cpt_sym_inst_fill(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op, struct cnxk_se_sess *sess, struct cpt_inflight_req *infl_req, struct cpt_inst_s *inst) { - uint64_t cpt_op = sess->cpt_op; int ret; - if (cpt_op & ROC_SE_OP_CIPHER_MASK) { - switch (sess->roc_se_ctx.fc_type) { - case ROC_SE_PDCP_CHAIN: - ret = fill_pdcp_chain_params(op, sess, &qp->meta_info, infl_req, inst); - break; - case ROC_SE_PDCP: - ret = fill_pdcp_params(op, sess, &qp->meta_info, infl_req, inst); - break; - case ROC_SE_KASUMI: - ret = fill_fc_params(op, sess, &qp->meta_info, infl_req, inst, true); - break; - default: - ret = fill_fc_params(op, sess, &qp->meta_info, infl_req, inst, false); - break; - } - } else { + switch (sess->dp_thr_type) { + case CPT_DP_THREAD_TYPE_PDCP: + ret = fill_pdcp_params(op, sess, &qp->meta_info, infl_req, inst); + break; + case CPT_DP_THREAD_TYPE_FC_CHAIN: + ret = fill_fc_params(op, sess, &qp->meta_info, infl_req, inst, false, false); + break; + case CPT_DP_THREAD_TYPE_FC_AEAD: + ret = fill_fc_params(op, sess, &qp->meta_info, infl_req, inst, false, true); + break; + case CPT_DP_THREAD_TYPE_PDCP_CHAIN: + ret = fill_pdcp_chain_params(op, sess, &qp->meta_info, infl_req, inst); + break; + case CPT_DP_THREAD_TYPE_KASUMI: + ret = fill_fc_params(op, sess, &qp->meta_info, infl_req, inst, true, false); + break; + case CPT_DP_THREAD_AUTH_ONLY: ret = fill_digest_params(op, sess, &qp->meta_info, infl_req, inst); + break; + default: + ret = -EINVAL; } return ret; -- 2.25.1