* [PATCH 0/9] fixes and new features to cnxk crypto PMD
@ 2025-05-27 13:01 Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 1/9] crypto/cnxk: include required headers Tejasree Kondoj
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Tejasree Kondoj @ 2025-05-27 13:01 UTC (permalink / raw)
To: Akhil Goyal
Cc: Anoob Joseph, Nithinsen Kaithakadan, Rupesh Chiluka,
Vidya Sagar Velumuri, dev
This series adds fixes and new features to cnxk crypto PMD.
It is dependent on below series:
https://patches.dpdk.org/project/dpdk/list/?series=35294
Nithinsen Kaithakadan (4):
common/cnxk: fix salt handling with aes-ctr
common/cnxk: set correct salt value for ctr algos
common/cnxk: update qsize in CPT iq enable
crypto/cnxk: copy 8B iv into sess in aes ctr
Rupesh Chiluka (2):
crypto/cnxk: extend check for max supported gather entries
crypto/cnxk: add asym sessionless handling
Tejasree Kondoj (2):
crypto/cnxk: include required headers
crypto/cnxk: add struct variable for custom metadata
Vidya Sagar Velumuri (1):
crypto/cnxk: add support for sessionless asym
drivers/common/cnxk/cnxk_security.c | 8 ++
drivers/common/cnxk/roc_cpt.c | 5 ++
drivers/common/cnxk/roc_cpt_sg.h | 1 +
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 91 +++++++++++++++++++++--
drivers/crypto/cnxk/cn10k_ipsec_la_ops.h | 17 ++++-
drivers/crypto/cnxk/cn10k_tls_ops.h | 10 +++
drivers/crypto/cnxk/cn20k_ipsec_la_ops.h | 17 ++++-
drivers/crypto/cnxk/cn20k_tls_ops.h | 10 +++
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 77 ++++++++++++++++++-
drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 10 +++
drivers/crypto/cnxk/cnxk_cryptodev.c | 3 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 5 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 4 +
drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 3 +
14 files changed, 244 insertions(+), 17 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/9] crypto/cnxk: include required headers
2025-05-27 13:01 [PATCH 0/9] fixes and new features to cnxk crypto PMD Tejasree Kondoj
@ 2025-05-27 13:01 ` Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 2/9] common/cnxk: fix salt handling with aes-ctr Tejasree Kondoj
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tejasree Kondoj @ 2025-05-27 13:01 UTC (permalink / raw)
To: Akhil Goyal
Cc: Anoob Joseph, Nithinsen Kaithakadan, Rupesh Chiluka,
Vidya Sagar Velumuri, dev
Including required headers.
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h b/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h
index 02278605a2..46861ab2cf 100644
--- a/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h
+++ b/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h
@@ -13,6 +13,9 @@
#include <stdint.h>
+#include <rte_crypto.h>
+#include <rte_security.h>
+
/* Forward declarations */
/**
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/9] common/cnxk: fix salt handling with aes-ctr
2025-05-27 13:01 [PATCH 0/9] fixes and new features to cnxk crypto PMD Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 1/9] crypto/cnxk: include required headers Tejasree Kondoj
@ 2025-05-27 13:01 ` Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 3/9] common/cnxk: set correct salt value for ctr algos Tejasree Kondoj
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tejasree Kondoj @ 2025-05-27 13:01 UTC (permalink / raw)
To: Akhil Goyal
Cc: Nithinsen Kaithakadan, Anoob Joseph, Rupesh Chiluka,
Vidya Sagar Velumuri, dev
From: Nithinsen Kaithakadan <nkaithakadan@marvell.com>
This patch includes fix for setting correct salt value
for CTR algorithm.
Fixes: 78d03027f2cc ("common/cnxk: add IPsec common code")
Signed-off-by: Nithinsen Kaithakadan <nkaithakadan@marvell.com>
---
drivers/common/cnxk/cnxk_security.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c
index ea3b87e65c..62ae7b9b2e 100644
--- a/drivers/common/cnxk/cnxk_security.c
+++ b/drivers/common/cnxk/cnxk_security.c
@@ -96,6 +96,9 @@ ot_ipsec_sa_common_param_fill(union roc_ot_ipsec_sa_word2 *w2, uint8_t *cipher_k
break;
case RTE_CRYPTO_CIPHER_AES_CTR:
w2->s.enc_type = ROC_IE_SA_ENC_AES_CTR;
+ memcpy(salt_key, &ipsec_xfrm->salt, 4);
+ tmp_salt = (uint32_t *)salt_key;
+ *tmp_salt = rte_be_to_cpu_32(*tmp_salt);
break;
case RTE_CRYPTO_CIPHER_3DES_CBC:
w2->s.enc_type = ROC_IE_SA_ENC_3DES_CBC;
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/9] common/cnxk: set correct salt value for ctr algos
2025-05-27 13:01 [PATCH 0/9] fixes and new features to cnxk crypto PMD Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 1/9] crypto/cnxk: include required headers Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 2/9] common/cnxk: fix salt handling with aes-ctr Tejasree Kondoj
@ 2025-05-27 13:01 ` Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 4/9] crypto/cnxk: extend check for max supported gather entries Tejasree Kondoj
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tejasree Kondoj @ 2025-05-27 13:01 UTC (permalink / raw)
To: Akhil Goyal
Cc: Nithinsen Kaithakadan, Anoob Joseph, Rupesh Chiluka,
Vidya Sagar Velumuri, dev
From: Nithinsen Kaithakadan <nkaithakadan@marvell.com>
This patch includes fix for setting correct salt value
for CTR algorithm.
Fixes: 532963b8070 ("crypto/cnxk: move IPsec SA creation to common")
Signed-off-by: Nithinsen Kaithakadan <nkaithakadan@marvell.com>
---
drivers/common/cnxk/cnxk_security.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c
index 62ae7b9b2e..0e6777e6ca 100644
--- a/drivers/common/cnxk/cnxk_security.c
+++ b/drivers/common/cnxk/cnxk_security.c
@@ -965,6 +965,8 @@ on_fill_ipsec_common_sa(struct rte_security_ipsec_xform *ipsec,
cipher_key_len = crypto_xform->aead.key.length;
} else {
if (cipher_xform) {
+ if (cipher_xform->cipher.algo == RTE_CRYPTO_CIPHER_AES_CTR)
+ memcpy(common_sa->iv.gcm.nonce, &ipsec->salt, 4);
cipher_key = cipher_xform->cipher.key.data;
cipher_key_len = cipher_xform->cipher.key.length;
}
@@ -1285,6 +1287,9 @@ ow_ipsec_sa_common_param_fill(union roc_ow_ipsec_sa_word2 *w2, uint8_t *cipher_k
break;
case RTE_CRYPTO_CIPHER_AES_CTR:
w2->s.enc_type = ROC_IE_SA_ENC_AES_CTR;
+ memcpy(salt_key, &ipsec_xfrm->salt, 4);
+ tmp_salt = (uint32_t *)salt_key;
+ *tmp_salt = rte_be_to_cpu_32(*tmp_salt);
break;
case RTE_CRYPTO_CIPHER_3DES_CBC:
w2->s.enc_type = ROC_IE_SA_ENC_3DES_CBC;
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/9] crypto/cnxk: extend check for max supported gather entries
2025-05-27 13:01 [PATCH 0/9] fixes and new features to cnxk crypto PMD Tejasree Kondoj
` (2 preceding siblings ...)
2025-05-27 13:01 ` [PATCH 3/9] common/cnxk: set correct salt value for ctr algos Tejasree Kondoj
@ 2025-05-27 13:01 ` Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 5/9] crypto/cnxk: add struct variable for custom metadata Tejasree Kondoj
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tejasree Kondoj @ 2025-05-27 13:01 UTC (permalink / raw)
To: Akhil Goyal
Cc: Rupesh Chiluka, Anoob Joseph, Nithinsen Kaithakadan,
Vidya Sagar Velumuri, dev
From: Rupesh Chiluka <rchiluka@marvell.com>
Extend check for max supported gather entries in CNXK
CPT PMD.
Signed-off-by: Rupesh Chiluka <rchiluka@marvell.com>
---
drivers/common/cnxk/roc_cpt_sg.h | 1 +
drivers/crypto/cnxk/cn10k_ipsec_la_ops.h | 10 ++++++++++
drivers/crypto/cnxk/cn10k_tls_ops.h | 10 ++++++++++
drivers/crypto/cnxk/cn20k_ipsec_la_ops.h | 10 ++++++++++
drivers/crypto/cnxk/cn20k_tls_ops.h | 10 ++++++++++
drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 10 ++++++++++
6 files changed, 51 insertions(+)
diff --git a/drivers/common/cnxk/roc_cpt_sg.h b/drivers/common/cnxk/roc_cpt_sg.h
index e7e01cd29a..7c3caf94d7 100644
--- a/drivers/common/cnxk/roc_cpt_sg.h
+++ b/drivers/common/cnxk/roc_cpt_sg.h
@@ -15,6 +15,7 @@
#define ROC_SG_MAX_COMP 25
#define ROC_SG_MAX_DLEN_SIZE (ROC_SG_LIST_HDR_SIZE + (ROC_SG_MAX_COMP * ROC_SG_ENTRY_SIZE))
#define ROC_SG2_MAX_PTRS 48
+#define ROC_SG1_MAX_PTRS 32
struct roc_sglist_comp {
union {
diff --git a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
index 87442c2a1f..0cc6283c7e 100644
--- a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
+++ b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
@@ -105,6 +105,11 @@ process_outb_sa(struct roc_cpt_lf *lf, struct rte_crypto_op *cop, struct cn10k_s
return -ENOMEM;
}
+ if (unlikely(m_src->nb_segs > ROC_SG1_MAX_PTRS)) {
+ plt_dp_err("Exceeds max supported components. Reduce segments");
+ return -1;
+ }
+
m_data = alloc_op_meta(NULL, m_info->mlen, m_info->pool, infl_req);
if (unlikely(m_data == NULL)) {
plt_dp_err("Error allocating meta buffer for request");
@@ -224,6 +229,11 @@ process_inb_sa(struct rte_crypto_op *cop, struct cn10k_sec_session *sess, struct
void *m_data;
int i;
+ if (unlikely(m_src->nb_segs > ROC_SG1_MAX_PTRS)) {
+ plt_dp_err("Exceeds max supported components. Reduce segments");
+ return -1;
+ }
+
m_data = alloc_op_meta(NULL, m_info->mlen, m_info->pool, infl_req);
if (unlikely(m_data == NULL)) {
plt_dp_err("Error allocating meta buffer for request");
diff --git a/drivers/crypto/cnxk/cn10k_tls_ops.h b/drivers/crypto/cnxk/cn10k_tls_ops.h
index 427c31425c..90600bd850 100644
--- a/drivers/crypto/cnxk/cn10k_tls_ops.h
+++ b/drivers/crypto/cnxk/cn10k_tls_ops.h
@@ -117,6 +117,11 @@ process_tls_write(struct roc_cpt_lf *lf, struct rte_crypto_op *cop, struct cn10k
return -ENOMEM;
}
+ if (unlikely(m_src->nb_segs > ROC_SG1_MAX_PTRS)) {
+ plt_dp_err("Exceeds max supported components. Reduce segments");
+ return -1;
+ }
+
m_data = alloc_op_meta(NULL, m_info->mlen, m_info->pool, infl_req);
if (unlikely(m_data == NULL)) {
plt_dp_err("Error allocating meta buffer for request");
@@ -255,6 +260,11 @@ process_tls_read(struct rte_crypto_op *cop, struct cn10k_sec_session *sess,
uint32_t dlen;
int i;
+ if (unlikely(m_src->nb_segs > ROC_SG1_MAX_PTRS)) {
+ plt_dp_err("Exceeds max supported components. Reduce segments");
+ return -1;
+ }
+
m_data = alloc_op_meta(NULL, m_info->mlen, m_info->pool, infl_req);
if (unlikely(m_data == NULL)) {
plt_dp_err("Error allocating meta buffer for request");
diff --git a/drivers/crypto/cnxk/cn20k_ipsec_la_ops.h b/drivers/crypto/cnxk/cn20k_ipsec_la_ops.h
index eff51bd794..505fddb517 100644
--- a/drivers/crypto/cnxk/cn20k_ipsec_la_ops.h
+++ b/drivers/crypto/cnxk/cn20k_ipsec_la_ops.h
@@ -104,6 +104,11 @@ process_outb_sa(struct roc_cpt_lf *lf, struct rte_crypto_op *cop, struct cn20k_s
return -ENOMEM;
}
+ if (unlikely(m_src->nb_segs > ROC_SG2_MAX_PTRS)) {
+ plt_dp_err("Exceeds max supported components. Reduce segments");
+ return -1;
+ }
+
m_data = alloc_op_meta(NULL, m_info->mlen, m_info->pool, infl_req);
if (unlikely(m_data == NULL)) {
plt_dp_err("Error allocating meta buffer for request");
@@ -163,6 +168,11 @@ process_inb_sa(struct rte_crypto_op *cop, struct cn20k_sec_session *sess, struct
void *m_data;
int i;
+ if (unlikely(m_src->nb_segs > ROC_SG2_MAX_PTRS)) {
+ plt_dp_err("Exceeds max supported components. Reduce segments");
+ return -1;
+ }
+
m_data = alloc_op_meta(NULL, m_info->mlen, m_info->pool, infl_req);
if (unlikely(m_data == NULL)) {
plt_dp_err("Error allocating meta buffer for request");
diff --git a/drivers/crypto/cnxk/cn20k_tls_ops.h b/drivers/crypto/cnxk/cn20k_tls_ops.h
index 14f879f2a9..9f70a1d42d 100644
--- a/drivers/crypto/cnxk/cn20k_tls_ops.h
+++ b/drivers/crypto/cnxk/cn20k_tls_ops.h
@@ -118,6 +118,11 @@ process_tls_write(struct roc_cpt_lf *lf, struct rte_crypto_op *cop, struct cn20k
return -ENOMEM;
}
+ if (unlikely(m_src->nb_segs > ROC_SG2_MAX_PTRS)) {
+ plt_dp_err("Exceeds max supported components. Reduce segments");
+ return -1;
+ }
+
m_data = alloc_op_meta(NULL, m_info->mlen, m_info->pool, infl_req);
if (unlikely(m_data == NULL)) {
plt_dp_err("Error allocating meta buffer for request");
@@ -194,6 +199,11 @@ process_tls_read(struct rte_crypto_op *cop, struct cn20k_sec_session *sess,
uint32_t g_size_bytes;
int i;
+ if (unlikely(m_src->nb_segs > ROC_SG2_MAX_PTRS)) {
+ plt_dp_err("Exceeds max supported components. Reduce segments");
+ return -1;
+ }
+
m_data = alloc_op_meta(NULL, m_info->mlen, m_info->pool, infl_req);
if (unlikely(m_data == NULL)) {
plt_dp_err("Error allocating meta buffer for request");
diff --git a/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h b/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
index befd5b0c05..79e00e3c57 100644
--- a/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
+++ b/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
@@ -111,6 +111,11 @@ process_outb_sa(struct cpt_qp_meta_info *m_info, struct rte_crypto_op *cop,
return -ENOMEM;
}
+ if (unlikely(m_src->nb_segs > ROC_SG1_MAX_PTRS)) {
+ plt_dp_err("Exceeds max supported components. Reduce segments");
+ return -1;
+ }
+
m_data = alloc_op_meta(NULL, m_info->mlen, m_info->pool, infl_req);
if (unlikely(m_data == NULL)) {
plt_dp_err("Error allocating meta buffer for request");
@@ -206,6 +211,11 @@ process_inb_sa(struct cpt_qp_meta_info *m_info, struct rte_crypto_op *cop,
void *m_data;
int i;
+ if (unlikely(m_src->nb_segs > ROC_SG1_MAX_PTRS)) {
+ plt_dp_err("Exceeds max supported components. Reduce segments");
+ return -1;
+ }
+
m_data = alloc_op_meta(NULL, m_info->mlen, m_info->pool, infl_req);
if (unlikely(m_data == NULL)) {
plt_dp_err("Error allocating meta buffer for request");
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/9] crypto/cnxk: add struct variable for custom metadata
2025-05-27 13:01 [PATCH 0/9] fixes and new features to cnxk crypto PMD Tejasree Kondoj
` (3 preceding siblings ...)
2025-05-27 13:01 ` [PATCH 4/9] crypto/cnxk: extend check for max supported gather entries Tejasree Kondoj
@ 2025-05-27 13:01 ` Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 6/9] crypto/cnxk: add asym sessionless handling Tejasree Kondoj
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tejasree Kondoj @ 2025-05-27 13:01 UTC (permalink / raw)
To: Akhil Goyal
Cc: Anoob Joseph, Nithinsen Kaithakadan, Rupesh Chiluka,
Vidya Sagar Velumuri, dev
Adding struct variable for passing custom metadata
to microcode.
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index df8d08b7c5..17d39aa34f 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -30,6 +30,8 @@
/* Default command timeout in seconds */
#define DEFAULT_COMMAND_TIMEOUT 4
+#define META_LEN 64
+
#define MOD_INC(i, l) ((i) == (l - 1) ? (i) = 0 : (i)++)
#define CN10K_CPT_PKTS_PER_LOOP 64
@@ -58,6 +60,7 @@ struct __rte_aligned(ROC_ALIGN) cpt_inflight_req {
struct rte_event_vector *vec;
};
void *mdata;
+ uint8_t meta[META_LEN];
uint8_t op_flags;
#ifdef CPT_INST_DEBUG_ENABLE
uint8_t scatter_sz;
@@ -70,6 +73,7 @@ struct __rte_aligned(ROC_ALIGN) cpt_inflight_req {
};
PLT_STATIC_ASSERT(sizeof(struct cpt_inflight_req) == ROC_CACHE_LINE_SZ);
+PLT_STATIC_ASSERT(offsetof(struct cpt_inflight_req, meta) == 32);
struct pending_queue {
/** Array of pending requests */
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6/9] crypto/cnxk: add asym sessionless handling
2025-05-27 13:01 [PATCH 0/9] fixes and new features to cnxk crypto PMD Tejasree Kondoj
` (4 preceding siblings ...)
2025-05-27 13:01 ` [PATCH 5/9] crypto/cnxk: add struct variable for custom metadata Tejasree Kondoj
@ 2025-05-27 13:01 ` Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 7/9] crypto/cnxk: add support for sessionless asym Tejasree Kondoj
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tejasree Kondoj @ 2025-05-27 13:01 UTC (permalink / raw)
To: Akhil Goyal
Cc: Rupesh Chiluka, Anoob Joseph, Nithinsen Kaithakadan,
Vidya Sagar Velumuri, dev
From: Rupesh Chiluka <rchiluka@marvell.com>
Add asymmetric sessionless handling for cnxk
Signed-off-by: Rupesh Chiluka <rchiluka@marvell.com>
---
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 19 +++++++++++++++++--
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 20 ++++++++++++++++++--
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 9ad0629519..813a2deb66 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -417,8 +417,23 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op, struct cnxk_cpt_qp **qp, ui
priv = (struct cnxk_ae_sess *)op->asym->session;
*qp = priv->qp;
*w2 = priv->cpt_inst_w2;
- } else
- return -EINVAL;
+ } else {
+ union rte_event_crypto_metadata *ec_mdata;
+ struct rte_event *rsp_info;
+ uint8_t cdev_id;
+ uint16_t qp_id;
+
+ if (unlikely(op->private_data_offset == 0))
+ return -EINVAL;
+ ec_mdata = (union rte_event_crypto_metadata *)((uint8_t *)op +
+ op->private_data_offset);
+ rsp_info = &ec_mdata->response_info;
+ cdev_id = ec_mdata->request_info.cdev_id;
+ qp_id = ec_mdata->request_info.queue_pair_id;
+ *qp = rte_cryptodevs[cdev_id].data->queue_pairs[qp_id];
+ *w2 = CNXK_CPT_INST_W2((RTE_EVENT_TYPE_CRYPTODEV << 28) | rsp_info->flow_id,
+ rsp_info->sched_type, rsp_info->queue_id, 0);
+ }
} else
return -EINVAL;
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index ee35ed1eba..fa22b5ce44 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -333,8 +333,24 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
priv = (struct cnxk_ae_sess *)op->asym->session;
*qp = priv->qp;
inst->w2.u64 = priv->cpt_inst_w2;
- } else
- return -EINVAL;
+ } else {
+ union rte_event_crypto_metadata *ec_mdata;
+ struct rte_event *rsp_info;
+ uint8_t cdev_id;
+ uint16_t qp_id;
+
+ if (unlikely(op->private_data_offset == 0))
+ return -EINVAL;
+ ec_mdata = (union rte_event_crypto_metadata *)((uint8_t *)op +
+ op->private_data_offset);
+ rsp_info = &ec_mdata->response_info;
+ cdev_id = ec_mdata->request_info.cdev_id;
+ qp_id = ec_mdata->request_info.queue_pair_id;
+ *qp = rte_cryptodevs[cdev_id].data->queue_pairs[qp_id];
+ inst->w2.u64 = CNXK_CPT_INST_W2(
+ (RTE_EVENT_TYPE_CRYPTODEV << 28) | rsp_info->flow_id,
+ rsp_info->sched_type, rsp_info->queue_id, 0);
+ }
} else
return -EINVAL;
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 7/9] crypto/cnxk: add support for sessionless asym
2025-05-27 13:01 [PATCH 0/9] fixes and new features to cnxk crypto PMD Tejasree Kondoj
` (5 preceding siblings ...)
2025-05-27 13:01 ` [PATCH 6/9] crypto/cnxk: add asym sessionless handling Tejasree Kondoj
@ 2025-05-27 13:01 ` Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 8/9] common/cnxk: update qsize in CPT iq enable Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 9/9] crypto/cnxk: copy 8B iv into sess in aes ctr Tejasree Kondoj
8 siblings, 0 replies; 10+ messages in thread
From: Tejasree Kondoj @ 2025-05-27 13:01 UTC (permalink / raw)
To: Akhil Goyal
Cc: Vidya Sagar Velumuri, Anoob Joseph, Nithinsen Kaithakadan,
Rupesh Chiluka, dev
From: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Add support for sessionless asymmetric operations for cnxk
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 72 ++++++++++++++++++++++-
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 57 +++++++++++++++++-
drivers/crypto/cnxk/cnxk_cryptodev.c | 3 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 5 +-
4 files changed, 130 insertions(+), 7 deletions(-)
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 813a2deb66..4f7b34cc21 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -76,6 +76,55 @@ cn10k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
return NULL;
}
+static inline struct cnxk_ae_sess *
+cn10k_cpt_asym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
+{
+ struct rte_crypto_asym_op *asym_op = op->asym;
+ struct roc_cpt *roc_cpt = qp->lf.roc_cpt;
+ struct rte_cryptodev_asym_session *sess;
+ struct cnxk_ae_sess *priv;
+ struct cnxk_cpt_vf *vf;
+ union cpt_inst_w7 w7;
+ struct hw_ctx_s *hwc;
+
+ /* Create temporary session */
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
+ return NULL;
+
+ priv = (struct cnxk_ae_sess *)sess;
+ if (cnxk_ae_fill_session_parameters(priv, asym_op->xform))
+ goto sess_put;
+
+ priv->lf = &qp->lf;
+
+ if (roc_errata_cpt_hang_on_mixed_ctx_val()) {
+ hwc = &priv->hw_ctx;
+ hwc->w0.s.aop_valid = 1;
+ hwc->w0.s.ctx_hdr_size = 0;
+ hwc->w0.s.ctx_size = 1;
+ hwc->w0.s.ctx_push_size = 1;
+
+ w7.s.ctx_val = 1;
+ w7.s.cptr = (uint64_t)hwc;
+ }
+
+ w7.u64 = 0;
+ w7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_AE];
+
+ vf = container_of(roc_cpt, struct cnxk_cpt_vf, cpt);
+ priv->cpt_inst_w7 = w7.u64;
+ priv->cnxk_fpm_iova = vf->cnxk_fpm_iova;
+ priv->ec_grp = vf->ec_grp;
+
+ asym_op->session = sess;
+
+ return priv;
+
+sess_put:
+ rte_mempool_put(qp->sess_mp, sess);
+ return NULL;
+}
+
static __rte_always_inline int __rte_hot
cpt_sec_ipsec_inst_fill(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
struct cn10k_sec_session *sess, struct cpt_inst_s *inst,
@@ -177,7 +226,6 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[], struct
w7 = sess->cpt_inst_w7;
}
} else if (op->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC) {
-
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
asym_op = op->asym;
ae_sess = (struct cnxk_ae_sess *)asym_op->session;
@@ -186,9 +234,22 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[], struct
return 0;
w7 = ae_sess->cpt_inst_w7;
} else {
- plt_dp_err("Not supported Asym op without session");
- return 0;
+ ae_sess = cn10k_cpt_asym_temp_sess_create(qp, op);
+ if (unlikely(ae_sess == NULL)) {
+ plt_dp_err("Could not create temp session");
+ return 0;
+ }
+
+ ret = cnxk_ae_enqueue(qp, op, infl_req, &inst[0], ae_sess);
+ if (unlikely(ret)) {
+ cnxk_ae_session_clear(NULL,
+ (struct rte_cryptodev_asym_session *)ae_sess);
+ rte_mempool_put(qp->sess_mp, ae_sess);
+ return 0;
+ }
+ w7 = ae_sess->cpt_inst_w7;
}
+
} else {
plt_dp_err("Unsupported op type");
return 0;
@@ -1145,6 +1206,11 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
+ if (cop->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC) {
+ cnxk_ae_session_clear(NULL, cop->asym->session);
+ rte_mempool_put(qp->sess_mp, cop->asym->session);
+ cop->asym->session = NULL;
+ }
}
}
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index fa22b5ce44..570051518c 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -67,6 +67,43 @@ cn9k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
return NULL;
}
+static inline struct cnxk_ae_sess *
+cn9k_cpt_asym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
+{
+ struct rte_crypto_asym_op *asym_op = op->asym;
+ struct roc_cpt *roc_cpt = qp->lf.roc_cpt;
+ struct rte_cryptodev_asym_session *sess;
+ struct cnxk_ae_sess *priv;
+ struct cnxk_cpt_vf *vf;
+ union cpt_inst_w7 w7;
+
+ /* Create temporary session */
+ if (rte_mempool_get(qp->sess_mp, (void **)&sess) < 0)
+ return NULL;
+
+ priv = (struct cnxk_ae_sess *)sess;
+ if (cnxk_ae_fill_session_parameters(priv, asym_op->xform))
+ goto sess_put;
+
+ priv->lf = &qp->lf;
+
+ w7.u64 = 0;
+ w7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_AE];
+
+ vf = container_of(roc_cpt, struct cnxk_cpt_vf, cpt);
+ priv->cpt_inst_w7 = w7.u64;
+ priv->cnxk_fpm_iova = vf->cnxk_fpm_iova;
+ priv->ec_grp = vf->ec_grp;
+
+ asym_op->session = sess;
+
+ return priv;
+
+sess_put:
+ rte_mempool_put(qp->sess_mp, sess);
+ return NULL;
+}
+
static inline int
cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
struct cpt_inflight_req *infl_req, struct cpt_inst_s *inst)
@@ -106,7 +143,20 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,
ret = cnxk_ae_enqueue(qp, op, infl_req, inst, sess);
inst->w7.u64 = sess->cpt_inst_w7;
} else {
- ret = -EINVAL;
+ sess = cn9k_cpt_asym_temp_sess_create(qp, op);
+ if (unlikely(sess == NULL)) {
+ plt_dp_err("Could not create temp session");
+ return 0;
+ }
+
+ ret = cnxk_ae_enqueue(qp, op, infl_req, inst, sess);
+ if (unlikely(ret)) {
+ cnxk_ae_session_clear(NULL,
+ (struct rte_cryptodev_asym_session *)sess);
+ rte_mempool_put(qp->sess_mp, sess);
+ return 0;
+ }
+ inst->w7.u64 = sess->cpt_inst_w7;
}
} else {
ret = -EINVAL;
@@ -607,6 +657,11 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
rte_mempool_put(qp->sess_mp, cop->sym->session);
cop->sym->session = NULL;
}
+ if (cop->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC) {
+ cnxk_ae_session_clear(NULL, cop->asym->session);
+ rte_mempool_put(qp->sess_mp, cop->asym->session);
+ cop->asym->session = NULL;
+ }
}
}
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.c b/drivers/crypto/cnxk/cnxk_cryptodev.c
index 96b5121097..5828a502e4 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev.c
@@ -19,7 +19,8 @@ cnxk_cpt_default_ff_get(void)
RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | RTE_CRYPTODEV_FF_IN_PLACE_SGL |
RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT | RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT | RTE_CRYPTODEV_FF_SYM_SESSIONLESS |
- RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED | RTE_CRYPTODEV_FF_SECURITY;
+ RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED | RTE_CRYPTODEV_FF_SECURITY |
+ RTE_CRYPTODEV_FF_ASYM_SESSIONLESS;
if (roc_model_is_cn10k() || roc_model_is_cn20k())
ff |= RTE_CRYPTODEV_FF_SECURITY_INNER_CSUM | RTE_CRYPTODEV_FF_SYM_RAW_DP;
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index e5ca082e10..261e14b418 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -866,7 +866,8 @@ cnxk_ae_session_size_get(struct rte_cryptodev *dev __rte_unused)
}
void
-cnxk_ae_session_clear(struct rte_cryptodev *dev, struct rte_cryptodev_asym_session *sess)
+cnxk_ae_session_clear(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_asym_session *sess)
{
struct cnxk_ae_sess *priv = (struct cnxk_ae_sess *)sess;
@@ -878,7 +879,7 @@ cnxk_ae_session_clear(struct rte_cryptodev *dev, struct rte_cryptodev_asym_sessi
cnxk_ae_free_session_parameters(priv);
/* Reset and free object back to pool */
- memset(priv, 0, cnxk_ae_session_size_get(dev));
+ memset(priv, 0, sizeof(struct cnxk_ae_sess));
}
int
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 8/9] common/cnxk: update qsize in CPT iq enable
2025-05-27 13:01 [PATCH 0/9] fixes and new features to cnxk crypto PMD Tejasree Kondoj
` (6 preceding siblings ...)
2025-05-27 13:01 ` [PATCH 7/9] crypto/cnxk: add support for sessionless asym Tejasree Kondoj
@ 2025-05-27 13:01 ` Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 9/9] crypto/cnxk: copy 8B iv into sess in aes ctr Tejasree Kondoj
8 siblings, 0 replies; 10+ messages in thread
From: Tejasree Kondoj @ 2025-05-27 13:01 UTC (permalink / raw)
To: Akhil Goyal
Cc: Nithinsen Kaithakadan, Anoob Joseph, Rupesh Chiluka,
Vidya Sagar Velumuri, dev
From: Nithinsen Kaithakadan <nkaithakadan@marvell.com>
Reconfigure qsize in each CPT iq enable call.
Fixes: 3bf87839559 ("common/cnxk: move instruction queue enable to ROC")
Signed-off-by: Nithinsen Kaithakadan <nkaithakadan@marvell.com>
---
drivers/common/cnxk/roc_cpt.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c
index b4bf0ccd64..d1ba2b8858 100644
--- a/drivers/common/cnxk/roc_cpt.c
+++ b/drivers/common/cnxk/roc_cpt.c
@@ -1125,9 +1125,14 @@ roc_cpt_iq_disable(struct roc_cpt_lf *lf)
void
roc_cpt_iq_enable(struct roc_cpt_lf *lf)
{
+ union cpt_lf_q_size lf_q_size;
union cpt_lf_inprog lf_inprog;
union cpt_lf_ctl lf_ctl;
+ /* Reconfigure the QSIZE register to ensure NQ_PTR and DQ_PTR are reset */
+ lf_q_size.u = plt_read64(lf->rbase + CPT_LF_Q_SIZE);
+ plt_write64(lf_q_size.u, lf->rbase + CPT_LF_Q_SIZE);
+
/* Disable command queue */
roc_cpt_iq_disable(lf);
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 9/9] crypto/cnxk: copy 8B iv into sess in aes ctr
2025-05-27 13:01 [PATCH 0/9] fixes and new features to cnxk crypto PMD Tejasree Kondoj
` (7 preceding siblings ...)
2025-05-27 13:01 ` [PATCH 8/9] common/cnxk: update qsize in CPT iq enable Tejasree Kondoj
@ 2025-05-27 13:01 ` Tejasree Kondoj
8 siblings, 0 replies; 10+ messages in thread
From: Tejasree Kondoj @ 2025-05-27 13:01 UTC (permalink / raw)
To: Akhil Goyal
Cc: Nithinsen Kaithakadan, Anoob Joseph, Rupesh Chiluka,
Vidya Sagar Velumuri, dev
From: Nithinsen Kaithakadan <nkaithakadan@marvell.com>
Copy 8 bytes of the IV into the iv field within the
session for the AES CTR algorithm.
Signed-off-by: Nithinsen Kaithakadan <nkaithakadan@marvell.com>
---
drivers/crypto/cnxk/cn10k_ipsec_la_ops.h | 7 ++++---
drivers/crypto/cnxk/cn20k_ipsec_la_ops.h | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
index 0cc6283c7e..b9122a509a 100644
--- a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
+++ b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h
@@ -32,7 +32,7 @@ ipsec_po_sa_iv_set(struct cn10k_sec_session *sess, struct rte_crypto_op *cop)
}
static inline void
-ipsec_po_sa_aes_gcm_iv_set(struct cn10k_sec_session *sess, struct rte_crypto_op *cop)
+ipsec_po_sa_aes_8b_iv_set(struct cn10k_sec_session *sess, struct rte_crypto_op *cop)
{
uint8_t *iv = &sess->sa.out_sa.iv.s.iv_dbg1[0];
uint32_t *tmp_iv;
@@ -63,8 +63,9 @@ process_outb_sa(struct roc_cpt_lf *lf, struct rte_crypto_op *cop, struct cn10k_s
if (sess->sa.out_sa.w2.s.iv_src == ROC_IE_OT_SA_IV_SRC_FROM_SA) {
if (sess->sa.out_sa.w2.s.enc_type == ROC_IE_SA_ENC_AES_GCM ||
sess->sa.out_sa.w2.s.enc_type == ROC_IE_SA_ENC_AES_CCM ||
- sess->sa.out_sa.w2.s.auth_type == ROC_IE_SA_AUTH_AES_GMAC)
- ipsec_po_sa_aes_gcm_iv_set(sess, cop);
+ sess->sa.out_sa.w2.s.auth_type == ROC_IE_SA_AUTH_AES_GMAC ||
+ sess->sa.out_sa.w2.s.enc_type == ROC_IE_SA_ENC_AES_CTR)
+ ipsec_po_sa_aes_8b_iv_set(sess, cop);
else
ipsec_po_sa_iv_set(sess, cop);
}
diff --git a/drivers/crypto/cnxk/cn20k_ipsec_la_ops.h b/drivers/crypto/cnxk/cn20k_ipsec_la_ops.h
index 505fddb517..2f860c1855 100644
--- a/drivers/crypto/cnxk/cn20k_ipsec_la_ops.h
+++ b/drivers/crypto/cnxk/cn20k_ipsec_la_ops.h
@@ -31,7 +31,7 @@ ipsec_po_sa_iv_set(struct cn20k_sec_session *sess, struct rte_crypto_op *cop)
}
static inline void
-ipsec_po_sa_aes_gcm_iv_set(struct cn20k_sec_session *sess, struct rte_crypto_op *cop)
+ipsec_po_sa_aes_8b_iv_set(struct cn20k_sec_session *sess, struct rte_crypto_op *cop)
{
uint8_t *iv = &sess->sa.out_sa.iv.s.iv_dbg1[0];
uint32_t *tmp_iv;
@@ -62,8 +62,9 @@ process_outb_sa(struct roc_cpt_lf *lf, struct rte_crypto_op *cop, struct cn20k_s
if (sess->sa.out_sa.w2.s.iv_src == ROC_IE_OW_SA_IV_SRC_FROM_SA) {
if (sess->sa.out_sa.w2.s.enc_type == ROC_IE_SA_ENC_AES_GCM ||
sess->sa.out_sa.w2.s.enc_type == ROC_IE_SA_ENC_AES_CCM ||
- sess->sa.out_sa.w2.s.auth_type == ROC_IE_SA_AUTH_AES_GMAC)
- ipsec_po_sa_aes_gcm_iv_set(sess, cop);
+ sess->sa.out_sa.w2.s.auth_type == ROC_IE_SA_AUTH_AES_GMAC ||
+ sess->sa.out_sa.w2.s.enc_type == ROC_IE_SA_ENC_AES_CTR)
+ ipsec_po_sa_aes_8b_iv_set(sess, cop);
else
ipsec_po_sa_iv_set(sess, cop);
}
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-05-27 13:02 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-27 13:01 [PATCH 0/9] fixes and new features to cnxk crypto PMD Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 1/9] crypto/cnxk: include required headers Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 2/9] common/cnxk: fix salt handling with aes-ctr Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 3/9] common/cnxk: set correct salt value for ctr algos Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 4/9] crypto/cnxk: extend check for max supported gather entries Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 5/9] crypto/cnxk: add struct variable for custom metadata Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 6/9] crypto/cnxk: add asym sessionless handling Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 7/9] crypto/cnxk: add support for sessionless asym Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 8/9] common/cnxk: update qsize in CPT iq enable Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 9/9] crypto/cnxk: copy 8B iv into sess in aes ctr Tejasree Kondoj
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).