From: Anoob Joseph <anoobj@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>, Jerin Jacob <jerinj@marvell.com>
Cc: Archana Muniganti <marchana@marvell.com>,
Tejasree Kondoj <ktejasree@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 14/18] crypto/cnxk: use dedicated dp threads depending on operation
Date: Mon, 8 Aug 2022 13:36:02 +0530 [thread overview]
Message-ID: <20220808080606.220-15-anoobj@marvell.com> (raw)
In-Reply-To: <20220808080606.220-1-anoobj@marvell.com>
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 <anoobj@marvell.com>
---
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;
--
2.25.1
next prev parent reply other threads:[~2022-08-08 8:07 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-08 8:05 [PATCH 00/18] Fixes and improvements in cnxk crypto PMDs Anoob Joseph
2022-08-08 8:05 ` [PATCH 01/18] crypto/cnxk: add AES-CCM support Anoob Joseph
2022-08-08 8:05 ` [PATCH 02/18] crypto/cnxk: add burst enqueue for event crypto Anoob Joseph
2022-08-08 8:05 ` [PATCH 03/18] crypto/cnxk: remove zero IV Anoob Joseph
2022-08-08 8:05 ` [PATCH 04/18] crypto/cnxk: limit the meta buf cache to 128 Anoob Joseph
2022-08-08 8:05 ` [PATCH 05/18] crypto/cnxk: add separate path for pdcp chain opcode Anoob Joseph
2022-08-08 8:05 ` [PATCH 06/18] crypto/cnxk: add separate datapath for pdcp cipher operation Anoob Joseph
2022-08-08 8:05 ` [PATCH 07/18] crypto/cnxk: remove MAC len check for AEAD Anoob Joseph
2022-08-08 8:05 ` [PATCH 08/18] crypto/cnxk: fix endianness in anti-replay Anoob Joseph
2022-08-08 8:05 ` [PATCH 09/18] crypto/cnxk: remove extra indirection for FC and Kasumi Anoob Joseph
2022-08-08 8:05 ` [PATCH 10/18] crypto/cnxk: remove extra digest len check Anoob Joseph
2022-08-08 8:05 ` [PATCH 11/18] crypto/cnxk: avoid accessing se ctx in aes gcm path Anoob Joseph
2022-08-08 8:06 ` [PATCH 12/18] crypto/cnxk: remove auth iv from kasumi cipher Anoob Joseph
2022-08-08 8:06 ` [PATCH 13/18] crypto/cnxk: enable IE engine for Chacha-Poly Anoob Joseph
2022-08-08 8:06 ` Anoob Joseph [this message]
2022-08-08 8:06 ` [PATCH 15/18] crypto/cnxk: remove unused ctx buf len Anoob Joseph
2022-08-08 8:06 ` [PATCH 16/18] drivers: change crypto adapter datapath error print to debug Anoob Joseph
2022-08-08 8:06 ` [PATCH 17/18] crypto/cnxk: update flow label copy capability Anoob Joseph
2022-08-08 8:06 ` [PATCH 18/18] crypto/cnxk: add support for DOCSIS algorithm Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 00/18] Fixes and improvements in cnxk crypto PMDs Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 01/18] crypto/cnxk: add AES-CCM support Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 02/18] crypto/cnxk: add burst enqueue for event crypto Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 03/18] crypto/cnxk: remove zero IV Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 04/18] crypto/cnxk: limit the meta buf cache to 128 Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 05/18] crypto/cnxk: add separate path for pdcp chain opcode Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 06/18] crypto/cnxk: add separate datapath for pdcp cipher operation Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 07/18] crypto/cnxk: remove MAC len check for AEAD Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 08/18] crypto/cnxk: fix endianness in anti-replay Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 09/18] crypto/cnxk: remove extra indirection for FC and Kasumi Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 10/18] crypto/cnxk: remove extra digest len check Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 11/18] crypto/cnxk: avoid accessing se ctx in aes gcm path Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 12/18] crypto/cnxk: remove auth iv from kasumi cipher Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 13/18] crypto/cnxk: enable IE engine for Chacha-Poly Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 14/18] crypto/cnxk: use dedicated dp threads depending on operation Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 15/18] crypto/cnxk: remove unused ctx buf len Anoob Joseph
2022-09-28 10:14 ` Thomas Monjalon
2022-09-28 10:17 ` [EXT] " Anoob Joseph
2022-09-28 11:00 ` Thomas Monjalon
2022-08-09 10:53 ` [PATCH v2 16/18] drivers: change crypto adapter datapath error print to debug Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 17/18] crypto/cnxk: update flow label copy capability Anoob Joseph
2022-08-09 10:53 ` [PATCH v2 18/18] crypto/cnxk: add support for DOCSIS algorithm Anoob Joseph
2022-08-28 13:25 ` [PATCH v2 00/18] Fixes and improvements in cnxk crypto PMDs Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220808080606.220-15-anoobj@marvell.com \
--to=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=jerinj@marvell.com \
--cc=ktejasree@marvell.com \
--cc=marchana@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).