X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcrypto%2Fcnxk%2Fcnxk_cryptodev_capabilities.c;h=f79e4d701086a5b376eb07d36d6e719d7646b5c5;hb=2f20817c0004886e68ba687d8e257a5c779840d9;hp=34eb441ab3612bd08465d81a454902d1874ecd7b;hpb=29742632ac9e6af39e64f613f95a3b808803b983;p=dpdk.git diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c index 34eb441ab3..f79e4d7010 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c @@ -2,7 +2,7 @@ * Copyright(C) 2021 Marvell. */ -#include +#include #include #include "roc_api.h" @@ -568,6 +568,26 @@ static const struct rte_cryptodev_capabilities caps_aes[] = { }, } }, } }, + { /* AES CMAC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_AES_CMAC, + .block_size = 16, + .key_size = { + .min = 16, + .max = 32, + .increment = 8 + }, + .digest_size = { + .min = 4, + .max = 4, + .increment = 0 + }, + }, } + }, } + }, }; static const struct rte_cryptodev_capabilities caps_kasumi[] = { @@ -754,6 +774,26 @@ static const struct rte_cryptodev_capabilities sec_caps_aes[] = { }, } }, } }, + { /* AES CTR */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, + {.cipher = { + .algo = RTE_CRYPTO_CIPHER_AES_CTR, + .block_size = 16, + .key_size = { + .min = 16, + .max = 32, + .increment = 8 + }, + .iv_size = { + .min = 12, + .max = 16, + .increment = 4 + } + }, } + }, } + }, { /* AES CBC */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, {.sym = { @@ -774,6 +814,26 @@ static const struct rte_cryptodev_capabilities sec_caps_aes[] = { }, } }, } }, + { /* AES-XCBC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + { .sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_AES_XCBC_MAC, + .block_size = 16, + .key_size = { + .min = 16, + .max = 16, + .increment = 0 + }, + .digest_size = { + .min = 12, + .max = 12, + .increment = 0, + }, + }, } + }, } + }, }; static const struct rte_cryptodev_capabilities sec_caps_sha1_sha2[] = { @@ -797,6 +857,89 @@ static const struct rte_cryptodev_capabilities sec_caps_sha1_sha2[] = { }, } }, } }, + { /* SHA256 HMAC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHA256_HMAC, + .block_size = 64, + .key_size = { + .min = 1, + .max = 1024, + .increment = 1 + }, + .digest_size = { + .min = 16, + .max = 16, + .increment = 0 + }, + }, } + }, } + }, + { /* SHA384 HMAC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHA384_HMAC, + .block_size = 64, + .key_size = { + .min = 48, + .max = 48, + .increment = 0 + }, + .digest_size = { + .min = 24, + .max = 24, + .increment = 0 + }, + }, } + }, } + }, + { /* SHA512 HMAC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHA512_HMAC, + .block_size = 128, + .key_size = { + .min = 64, + .max = 64, + .increment = 0 + }, + .digest_size = { + .min = 32, + .max = 32, + .increment = 0 + }, + }, } + }, } + }, +}; + +static const struct rte_cryptodev_capabilities sec_caps_null[] = { + { /* NULL (CIPHER) */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, + {.cipher = { + .algo = RTE_CRYPTO_CIPHER_NULL, + .block_size = 1, + .key_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .iv_size = { + .min = 0, + .max = 0, + .increment = 0 + } + }, }, + }, } + }, }; static const struct rte_security_capability sec_caps_templ[] = { @@ -874,8 +1017,8 @@ cn10k_crypto_caps_update(struct rte_cryptodev_capabilities cnxk_caps[]) caps->sym.cipher.key_size.max = 32; caps->sym.cipher.key_size.increment = 16; - caps->sym.cipher.iv_size.max = 24; - caps->sym.cipher.iv_size.increment = 8; + caps->sym.cipher.iv_size.max = 25; + caps->sym.cipher.iv_size.increment = 1; } if ((caps->op == RTE_CRYPTO_OP_TYPE_SYMMETRIC) && @@ -886,8 +1029,8 @@ cn10k_crypto_caps_update(struct rte_cryptodev_capabilities cnxk_caps[]) caps->sym.auth.key_size.increment = 16; caps->sym.auth.digest_size.max = 16; caps->sym.auth.digest_size.increment = 4; - caps->sym.auth.iv_size.max = 24; - caps->sym.auth.iv_size.increment = 8; + caps->sym.auth.iv_size.max = 25; + caps->sym.auth.iv_size.increment = 1; } } } @@ -923,13 +1066,58 @@ static void sec_caps_add(struct rte_cryptodev_capabilities cnxk_caps[], int *cur_pos, const struct rte_cryptodev_capabilities *caps, int nb_caps) { - if (*cur_pos + nb_caps > CNXK_SEC_CRYPTO_MAX_CAPS) + if (*cur_pos + nb_caps > CNXK_SEC_CRYPTO_MAX_CAPS) { + rte_panic("Could not add sec crypto caps"); return; + } memcpy(&cnxk_caps[*cur_pos], caps, nb_caps * sizeof(caps[0])); *cur_pos += nb_caps; } +static void +cn10k_sec_crypto_caps_update(struct rte_cryptodev_capabilities cnxk_caps[], + int *cur_pos) +{ + const struct rte_cryptodev_capabilities *cap; + unsigned int i; + + if ((CNXK_SEC_CRYPTO_MAX_CAPS - *cur_pos) < 1) { + rte_panic("Could not add sec crypto caps"); + return; + } + + /* NULL auth */ + for (i = 0; i < RTE_DIM(caps_null); i++) { + cap = &caps_null[i]; + if (cap->sym.xform_type == RTE_CRYPTO_SYM_XFORM_AUTH && + cap->sym.auth.algo == RTE_CRYPTO_AUTH_NULL) { + cnxk_caps[*cur_pos] = caps_null[i]; + *cur_pos += 1; + } + } +} + +static void +cn9k_sec_crypto_caps_update(struct rte_cryptodev_capabilities cnxk_caps[]) +{ + + struct rte_cryptodev_capabilities *caps; + int i = 0; + + while ((caps = &cnxk_caps[i++])->op != RTE_CRYPTO_OP_TYPE_UNDEFINED) { + if ((caps->op == RTE_CRYPTO_OP_TYPE_SYMMETRIC) && + (caps->sym.xform_type == RTE_CRYPTO_SYM_XFORM_AUTH) && + (caps->sym.auth.algo == RTE_CRYPTO_AUTH_SHA256_HMAC)) { + caps->sym.auth.key_size.min = 32; + caps->sym.auth.key_size.max = 64; + caps->sym.auth.key_size.increment = 1; + + break; + } + } +} + static void sec_crypto_caps_populate(struct rte_cryptodev_capabilities cnxk_caps[], union cpt_eng_caps *hw_caps) @@ -939,6 +1127,13 @@ sec_crypto_caps_populate(struct rte_cryptodev_capabilities cnxk_caps[], SEC_CAPS_ADD(cnxk_caps, &cur_pos, hw_caps, aes); SEC_CAPS_ADD(cnxk_caps, &cur_pos, hw_caps, sha1_sha2); + if (roc_model_is_cn10k()) + cn10k_sec_crypto_caps_update(cnxk_caps, &cur_pos); + else + cn9k_sec_crypto_caps_update(cnxk_caps); + + sec_caps_add(cnxk_caps, &cur_pos, sec_caps_null, + RTE_DIM(sec_caps_null)); sec_caps_add(cnxk_caps, &cur_pos, caps_end, RTE_DIM(caps_end)); } @@ -946,6 +1141,7 @@ static void cnxk_sec_caps_update(struct rte_security_capability *sec_cap) { sec_cap->ipsec.options.udp_encap = 1; + sec_cap->ipsec.options.copy_df = 1; } static void @@ -961,13 +1157,18 @@ cn10k_sec_caps_update(struct rte_security_capability *sec_cap) sec_cap->ipsec.options.tunnel_hdr_verify = RTE_SECURITY_IPSEC_TUNNEL_VERIFY_SRC_DST_ADDR; } + sec_cap->ipsec.options.ip_csum_enable = 1; + sec_cap->ipsec.options.l4_csum_enable = 1; + sec_cap->ipsec.options.stats = 1; } static void cn9k_sec_caps_update(struct rte_security_capability *sec_cap) { if (sec_cap->ipsec.direction == RTE_SECURITY_IPSEC_SA_DIR_EGRESS) { +#ifdef LA_IPSEC_DEBUG sec_cap->ipsec.options.iv_gen_disable = 1; +#endif } }