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"
#endif
nb_devs = rte_cryptodev_count_devtype(
RTE_CRYPTODEV_AESNI_MB_PMD);
- if (nb_devs < 2) {
- for (i = nb_devs; i < 2; i++) {
- 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));
- }
+ if (nb_devs < 1) {
+ ret = rte_vdev_init(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
+
+ TEST_ASSERT(ret == 0,
+ "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_type == RTE_CRYPTODEV_AESNI_GCM_PMD) {
#ifndef RTE_LIBRTE_PMD_AESNI_GCM
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM must be"
#endif
nb_devs = rte_cryptodev_count_devtype(
RTE_CRYPTODEV_AESNI_GCM_PMD);
- if (nb_devs < 2) {
- for (i = nb_devs; i < 2; i++) {
- TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
- RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL),
- "Failed to create instance %u of"
- " pmd : %s",
- i, RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
- }
+ if (nb_devs < 1) {
+ TEST_ASSERT_SUCCESS(rte_vdev_init(
+ RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL),
+ "Failed to create instance of"
+ " pmd : %s",
+ 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"
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++) {
- TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
- RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL),
- "Failed to create instance %u of"
- " pmd : %s",
- i, RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
- }
+ if (nb_devs < 1) {
+ TEST_ASSERT_SUCCESS(rte_vdev_init(
+ RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL),
+ "Failed to create instance of"
+ " pmd : %s",
+ 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"
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++) {
- TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
- RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), NULL),
- "Failed to create instance %u of"
- " pmd : %s",
- i, RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
- }
+ if (nb_devs < 1) {
+ TEST_ASSERT_SUCCESS(rte_vdev_init(
+ RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), NULL),
+ "Failed to create instance of"
+ " pmd : %s",
+ 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"
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++) {
- TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
- RTE_STR(CRYPTODEV_NAME_ZUC_PMD), NULL),
- "Failed to create instance %u of"
- " pmd : %s",
- i, RTE_STR(CRYPTODEV_NAME_ZUC_PMD));
- }
+ if (nb_devs < 1) {
+ TEST_ASSERT_SUCCESS(rte_vdev_init(
+ RTE_STR(CRYPTODEV_NAME_ZUC_PMD), NULL),
+ "Failed to create instance of"
+ " pmd : %s",
+ 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"
#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(
- RTE_STR(CRYPTODEV_NAME_NULL_PMD), NULL);
-
- TEST_ASSERT(dev_id >= 0,
- "Failed to create instance %u of"
- " pmd : %s",
- i, RTE_STR(CRYPTODEV_NAME_NULL_PMD));
- }
+ if (nb_devs < 1) {
+ ret = rte_vdev_init(
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD), NULL);
+
+ TEST_ASSERT(ret == 0,
+ "Failed to create instance of"
+ " pmd : %s",
+ 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"
#endif
nb_devs = rte_cryptodev_count_devtype(
RTE_CRYPTODEV_OPENSSL_PMD);
- if (nb_devs < 2) {
- for (i = nb_devs; i < 2; i++) {
- 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,
- RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
- }
+ if (nb_devs < 1) {
+ ret = rte_vdev_init(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
+ NULL);
+
+ TEST_ASSERT(ret == 0, "Failed to create "
+ "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"
#endif
nb_devs = rte_cryptodev_count_devtype(
RTE_CRYPTODEV_ARMV8_PMD);
- if (nb_devs < 2) {
- for (i = nb_devs; i < 2; i++) {
- 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,
- RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
- }
+ if (nb_devs < 1) {
+ ret = rte_vdev_init(
+ RTE_STR(CRYPTODEV_NAME_ARMV8_PMD),
+ NULL);
+
+ TEST_ASSERT(ret == 0, "Failed to create "
+ "instance of pmd : %s",
+ RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
}
}
nb_devs = rte_cryptodev_count_devtype(
RTE_CRYPTODEV_SCHEDULER_PMD);
if (nb_devs < 1) {
- ret = rte_eal_vdev_init(
+ ret = rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD),
NULL);
return TEST_SUCCESS;
}
+static int
+test_AES_chain_dpaa2_sec_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->valid_devs[0],
+ RTE_CRYPTODEV_DPAA2_SEC_PMD,
+ BLKCIPHER_AES_CHAIN_TYPE);
+
+ TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+ return TEST_SUCCESS;
+}
+
+static int
+test_AES_cipheronly_dpaa2_sec_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->valid_devs[0],
+ RTE_CRYPTODEV_DPAA2_SEC_PMD,
+ BLKCIPHER_AES_CIPHERONLY_TYPE);
+
+ TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+ return TEST_SUCCESS;
+}
+
static int
test_authonly_openssl_all(void)
{
return TEST_SUCCESS;
}
+static int
+test_3DES_chain_dpaa2_sec_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->valid_devs[0],
+ RTE_CRYPTODEV_DPAA2_SEC_PMD,
+ BLKCIPHER_3DES_CHAIN_TYPE);
+
+ TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+ return TEST_SUCCESS;
+}
+
+static int
+test_3DES_cipheronly_dpaa2_sec_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->valid_devs[0],
+ RTE_CRYPTODEV_DPAA2_SEC_PMD,
+ BLKCIPHER_3DES_CIPHERONLY_TYPE);
+
+ TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+ return TEST_SUCCESS;
+}
+
static int
test_3DES_cipheronly_qat_all(void)
{
uint8_t sched_id = ts_params->valid_devs[0];
uint32_t nb_devs, i, nb_devs_attached = 0;
int ret;
+ char vdev_name[32];
/* create 2 AESNI_MB if necessary */
nb_devs = rte_cryptodev_count_devtype(
RTE_CRYPTODEV_AESNI_MB_PMD);
if (nb_devs < 2) {
for (i = nb_devs; i < 2; i++) {
- ret = rte_eal_vdev_init(
- RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
+ snprintf(vdev_name, sizeof(vdev_name), "%s_%u",
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD),
+ i);
+ ret = rte_vdev_init(vdev_name, NULL);
TEST_ASSERT(ret == 0,
"Failed to create instance %u of"
}
};
+static struct unit_test_suite cryptodev_dpaa2_sec_testsuite = {
+ .suite_name = "Crypto DPAA2_SEC 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_multi_session),
+
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_chain_dpaa2_sec_all),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_3DES_chain_dpaa2_sec_all),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_cipheronly_dpaa2_sec_all),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_3DES_cipheronly_dpaa2_sec_all),
+
+ /** HMAC_MD5 Authentication */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_MD5_HMAC_generate_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_MD5_HMAC_verify_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_MD5_HMAC_generate_case_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_MD5_HMAC_verify_case_2),
+
+ TEST_CASES_END() /**< NULL terminate unit test array */
+ }
+};
+
static struct unit_test_suite cryptodev_null_testsuite = {
.suite_name = "Crypto Device NULL Unit Test Suite",
.setup = testsuite_setup,
#endif
+static int
+test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/)
+{
+ gbl_cryptodev_type = RTE_CRYPTODEV_DPAA2_SEC_PMD;
+ return unit_test_suite_runner(&cryptodev_dpaa2_sec_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);
REGISTER_TEST_COMMAND(cryptodev_sw_kasumi_autotest, test_cryptodev_sw_kasumi);
REGISTER_TEST_COMMAND(cryptodev_sw_zuc_autotest, test_cryptodev_sw_zuc);
REGISTER_TEST_COMMAND(cryptodev_sw_armv8_autotest, test_cryptodev_armv8);
+REGISTER_TEST_COMMAND(cryptodev_dpaa2_sec_autotest, test_cryptodev_dpaa2_sec);