From patchwork Mon Aug 8 08:06:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 114704 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1D8F2A034C; Mon, 8 Aug 2022 10:07:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 429B842C7F; Mon, 8 Aug 2022 10:06:46 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id AC56742C60 for ; Mon, 8 Aug 2022 10:06:44 +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 277N0eba006022 for ; Mon, 8 Aug 2022 01:06:44 -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=qNQsbbeY4cj7n4wpMdOcUBYpUBDk+Q/rI19BLmkS6sA=; b=lJTK6+LgDVq8fAzqjsYSF8pbu3GmjJC9N3pH3617F7mWFDV6DfNWziyS8ZmTSbjjtXpV zmCmJXSJefUk7gRxR3vZlXAHwm84bswiwuxP+JO22OrupccA/ks+4kqhy1FwJJxhDtBN 4bO/DmT/Bof5fs2DEoURyEiyvUTFsP5GfamefZ67a1G9qt4CtgNoPFluc9QVhJ5SYCuS vBReCD0QMDyljyADNnsAW8CKZ0TJMWAM3Anu28s1CVfaGseBBYqhM++imB6CDP3j2pqL uZxZnsEWzpqzwzvB4Ka91HIpCSmsIdu9nrmOSgooo3sufaD8BeyqRANmcC7HRf7/Ty3+ EA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3hsqtmmxf4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 08 Aug 2022 01:06:43 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 8 Aug 2022 01:06:42 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 8 Aug 2022 01:06:42 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.28.160.62]) by maili.marvell.com (Postfix) with ESMTP id 2B1343F7051; Mon, 8 Aug 2022 01:06:39 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Jerin Jacob CC: Archana Muniganti , Tejasree Kondoj , Subject: [PATCH 14/18] crypto/cnxk: use dedicated dp threads depending on operation Date: Mon, 8 Aug 2022 13:36:02 +0530 Message-ID: <20220808080606.220-15-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220808080606.220-1-anoobj@marvell.com> References: <20220808080606.220-1-anoobj@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: tox9xNC9hTAOtTqDMxuWM7CDh1WnDrvW X-Proofpoint-ORIG-GUID: tox9xNC9hTAOtTqDMxuWM7CDh1WnDrvW 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-08_05,2022-08-05_01,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 | 52 +++++++++++++++--------- 2 files changed, 61 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 3de9718f8b..dc9621fb84 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; @@ -2419,7 +2428,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; @@ -3060,26 +3069,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;