fixes and improvements to CNXK crypto PMD
cover fixes and improvements to CNXK crypto PMD
This series adds SM3, CN10K PDCP CHAIN support and improvements to CNXK crypto PMD.
Aakash Sasidharan (1):
crypto/cnxk: add cryptodev reconfiguration support
Anoob Joseph (2):
crypto/cnxk: increase max segments
crypto/cnxk: remove redundant assignment
Tejasree Kondoj (3):
crypto/cnxk: return error for unsupported paths crypto/cnxk: add CN10K pdcp chain support crypto/cnxk: set local variables to template value
Vidya Sagar Velumuri (1):
crypto/cnxk: support SM3 hash
doc/guides/cryptodevs/cnxk.rst | 1 + doc/guides/cryptodevs/features/cn10k.ini | 1 + drivers/common/cnxk/roc_cpt_sg.h | 4 +- drivers/common/cnxk/roc_se.c | 61 ++- drivers/common/cnxk/roc_se.h | 8 +- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 32 ++ drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 55 ++- drivers/crypto/cnxk/cnxk_se.h | 444 ++++++++++++------ 9 files changed, 424 insertions(+), 184 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/7 crypto/cnxk: return error for unsupported paths
Returning error in control path for unsupported
algorithm combinations.
--- drivers/common/cnxk/roc_se.c | 12 +++++++++--- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/common/cnxk/roc_se.c +9 -3
@@ -329,6 +329,11 @@ roc_se_auth_key_set(struct roc_se_ctx *se_ctx, roc_se_auth_type type,if (!key_len)return -1 ; +if (se_ctx->fc_type ==ROC_SE_FC_GEN ) { +plt_err ("Cipher and Auth algorithm combination is not supported" ); +return -1 ; + } +if (roc_model_is_cn9k ()) { ci_key = zs_ctx->zuc.onk_ctx.ci_key; zuc_const = zs_ctx->zuc.onk_ctx.zuc_const;
@@ -454,12 +459,13 @@ roc_se_auth_key_set(struct roc_se_ctx *se_ctx, roc_se_auth_type type,return 0 ; } -if (!se_ctx->fc_type || - (type && type !=ROC_SE_GMAC_TYPE && !se_ctx->enc_cipher)) +if (!se_ctx->fc_type || (type && type !=ROC_SE_GMAC_TYPE && !se_ctx->enc_cipher)) se_ctx->fc_type =ROC_SE_HASH_HMAC ; -if (se_ctx->fc_type ==ROC_SE_FC_GEN && key_len >64 ) +if (se_ctx->fc_type ==ROC_SE_FC_GEN && key_len >64 ) { +plt_err ("Maximum auth key length supported is 64" );return -1 ; + }/* For GMAC auth, cipher must be NULL */ if (type ==ROC_SE_GMAC_TYPE ) {
drivers/crypto/cnxk/cnxk_cryptodev_ops.c +5 -0
@@ -551,6 +551,11 @@ cnxk_sess_fill(struct roc_cpt *roc_cpt, struct rte_crypto_sym_xform *xform,return -EINVAL ; } +if (c_xfrm->cipher.algo ==RTE_CRYPTO_CIPHER_AES_XTS ) { +plt_err ("AES XTS with auth algorithm is not supported" ); +return -ENOTSUP ; + } +if (c_xfrm->cipher.algo ==RTE_CRYPTO_CIPHER_3DES_CBC && a_xfrm->auth.algo ==RTE_CRYPTO_AUTH_SHA1 ) {plt_dp_err ("3DES-CBC + SHA1 is not supported" );
Signature · 1 line
2.25.1
PATCH 2/7 crypto/cnxk: add cryptodev reconfiguration support
In reply to Tejasree KondojFrom: Aakash Sasidharan <[email protected]>
Add support for reconfiguration of cryptodev on cnxk platforms.
--- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 46 +++++++++++++++--------- 1 file changed, 30 insertions(+), 16 deletions(-)
drivers/crypto/cnxk/cnxk_cryptodev_ops.c +30 -16
@@ -67,15 +67,42 @@ cnxk_cpt_asym_get_mlen(void)return len; } +static int +cnxk_cpt_dev_clear (struct rte_cryptodev *dev) +{ +struct cnxk_cpt_vf *vf = dev->data->dev_private; +int ret; + +if (dev->feature_flags &RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO ) { +roc_ae_fpm_put (); +roc_ae_ec_grp_put (); + } + + ret =roc_cpt_int_misc_cb_unregister (cnxk_cpt_int_misc_cb,NULL ); +if (ret <0 ) { +plt_err ("Could not unregister CPT_MISC_INT cb" ); +return ret; + } + +roc_cpt_dev_clear (&vf->cpt); + +return 0 ; +} +int -cnxk_cpt_dev_config (struct rte_cryptodev *dev, -struct rte_cryptodev_config *conf) +cnxk_cpt_dev_config (struct rte_cryptodev *dev,struct rte_cryptodev_config *conf) {struct cnxk_cpt_vf *vf = dev->data->dev_private;struct roc_cpt *roc_cpt = &vf->cpt;uint16_t nb_lf_avail, nb_lf;int ret; +/* If this is a reconfigure attempt, clear the device and configure again */ +if (roc_cpt->nb_lf >0 ) { +cnxk_cpt_dev_clear (dev); + roc_cpt->opaque =NULL ; + } + dev->feature_flags =cnxk_cpt_default_ff_get () & ~conf->ff_disable; nb_lf_avail = roc_cpt->nb_lf_avail;
@@ -151,7 +178,6 @@ cnxk_cpt_dev_stop(struct rte_cryptodev *dev)int cnxk_cpt_dev_close (struct rte_cryptodev *dev) { -struct cnxk_cpt_vf *vf = dev->data->dev_private;uint16_t i;int ret;
@@ -163,19 +189,7 @@ cnxk_cpt_dev_close(struct rte_cryptodev *dev) } } -if (dev->feature_flags &RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO ) { -roc_ae_fpm_put (); -roc_ae_ec_grp_put (); - } - - ret =roc_cpt_int_misc_cb_unregister (cnxk_cpt_int_misc_cb,NULL ); -if (ret <0 ) { -plt_err ("Could not unregister CPT_MISC_INT cb" ); -return ret; - } -roc_cpt_dev_clear (&vf->cpt); - -return 0 ; +return cnxk_cpt_dev_clear (dev); }void
Signature · 1 line
2.25.1
PATCH 3/7 crypto/cnxk: add CN10K pdcp chain support
In reply to Tejasree KondojAdding CN10K pdcp chain support.
--- drivers/common/cnxk/roc_se.c | 49 ++-- drivers/common/cnxk/roc_se.h | 7 +- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +- drivers/crypto/cnxk/cnxk_se.h | 332 +++++++++++++++-------- 4 files changed, 257 insertions(+), 133 deletions(-)
drivers/common/cnxk/roc_se.c +29 -20
@@ -52,9 +52,9 @@ cpt_ciph_aes_key_validate(uint16_t key_len) }static inline int -cpt_ciph_type_set (roc_se_cipher_type type,struct roc_se_ctx *ctx, -uint16_t key_len) +cpt_ciph_type_set (roc_se_cipher_type type,struct roc_se_ctx *ctx,uint16_t key_len) { +bool chained_op = ctx->ciph_then_auth || ctx->auth_then_ciph;int fc_type =0 ;switch (type) {
@@ -90,21 +90,24 @@ cpt_ciph_type_set(roc_se_cipher_type type, struct roc_se_ctx *ctx, fc_type =ROC_SE_FC_GEN ;break ;case ROC_SE_ZUC_EEA3 : -if (ctx->hash_type) +if (chained_op) { +if (unlikely (key_len !=16 )) +return -1 ; fc_type =ROC_SE_PDCP_CHAIN ; -else + }else { fc_type =ROC_SE_PDCP ; + }break ;case ROC_SE_SNOW3G_UEA2 :if (unlikely (key_len !=16 ))return -1 ; -if (ctx->hash_type) +if (chained_op) fc_type =ROC_SE_PDCP_CHAIN ;else fc_type =ROC_SE_PDCP ;break ;case ROC_SE_AES_CTR_EEA2 : -if (ctx->hash_type) +if (chained_op) fc_type =ROC_SE_PDCP_CHAIN ;else fc_type =ROC_SE_PDCP ;
@@ -427,6 +430,7 @@ roc_se_auth_key_set(struct roc_se_ctx *se_ctx, roc_se_auth_type type, se_ctx->fc_type =ROC_SE_PDCP ; } se_ctx->pdcp_auth_alg =ROC_SE_PDCP_ALG_TYPE_AES_CMAC ; + se_ctx->eia2 =1 ; se_ctx->zsk_flags =0x1 ;break ;case ROC_SE_KASUMI_F9_ECB :
@@ -444,14 +448,19 @@ roc_se_auth_key_set(struct roc_se_ctx *se_ctx, roc_se_auth_type type,default :return -1 ; } + +if ((se_ctx->fc_type ==ROC_SE_PDCP_CHAIN ) && (mac_len !=4 )) { +plt_err ("Only digest length of 4 is supported with PDCP chain" ); +return -1 ; + } + se_ctx->mac_len = mac_len; se_ctx->hash_type = type; pdcp_alg = zs_ctx->zuc.otk_ctx.w0.s.alg_type; -if (roc_model_is_cn9k ()) -if (chained_op == true) - opcode_minor = se_ctx->ciph_then_auth ?2 :3 ; -else - opcode_minor = ((1 <<7 ) | (pdcp_alg <<5 ) |1 ); +if (chained_op) + opcode_minor = se_ctx->ciph_then_auth ?2 :3 ; +else if (roc_model_is_cn9k ()) + opcode_minor = ((1 <<7 ) | (pdcp_alg <<5 ) |1 );else opcode_minor = ((1 <<4 ) |1 );
@@ -510,7 +519,7 @@ roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, roc_se_cipher_type type, const uistruct roc_se_zuc_snow3g_ctx *zs_ctx = &se_ctx->se_ctx.zs_ctx;struct roc_se_context *fctx = &se_ctx->se_ctx.fctx;struct roc_se_zuc_snow3g_chain_ctx *zs_ch_ctx; -uint8_t opcode_minor; +uint8_t opcode_minor =0 ;uint8_t *zuc_const;uint32_t keyx[4 ];uint8_t *ci_key;
@@ -699,17 +708,14 @@ roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, roc_se_cipher_type type, const ui success: se_ctx->enc_cipher = type; -if (se_ctx->fc_type ==ROC_SE_PDCP ) { +if (se_ctx->fc_type ==ROC_SE_PDCP_CHAIN ) { + se_ctx->template_w4.s.opcode_minor = se_ctx->ciph_then_auth ?2 :3 ; + }else if (se_ctx->fc_type ==ROC_SE_PDCP ) {if (roc_model_is_cn9k ()) -if (chained_op == true) - opcode_minor = se_ctx->ciph_then_auth ?2 :3 ; -else - opcode_minor = - ((1 <<7 ) | (se_ctx->pdcp_ci_alg <<5 ) | - (se_ctx->zsk_flags &0x7 )); + opcode_minor = + ((1 <<7 ) | (se_ctx->pdcp_ci_alg <<5 ) | (se_ctx->zsk_flags &0x7 ));else opcode_minor = ((1 <<4 )); - se_ctx->template_w4.s.opcode_minor = opcode_minor; }return 0 ;
@@ -723,6 +729,9 @@ roc_se_ctx_swap(struct roc_se_ctx *se_ctx)if (roc_model_is_cn9k ())return ; +if (se_ctx->fc_type ==ROC_SE_PDCP_CHAIN ) +return ; + zs_ctx->zuc.otk_ctx.w0.u64 =htobe64 (zs_ctx->zuc.otk_ctx.w0.u64); }
drivers/common/cnxk/roc_se.h +5 -2
@@ -230,14 +230,16 @@ struct roc_se_onk_zuc_chain_ctx { } w0;union {struct { -uint8_t encr_lfsr_state[64 ]; -uint8_t auth_lfsr_state[64 ]; +uint8_t encr_lfsr_state[72 ]; +uint8_t auth_lfsr_state[72 ]; };struct {uint8_t ci_key[32 ];uint8_t ci_zuc_const[32 ]; +uint8_t rsvd[8 ];uint8_t auth_key[32 ];uint8_t auth_zuc_const[32 ]; +uint8_t rsvd1[8 ]; }; } st; };
@@ -297,6 +299,7 @@ struct roc_se_ctx { uint64_t pdcp_auth_alg : 2; uint64_t ciph_then_auth : 1; uint64_t auth_then_ciph : 1; + uint64_t eia2 : 1;union cpt_inst_w4 template_w4;/* Below fields are accessed by hardware */ struct se_ctx_s {
drivers/crypto/cnxk/cnxk_cryptodev_ops.c +1 -1
@@ -493,7 +493,7 @@ cnxk_sess_fill(struct roc_cpt *roc_cpt, struct rte_crypto_sym_xform *xform,bool pdcp_chain_supported = false;bool ciph_then_auth = false; -if (roc_model_is_cn9k () && (roc_cpt->hw_caps[CPT_ENG_TYPE_SE ].pdcp_chain)) +if (roc_cpt->hw_caps[CPT_ENG_TYPE_SE ].pdcp_chain) pdcp_chain_supported = true;if (xform ==NULL )
drivers/crypto/cnxk/cnxk_se.h +222 -110
403 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 4/7 crypto/cnxk: support SM3 hash
In reply to Tejasree KondojFrom: Vidya Sagar Velumuri <[email protected]>
Add support for SM3 hash operations
--- doc/guides/cryptodevs/cnxk.rst | 1 + doc/guides/cryptodevs/features/cn10k.ini | 1 + drivers/common/cnxk/roc_se.h | 1 + drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 32 +++++++++++++++++++ drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +- drivers/crypto/cnxk/cnxk_se.h | 12 ++++++- 7 files changed, 48 insertions(+), 3 deletions(-)
doc/guides/cryptodevs/cnxk.rst +1 -0
@@ -72,6 +72,7 @@ Hash algorithms: * ``RTE_CRYPTO_AUTH_SNOW3G_UIA2`` * ``RTE_CRYPTO_AUTH_ZUC_EIA3`` * ``RTE_CRYPTO_AUTH_AES_CMAC`` +* ``RTE_CRYPTO_AUTH_SM3`` AEAD algorithms:
doc/guides/cryptodevs/features/cn10k.ini +1 -0
@@ -73,6 +73,7 @@ SHA3_512 = Y SHA3_512 HMAC = Y SHAKE_128 = Y SHAKE_256 = Y +SM3 = Y ; ; Supported AEAD algorithms of 'cn10k' crypto driver.
drivers/common/cnxk/roc_se.h +1 -0
@@ -81,6 +81,7 @@ typedef enum {ROC_SE_SHA2_SHA512 =6 ,ROC_SE_GMAC_TYPE =7 ,ROC_SE_POLY1305 =8 , +ROC_SE_SM3 =9 ,ROC_SE_SHA3_SHA224 =10 ,ROC_SE_SHA3_SHA256 =11 , ROC_SE_SHA3_SHA384 = 12,
drivers/crypto/cnxk/cnxk_cryptodev.h +1 -1
@@ -10,7 +10,7 @@#include "roc_cpt.h" -#define CNXK_CPT_MAX_CAPS 48 +#define CNXK_CPT_MAX_CAPS 49#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 +32 -0
@@ -337,6 +337,29 @@ static const struct rte_cryptodev_capabilities caps_sha1_sha2[] = { }, }; +static const struct rte_cryptodev_capabilities caps_sm3[] = { + {/* SM3 */ + .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_AUTH , + {.auth = { + .algo =RTE_CRYPTO_AUTH_SM3 , + .block_size =64 , + .key_size = { + .min =0 , + .max =0 , + .increment =0 + }, + .digest_size = { + .min =32 , + .max =32 , + .increment =0 + }, + }, } + }, } + } +}; +static const struct rte_cryptodev_capabilities caps_sha3[] = { {/* SHA3_224 */ .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC ,
@@ -1459,6 +1482,12 @@ cn9k_crypto_caps_add(struct rte_cryptodev_capabilities cnxk_caps[], int *cur_poscpt_caps_add (cnxk_caps, cur_pos, caps_docsis,RTE_DIM (caps_docsis)); } +static void +cn10k_crypto_caps_add (struct rte_cryptodev_capabilities cnxk_caps[],int *cur_pos) +{ +cpt_caps_add (cnxk_caps, cur_pos, caps_sm3,RTE_DIM (caps_sm3)); +} +static void crypto_caps_populate (struct rte_cryptodev_capabilities cnxk_caps[],union cpt_eng_caps *hw_caps)
@@ -1477,6 +1506,9 @@ crypto_caps_populate(struct rte_cryptodev_capabilities cnxk_caps[],if (!roc_model_is_cn10k ())cn9k_crypto_caps_add (cnxk_caps, &cur_pos); +if (roc_model_is_cn10k ()) +cn10k_crypto_caps_add (cnxk_caps, &cur_pos); +cpt_caps_add (cnxk_caps, &cur_pos, caps_null,RTE_DIM (caps_null));cpt_caps_add (cnxk_caps, &cur_pos, caps_end,RTE_DIM (caps_end));
drivers/crypto/cnxk/cnxk_cryptodev_ops.c +1 -1
@@ -662,7 +662,7 @@ 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) +if (sess->zsk_flag || sess->aes_ctr_eea2 || sess->is_sha3 || sess->is_sm3) 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 ];
drivers/crypto/cnxk/cnxk_se.h +11 -1
@@ -44,7 +44,8 @@ struct cnxk_se_sess {uint16_t aad_length; uint8_t is_sha3 : 1; uint8_t short_iv : 1; - uint8_t rsvd : 6; + uint8_t is_sm3 : 1; + uint8_t rsvd : 5;uint8_t mac_len;uint8_t iv_length;uint8_t auth_iv_length;
@@ -199,6 +200,9 @@ cpt_mac_len_verify(struct rte_crypto_auth_xform *auth)case RTE_CRYPTO_AUTH_SHAKE_256 : ret = (mac_len <=UINT8_MAX ) ?0 :-1 ;break ; +case RTE_CRYPTO_AUTH_SM3 : + ret = (mac_len <=32 ) ?0 :-1 ; +break ;case RTE_CRYPTO_AUTH_NULL : ret =0 ;break ;
@@ -1999,6 +2003,7 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess)uint8_t zsk_flag =0 , zs_auth =0 , aes_gcm =0 , is_null =0 , is_sha3 =0 ;struct rte_crypto_auth_xform *a_form;roc_se_auth_type auth_type =0 ;/* NULL Auth type */ +uint8_t is_sm3 =0 ;if (xform->auth.algo ==RTE_CRYPTO_AUTH_AES_GMAC )return fill_sess_gmac (xform, sess);
@@ -2109,6 +2114,10 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) auth_type =ROC_SE_AES_CMAC_EIA2 ; zsk_flag =ROC_SE_ZS_IA ;break ; +case RTE_CRYPTO_AUTH_SM3 : + auth_type =ROC_SE_SM3 ; + is_sm3 =1 ; +break ;case RTE_CRYPTO_AUTH_AES_XCBC_MAC :case RTE_CRYPTO_AUTH_AES_CBC_MAC :plt_dp_err ("Crypto: Unsupported hash algo %u" , a_form->algo);
@@ -2136,6 +2145,7 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) sess->mac_len = a_form->digest_length; sess->is_null = is_null; sess->is_sha3 = is_sha3; + sess->is_sm3 = is_sm3;if (zsk_flag) { sess->auth_iv_offset = a_form->iv.offset; sess->auth_iv_length = a_form->iv.length;
Signature · 1 line
2.25.1
PATCH 5/7 crypto/cnxk: set local variables to template value
In reply to Tejasree KondojInitializing local variable from the template populated in control path.
--- drivers/crypto/cnxk/cnxk_se.h | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/crypto/cnxk/cnxk_se.h +12 -13
@@ -607,8 +607,7 @@ cpt_digest_gen_sg_ver1_prep(uint32_t flags, uint64_t d_lens, struct roc_se_fc_pa key_len = ctx->auth_key_len; data_len =ROC_SE_AUTH_DLEN (d_lens); -/*GP op header */ - cpt_inst_w4.s.opcode_minor =0 ; + cpt_inst_w4.u64 = ctx->template_w4.u64; cpt_inst_w4.s.param2 = ((uint16_t )hash_type <<8 ) | mac_len;if (ctx->hmac) { cpt_inst_w4.s.opcode_major =ROC_SE_MAJOR_OP_HMAC |ROC_DMA_MODE_SG ;
@@ -724,8 +723,7 @@ cpt_digest_gen_sg_ver2_prep(uint32_t flags, uint64_t d_lens, struct roc_se_fc_pa key_len = ctx->auth_key_len; data_len =ROC_SE_AUTH_DLEN (d_lens); -/*GP op header */ - cpt_inst_w4.s.opcode_minor =0 ; + cpt_inst_w4.u64 = ctx->template_w4.u64; cpt_inst_w4.s.param2 = ((uint16_t )hash_type <<8 ) | mac_len;if (ctx->hmac) { cpt_inst_w4.s.opcode_major =ROC_SE_MAJOR_OP_HMAC ;
@@ -1049,7 +1047,8 @@ cpt_enc_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, cipher_type = se_ctx->enc_cipher; hash_type = se_ctx->hash_type; mac_len = se_ctx->mac_len; - op_minor = se_ctx->template_w4.s.opcode_minor; + cpt_inst_w4.u64 = se_ctx->template_w4.u64; + op_minor = cpt_inst_w4.s.opcode_minor;if (unlikely (!(flags &ROC_SE_VALID_IV_BUF ))) { iv_len =0 ;
@@ -1080,8 +1079,7 @@ cpt_enc_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens,/* Encryption */ cpt_inst_w4.s.opcode_major =ROC_SE_MAJOR_OP_FC ; - cpt_inst_w4.s.opcode_minor =ROC_SE_FC_MINOR_OP_ENCRYPT ; - cpt_inst_w4.s.opcode_minor |= (uint64_t )op_minor; + cpt_inst_w4.s.opcode_minor |=ROC_SE_FC_MINOR_OP_ENCRYPT ;if (hash_type ==ROC_SE_GMAC_TYPE ) { encr_offset =0 ;
@@ -1112,7 +1110,6 @@ cpt_enc_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens,if (op_minor &ROC_SE_FC_MINOR_OP_HMAC_FIRST ) outputlen = enc_dlen; -/* GP op header */ cpt_inst_w4.s.param1 = encr_data_len; cpt_inst_w4.s.param2 = auth_data_len;
@@ -1219,7 +1216,8 @@ cpt_dec_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, se_ctx = fc_params->ctx; hash_type = se_ctx->hash_type; mac_len = se_ctx->mac_len; - op_minor = se_ctx->template_w4.s.opcode_minor; + cpt_inst_w4.u64 = se_ctx->template_w4.u64; + op_minor = cpt_inst_w4.s.opcode_minor;if (unlikely (!(flags &ROC_SE_VALID_IV_BUF ))) { iv_len =0 ;
@@ -1390,8 +1388,8 @@ cpt_pdcp_chain_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens,return -1 ; } + cpt_inst_w4.u64 = se_ctx->template_w4.u64; cpt_inst_w4.s.opcode_major =ROC_SE_MAJOR_OP_PDCP_CHAIN ; - cpt_inst_w4.s.opcode_minor = se_ctx->template_w4.s.opcode_minor; cpt_inst_w4.s.param1 = auth_data_len; cpt_inst_w4.s.param2 =0 ;
@@ -1475,8 +1473,8 @@ cpt_pdcp_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, flags = se_ctx->zsk_flags; mac_len = se_ctx->mac_len; + cpt_inst_w4.u64 = se_ctx->template_w4.u64; cpt_inst_w4.s.opcode_major =ROC_SE_MAJOR_OP_PDCP ; - cpt_inst_w4.s.opcode_minor = se_ctx->template_w4.s.opcode_minor;if (flags ==0x1 ) { iv_s = params->auth_iv_buf;
@@ -1563,7 +1561,7 @@ cpt_pdcp_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, }/* -* GP op header, lengths are expected in bits. +* Lengths are expected in bits. */ cpt_inst_w4.s.param1 = encr_data_len; cpt_inst_w4.s.param2 = auth_data_len;
@@ -1637,6 +1635,7 @@ cpt_kasumi_enc_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, mac_len = se_ctx->mac_len; dir = iv_s[8 ] &0x1 ; + cpt_inst_w4.u64 = se_ctx->template_w4.u64;if (flags ==0x0 ) {/* Consider IV len */
@@ -1712,7 +1711,7 @@ cpt_kasumi_dec_prep(uint64_t d_offs, uint64_t d_lens, struct roc_se_fc_params *p ((1 <<6 ) | (se_ctx->k_ecb <<5 ) | (dir <<4 ) | (0 <<3 ) | (flags &0x7 ));/* -* GP op header, lengths are expected in bits. +* Lengths are expected in bits. */ cpt_inst_w4.s.param1 = encr_data_len;
Signature · 1 line
2.25.1
PATCH 6/7 crypto/cnxk: increase max segments
In reply to Tejasree KondojFrom: Anoob Joseph <[email protected]>
Increase max segments to allow max values supported by hardware/microcode. For SG_VER2, max number of descriptors supported would be 45. For SG_VER1, maximum number of total components would be 100.
--- drivers/common/cnxk/roc_cpt_sg.h | 4 +- drivers/crypto/cnxk/cnxk_se.h | 90 ++++++++++++++++++++++++-------- 2 files changed, 72 insertions(+), 22 deletions(-)
drivers/common/cnxk/roc_cpt_sg.h +3 -1
@@ -7,11 +7,13 @@#define ROC_DMA_MODE_SG (1 << 7) -#define ROC_MAX_SG_IN_OUT_CNT 32 +#define ROC_MAX_SG_IN_OUT_CNT 128#define ROC_MAX_SG_CNT (ROC_MAX_SG_IN_OUT_CNT / 2)#define ROC_SG_LIST_HDR_SIZE (8u)#define ROC_SG_ENTRY_SIZE sizeof(struct roc_sglist_comp) +#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)) struct roc_sglist_comp { union {
drivers/crypto/cnxk/cnxk_se.h +69 -21
242 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 7/7 crypto/cnxk: remove redundant assignment
In reply to Tejasree KondojFrom: Anoob Joseph <[email protected]>
In SG_VER2, DPTR would be poining at gather_comp. No need to set it m_vaddr only to be overwritten.
--- drivers/crypto/cnxk/cnxk_se.h | 3 --- 1 file changed, 3 deletions(-)
drivers/crypto/cnxk/cnxk_se.h +0 -3
@@ -976,9 +976,6 @@ pdcp_chain_sg2_prep(struct roc_se_fc_params *params, struct roc_se_ctx *cpt_ctx, w4.s.opcode_major |= (uint64_t )ROC_DMA_MODE_SG ; w4.s.dlen = inputlen +ROC_SE_OFF_CTRL_LEN ; -/* DPTR has SG list */ - inst->dptr =PLT_U64_CAST (m_vaddr); - gather_comp = m_vaddr;/* Input Gather List */
Signature · 1 line
2.25.1
Akhil Goyal
AppliedQuoted 20 lines
Subject: [PATCH 0/7] fixes and improvements to CNXK crypto PMD
This series adds SM3, CN10K PDCP CHAIN support and improvements to CNXK crypto PMD.
Aakash Sasidharan (1):
crypto/cnxk: add cryptodev reconfiguration supportAnoob Joseph (2):
crypto/cnxk: increase max segments
crypto/cnxk: remove redundant assignmentTejasree Kondoj (3):
crypto/cnxk: return error for unsupported pathscrypto/cnxk: add CN10K pdcp chain supportcrypto/cnxk: set local variables to template valueVidya Sagar Velumuri (1):
crypto/cnxk: support SM3 hash
Quoted 10 lines
doc/guides/cryptodevs/cnxk.rst | 1 + doc/guides/cryptodevs/features/cn10k.ini | 1 + drivers/common/cnxk/roc_cpt_sg.h | 4 +- drivers/common/cnxk/roc_se.c | 61 ++- drivers/common/cnxk/roc_se.h | 8 +- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 32 ++ drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 55 ++- drivers/crypto/cnxk/cnxk_se.h | 444 ++++++++++++------ 9 files changed, 424 insertions(+), 184 deletions(-)
Applied to dpdk-next-crypto
Updated release notes for SM3 and PDCP chain support