test/crypto: create only one virtual device if needed
Instead of creating two virtual devices per PMD, if they have not been initialized from EAL already, create only one, as only the first device is used for the crypto tests. Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
This commit is contained in:
parent
44e2980b70
commit
8fec4832c9
@ -209,7 +209,7 @@ testsuite_setup(void)
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
/* Create 2 AESNI MB devices if required */
|
||||
/* Create an AESNI MB device if required */
|
||||
if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_AESNI_MB
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be"
|
||||
@ -218,20 +218,18 @@ testsuite_setup(void)
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(
|
||||
RTE_CRYPTODEV_AESNI_MB_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
ret = rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
|
||||
|
||||
TEST_ASSERT(ret == 0,
|
||||
"Failed to create instance %u of"
|
||||
"Failed to create instance of"
|
||||
" pmd : %s",
|
||||
i, RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
|
||||
}
|
||||
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
|
||||
}
|
||||
}
|
||||
|
||||
/* Create 2 AESNI GCM devices if required */
|
||||
/* Create an AESNI GCM device if required */
|
||||
if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_GCM_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_AESNI_GCM
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM must be"
|
||||
@ -240,18 +238,16 @@ testsuite_setup(void)
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(
|
||||
RTE_CRYPTODEV_AESNI_GCM_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL),
|
||||
"Failed to create instance %u of"
|
||||
"Failed to create instance of"
|
||||
" pmd : %s",
|
||||
i, RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
|
||||
}
|
||||
RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
|
||||
}
|
||||
}
|
||||
|
||||
/* Create 2 SNOW 3G devices if required */
|
||||
/* Create a SNOW 3G device if required */
|
||||
if (gbl_cryptodev_type == RTE_CRYPTODEV_SNOW3G_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_SNOW3G
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_SNOW3G must be"
|
||||
@ -259,18 +255,16 @@ testsuite_setup(void)
|
||||
return TEST_FAILED;
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL),
|
||||
"Failed to create instance %u of"
|
||||
"Failed to create instance of"
|
||||
" pmd : %s",
|
||||
i, RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
|
||||
}
|
||||
RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
|
||||
}
|
||||
}
|
||||
|
||||
/* Create 2 KASUMI devices if required */
|
||||
/* Create a KASUMI device if required */
|
||||
if (gbl_cryptodev_type == RTE_CRYPTODEV_KASUMI_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_KASUMI
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_KASUMI must be"
|
||||
@ -278,18 +272,16 @@ testsuite_setup(void)
|
||||
return TEST_FAILED;
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_KASUMI_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), NULL),
|
||||
"Failed to create instance %u of"
|
||||
"Failed to create instance of"
|
||||
" pmd : %s",
|
||||
i, RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
|
||||
}
|
||||
RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
|
||||
}
|
||||
}
|
||||
|
||||
/* Create 2 ZUC devices if required */
|
||||
/* Create a ZUC device if required */
|
||||
if (gbl_cryptodev_type == RTE_CRYPTODEV_ZUC_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_ZUC
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_ZUC must be"
|
||||
@ -297,18 +289,16 @@ testsuite_setup(void)
|
||||
return TEST_FAILED;
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_ZUC_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_ZUC_PMD), NULL),
|
||||
"Failed to create instance %u of"
|
||||
"Failed to create instance of"
|
||||
" pmd : %s",
|
||||
i, RTE_STR(CRYPTODEV_NAME_ZUC_PMD));
|
||||
}
|
||||
RTE_STR(CRYPTODEV_NAME_ZUC_PMD));
|
||||
}
|
||||
}
|
||||
|
||||
/* Create 2 NULL devices if required */
|
||||
/* Create a NULL device if required */
|
||||
if (gbl_cryptodev_type == RTE_CRYPTODEV_NULL_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_NULL_CRYPTO
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO must be"
|
||||
@ -317,20 +307,18 @@ testsuite_setup(void)
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(
|
||||
RTE_CRYPTODEV_NULL_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
int dev_id = rte_eal_vdev_init(
|
||||
if (nb_devs < 1) {
|
||||
ret = rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_NULL_PMD), NULL);
|
||||
|
||||
TEST_ASSERT(dev_id >= 0,
|
||||
"Failed to create instance %u of"
|
||||
TEST_ASSERT(ret == 0,
|
||||
"Failed to create instance of"
|
||||
" pmd : %s",
|
||||
i, RTE_STR(CRYPTODEV_NAME_NULL_PMD));
|
||||
}
|
||||
RTE_STR(CRYPTODEV_NAME_NULL_PMD));
|
||||
}
|
||||
}
|
||||
|
||||
/* Create 2 OPENSSL devices if required */
|
||||
/* Create an OPENSSL device if required */
|
||||
if (gbl_cryptodev_type == RTE_CRYPTODEV_OPENSSL_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_OPENSSL
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_OPENSSL must be"
|
||||
@ -339,20 +327,18 @@ testsuite_setup(void)
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(
|
||||
RTE_CRYPTODEV_OPENSSL_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
ret = rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
|
||||
NULL);
|
||||
|
||||
TEST_ASSERT(ret == 0, "Failed to create "
|
||||
"instance %u of pmd : %s", i,
|
||||
"instance of pmd : %s",
|
||||
RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Create 2 ARMv8 devices if required */
|
||||
/* Create a ARMv8 device if required */
|
||||
if (gbl_cryptodev_type == RTE_CRYPTODEV_ARMV8_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_ARMV8_CRYPTO
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO must be"
|
||||
@ -361,18 +347,16 @@ testsuite_setup(void)
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(
|
||||
RTE_CRYPTODEV_ARMV8_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
ret = rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_ARMV8_PMD),
|
||||
NULL);
|
||||
|
||||
TEST_ASSERT(ret == 0, "Failed to create "
|
||||
"instance %u of pmd : %s", i,
|
||||
"instance of pmd : %s",
|
||||
RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER
|
||||
if (gbl_cryptodev_type == RTE_CRYPTODEV_SCHEDULER_PMD) {
|
||||
|
@ -321,7 +321,7 @@ testsuite_setup(void)
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
/* Create 2 AESNI MB devices if required */
|
||||
/* Create an AESNI MB device if required */
|
||||
if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_AESNI_MB_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_AESNI_MB
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be"
|
||||
@ -329,19 +329,17 @@ testsuite_setup(void)
|
||||
return TEST_FAILED;
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_MB_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
ret = rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
|
||||
|
||||
TEST_ASSERT(ret == 0,
|
||||
"Failed to create instance %u of pmd : %s",
|
||||
i, RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
|
||||
}
|
||||
"Failed to create instance of pmd : %s",
|
||||
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
|
||||
}
|
||||
}
|
||||
|
||||
/* Create 2 AESNI GCM devices if required */
|
||||
/* Create an AESNI GCM device if required */
|
||||
if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_AESNI_GCM_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_AESNI_GCM
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM must be"
|
||||
@ -349,19 +347,17 @@ testsuite_setup(void)
|
||||
return TEST_FAILED;
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_GCM_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
ret = rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL);
|
||||
|
||||
TEST_ASSERT(ret == 0,
|
||||
"Failed to create instance %u of pmd : %s",
|
||||
i, RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
|
||||
}
|
||||
"Failed to create instance of pmd : %s",
|
||||
RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
|
||||
}
|
||||
}
|
||||
|
||||
/* Create 2 SNOW3G devices if required */
|
||||
/* Create a SNOW3G device if required */
|
||||
if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_SNOW3G_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_SNOW3G
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_SNOW3G must be"
|
||||
@ -369,19 +365,17 @@ testsuite_setup(void)
|
||||
return TEST_FAILED;
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
ret = rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL);
|
||||
|
||||
TEST_ASSERT(ret == 0,
|
||||
"Failed to create instance %u of pmd : %s",
|
||||
i, RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
|
||||
}
|
||||
"Failed to create instance of pmd : %s",
|
||||
RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
|
||||
}
|
||||
}
|
||||
|
||||
/* Create 2 OPENSSL devices if required */
|
||||
/* Create an OPENSSL device if required */
|
||||
if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_OPENSSL_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_OPENSSL
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_OPENSSL must be"
|
||||
@ -390,20 +384,18 @@ testsuite_setup(void)
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(
|
||||
RTE_CRYPTODEV_OPENSSL_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
ret = rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
|
||||
NULL);
|
||||
|
||||
TEST_ASSERT(ret == 0, "Failed to create "
|
||||
"instance %u of pmd : %s", i,
|
||||
"instance of pmd : %s",
|
||||
RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Create 2 ARMv8 devices if required */
|
||||
/* Create an ARMv8 device if required */
|
||||
if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_ARMV8_PMD) {
|
||||
#ifndef RTE_LIBRTE_PMD_ARMV8_CRYPTO
|
||||
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO must be"
|
||||
@ -412,18 +404,16 @@ testsuite_setup(void)
|
||||
#endif
|
||||
nb_devs = rte_cryptodev_count_devtype(
|
||||
RTE_CRYPTODEV_ARMV8_PMD);
|
||||
if (nb_devs < 2) {
|
||||
for (i = nb_devs; i < 2; i++) {
|
||||
if (nb_devs < 1) {
|
||||
ret = rte_eal_vdev_init(
|
||||
RTE_STR(CRYPTODEV_NAME_ARMV8_PMD),
|
||||
NULL);
|
||||
|
||||
TEST_ASSERT(ret == 0, "Failed to create "
|
||||
"instance %u of pmd : %s", i,
|
||||
"instance of pmd : %s",
|
||||
RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef RTE_LIBRTE_PMD_QAT
|
||||
if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_QAT_SYM_PMD) {
|
||||
|
Loading…
Reference in New Issue
Block a user