test/crypto: add cases for Nitrox

Add aes chain test cases for Nitrox in-pace and
out-of-place operations.

Signed-off-by: Nagadheeraj Rottela <rnagadheeraj@marvell.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
This commit is contained in:
Nagadheeraj Rottela 2019-10-01 06:41:36 +00:00 committed by Akhil Goyal
parent 9282bdee5c
commit 5adf37e676
5 changed files with 94 additions and 17 deletions

View File

@ -2347,6 +2347,25 @@ test_3DES_chain_octeontx_all(void)
return TEST_SUCCESS;
}
static int
test_AES_chain_nitrox_all(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
ts_params->op_mpool,
ts_params->session_mpool, ts_params->session_priv_mpool,
ts_params->valid_devs[0],
rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_NITROX_PMD)),
BLKCIPHER_AES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
return TEST_SUCCESS;
}
static int
test_3DES_cipheronly_octeontx_all(void)
{
@ -12690,6 +12709,22 @@ static struct unit_test_suite cryptodev_octeontx_testsuite = {
}
};
static struct unit_test_suite cryptodev_nitrox_testsuite = {
.suite_name = "Crypto NITROX Unit Test Suite",
.setup = testsuite_setup,
.teardown = testsuite_teardown,
.unit_test_cases = {
TEST_CASE_ST(ut_setup, ut_teardown,
test_device_configure_invalid_dev_id),
TEST_CASE_ST(ut_setup, ut_teardown,
test_device_configure_invalid_queue_pair_ids),
TEST_CASE_ST(ut_setup, ut_teardown,
test_AES_chain_nitrox_all),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
static int
test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/)
{
@ -12973,6 +13008,22 @@ test_cryptodev_caam_jr(void /*argv __rte_unused, int argc __rte_unused*/)
return unit_test_suite_runner(&cryptodev_caam_jr_testsuite);
}
static int
test_cryptodev_nitrox(void)
{
gbl_driver_id = rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_NITROX_PMD));
if (gbl_driver_id == -1) {
RTE_LOG(ERR, USER1, "NITROX PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_NITROX is enabled "
"in config file to run this testsuite.\n");
return TEST_FAILED;
}
return unit_test_suite_runner(&cryptodev_nitrox_testsuite);
}
REGISTER_TEST_COMMAND(cryptodev_qat_autotest, test_cryptodev_qat);
REGISTER_TEST_COMMAND(cryptodev_aesni_mb_autotest, test_cryptodev_aesni_mb);
REGISTER_TEST_COMMAND(cryptodev_openssl_autotest, test_cryptodev_openssl);
@ -12989,3 +13040,4 @@ REGISTER_TEST_COMMAND(cryptodev_ccp_autotest, test_cryptodev_ccp);
REGISTER_TEST_COMMAND(cryptodev_virtio_autotest, test_cryptodev_virtio);
REGISTER_TEST_COMMAND(cryptodev_octeontx_autotest, test_cryptodev_octeontx);
REGISTER_TEST_COMMAND(cryptodev_caam_jr_autotest, test_cryptodev_caam_jr);
REGISTER_TEST_COMMAND(cryptodev_nitrox_autotest, test_cryptodev_nitrox);

View File

@ -67,6 +67,7 @@
#define CRYPTODEV_NAME_VIRTIO_PMD crypto_virtio
#define CRYPTODEV_NAME_OCTEONTX_SYM_PMD crypto_octeontx
#define CRYPTODEV_NAME_CAAM_JR_PMD crypto_caam_jr
#define CRYPTODEV_NAME_NITROX_PMD crypto_nitrox_sym
/**
* Write (spread) data from buffer to mbuf data

View File

@ -1537,7 +1537,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_QAT
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CTR HMAC-SHA1 Encryption Digest",
@ -1638,7 +1639,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
BLOCKCIPHER_TEST_TARGET_PMD_CCP |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest "
@ -1647,7 +1649,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 |
BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest "
@ -1663,7 +1666,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
@ -1680,7 +1684,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
BLOCKCIPHER_TEST_TARGET_PMD_CCP |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
@ -1691,7 +1696,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
@ -1700,7 +1706,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 |
BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA256 Encryption Digest",
@ -1716,7 +1723,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
BLOCKCIPHER_TEST_TARGET_PMD_CCP |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA256 Encryption Digest "
@ -1725,7 +1733,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 |
BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA256 Decryption Digest "
@ -1741,7 +1750,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
BLOCKCIPHER_TEST_TARGET_PMD_CCP |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA256 Decryption Digest "
@ -1750,7 +1760,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 |
BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest",
@ -1850,7 +1861,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest "
@ -1859,7 +1871,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_QAT
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
@ -1874,7 +1887,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_MB
BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA224 Encryption Digest",
@ -1888,7 +1902,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
BLOCKCIPHER_TEST_TARGET_PMD_CCP |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA224 Decryption Digest "
@ -1903,7 +1918,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
BLOCKCIPHER_TEST_TARGET_PMD_CCP |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
BLOCKCIPHER_TEST_TARGET_PMD_NITROX
},
{
.test_descr = "AES-128-CBC HMAC-SHA384 Encryption Digest",

View File

@ -79,6 +79,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
int null_pmd = rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_NULL_PMD));
int nitrox_pmd = rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_NITROX_PMD));
int nb_segs = 1;
uint32_t nb_iterates = 0;
@ -125,7 +127,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
driver_id == ccp_pmd ||
driver_id == virtio_pmd ||
driver_id == octeontx_pmd ||
driver_id == null_pmd) { /* Fall through */
driver_id == null_pmd ||
driver_id == nitrox_pmd) { /* Fall through */
digest_len = tdata->digest.len;
} else if (driver_id == aesni_mb_pmd ||
driver_id == scheduler_pmd) {
@ -717,6 +720,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
int null_pmd = rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_NULL_PMD));
int nitrox_pmd = rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_NITROX_PMD));
switch (test_type) {
case BLKCIPHER_AES_CHAIN_TYPE:
@ -789,6 +794,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX;
else if (driver_id == null_pmd)
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL;
else if (driver_id == nitrox_pmd)
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NITROX;
else
TEST_ASSERT(0, "Unrecognized cryptodev type");

View File

@ -32,6 +32,7 @@
#define BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR 0x0400 /* CAAM_JR flag */
#define BLOCKCIPHER_TEST_TARGET_PMD_CCP 0x0800 /* CCP flag */
#define BLOCKCIPHER_TEST_TARGET_PMD_NULL 0x1000 /* NULL flag */
#define BLOCKCIPHER_TEST_TARGET_PMD_NITROX 0x2000 /* NITROX flag */
#define BLOCKCIPHER_TEST_OP_CIPHER (BLOCKCIPHER_TEST_OP_ENCRYPT | \
BLOCKCIPHER_TEST_OP_DECRYPT)