fixes and improvements to CNXK crypto PMD
v3 cover fixes and improvements to CNXK crypto PMD
This series adds SM4, raw cryptodev API support and fixes to CNXK crypto PMD.
v3:
* Updated feature file for cn10k
v2:
* Fixed documentation build failure
* Updated release notes
Aakash Sasidharan (1):
crypto/cnxk: use pt inst for null cipher with null auth
Anoob Joseph (3):
crypto/cnxk: remove packet length checks in crypto offload crypto/cnxk: add support for raw APIs test/crypto: enable raw crypto tests for crypto_cn10k
Gowrishankar Muthukrishnan (1):
crypto/cnxk: fix order of ECFPM parameters
Tejasree Kondoj (2):
crypto/cnxk: check for null pointer
crypto/cnxk: enable context cache for 103XX
Vidya Sagar Velumuri (1):
crypto/cnxk: add support for sm4
app/test/test_cryptodev.c | 8 + doc/guides/cryptodevs/cnxk.rst | 1 + doc/guides/cryptodevs/features/cn10k.ini | 6 + doc/guides/rel_notes/release_23_07.rst | 2 + drivers/common/cnxk/hw/cpt.h | 5 +- drivers/common/cnxk/roc_se.c | 3 + drivers/common/cnxk/roc_se.h | 20 + drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 459 ++++++++++++ drivers/crypto/cnxk/cnxk_ae.h | 3 +- drivers/crypto/cnxk/cnxk_cryptodev.c | 20 +- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 113 ++- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 29 +- drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 9 + drivers/crypto/cnxk/cnxk_se.h | 696 ++++++++++++++++-- 15 files changed, 1269 insertions(+), 107 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/8 crypto/cnxk: check for null pointer
Checking for NULL pointer dereference.
--- drivers/crypto/cnxk/cnxk_se.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/crypto/cnxk/cnxk_se.h +8 -6
@@ -2185,12 +2185,14 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess)if (zsk_flag && sess->roc_se_ctx.auth_then_ciph) {struct rte_crypto_cipher_xform *c_form; - c_form = &xform->next->cipher; -if (c_form->op !=RTE_CRYPTO_CIPHER_OP_ENCRYPT && - a_form->op !=RTE_CRYPTO_AUTH_OP_GENERATE ) { -plt_dp_err ("Crypto: PDCP auth then cipher must use" -" options: encrypt and generate" ); -return -EINVAL ; +if (xform->next !=NULL ) { + c_form = &xform->next->cipher; +if ((c_form !=NULL ) && (c_form->op !=RTE_CRYPTO_CIPHER_OP_ENCRYPT ) && + a_form->op !=RTE_CRYPTO_AUTH_OP_GENERATE ) { +plt_dp_err ("Crypto: PDCP auth then cipher must use" +" options: encrypt and generate" ); +return -EINVAL ; + } } }
Signature · 1 line
2.25.1
PATCH v3 2/8 crypto/cnxk: remove packet length checks in crypto offload
In reply to Tejasree KondojFrom: Anoob Joseph <[email protected]>
When performing crypto offload, the packet length of the input/output buffer does not matter. The length that matters is the cipher/authentication range specified in crypto_op. Since application can request for ciphering of a small portion of the buffer, the extra comparison of buffer lengths may result in false failures during enqueue of OOP operations.
--- drivers/crypto/cnxk/cnxk_se.h | 54 +++-------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-)
drivers/crypto/cnxk/cnxk_se.h +4 -50
@@ -2539,23 +2539,6 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, }if (unlikely (m_dst !=NULL )) { -uint32_t pkt_len; - -/* Try to make room as much as src has */ - pkt_len =rte_pktmbuf_pkt_len (m_dst); - -if (unlikely (pkt_len <rte_pktmbuf_pkt_len (m_src))) { - pkt_len =rte_pktmbuf_pkt_len (m_src) - pkt_len; -if (!rte_pktmbuf_append (m_dst, pkt_len)) { -plt_dp_err ("Not enough space in " -"m_dst %p, need %u" -" more" , - m_dst, pkt_len); - ret = -EINVAL ; - goto err_exit; - } - } -if (prepare_iov_from_pkt (m_dst, fc_params.dst_iov,0 )) { plt_dp_err("Prepare dst iov failed for " "m_dst %p",
@@ -2650,32 +2633,18 @@ fill_pdcp_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, fc_params.dst_iov = fc_params.src_iov = (void *)src;prepare_iov_from_pkt_inplace (m_src, &fc_params, &flags); }else { -uint32_t pkt_len; -/* Out of place processing */ + fc_params.src_iov = (void *)src; fc_params.dst_iov = (void *)dst;/* Store SG I/O in the api for reuse */ -if (prepare_iov_from_pkt (m_src, fc_params.src_iov,0 )) { +if (unlikely (prepare_iov_from_pkt (m_src, fc_params.src_iov,0 ))) {plt_dp_err ("Prepare src iov failed" ); ret = -EINVAL ; goto err_exit; } -/* Try to make room as much as src has */ - pkt_len =rte_pktmbuf_pkt_len (m_dst); - -if (unlikely (pkt_len <rte_pktmbuf_pkt_len (m_src))) { - pkt_len =rte_pktmbuf_pkt_len (m_src) - pkt_len; -if (unlikely (rte_pktmbuf_append (m_dst, pkt_len) ==NULL )) { -plt_dp_err ("Not enough space in m_dst %p, need %u more" , m_dst, - pkt_len); - ret = -EINVAL ; - goto err_exit; - } - } -if (unlikely (prepare_iov_from_pkt (m_dst, fc_params.dst_iov,0 ))) {plt_dp_err ("Prepare dst iov failed for m_dst %p" , m_dst); ret = -EINVAL ;
@@ -2689,7 +2658,8 @@ fill_pdcp_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, mdata =alloc_op_meta (&fc_params.meta_buf, m_info->mlen, m_info->pool, infl_req);if (mdata ==NULL ) {plt_dp_err ("Could not allocate meta buffer" ); -return -ENOMEM ; + ret = -ENOMEM ; + goto err_exit; } }
@@ -2798,22 +2768,6 @@ fill_pdcp_chain_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, }if (unlikely (m_dst !=NULL )) { -uint32_t pkt_len; - -/* Try to make room as much as src has */ - pkt_len =rte_pktmbuf_pkt_len (m_dst); - -if (unlikely (pkt_len <rte_pktmbuf_pkt_len (m_src))) { - pkt_len =rte_pktmbuf_pkt_len (m_src) - pkt_len; -if (!rte_pktmbuf_append (m_dst, pkt_len)) { -plt_dp_err ("Not enough space in m_dst " -"%p, need %u more" , - m_dst, pkt_len); - ret = -EINVAL ; - goto err_exit; - } - } -if (unlikely (prepare_iov_from_pkt (m_dst, fc_params.dst_iov,0 ))) {plt_dp_err ("Could not prepare m_dst iov %p" , m_dst); ret = -EINVAL ;
Signature · 1 line
2.25.1
PATCH v3 3/8 crypto/cnxk: use pt inst for null cipher with null auth
In reply to Tejasree KondojFrom: Aakash Sasidharan <[email protected]>
Use passthrough instruction for NULL cipher with NULL auth combination.
--- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 20 ++++---- drivers/crypto/cnxk/cnxk_se.h | 59 ++++++++++++++++-------- 2 files changed, 50 insertions(+), 29 deletions(-)
drivers/crypto/cnxk/cnxk_cryptodev_ops.c +10 -10
@@ -526,16 +526,13 @@ cnxk_sess_fill(struct roc_cpt *roc_cpt, struct rte_crypto_sym_xform *xform,return -EINVAL ; } -if ((c_xfrm ==NULL || c_xfrm->cipher.algo ==RTE_CRYPTO_CIPHER_NULL ) && - a_xfrm !=NULL && a_xfrm->auth.algo ==RTE_CRYPTO_AUTH_NULL && - a_xfrm->auth.op ==RTE_CRYPTO_AUTH_OP_VERIFY ) { -plt_dp_err ("Null cipher + null auth verify is not supported" ); -return -ENOTSUP ; - } +if ((aead_xfrm ==NULL ) && + (c_xfrm ==NULL || c_xfrm->cipher.algo ==RTE_CRYPTO_CIPHER_NULL ) && + (a_xfrm ==NULL || a_xfrm->auth.algo ==RTE_CRYPTO_AUTH_NULL )) + sess->passthrough =1 ;/* Cipher only */ -if (c_xfrm !=NULL && - (a_xfrm ==NULL || a_xfrm->auth.algo ==RTE_CRYPTO_AUTH_NULL )) { +if (c_xfrm !=NULL && (a_xfrm ==NULL || a_xfrm->auth.algo ==RTE_CRYPTO_AUTH_NULL )) {if (fill_sess_cipher (c_xfrm, sess))return -ENOTSUP ;else
@@ -662,7 +659,8 @@ cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt) inst_w7.s.cptr +=8 ;/* Set the engine group */ -if (sess->zsk_flag || sess->aes_ctr_eea2 || sess->is_sha3 || sess->is_sm3) +if (sess->zsk_flag || sess->aes_ctr_eea2 || sess->is_sha3 || sess->is_sm3 || + sess->passthrough) inst_w7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_SE ];else inst_w7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_IE ];
@@ -687,7 +685,9 @@ sym_session_configure(struct roc_cpt *roc_cpt, struct rte_crypto_sym_xform *xfor sess_priv->lf = roc_cpt->lf[0 ]; -if (sess_priv->cpt_op &ROC_SE_OP_CIPHER_MASK ) { +if (sess_priv->passthrough) + thr_type =CPT_DP_THREAD_TYPE_PT ; +else 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->aes_ccm || sess_priv->chacha_poly)
drivers/crypto/cnxk/cnxk_se.h +40 -19
101 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 4/8 crypto/cnxk: enable context cache for 103XX
In reply to Tejasree KondojEnabling context cache for SE instructions on 106B0 and 103XX.
--- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 6 +++--- drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-)
drivers/crypto/cnxk/cnxk_cryptodev_ops.c +3 -3
@@ -653,7 +653,7 @@ cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt) inst_w7.s.cptr = (uint64_t )&sess->roc_se_ctx.se_ctx; -if (roc_errata_cpt_hang_on_mixed_ctx_val ()) +if (hw_ctx_cache_enable ()) inst_w7.s.ctx_val =1 ;else inst_w7.s.cptr +=8 ;
@@ -729,7 +729,7 @@ sym_session_configure(struct roc_cpt *roc_cpt, struct rte_crypto_sym_xform *xfor sess_priv->cpt_inst_w7 =cnxk_cpt_inst_w7_get (sess_priv, roc_cpt); -if (roc_errata_cpt_hang_on_mixed_ctx_val ()) +if (hw_ctx_cache_enable ())roc_se_ctx_init (&sess_priv->roc_se_ctx);return 0 ;
@@ -755,7 +755,7 @@ sym_session_clear(struct rte_cryptodev_sym_session *sess, bool is_session_less)struct cnxk_se_sess *sess_priv = (struct cnxk_se_sess *)sess;/* Trigger CTX flush + invalidate to remove from CTX_CACHE */ -if (roc_errata_cpt_hang_on_mixed_ctx_val ()) +if (hw_ctx_cache_enable ())roc_cpt_lf_ctx_flush (sess_priv->lf, &sess_priv->roc_se_ctx.se_ctx, true);if (sess_priv->roc_se_ctx.auth_key !=NULL )
drivers/crypto/cnxk/cnxk_cryptodev_ops.h +8 -0
@@ -13,6 +13,7 @@#include "roc_constants.h" #include "roc_cpt.h" #include "roc_cpt_sg.h" +#include "roc_errata.h" #include "roc_se.h" #define CNXK_CPT_MIN_HEADROOM_REQ 32
@@ -180,4 +181,11 @@ alloc_op_meta(struct roc_se_buf_ptr *buf, int32_t len, struct rte_mempool *cpt_mreturn mdata; } + +static __rte_always_inline bool +hw_ctx_cache_enable (void ) +{ +return roc_errata_cpt_hang_on_mixed_ctx_val () ||roc_model_is_cn10ka_b0 () || +roc_model_is_cn10kb_a0 (); +}#endif /* _CNXK_CRYPTODEV_OPS_H_ */
Signature · 1 line
2.25.1
PATCH v3 5/8 crypto/cnxk: add support for raw APIs
In reply to Tejasree KondojFrom: Anoob Joseph <[email protected]>
Add crypto RAW API support in cnxk PMD
Enable the flag to allow execution of raw test suite.
--- doc/guides/cryptodevs/features/cn10k.ini | 1 + doc/guides/rel_notes/release_23_07.rst | 1 + drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 459 ++++++++++++++++++++++ drivers/crypto/cnxk/cnxk_cryptodev.c | 20 +- drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 1 + drivers/crypto/cnxk/cnxk_se.h | 293 ++++++++++++++ 6 files changed, 762 insertions(+), 13 deletions(-)
doc/guides/cryptodevs/features/cn10k.ini +1 -0
@@ -17,6 +17,7 @@ Symmetric sessionless = Y RSA PRIV OP KEY EXP = Y RSA PRIV OP KEY QT = Y Digest encrypted = Y +Sym raw data path API = Y Inner checksum = Y ;
doc/guides/rel_notes/release_23_07.rst +1 -0
@@ -154,6 +154,7 @@ New Features * Added support for PDCP chain in cn10k crypto driver. * Added support for SM3 hash operations. * Added support for AES-CCM in cn9k and cn10k drivers. + * Added support for RAW cryptodev APIs in cn10k driver. * **Updated OpenSSL crypto driver.**
drivers/crypto/cnxk/cn10k_cryptodev_ops.c +459 -0
469 lines not on this page · raw message
drivers/crypto/cnxk/cnxk_cryptodev.c +7 -13
@@ -13,22 +13,16 @@uint64_t cnxk_cpt_default_ff_get (void ) { -uint64_t ff =RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | -RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO | -RTE_CRYPTODEV_FF_HW_ACCELERATED | -RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT | +uint64_t ff =RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO | +RTE_CRYPTODEV_FF_HW_ACCELERATED |RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT |RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP | -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_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 ;if (roc_model_is_cn10k ()) - ff |=RTE_CRYPTODEV_FF_SECURITY_INNER_CSUM ; + ff |=RTE_CRYPTODEV_FF_SECURITY_INNER_CSUM |RTE_CRYPTODEV_FF_SYM_RAW_DP ;return ff; }
drivers/crypto/cnxk/cnxk_cryptodev_ops.h +1 -0
@@ -44,6 +44,7 @@ struct cpt_qp_meta_info {struct cpt_inflight_req {union cpt_res_s res;union { +void *opaque;struct rte_crypto_op *cop;struct rte_event_vector *vec; };
drivers/crypto/cnxk/cnxk_se.h +293 -0
303 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v3 5/8] crypto/cnxk: add support for raw APIs
20/06/2023 12:21, Tejasree Kondoj:
Quoted 7 lines
From: Anoob Joseph <[email protected]>
Add crypto RAW API support in cnxk PMD
Enable the flag to allow execution of raw test suite.Signed-off-by Vidya Sagar Velumuri <[email protected]>Signed-off-by Anoob Joseph <[email protected]>
The compilation with a RISC-V compiler reveal an issue with iv_buf being null in some case:
In file included from ../../dpdk/drivers/crypto/cnxk/cn10k_cryptodev_ops.c:29:
In function 'sg2_inst_prep',
inlined from 'cpt_kasumi_enc_prep' at ../../dpdk/drivers/crypto/cnxk/cnxk_se.h:1821:3,
inlined from 'cpt_fc_enc_hmac_prep' at ../../dpdk/drivers/crypto/cnxk/cnxk_se.h:1902:9,
inlined from 'fill_raw_digest_params' at ../../dpdk/drivers/crypto/cnxk/cnxk_se.h:3620:8,
inlined from 'cn10k_cpt_raw_fill_inst.isra' at ../../dpdk/drivers/crypto/cnxk/cn10k_cryptodev_ops.c:1098:9:../../dpdk/drivers/crypto/cnxk/cnxk_se.h:479:25: error: argument 2 null where non-null expected [-Werror=nonnull]
479 | memcpy(iv_d, iv_s, iv_len);
I won't pull this patch and the next one about testing of raw API.
PATCH v3 6/8 test/crypto: enable raw crypto tests for crypto_cn10k
In reply to Tejasree KondojFrom: Anoob Joseph <[email protected]>
Enable raw crypto tests with crypto_cn10k.
--- app/test/test_cryptodev.c | 8 ++++++++ 1 file changed, 8 insertions(+)
app/test/test_cryptodev.c +8 -0
@@ -17519,6 +17519,12 @@ test_cryptodev_cn10k(void)return run_cryptodev_testsuite (RTE_STR (CRYPTODEV_NAME_CN10K_PMD )); } +static int +test_cryptodev_cn10k_raw_api (void ) +{ +return run_cryptodev_raw_testsuite (RTE_STR (CRYPTODEV_NAME_CN10K_PMD )); +} +static int test_cryptodev_dpaa2_sec_raw_api (void ) {
@@ -17531,6 +17537,8 @@ test_cryptodev_dpaa_sec_raw_api(void)return run_cryptodev_raw_testsuite (RTE_STR (CRYPTODEV_NAME_DPAA_SEC_PMD )); } +REGISTER_TEST_COMMAND (cryptodev_cn10k_raw_api_autotest, + test_cryptodev_cn10k_raw_api);REGISTER_TEST_COMMAND (cryptodev_dpaa2_sec_raw_api_autotest, test_cryptodev_dpaa2_sec_raw_api); REGISTER_TEST_COMMAND(cryptodev_dpaa_sec_raw_api_autotest,
Signature · 1 line
2.25.1
PATCH v3 7/8 crypto/cnxk: add support for sm4
In reply to Tejasree KondojFrom: Vidya Sagar Velumuri <[email protected]>
Add support for SM4 cipher
Support for modes: SM4_CBC, SM4_ECB, SM4_CTR, SM4_OFB, SM4_CFB
--- doc/guides/cryptodevs/cnxk.rst | 1 + doc/guides/cryptodevs/features/cn10k.ini | 5 + doc/guides/rel_notes/release_23_07.rst | 1 + drivers/common/cnxk/hw/cpt.h | 5 +- drivers/common/cnxk/roc_se.c | 3 + drivers/common/cnxk/roc_se.h | 20 ++ drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 113 ++++++- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 5 +- drivers/crypto/cnxk/cnxk_se.h | 278 +++++++++++++++++- 10 files changed, 426 insertions(+), 7 deletions(-)
doc/guides/cryptodevs/cnxk.rst +1 -0
@@ -41,6 +41,7 @@ Cipher algorithms: * ``RTE_CRYPTO_CIPHER_KASUMI_F8`` * ``RTE_CRYPTO_CIPHER_SNOW3G_UEA2`` * ``RTE_CRYPTO_CIPHER_ZUC_EEA3`` +* ``RTE_CRYPTO_CIPHER_SM4`` Hash algorithms:
doc/guides/cryptodevs/features/cn10k.ini +5 -0
@@ -39,6 +39,11 @@ DES CBC = Y KASUMI F8 = Y SNOW3G UEA2 = Y ZUC EEA3 = Y +SM4 ECB = Y +SM4 CBC = Y +SM4 CTR = Y +SM4 CFB = Y +SM4 OFB = Y ; ; Supported authentication algorithms of 'cn10k' crypto driver.
doc/guides/rel_notes/release_23_07.rst +1 -0
@@ -155,6 +155,7 @@ New Features * Added support for SM3 hash operations. * Added support for AES-CCM in cn9k and cn10k drivers. * Added support for RAW cryptodev APIs in cn10k driver. + * Added support for SM4 operations in cn10k driver. * **Updated OpenSSL crypto driver.**
drivers/common/cnxk/hw/cpt.h +4 -1
@@ -73,7 +73,10 @@ union cpt_eng_caps { uint64_t __io des : 1; uint64_t __io crc : 1; uint64_t __io mmul : 1; - uint64_t __io reserved_15_33 : 19; + uint64_t __io reserved_15_20 : 6; + uint64_t __io sm3 : 1; + uint64_t __io sm4 : 1; + uint64_t __io reserved_23_33 : 11; uint64_t __io pdcp_chain : 1; uint64_t __io sg_ver2 : 1; uint64_t __io reserved_36_63 : 28;
drivers/common/cnxk/roc_se.c +3 -0
@@ -757,6 +757,9 @@ roc_se_ctx_init(struct roc_se_ctx *roc_se_ctx)case ROC_SE_PDCP_CHAIN : ctx_len =sizeof (struct roc_se_zuc_snow3g_chain_ctx );break ; +case ROC_SE_SM : + ctx_len =sizeof (struct roc_se_sm_context ); +break ;default : ctx_len =0 ; }
drivers/common/cnxk/roc_se.h +20 -0
@@ -17,6 +17,7 @@#define ROC_SE_MAJOR_OP_PDCP 0x37#define ROC_SE_MAJOR_OP_KASUMI 0x38#define ROC_SE_MAJOR_OP_PDCP_CHAIN 0x3C +#define ROC_SE_MAJOR_OP_SM 0x3D#define ROC_SE_MAJOR_OP_MISC 0x01ULL#define ROC_SE_MISC_MINOR_OP_PASSTHROUGH 0x03ULL
@@ -28,6 +29,8 @@#define ROC_SE_OFF_CTRL_LEN 8 +#define ROC_SE_SM4_KEY_LEN 16 +#define ROC_SE_ZS_EA 0x1#define ROC_SE_ZS_IA 0x2#define ROC_SE_K_F8 0x4
@@ -38,6 +41,7 @@#define ROC_SE_KASUMI 0x3#define ROC_SE_HASH_HMAC 0x4#define ROC_SE_PDCP_CHAIN 0x5 +#define ROC_SE_SM 0x6#define ROC_SE_OP_CIPHER_ENCRYPT 0x1#define ROC_SE_OP_CIPHER_DECRYPT 0x2
@@ -125,6 +129,14 @@ typedef enum {ROC_SE_DES_DOCSISBPI =0x96 , } roc_se_cipher_type; +typedef enum { +ROC_SM4_ECB =0x0 , +ROC_SM4_CBC =0x1 , +ROC_SM4_CTR =0x2 , +ROC_SM4_CFB =0x3 , +ROC_SM4_OFB =0x4 , +}roc_sm_cipher_type ; + typedef enum { /* Microcode errors */ ROC_SE_NO_ERR = 0x00,
@@ -192,6 +204,13 @@ struct roc_se_context {struct roc_se_hmac_context hmac; }; +struct roc_se_sm_context { +uint64_t rsvd_56_60 :5 ; +uint64_t enc_cipher :3 ; +uint64_t rsvd_0_55 :56 ; +uint8_t encr_key[16 ]; +}; + struct roc_se_otk_zuc_ctx { union { uint64_t u64;
@@ -325,6 +344,7 @@ struct roc_se_ctx {struct roc_se_zuc_snow3g_ctx zs_ctx;struct roc_se_zuc_snow3g_chain_ctx zs_ch_ctx;struct roc_se_kasumi_ctx k_ctx; +struct roc_se_sm_context sm_ctx; }; }se_ctx __plt_aligned (ROC_ALIGN );uint8_t *auth_key;
drivers/crypto/cnxk/cnxk_cryptodev.h +1 -1
@@ -10,7 +10,7 @@#include "roc_cpt.h" -#define CNXK_CPT_MAX_CAPS 49 +#define CNXK_CPT_MAX_CAPS 54#define CNXK_SEC_CRYPTO_MAX_CAPS 16#define CNXK_SEC_MAX_CAPS 9#define CNXK_AE_EC_ID_MAX 8
drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c +110 -3
132 lines not on this page · raw message
drivers/crypto/cnxk/cnxk_cryptodev_ops.c +4 -1
@@ -660,7 +660,7 @@ cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt)/* Set the engine group */ if (sess->zsk_flag || sess->aes_ctr_eea2 || sess->is_sha3 || sess->is_sm3 || - sess->passthrough) + sess->passthrough || sess->is_sm4) inst_w7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_SE ];else inst_w7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_IE ];
@@ -704,6 +704,9 @@ sym_session_configure(struct roc_cpt *roc_cpt, struct rte_crypto_sym_xform *xforcase ROC_SE_PDCP_CHAIN : thr_type =CPT_DP_THREAD_TYPE_PDCP_CHAIN ;break ; +case ROC_SE_SM : + thr_type =CPT_DP_THREAD_TYPE_SM ; +break ;default :plt_err ("Invalid op type" ); ret = -ENOTSUP ;
drivers/crypto/cnxk/cnxk_se.h +277 -1
320 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 8/8 crypto/cnxk: fix order of ECFPM parameters
In reply to Tejasree KondojFrom: Gowrishankar Muthukrishnan <[email protected]>
Fix order of ECFPM parameters.
--- drivers/crypto/cnxk/cnxk_ae.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/cnxk/cnxk_ae.h +2 -1
@@ -723,7 +723,8 @@ cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm,* optionally ROUNDUP8(input point(x and y coordinates)). * Please note point length is equivalent to prime of the curve */ -if (cpt_ver ==ROC_CPT_REVISION_ID_96XX_C0 ) { +if (cpt_ver ==ROC_CPT_REVISION_ID_96XX_B0 || cpt_ver ==ROC_CPT_REVISION_ID_96XX_C0 || + cpt_ver ==ROC_CPT_REVISION_ID_98XX ) { dlen =sizeof (fpm_table_iova) +3 * p_align + scalar_align;memset (dptr,0 , dlen); *(uint64_t *)dptr = fpm_table_iova;
Signature · 1 line
2.25.1
Quoted 7 lines
Subject: [PATCH v3 0/8] fixes and improvements to CNXK crypto PMD
This series adds SM4, raw cryptodev API support and fixes to CNXK crypto PMD.
v3:
* Updated feature file for cn10k
Series applied to dpdk-next-crypto
Had just applied your v2 with the doc changes and few title updates.
Thanks.