summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test-pipeline/config.c1
-rw-r--r--test/test-pipeline/init.c1
-rw-r--r--test/test-pipeline/main.c1
-rw-r--r--test/test-pipeline/runtime.c2
-rw-r--r--test/test/Makefile3
-rw-r--r--test/test/test_alarm.c10
-rw-r--r--test/test/test_atomic.c1
-rw-r--r--test/test/test_cmdline_cirbuf.c2
-rw-r--r--test/test/test_common.c22
-rw-r--r--test/test/test_crc.c9
-rw-r--r--test/test/test_cryptodev.c2652
-rw-r--r--test/test/test_cryptodev.h20
-rw-r--r--test/test/test_cryptodev_aes_test_vectors.h264
-rw-r--r--test/test/test_cryptodev_blockcipher.c130
-rw-r--r--test/test/test_cryptodev_blockcipher.h3
-rw-r--r--test/test/test_cryptodev_des_test_vectors.h24
-rw-r--r--test/test/test_cryptodev_gcm_test_vectors.h386
-rw-r--r--test/test/test_cryptodev_hash_test_vectors.h48
-rw-r--r--test/test/test_cryptodev_kasumi_hash_test_vectors.h129
-rw-r--r--test/test/test_cryptodev_kasumi_test_vectors.h104
-rw-r--r--test/test/test_cryptodev_perf.c1192
-rw-r--r--test/test/test_cryptodev_snow3g_hash_test_vectors.h38
-rw-r--r--test/test/test_cryptodev_snow3g_test_vectors.h58
-rw-r--r--test/test/test_cryptodev_zuc_test_vectors.h101
-rw-r--r--test/test/test_devargs.c9
-rw-r--r--test/test/test_distributor.c2
-rw-r--r--test/test/test_distributor_perf.c1
-rw-r--r--test/test/test_eal_flags.c5
-rw-r--r--test/test/test_event_ring.c276
-rw-r--r--test/test/test_eventdev.c14
-rw-r--r--test/test/test_eventdev_octeontx.c9
-rw-r--r--test/test/test_eventdev_sw.c105
-rw-r--r--test/test/test_func_reentrancy.c4
-rw-r--r--test/test/test_hash.c10
-rw-r--r--test/test/test_interrupts.c6
-rw-r--r--test/test/test_link_bonding.c106
-rw-r--r--test/test/test_link_bonding_mode4.c89
-rw-r--r--test/test/test_link_bonding_rssconf.c7
-rw-r--r--test/test/test_malloc.c3
-rw-r--r--test/test/test_mbuf.c151
-rw-r--r--test/test/test_mp_secondary.c4
-rw-r--r--test/test/test_per_lcore.c1
-rw-r--r--test/test/test_reorder.c4
-rw-r--r--test/test/test_ring.c75
-rw-r--r--test/test/test_ring_perf.c1
-rw-r--r--test/test/test_rwlock.c1
-rw-r--r--test/test/test_service_cores.c599
-rw-r--r--test/test/test_spinlock.c3
-rw-r--r--test/test/test_timer.c1
-rw-r--r--test/test/test_timer_perf.c1
-rw-r--r--test/test/test_timer_racecond.c1
-rw-r--r--test/test/test_xmmt_ops.h8
-rw-r--r--test/test/virtual_pmd.c22
53 files changed, 4358 insertions, 2361 deletions
diff --git a/test/test-pipeline/config.c b/test/test-pipeline/config.c
index 1b397c03..eebb8102 100644
--- a/test/test-pipeline/config.c
+++ b/test/test-pipeline/config.c
@@ -55,7 +55,6 @@
#include <rte_cycles.h>
#include <rte_prefetch.h>
#include <rte_lcore.h>
-#include <rte_per_lcore.h>
#include <rte_branch_prediction.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
diff --git a/test/test-pipeline/init.c b/test/test-pipeline/init.c
index 00dbc279..1457c789 100644
--- a/test/test-pipeline/init.c
+++ b/test/test-pipeline/init.c
@@ -55,7 +55,6 @@
#include <rte_cycles.h>
#include <rte_prefetch.h>
#include <rte_lcore.h>
-#include <rte_per_lcore.h>
#include <rte_branch_prediction.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
diff --git a/test/test-pipeline/main.c b/test/test-pipeline/main.c
index 71ab6ad9..795b1aeb 100644
--- a/test/test-pipeline/main.c
+++ b/test/test-pipeline/main.c
@@ -56,7 +56,6 @@
#include <rte_cycles.h>
#include <rte_prefetch.h>
#include <rte_lcore.h>
-#include <rte_per_lcore.h>
#include <rte_branch_prediction.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
diff --git a/test/test-pipeline/runtime.c b/test/test-pipeline/runtime.c
index 8970e1c3..cb02fff0 100644
--- a/test/test-pipeline/runtime.c
+++ b/test/test-pipeline/runtime.c
@@ -54,8 +54,6 @@
#include <rte_atomic.h>
#include <rte_cycles.h>
#include <rte_prefetch.h>
-#include <rte_lcore.h>
-#include <rte_per_lcore.h>
#include <rte_branch_prediction.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
diff --git a/test/test/Makefile b/test/test/Makefile
index ee240be4..42d9a49e 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -151,6 +151,8 @@ SRCS-y += test_interrupts.c
SRCS-y += test_version.c
SRCS-y += test_func_reentrancy.c
+SRCS-y += test_service_cores.c
+
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_num.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_etheraddr.c
@@ -201,6 +203,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y)
SRCS-y += test_eventdev.c
+SRCS-y += test_event_ring.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c
endif
diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c
index ecb2f6d4..2d16d6ff 100644
--- a/test/test/test_alarm.c
+++ b/test/test/test_alarm.c
@@ -37,7 +37,6 @@
#include <rte_common.h>
#include <rte_cycles.h>
#include <rte_interrupts.h>
-#include <rte_common.h>
#include <rte_atomic.h>
#include <rte_alarm.h>
@@ -47,6 +46,7 @@
#define RTE_TEST_ALARM_TIMEOUT 10 /* ms */
#define RTE_TEST_CHECK_PERIOD 3 /* ms */
+#define RTE_TEST_MAX_REPEAT 20
static volatile int flag;
@@ -96,6 +96,7 @@ static int
test_multi_alarms(void)
{
int rm_count = 0;
+ int count = 0;
cb_count.cnt = 0;
printf("Expect 6 callbacks in order...\n");
@@ -169,7 +170,10 @@ test_multi_alarms(void)
printf("Error, cancelling head-of-list leads to premature callback\n");
return -1;
}
- rte_delay_ms(10);
+
+ while (flag != 2 && count++ < RTE_TEST_MAX_REPEAT)
+ rte_delay_ms(10);
+
if (flag != 2) {
printf("Error - expected callback not called\n");
rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1);
@@ -212,7 +216,7 @@ test_alarm(void)
printf("fail to set alarm callback\n");
return -1;
}
- while (flag == 0 && count ++ < 6)
+ while (flag == 0 && count++ < RTE_TEST_MAX_REPEAT)
rte_delay_ms(RTE_TEST_CHECK_PERIOD);
if (flag == 0){
diff --git a/test/test/test_atomic.c b/test/test/test_atomic.c
index b5e7e1b7..c68723ae 100644
--- a/test/test/test_atomic.c
+++ b/test/test/test_atomic.c
@@ -42,7 +42,6 @@
#include <rte_launch.h>
#include <rte_atomic.h>
#include <rte_eal.h>
-#include <rte_per_lcore.h>
#include <rte_lcore.h>
#include "test.h"
diff --git a/test/test/test_cmdline_cirbuf.c b/test/test/test_cmdline_cirbuf.c
index 87f83cc6..2c321457 100644
--- a/test/test/test_cmdline_cirbuf.c
+++ b/test/test/test_cmdline_cirbuf.c
@@ -45,7 +45,7 @@
#define CIRBUF_STR_HEAD " HEAD"
#define CIRBUF_STR_TAIL "TAIL"
-/* miscelaneous tests - they make bullseye happy */
+/* miscellaneous tests - they make bullseye happy */
static int
test_cirbuf_string_misc(void)
{
diff --git a/test/test/test_common.c b/test/test/test_common.c
index 8effa2f9..ae3482da 100644
--- a/test/test/test_common.c
+++ b/test/test/test_common.c
@@ -33,8 +33,10 @@
#include <stdio.h>
#include <string.h>
+#include <math.h>
#include <rte_common.h>
#include <rte_hexdump.h>
+#include <rte_pause.h>
#include "test.h"
@@ -159,12 +161,32 @@ test_align(void)
}
static int
+test_log2(void)
+{
+ uint32_t i, base, compare;
+ const uint32_t max = 0x10000;
+ const uint32_t step = 1;
+
+ for (i = 0; i < max; i = i + step) {
+ base = (uint32_t)ceilf(log2((uint32_t)i));
+ compare = rte_log2_u32(i);
+ if (base != compare) {
+ printf("Wrong rte_log2_u32(%x) val %x, expected %x\n",
+ i, compare, base);
+ return TEST_FAILED;
+ }
+ }
+ return 0;
+}
+
+static int
test_common(void)
{
int ret = 0;
ret |= test_align();
ret |= test_macros(0);
ret |= test_misc();
+ ret |= test_log2();
return ret;
}
diff --git a/test/test/test_crc.c b/test/test/test_crc.c
index cd5af69a..9f2a17d4 100644
--- a/test/test/test_crc.c
+++ b/test/test/test_crc.c
@@ -178,6 +178,15 @@ test_crc(void)
return ret;
}
+ /* set CRC neon mode */
+ rte_net_crc_set_alg(RTE_NET_CRC_NEON);
+
+ ret = test_crc_calc();
+ if (ret < 0) {
+ printf("test crc (arm64 neon pmull): failed (%d)\n", ret);
+ return ret;
+ }
+
return 0;
}
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 029ce8a0..a4116c65 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -35,6 +35,7 @@
#include <rte_mbuf.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
+#include <rte_pause.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
@@ -60,12 +61,13 @@
#include "test_cryptodev_gcm_test_vectors.h"
#include "test_cryptodev_hmac_test_vectors.h"
-static enum rte_cryptodev_type gbl_cryptodev_type;
+static int gbl_driver_id;
struct crypto_testsuite_params {
struct rte_mempool *mbuf_pool;
struct rte_mempool *large_mbuf_pool;
struct rte_mempool *op_mpool;
+ struct rte_mempool *session_mpool;
struct rte_cryptodev_config conf;
struct rte_cryptodev_qp_conf qp_conf;
@@ -76,6 +78,7 @@ struct crypto_testsuite_params {
struct crypto_unittest_params {
struct rte_crypto_sym_xform cipher_xform;
struct rte_crypto_sym_xform auth_xform;
+ struct rte_crypto_sym_xform aead_xform;
struct rte_cryptodev_sym_session *sess;
@@ -202,7 +205,8 @@ testsuite_setup(void)
RTE_CRYPTO_OP_TYPE_SYMMETRIC,
NUM_MBUFS, MBUF_CACHE_SIZE,
DEFAULT_NUM_XFORMS *
- sizeof(struct rte_crypto_sym_xform),
+ sizeof(struct rte_crypto_sym_xform) +
+ MAXIMUM_IV_LENGTH,
rte_socket_id());
if (ts_params->op_mpool == NULL) {
RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
@@ -210,14 +214,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(
- RTE_CRYPTODEV_AESNI_MB_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
if (nb_devs < 1) {
ret = rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
@@ -230,14 +231,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(
- RTE_CRYPTODEV_AESNI_GCM_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ 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),
@@ -248,13 +246,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)));
if (nb_devs < 1) {
TEST_ASSERT_SUCCESS(rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL),
@@ -265,13 +261,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_KASUMI_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_KASUMI_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_KASUMI_PMD)));
if (nb_devs < 1) {
TEST_ASSERT_SUCCESS(rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), NULL),
@@ -282,13 +276,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_ZUC_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ZUC_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ZUC_PMD)));
if (nb_devs < 1) {
TEST_ASSERT_SUCCESS(rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_ZUC_PMD), NULL),
@@ -299,14 +291,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(
- RTE_CRYPTODEV_NULL_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD)));
if (nb_devs < 1) {
ret = rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_NULL_PMD), NULL);
@@ -319,14 +308,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(
- RTE_CRYPTODEV_OPENSSL_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)));
if (nb_devs < 1) {
ret = rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
@@ -339,14 +325,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(
- RTE_CRYPTODEV_ARMV8_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ARMV8_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)));
if (nb_devs < 1) {
ret = rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_ARMV8_PMD),
@@ -359,15 +342,12 @@ testsuite_setup(void)
}
#ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER
- if (gbl_cryptodev_type == RTE_CRYPTODEV_SCHEDULER_PMD) {
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD))) {
-#ifndef RTE_LIBRTE_PMD_AESNI_MB
- RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(
- RTE_CRYPTODEV_SCHEDULER_PMD);
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)));
if (nb_devs < 1) {
ret = rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD),
@@ -381,14 +361,6 @@ testsuite_setup(void)
}
#endif /* RTE_LIBRTE_PMD_CRYPTO_SCHEDULER */
-#ifndef RTE_LIBRTE_PMD_QAT
- if (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) {
- RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_QAT must be enabled "
- "in config file to run this testsuite.\n");
- return TEST_FAILED;
- }
-#endif
-
nb_devs = rte_cryptodev_count();
if (nb_devs < 1) {
RTE_LOG(ERR, USER1, "No crypto devices found?\n");
@@ -398,7 +370,7 @@ testsuite_setup(void)
/* Create list of valid crypto devs */
for (i = 0; i < nb_devs; i++) {
rte_cryptodev_info_get(i, &info);
- if (info.dev_type == gbl_cryptodev_type)
+ if (info.driver_id == gbl_driver_id)
ts_params->valid_devs[ts_params->valid_dev_count++] = i;
}
@@ -413,7 +385,23 @@ testsuite_setup(void)
ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
ts_params->conf.socket_id = SOCKET_ID_ANY;
- ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions;
+
+ unsigned int session_size = rte_cryptodev_get_private_session_size(dev_id);
+
+ /*
+ * Create mempool with maximum number of sessions * 2,
+ * to include the session headers
+ */
+ ts_params->session_mpool = rte_mempool_create(
+ "test_sess_mp",
+ info.sym.max_nb_sessions * 2,
+ session_size,
+ 0, 0, NULL, NULL, NULL,
+ NULL, SOCKET_ID_ANY,
+ 0);
+
+ TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+ "session mempool allocation failed");
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
&ts_params->conf),
@@ -425,7 +413,8 @@ testsuite_setup(void)
for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
dev_id, qp_id, &ts_params->qp_conf,
- rte_cryptodev_socket_id(dev_id)),
+ rte_cryptodev_socket_id(dev_id),
+ ts_params->session_mpool),
"Failed to setup queue pair %u on cryptodev %u",
qp_id, dev_id);
}
@@ -448,6 +437,11 @@ testsuite_teardown(void)
rte_mempool_avail_count(ts_params->op_mpool));
}
+ /* Free session mempools */
+ if (ts_params->session_mpool != NULL) {
+ rte_mempool_free(ts_params->session_mpool);
+ ts_params->session_mpool = NULL;
+ }
}
static int
@@ -463,7 +457,6 @@ ut_setup(void)
/* Reconfigure device to default parameters */
ts_params->conf.socket_id = SOCKET_ID_ANY;
- ts_params->conf.session_mp.nb_objs = DEFAULT_NUM_OPS_INFLIGHT;
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
&ts_params->conf),
@@ -474,7 +467,8 @@ ut_setup(void)
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id,
&ts_params->qp_conf,
- rte_cryptodev_socket_id(ts_params->valid_devs[0])),
+ rte_cryptodev_socket_id(ts_params->valid_devs[0]),
+ ts_params->session_mpool),
"Failed to setup queue pair %u on cryptodev %u",
qp_id, ts_params->valid_devs[0]);
}
@@ -499,8 +493,9 @@ ut_teardown(void)
/* free crypto session structure */
if (ut_params->sess) {
- rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
+ rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
ut_params->sess);
+ rte_cryptodev_sym_session_free(ut_params->sess);
ut_params->sess = NULL;
}
@@ -593,7 +588,8 @@ test_device_configure_invalid_queue_pair_ids(void)
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
&ts_params->conf),
"Failed to configure cryptodev: dev_id %u, qp_id %u",
- ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs);
+ ts_params->valid_devs[0],
+ ts_params->conf.nb_queue_pairs);
/* invalid - zero queue pairs */
@@ -651,13 +647,11 @@ test_queue_pair_descriptor_setup(void)
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
- ts_params->conf.session_mp.nb_objs = dev_info.sym.max_nb_sessions;
-
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
- &ts_params->conf), "Failed to configure cryptodev %u",
+ &ts_params->conf),
+ "Failed to configure cryptodev %u",
ts_params->valid_devs[0]);
-
/*
* Test various ring sizes on this device. memzones can't be
* freed so are re-used if ring is released and re-created.
@@ -668,7 +662,8 @@ test_queue_pair_descriptor_setup(void)
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
rte_cryptodev_socket_id(
- ts_params->valid_devs[0])),
+ ts_params->valid_devs[0]),
+ ts_params->session_mpool),
"Failed test for "
"rte_cryptodev_queue_pair_setup: num_inflights "
"%u on qp %u on cryptodev %u",
@@ -682,7 +677,8 @@ test_queue_pair_descriptor_setup(void)
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
rte_cryptodev_socket_id(
- ts_params->valid_devs[0])),
+ ts_params->valid_devs[0]),
+ ts_params->session_mpool),
"Failed test for"
" rte_cryptodev_queue_pair_setup: num_inflights"
" %u on qp %u on cryptodev %u",
@@ -696,7 +692,8 @@ test_queue_pair_descriptor_setup(void)
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
rte_cryptodev_socket_id(
- ts_params->valid_devs[0])),
+ ts_params->valid_devs[0]),
+ ts_params->session_mpool),
"Failed test for "
"rte_cryptodev_queue_pair_setup: num_inflights"
" %u on qp %u on cryptodev %u",
@@ -711,7 +708,8 @@ test_queue_pair_descriptor_setup(void)
TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
rte_cryptodev_socket_id(
- ts_params->valid_devs[0])),
+ ts_params->valid_devs[0]),
+ ts_params->session_mpool),
"Unexpectedly passed test for "
"rte_cryptodev_queue_pair_setup:"
"num_inflights %u on qp %u on cryptodev %u",
@@ -726,7 +724,8 @@ test_queue_pair_descriptor_setup(void)
TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
rte_cryptodev_socket_id(
- ts_params->valid_devs[0])),
+ ts_params->valid_devs[0]),
+ ts_params->session_mpool),
"Unexpectedly passed test for "
"rte_cryptodev_queue_pair_setup:"
"num_inflights %u on qp %u on cryptodev %u",
@@ -740,7 +739,8 @@ test_queue_pair_descriptor_setup(void)
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
rte_cryptodev_socket_id(
- ts_params->valid_devs[0])),
+ ts_params->valid_devs[0]),
+ ts_params->session_mpool),
"Failed test for"
" rte_cryptodev_queue_pair_setup:"
"num_inflights %u on qp %u on cryptodev %u",
@@ -755,7 +755,8 @@ test_queue_pair_descriptor_setup(void)
TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id, &qp_conf,
rte_cryptodev_socket_id(
- ts_params->valid_devs[0])),
+ ts_params->valid_devs[0]),
+ ts_params->session_mpool),
"Unexpectedly passed test for "
"rte_cryptodev_queue_pair_setup:"
"num_inflights %u on qp %u on cryptodev %u",
@@ -771,7 +772,8 @@ test_queue_pair_descriptor_setup(void)
TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0],
qp_id, &qp_conf,
- rte_cryptodev_socket_id(ts_params->valid_devs[0])),
+ rte_cryptodev_socket_id(ts_params->valid_devs[0]),
+ ts_params->session_mpool),
"Failed test for rte_cryptodev_queue_pair_setup:"
"invalid qp %u on cryptodev %u",
qp_id, ts_params->valid_devs[0]);
@@ -781,7 +783,8 @@ test_queue_pair_descriptor_setup(void)
TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0],
qp_id, &qp_conf,
- rte_cryptodev_socket_id(ts_params->valid_devs[0])),
+ rte_cryptodev_socket_id(ts_params->valid_devs[0]),
+ ts_params->session_mpool),
"Failed test for rte_cryptodev_queue_pair_setup:"
"invalid qp %u on cryptodev %u",
qp_id, ts_params->valid_devs[0]);
@@ -1269,6 +1272,8 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
ut_params->cipher_xform.cipher.key.data = aes_cbc_key;
ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC;
+ ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
+ ut_params->cipher_xform.cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
/* Setup HMAC Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -1281,10 +1286,13 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
ut_params->auth_xform.auth.key.data = hmac_sha1_key;
ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1;
- /* Create crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->valid_devs[0],
- &ut_params->cipher_xform);
+ ts_params->session_mpool);
+
+ /* Create crypto session*/
+ rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ ut_params->sess, &ut_params->cipher_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
/* Generate crypto op data structure */
@@ -1304,21 +1312,16 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
sym_op->auth.digest.data = ut_params->digest;
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
ut_params->ibuf, QUOTE_512_BYTES);
- sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA1;
- sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC;
+ sym_op->auth.data.offset = 0;
sym_op->auth.data.length = QUOTE_512_BYTES;
- /* Set crypto operation cipher parameters */
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf,
- CIPHER_IV_LENGTH_AES_CBC);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
-
- rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv,
- CIPHER_IV_LENGTH_AES_CBC);
+ /* Copy IV at the end of the crypto operation */
+ rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
+ aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC);
- sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC;
+ /* Set crypto operation cipher parameters */
+ sym_op->cipher.data.offset = 0;
sym_op->cipher.data.length = QUOTE_512_BYTES;
/* Process crypto operation */
@@ -1329,8 +1332,8 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
"crypto op processing failed");
/* Validate obuf */
- uint8_t *ciphertext = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_src,
- uint8_t *, CIPHER_IV_LENGTH_AES_CBC);
+ uint8_t *ciphertext = rte_pktmbuf_mtod(ut_params->op->sym->m_src,
+ uint8_t *);
TEST_ASSERT_BUFFERS_ARE_EQUAL(ciphertext,
catch_22_quote_2_512_bytes_AES_CBC_ciphertext,
@@ -1341,7 +1344,8 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
TEST_ASSERT_BUFFERS_ARE_EQUAL(digest,
catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest,
- gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD ?
+ gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) ?
TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 :
DIGEST_BYTE_LENGTH_SHA1,
"Generated digest data not as expected");
@@ -1405,6 +1409,8 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
ut_params->cipher_xform.cipher.key.data = cipher_key;
ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC;
+ ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
+ ut_params->cipher_xform.cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
/* Setup HMAC Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -1458,21 +1464,15 @@ test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess,
sym_op->auth.digest.data = ut_params->digest;
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
ut_params->ibuf, QUOTE_512_BYTES);
- sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA512;
- sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC;
+ sym_op->auth.data.offset = 0;
sym_op->auth.data.length = QUOTE_512_BYTES;
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, CIPHER_IV_LENGTH_AES_CBC);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys_offset(
- ut_params->ibuf, 0);
- sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
+ /* Copy IV at the end of the crypto operation */
+ rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
+ iv, CIPHER_IV_LENGTH_AES_CBC);
- rte_memcpy(sym_op->cipher.iv.data, iv,
- CIPHER_IV_LENGTH_AES_CBC);
-
- sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC;
+ sym_op->cipher.data.offset = 0;
sym_op->cipher.data.length = QUOTE_512_BYTES;
/* Process crypto operation */
@@ -1486,8 +1486,8 @@ test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess,
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
- rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) +
- CIPHER_IV_LENGTH_AES_CBC, catch_22_quote,
+ rte_pktmbuf_mtod(ut_params->obuf, uint8_t *),
+ catch_22_quote,
QUOTE_512_BYTES,
"Plaintext data not as expected");
@@ -1505,8 +1505,11 @@ test_AES_cipheronly_mb_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_AESNI_MB_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
BLKCIPHER_AES_CIPHERONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1521,8 +1524,11 @@ test_AES_docsis_mb_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_AESNI_MB_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
BLKCIPHER_AES_DOCSIS_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1537,8 +1543,11 @@ test_AES_docsis_qat_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_QAT_SYM_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
BLKCIPHER_AES_DOCSIS_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1553,8 +1562,11 @@ test_DES_docsis_qat_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_QAT_SYM_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
BLKCIPHER_DES_DOCSIS_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1569,8 +1581,11 @@ test_authonly_mb_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_AESNI_MB_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
BLKCIPHER_AUTHONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1579,14 +1594,35 @@ test_authonly_mb_all(void)
}
static int
+test_authonly_qat_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->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
+ BLKCIPHER_AUTHONLY_TYPE);
+
+ TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+ return TEST_SUCCESS;
+}
+static int
test_AES_chain_mb_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_AESNI_MB_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
BLKCIPHER_AES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1603,8 +1639,11 @@ test_AES_cipheronly_scheduler_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_SCHEDULER_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
BLKCIPHER_AES_CIPHERONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1619,8 +1658,11 @@ test_AES_chain_scheduler_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_SCHEDULER_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
BLKCIPHER_AES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1635,8 +1677,11 @@ test_authonly_scheduler_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_SCHEDULER_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
BLKCIPHER_AUTHONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1653,8 +1698,11 @@ test_AES_chain_openssl_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_OPENSSL_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
BLKCIPHER_AES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1669,8 +1717,11 @@ test_AES_cipheronly_openssl_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_OPENSSL_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
BLKCIPHER_AES_CIPHERONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1685,8 +1736,11 @@ test_AES_chain_qat_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_QAT_SYM_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
BLKCIPHER_AES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1701,8 +1755,11 @@ test_AES_cipheronly_qat_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_QAT_SYM_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
BLKCIPHER_AES_CIPHERONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1717,8 +1774,11 @@ test_AES_chain_dpaa2_sec_all(void)
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,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
BLKCIPHER_AES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1733,8 +1793,11 @@ test_AES_cipheronly_dpaa2_sec_all(void)
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,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
BLKCIPHER_AES_CIPHERONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1743,14 +1806,36 @@ test_AES_cipheronly_dpaa2_sec_all(void)
}
static int
+test_authonly_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->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(RTE_CRYPTODEV_DPAA2_SEC_PMD)),
+ BLKCIPHER_AUTHONLY_TYPE);
+
+ TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+ return TEST_SUCCESS;
+}
+
+static int
test_authonly_openssl_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_OPENSSL_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
BLKCIPHER_AUTHONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1765,8 +1850,11 @@ test_AES_chain_armv8_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_ARMV8_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)),
BLKCIPHER_AES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -1778,12 +1866,13 @@ test_AES_chain_armv8_all(void)
static int
create_wireless_algo_hash_session(uint8_t dev_id,
const uint8_t *key, const uint8_t key_len,
- const uint8_t aad_len, const uint8_t auth_len,
+ const uint8_t iv_len, const uint8_t auth_len,
enum rte_crypto_auth_operation op,
enum rte_crypto_auth_algorithm algo)
{
uint8_t hash_key[key_len];
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
memcpy(hash_key, key, key_len);
@@ -1799,9 +1888,13 @@ create_wireless_algo_hash_session(uint8_t dev_id,
ut_params->auth_xform.auth.key.length = key_len;
ut_params->auth_xform.auth.key.data = hash_key;
ut_params->auth_xform.auth.digest_length = auth_len;
- ut_params->auth_xform.auth.add_auth_data_length = aad_len;
- ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
- &ut_params->auth_xform);
+ ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
+ ut_params->auth_xform.auth.iv.length = iv_len;
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->session_mpool);
+
+ rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ &ut_params->auth_xform, ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -1810,10 +1903,12 @@ static int
create_wireless_algo_cipher_session(uint8_t dev_id,
enum rte_crypto_cipher_operation op,
enum rte_crypto_cipher_algorithm algo,
- const uint8_t *key, const uint8_t key_len)
+ const uint8_t *key, const uint8_t key_len,
+ uint8_t iv_len)
{
uint8_t cipher_key[key_len];
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
memcpy(cipher_key, key, key_len);
@@ -1826,26 +1921,28 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
ut_params->cipher_xform.cipher.op = op;
ut_params->cipher_xform.cipher.key.data = cipher_key;
ut_params->cipher_xform.cipher.key.length = key_len;
+ ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
+ ut_params->cipher_xform.cipher.iv.length = iv_len;
TEST_HEXDUMP(stdout, "key:", key, key_len);
/* Create Crypto session */
- ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
- &ut_params->
- cipher_xform);
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->session_mpool);
+
+ rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ &ut_params->cipher_xform, ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
static int
-create_wireless_algo_cipher_operation(const uint8_t *iv, const unsigned iv_len,
- const unsigned cipher_len,
- const unsigned cipher_offset,
- enum rte_crypto_cipher_algorithm algo)
+create_wireless_algo_cipher_operation(const uint8_t *iv, uint8_t iv_len,
+ unsigned int cipher_len,
+ unsigned int cipher_offset)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- unsigned iv_pad_len = 0;
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -1862,35 +1959,20 @@ create_wireless_algo_cipher_operation(const uint8_t *iv, const unsigned iv_len,
sym_op->m_src = ut_params->ibuf;
/* iv */
- if (algo == RTE_CRYPTO_CIPHER_KASUMI_F8)
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 8);
- else
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16);
-
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf
- , iv_pad_len);
-
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
-
- memset(sym_op->cipher.iv.data, 0, iv_pad_len);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = iv_pad_len;
-
- rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
+ rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
+ iv, iv_len);
sym_op->cipher.data.length = cipher_len;
sym_op->cipher.data.offset = cipher_offset;
return 0;
}
static int
-create_wireless_algo_cipher_operation_oop(const uint8_t *iv, const uint8_t iv_len,
- const unsigned cipher_len,
- const unsigned cipher_offset,
- enum rte_crypto_cipher_algorithm algo)
+create_wireless_algo_cipher_operation_oop(const uint8_t *iv, uint8_t iv_len,
+ unsigned int cipher_len,
+ unsigned int cipher_offset)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- unsigned iv_pad_len = 0;
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -1908,24 +1990,8 @@ create_wireless_algo_cipher_operation_oop(const uint8_t *iv, const uint8_t iv_le
sym_op->m_dst = ut_params->obuf;
/* iv */
- if (algo == RTE_CRYPTO_CIPHER_KASUMI_F8)
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 8);
- else
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16);
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf,
- iv_pad_len);
-
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
-
- /* For OOP operation both buffers must have the same size */
- if (ut_params->obuf)
- rte_pktmbuf_prepend(ut_params->obuf, iv_pad_len);
-
- memset(sym_op->cipher.iv.data, 0, iv_pad_len);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = iv_pad_len;
-
- rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
+ rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
+ iv, iv_len);
sym_op->cipher.data.length = cipher_len;
sym_op->cipher.data.offset = cipher_offset;
return 0;
@@ -1937,12 +2003,14 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
enum rte_crypto_auth_operation auth_op,
enum rte_crypto_auth_algorithm auth_algo,
enum rte_crypto_cipher_algorithm cipher_algo,
- const uint8_t *key, const uint8_t key_len,
- const uint8_t aad_len, const uint8_t auth_len)
+ const uint8_t *key, uint8_t key_len,
+ uint8_t auth_iv_len, uint8_t auth_len,
+ uint8_t cipher_iv_len)
{
uint8_t cipher_auth_key[key_len];
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
memcpy(cipher_auth_key, key, key_len);
@@ -1957,7 +2025,9 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
/* Hash key = cipher key */
ut_params->auth_xform.auth.key.data = cipher_auth_key;
ut_params->auth_xform.auth.digest_length = auth_len;
- ut_params->auth_xform.auth.add_auth_data_length = aad_len;
+ /* Auth IV will be after cipher IV */
+ ut_params->auth_xform.auth.iv.offset = IV_OFFSET + cipher_iv_len;
+ ut_params->auth_xform.auth.iv.length = auth_iv_len;
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
@@ -1967,12 +2037,17 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
ut_params->cipher_xform.cipher.op = cipher_op;
ut_params->cipher_xform.cipher.key.data = cipher_auth_key;
ut_params->cipher_xform.cipher.key.length = key_len;
+ ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
+ ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
TEST_HEXDUMP(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
- &ut_params->cipher_xform);
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->session_mpool);
+
+ rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ &ut_params->cipher_xform, ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
@@ -1989,10 +2064,12 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
const uint8_t key_len = tdata->key.len;
uint8_t cipher_auth_key[key_len];
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
const uint8_t *key = tdata->key.data;
- const uint8_t aad_len = tdata->aad.len;
const uint8_t auth_len = tdata->digest.len;
+ uint8_t cipher_iv_len = tdata->cipher_iv.len;
+ uint8_t auth_iv_len = tdata->auth_iv.len;
memcpy(cipher_auth_key, key, key_len);
@@ -2006,7 +2083,9 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
/* Hash key = cipher key */
ut_params->auth_xform.auth.key.data = cipher_auth_key;
ut_params->auth_xform.auth.digest_length = auth_len;
- ut_params->auth_xform.auth.add_auth_data_length = aad_len;
+ /* Auth IV will be after cipher IV */
+ ut_params->auth_xform.auth.iv.offset = IV_OFFSET + cipher_iv_len;
+ ut_params->auth_xform.auth.iv.length = auth_iv_len;
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
@@ -2016,12 +2095,18 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
ut_params->cipher_xform.cipher.op = cipher_op;
ut_params->cipher_xform.cipher.key.data = cipher_auth_key;
ut_params->cipher_xform.cipher.key.length = key_len;
+ ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
+ ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
+
TEST_HEXDUMP(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
- &ut_params->cipher_xform);
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->session_mpool);
+
+ rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ &ut_params->cipher_xform, ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
@@ -2044,10 +2129,12 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
enum rte_crypto_auth_algorithm auth_algo,
enum rte_crypto_cipher_algorithm cipher_algo,
const uint8_t *key, const uint8_t key_len,
- const uint8_t aad_len, const uint8_t auth_len)
+ uint8_t auth_iv_len, uint8_t auth_len,
+ uint8_t cipher_iv_len)
{
uint8_t auth_cipher_key[key_len];
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
memcpy(auth_cipher_key, key, key_len);
@@ -2060,7 +2147,9 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
ut_params->auth_xform.auth.key.length = key_len;
ut_params->auth_xform.auth.key.data = auth_cipher_key;
ut_params->auth_xform.auth.digest_length = auth_len;
- ut_params->auth_xform.auth.add_auth_data_length = aad_len;
+ /* Auth IV will be after cipher IV */
+ ut_params->auth_xform.auth.iv.offset = IV_OFFSET + cipher_iv_len;
+ ut_params->auth_xform.auth.iv.length = auth_iv_len;
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
@@ -2069,12 +2158,17 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
ut_params->cipher_xform.cipher.op = cipher_op;
ut_params->cipher_xform.cipher.key.data = auth_cipher_key;
ut_params->cipher_xform.cipher.key.length = key_len;
+ ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
+ ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
TEST_HEXDUMP(stdout, "key:", key, key_len);
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
- &ut_params->auth_xform);
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->session_mpool);
+
+ rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ &ut_params->auth_xform, ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
@@ -2083,19 +2177,16 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
static int
create_wireless_algo_hash_operation(const uint8_t *auth_tag,
- const unsigned auth_tag_len,
- const uint8_t *aad, const unsigned aad_len,
- unsigned data_pad_len,
+ unsigned int auth_tag_len,
+ const uint8_t *iv, unsigned int iv_len,
+ unsigned int data_pad_len,
enum rte_crypto_auth_operation op,
- enum rte_crypto_auth_algorithm algo,
- const unsigned auth_len, const unsigned auth_offset)
+ unsigned int auth_len, unsigned int auth_offset)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- unsigned aad_buffer_len;
-
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC);
@@ -2110,32 +2201,9 @@ create_wireless_algo_hash_operation(const uint8_t *auth_tag,
/* set crypto operation source mbuf */
sym_op->m_src = ut_params->ibuf;
- /* aad */
- /*
- * Always allocate the aad up to the block size.
- * The cryptodev API calls out -
- * - the array must be big enough to hold the AAD, plus any
- * space to round this up to the nearest multiple of the
- * block size (8 bytes for KASUMI and 16 bytes for SNOW 3G).
- */
- if (algo == RTE_CRYPTO_AUTH_KASUMI_F9)
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 8);
- else
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16);
- sym_op->auth.aad.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, aad_buffer_len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
- "no room to prepend aad");
- sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(
- ut_params->ibuf);
- sym_op->auth.aad.length = aad_len;
-
- memset(sym_op->auth.aad.data, 0, aad_buffer_len);
- rte_memcpy(sym_op->auth.aad.data, aad, aad_len);
-
- TEST_HEXDUMP(stdout, "aad:",
- sym_op->auth.aad.data, aad_len);
-
+ /* iv */
+ rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
+ iv, iv_len);
/* digest */
sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
ut_params->ibuf, auth_tag_len);
@@ -2144,8 +2212,7 @@ create_wireless_algo_hash_operation(const uint8_t *auth_tag,
"no room to append auth tag");
ut_params->digest = sym_op->auth.digest.data;
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
- ut_params->ibuf, data_pad_len + aad_len);
- sym_op->auth.digest.length = auth_tag_len;
+ ut_params->ibuf, data_pad_len);
if (op == RTE_CRYPTO_AUTH_OP_GENERATE)
memset(sym_op->auth.digest.data, 0, auth_tag_len);
else
@@ -2153,7 +2220,7 @@ create_wireless_algo_hash_operation(const uint8_t *auth_tag,
TEST_HEXDUMP(stdout, "digest:",
sym_op->auth.digest.data,
- sym_op->auth.digest.length);
+ auth_tag_len);
sym_op->auth.data.length = auth_len;
sym_op->auth.data.offset = auth_offset;
@@ -2163,30 +2230,22 @@ create_wireless_algo_hash_operation(const uint8_t *auth_tag,
static int
create_wireless_cipher_hash_operation(const struct wireless_test_data *tdata,
- enum rte_crypto_auth_operation op,
- enum rte_crypto_auth_algorithm auth_algo,
- enum rte_crypto_cipher_algorithm cipher_algo)
+ enum rte_crypto_auth_operation op)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
const uint8_t *auth_tag = tdata->digest.data;
const unsigned int auth_tag_len = tdata->digest.len;
- const uint8_t *aad = tdata->aad.data;
- const uint8_t aad_len = tdata->aad.len;
unsigned int plaintext_len = ceil_byte_length(tdata->plaintext.len);
unsigned int data_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
- const uint8_t *iv = tdata->iv.data;
- const uint8_t iv_len = tdata->iv.len;
+ const uint8_t *cipher_iv = tdata->cipher_iv.data;
+ const uint8_t cipher_iv_len = tdata->cipher_iv.len;
+ const uint8_t *auth_iv = tdata->auth_iv.data;
+ const uint8_t auth_iv_len = tdata->auth_iv.len;
const unsigned int cipher_len = tdata->validCipherLenInBits.len;
- const unsigned int cipher_offset =
- tdata->validCipherOffsetLenInBits.len;
const unsigned int auth_len = tdata->validAuthLenInBits.len;
- const unsigned int auth_offset = tdata->validAuthOffsetLenInBits.len;
-
- unsigned int iv_pad_len = 0;
- unsigned int aad_buffer_len;
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -2210,7 +2269,6 @@ create_wireless_cipher_hash_operation(const struct wireless_test_data *tdata,
ut_params->digest = sym_op->auth.digest.data;
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
ut_params->ibuf, data_pad_len);
- sym_op->auth.digest.length = auth_tag_len;
if (op == RTE_CRYPTO_AUTH_OP_GENERATE)
memset(sym_op->auth.digest.data, 0, auth_tag_len);
else
@@ -2218,49 +2276,19 @@ create_wireless_cipher_hash_operation(const struct wireless_test_data *tdata,
TEST_HEXDUMP(stdout, "digest:",
sym_op->auth.digest.data,
- sym_op->auth.digest.length);
+ auth_tag_len);
- /* aad */
- /*
- * Always allocate the aad up to the block size.
- * The cryptodev API calls out -
- * - the array must be big enough to hold the AAD, plus any
- * space to round this up to the nearest multiple of the
- * block size (8 bytes for KASUMI and 16 bytes for SNOW 3G).
- */
- if (auth_algo == RTE_CRYPTO_AUTH_KASUMI_F9)
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 8);
- else
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16);
- sym_op->auth.aad.data =
- (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, aad_buffer_len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
- "no room to prepend aad");
- sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(
- ut_params->ibuf);
- sym_op->auth.aad.length = aad_len;
- memset(sym_op->auth.aad.data, 0, aad_buffer_len);
- rte_memcpy(sym_op->auth.aad.data, aad, aad_len);
- TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len);
+ /* Copy cipher and auth IVs at the end of the crypto operation */
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, uint8_t *,
+ IV_OFFSET);
+ rte_memcpy(iv_ptr, cipher_iv, cipher_iv_len);
+ iv_ptr += cipher_iv_len;
+ rte_memcpy(iv_ptr, auth_iv, auth_iv_len);
- /* iv */
- if (cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8)
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 8);
- else
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16);
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, iv_pad_len);
-
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
- memset(sym_op->cipher.iv.data, 0, iv_pad_len);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = iv_pad_len;
- rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
sym_op->cipher.data.length = cipher_len;
- sym_op->cipher.data.offset = cipher_offset + auth_offset;
+ sym_op->cipher.data.offset = 0;
sym_op->auth.data.length = auth_len;
- sym_op->auth.data.offset = auth_offset + cipher_offset;
+ sym_op->auth.data.offset = 0;
return 0;
}
@@ -2270,29 +2298,22 @@ create_zuc_cipher_hash_generate_operation(
const struct wireless_test_data *tdata)
{
return create_wireless_cipher_hash_operation(tdata,
- RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_ZUC_EIA3,
- RTE_CRYPTO_CIPHER_ZUC_EEA3);
+ RTE_CRYPTO_AUTH_OP_GENERATE);
}
static int
create_wireless_algo_cipher_hash_operation(const uint8_t *auth_tag,
const unsigned auth_tag_len,
- const uint8_t *aad, const uint8_t aad_len,
+ const uint8_t *auth_iv, uint8_t auth_iv_len,
unsigned data_pad_len,
enum rte_crypto_auth_operation op,
- enum rte_crypto_auth_algorithm auth_algo,
- enum rte_crypto_cipher_algorithm cipher_algo,
- const uint8_t *iv, const uint8_t iv_len,
+ const uint8_t *cipher_iv, uint8_t cipher_iv_len,
const unsigned cipher_len, const unsigned cipher_offset,
const unsigned auth_len, const unsigned auth_offset)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- unsigned iv_pad_len = 0;
- unsigned aad_buffer_len;
-
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC);
@@ -2315,7 +2336,6 @@ create_wireless_algo_cipher_hash_operation(const uint8_t *auth_tag,
ut_params->digest = sym_op->auth.digest.data;
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
ut_params->ibuf, data_pad_len);
- sym_op->auth.digest.length = auth_tag_len;
if (op == RTE_CRYPTO_AUTH_OP_GENERATE)
memset(sym_op->auth.digest.data, 0, auth_tag_len);
else
@@ -2323,69 +2343,34 @@ create_wireless_algo_cipher_hash_operation(const uint8_t *auth_tag,
TEST_HEXDUMP(stdout, "digest:",
sym_op->auth.digest.data,
- sym_op->auth.digest.length);
+ auth_tag_len);
- /* aad */
- /*
- * Always allocate the aad up to the block size.
- * The cryptodev API calls out -
- * - the array must be big enough to hold the AAD, plus any
- * space to round this up to the nearest multiple of the
- * block size (8 bytes for KASUMI and 16 bytes for SNOW 3G).
- */
- if (auth_algo == RTE_CRYPTO_AUTH_KASUMI_F9)
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 8);
- else
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16);
- sym_op->auth.aad.data =
- (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, aad_buffer_len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
- "no room to prepend aad");
- sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(
- ut_params->ibuf);
- sym_op->auth.aad.length = aad_len;
- memset(sym_op->auth.aad.data, 0, aad_buffer_len);
- rte_memcpy(sym_op->auth.aad.data, aad, aad_len);
- TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len);
+ /* Copy cipher and auth IVs at the end of the crypto operation */
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, uint8_t *,
+ IV_OFFSET);
+ rte_memcpy(iv_ptr, cipher_iv, cipher_iv_len);
+ iv_ptr += cipher_iv_len;
+ rte_memcpy(iv_ptr, auth_iv, auth_iv_len);
- /* iv */
- if (cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8)
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 8);
- else
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16);
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, iv_pad_len);
-
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
- memset(sym_op->cipher.iv.data, 0, iv_pad_len);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = iv_pad_len;
- rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
sym_op->cipher.data.length = cipher_len;
- sym_op->cipher.data.offset = cipher_offset + auth_offset;
+ sym_op->cipher.data.offset = cipher_offset;
sym_op->auth.data.length = auth_len;
- sym_op->auth.data.offset = auth_offset + cipher_offset;
+ sym_op->auth.data.offset = auth_offset;
return 0;
}
static int
-create_wireless_algo_auth_cipher_operation(const unsigned auth_tag_len,
- const uint8_t *iv, const uint8_t iv_len,
- const uint8_t *aad, const uint8_t aad_len,
- unsigned data_pad_len,
- const unsigned cipher_len, const unsigned cipher_offset,
- const unsigned auth_len, const unsigned auth_offset,
- enum rte_crypto_auth_algorithm auth_algo,
- enum rte_crypto_cipher_algorithm cipher_algo)
+create_wireless_algo_auth_cipher_operation(unsigned int auth_tag_len,
+ const uint8_t *cipher_iv, uint8_t cipher_iv_len,
+ const uint8_t *auth_iv, uint8_t auth_iv_len,
+ unsigned int data_pad_len,
+ unsigned int cipher_len, unsigned int cipher_offset,
+ unsigned int auth_len, unsigned int auth_offset)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- unsigned iv_pad_len = 0;
- unsigned aad_buffer_len = 0;
-
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC);
@@ -2409,59 +2394,25 @@ create_wireless_algo_auth_cipher_operation(const unsigned auth_tag_len,
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
ut_params->ibuf, data_pad_len);
- sym_op->auth.digest.length = auth_tag_len;
memset(sym_op->auth.digest.data, 0, auth_tag_len);
TEST_HEXDUMP(stdout, "digest:",
sym_op->auth.digest.data,
- sym_op->auth.digest.length);
-
- /* aad */
- /*
- * Always allocate the aad up to the block size.
- * The cryptodev API calls out -
- * - the array must be big enough to hold the AAD, plus any
- * space to round this up to the nearest multiple of the
- * block size (8 bytes for KASUMI 16 bytes).
- */
- if (auth_algo == RTE_CRYPTO_AUTH_KASUMI_F9)
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 8);
- else
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16);
- sym_op->auth.aad.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, aad_buffer_len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
- "no room to prepend aad");
- sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(
- ut_params->ibuf);
- sym_op->auth.aad.length = aad_len;
- memset(sym_op->auth.aad.data, 0, aad_buffer_len);
- rte_memcpy(sym_op->auth.aad.data, aad, aad_len);
- TEST_HEXDUMP(stdout, "aad:",
- sym_op->auth.aad.data, aad_len);
-
- /* iv */
- if (cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8)
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 8);
- else
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16);
-
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, iv_pad_len);
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
+ auth_tag_len);
- memset(sym_op->cipher.iv.data, 0, iv_pad_len);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = iv_pad_len;
-
- rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
+ /* Copy cipher and auth IVs at the end of the crypto operation */
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, uint8_t *,
+ IV_OFFSET);
+ rte_memcpy(iv_ptr, cipher_iv, cipher_iv_len);
+ iv_ptr += cipher_iv_len;
+ rte_memcpy(iv_ptr, auth_iv, auth_iv_len);
sym_op->cipher.data.length = cipher_len;
- sym_op->cipher.data.offset = auth_offset + cipher_offset;
+ sym_op->cipher.data.offset = cipher_offset;
sym_op->auth.data.length = auth_len;
- sym_op->auth.data.offset = auth_offset + cipher_offset;
+ sym_op->auth.data.offset = auth_offset;
return 0;
}
@@ -2480,7 +2431,7 @@ test_snow3g_authentication(const struct snow3g_hash_test_data *tdata)
/* Create SNOW 3G session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
+ tdata->auth_iv.len, tdata->digest.len,
RTE_CRYPTO_AUTH_OP_GENERATE,
RTE_CRYPTO_AUTH_SNOW3G_UIA2);
if (retval < 0)
@@ -2502,11 +2453,10 @@ test_snow3g_authentication(const struct snow3g_hash_test_data *tdata)
/* Create SNOW 3G operation */
retval = create_wireless_algo_hash_operation(NULL, tdata->digest.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->auth_iv.data, tdata->auth_iv.len,
plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_SNOW3G_UIA2,
tdata->validAuthLenInBits.len,
- tdata->validAuthOffsetLenInBits.len);
+ 0);
if (retval < 0)
return retval;
@@ -2515,7 +2465,7 @@ test_snow3g_authentication(const struct snow3g_hash_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_src;
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len;
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -2541,7 +2491,7 @@ test_snow3g_authentication_verify(const struct snow3g_hash_test_data *tdata)
/* Create SNOW 3G session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
+ tdata->auth_iv.len, tdata->digest.len,
RTE_CRYPTO_AUTH_OP_VERIFY,
RTE_CRYPTO_AUTH_SNOW3G_UIA2);
if (retval < 0)
@@ -2563,12 +2513,11 @@ test_snow3g_authentication_verify(const struct snow3g_hash_test_data *tdata)
/* Create SNOW 3G operation */
retval = create_wireless_algo_hash_operation(tdata->digest.data,
tdata->digest.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->auth_iv.data, tdata->auth_iv.len,
plaintext_pad_len,
RTE_CRYPTO_AUTH_OP_VERIFY,
- RTE_CRYPTO_AUTH_SNOW3G_UIA2,
tdata->validAuthLenInBits.len,
- tdata->validAuthOffsetLenInBits.len);
+ 0);
if (retval < 0)
return retval;
@@ -2577,7 +2526,7 @@ test_snow3g_authentication_verify(const struct snow3g_hash_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len;
+ + plaintext_pad_len;
/* Validate obuf */
if (ut_params->op->status == RTE_CRYPTO_OP_STATUS_SUCCESS)
@@ -2602,7 +2551,7 @@ test_kasumi_authentication(const struct kasumi_hash_test_data *tdata)
/* Create KASUMI session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
+ 0, tdata->digest.len,
RTE_CRYPTO_AUTH_OP_GENERATE,
RTE_CRYPTO_AUTH_KASUMI_F9);
if (retval < 0)
@@ -2624,11 +2573,10 @@ test_kasumi_authentication(const struct kasumi_hash_test_data *tdata)
/* Create KASUMI operation */
retval = create_wireless_algo_hash_operation(NULL, tdata->digest.len,
- tdata->aad.data, tdata->aad.len,
+ NULL, 0,
plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_KASUMI_F9,
- tdata->validAuthLenInBits.len,
- tdata->validAuthOffsetLenInBits.len);
+ tdata->plaintext.len,
+ 0);
if (retval < 0)
return retval;
@@ -2637,7 +2585,7 @@ test_kasumi_authentication(const struct kasumi_hash_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_src;
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + ALIGN_POW2_ROUNDUP(tdata->aad.len, 8);
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -2663,7 +2611,7 @@ test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata)
/* Create KASUMI session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
+ 0, tdata->digest.len,
RTE_CRYPTO_AUTH_OP_VERIFY,
RTE_CRYPTO_AUTH_KASUMI_F9);
if (retval < 0)
@@ -2685,12 +2633,11 @@ test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata)
/* Create KASUMI operation */
retval = create_wireless_algo_hash_operation(tdata->digest.data,
tdata->digest.len,
- tdata->aad.data, tdata->aad.len,
+ NULL, 0,
plaintext_pad_len,
RTE_CRYPTO_AUTH_OP_VERIFY,
- RTE_CRYPTO_AUTH_KASUMI_F9,
- tdata->validAuthLenInBits.len,
- tdata->validAuthOffsetLenInBits.len);
+ tdata->plaintext.len,
+ 0);
if (retval < 0)
return retval;
@@ -2699,7 +2646,7 @@ test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len;
+ + plaintext_pad_len;
/* Validate obuf */
if (ut_params->op->status == RTE_CRYPTO_OP_STATUS_SUCCESS)
@@ -2864,7 +2811,8 @@ test_kasumi_encryption(const struct kasumi_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -2885,10 +2833,10 @@ test_kasumi_encryption(const struct kasumi_test_data *tdata)
TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data, tdata->iv.len,
- tdata->plaintext.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_KASUMI_F8);
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
+ RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
+ tdata->validCipherOffsetInBits.len);
if (retval < 0)
return retval;
@@ -2898,17 +2846,18 @@ test_kasumi_encryption(const struct kasumi_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
- ciphertext = plaintext;
+ ciphertext = plaintext + (tdata->validCipherOffsetInBits.len >> 3);
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ const uint8_t *reference_ciphertext = tdata->ciphertext.data +
+ (tdata->validCipherOffsetInBits.len >> 3);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
ciphertext,
- tdata->ciphertext.data,
+ reference_ciphertext,
tdata->validCipherLenInBits.len,
"KASUMI Ciphertext data not as expected");
return 0;
@@ -2941,7 +2890,8 @@ test_kasumi_encryption_sgl(const struct kasumi_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -2958,11 +2908,10 @@ test_kasumi_encryption_sgl(const struct kasumi_test_data *tdata)
pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data,
- tdata->iv.len,
- tdata->plaintext.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_KASUMI_F8);
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
+ RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
+ tdata->validCipherOffsetInBits.len);
if (retval < 0)
return retval;
@@ -2973,22 +2922,25 @@ test_kasumi_encryption_sgl(const struct kasumi_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_read(ut_params->obuf, tdata->iv.len,
+ ciphertext = rte_pktmbuf_read(ut_params->obuf, 0,
plaintext_len, buffer);
else
- ciphertext = rte_pktmbuf_read(ut_params->ibuf, tdata->iv.len,
+ ciphertext = rte_pktmbuf_read(ut_params->ibuf,
+ tdata->validCipherOffsetInBits.len >> 3,
plaintext_len, buffer);
/* Validate obuf */
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
- /* Validate obuf */
- TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
- ciphertext,
- tdata->ciphertext.data,
- tdata->validCipherLenInBits.len,
- "KASUMI Ciphertext data not as expected");
- return 0;
+ const uint8_t *reference_ciphertext = tdata->ciphertext.data +
+ (tdata->validCipherOffsetInBits.len >> 3);
+ /* Validate obuf */
+ TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
+ ciphertext,
+ reference_ciphertext,
+ tdata->validCipherLenInBits.len,
+ "KASUMI Ciphertext data not as expected");
+ return 0;
}
static int
@@ -3006,7 +2958,8 @@ test_kasumi_encryption_oop(const struct kasumi_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3029,11 +2982,10 @@ test_kasumi_encryption_oop(const struct kasumi_test_data *tdata)
TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
- tdata->plaintext.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_KASUMI_F8);
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
+ RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
+ tdata->validCipherOffsetInBits.len);
if (retval < 0)
return retval;
@@ -3043,17 +2995,18 @@ test_kasumi_encryption_oop(const struct kasumi_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
- ciphertext = plaintext;
+ ciphertext = plaintext + (tdata->validCipherOffsetInBits.len >> 3);
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ const uint8_t *reference_ciphertext = tdata->ciphertext.data +
+ (tdata->validCipherOffsetInBits.len >> 3);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
ciphertext,
- tdata->ciphertext.data,
+ reference_ciphertext,
tdata->validCipherLenInBits.len,
"KASUMI Ciphertext data not as expected");
return 0;
@@ -3085,7 +3038,8 @@ test_kasumi_encryption_oop_sgl(const struct kasumi_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3104,11 +3058,10 @@ test_kasumi_encryption_oop_sgl(const struct kasumi_test_data *tdata)
pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
- tdata->plaintext.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_KASUMI_F8);
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
+ RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
+ tdata->validCipherOffsetInBits.len);
if (retval < 0)
return retval;
@@ -3118,16 +3071,19 @@ test_kasumi_encryption_oop_sgl(const struct kasumi_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_read(ut_params->obuf, tdata->iv.len,
+ ciphertext = rte_pktmbuf_read(ut_params->obuf, 0,
plaintext_pad_len, buffer);
else
- ciphertext = rte_pktmbuf_read(ut_params->ibuf, tdata->iv.len,
+ ciphertext = rte_pktmbuf_read(ut_params->ibuf,
+ tdata->validCipherOffsetInBits.len >> 3,
plaintext_pad_len, buffer);
+ const uint8_t *reference_ciphertext = tdata->ciphertext.data +
+ (tdata->validCipherOffsetInBits.len >> 3);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
ciphertext,
- tdata->ciphertext.data,
+ reference_ciphertext,
tdata->validCipherLenInBits.len,
"KASUMI Ciphertext data not as expected");
return 0;
@@ -3149,7 +3105,8 @@ test_kasumi_decryption_oop(const struct kasumi_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_DECRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3172,11 +3129,10 @@ test_kasumi_decryption_oop(const struct kasumi_test_data *tdata)
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
- tdata->ciphertext.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_KASUMI_F8);
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
+ RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
+ tdata->validCipherOffsetInBits.len);
if (retval < 0)
return retval;
@@ -3186,17 +3142,18 @@ test_kasumi_decryption_oop(const struct kasumi_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len;
+ plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
- plaintext = ciphertext;
+ plaintext = ciphertext + (tdata->validCipherOffsetInBits.len >> 3);
TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len);
+ const uint8_t *reference_plaintext = tdata->plaintext.data +
+ (tdata->validCipherOffsetInBits.len >> 3);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
plaintext,
- tdata->plaintext.data,
+ reference_plaintext,
tdata->validCipherLenInBits.len,
"KASUMI Plaintext data not as expected");
return 0;
@@ -3217,7 +3174,8 @@ test_kasumi_decryption(const struct kasumi_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_DECRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3238,11 +3196,10 @@ test_kasumi_decryption(const struct kasumi_test_data *tdata)
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->ciphertext.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_KASUMI_F8);
+ tdata->validCipherOffsetInBits.len);
if (retval < 0)
return retval;
@@ -3252,17 +3209,18 @@ test_kasumi_decryption(const struct kasumi_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len;
+ plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
- plaintext = ciphertext;
+ plaintext = ciphertext + (tdata->validCipherOffsetInBits.len >> 3);
TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len);
+ const uint8_t *reference_plaintext = tdata->plaintext.data +
+ (tdata->validCipherOffsetInBits.len >> 3);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
plaintext,
- tdata->plaintext.data,
+ reference_plaintext,
tdata->validCipherLenInBits.len,
"KASUMI Plaintext data not as expected");
return 0;
@@ -3283,7 +3241,8 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3304,10 +3263,10 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata)
TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data, tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_SNOW3G_UEA2);
+ 0);
if (retval < 0)
return retval;
@@ -3317,8 +3276,7 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
@@ -3349,7 +3307,8 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3377,11 +3336,10 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_SNOW3G_UEA2);
+ 0);
if (retval < 0)
return retval;
@@ -3391,8 +3349,7 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
@@ -3432,7 +3389,8 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3454,11 +3412,10 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata)
pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_SNOW3G_UEA2);
+ 0);
if (retval < 0)
return retval;
@@ -3468,10 +3425,10 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_read(ut_params->obuf, tdata->iv.len,
+ ciphertext = rte_pktmbuf_read(ut_params->obuf, 0,
plaintext_len, buffer);
else
- ciphertext = rte_pktmbuf_read(ut_params->ibuf, tdata->iv.len,
+ ciphertext = rte_pktmbuf_read(ut_params->ibuf, 0,
plaintext_len, buffer);
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
@@ -3522,7 +3479,8 @@ test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3557,12 +3515,10 @@ test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata)
rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len);
#endif
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
- tdata->validCipherOffsetLenInBits.len +
- extra_offset,
- RTE_CRYPTO_CIPHER_SNOW3G_UEA2);
+ extra_offset);
if (retval < 0)
return retval;
@@ -3572,8 +3528,7 @@ test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
@@ -3581,8 +3536,7 @@ test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata)
rte_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
#endif
- expected_ciphertext_shifted = rte_malloc(NULL,
- ceil_byte_length(plaintext_len + extra_offset), 0);
+ expected_ciphertext_shifted = rte_malloc(NULL, plaintext_len, 8);
TEST_ASSERT_NOT_NULL(expected_ciphertext_shifted,
"failed to reserve memory for ciphertext shifted\n");
@@ -3616,7 +3570,8 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_DECRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3637,10 +3592,10 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data, tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_SNOW3G_UEA2);
+ 0);
if (retval < 0)
return retval;
@@ -3649,8 +3604,7 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len;
+ plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
plaintext = ciphertext;
@@ -3679,7 +3633,8 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_DECRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3710,11 +3665,10 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_SNOW3G_UEA2);
+ 0);
if (retval < 0)
return retval;
@@ -3723,8 +3677,7 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len;
+ plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
plaintext = ciphertext;
@@ -3800,8 +3753,7 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len + tdata->aad.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
@@ -3814,7 +3766,7 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
"ZUC Ciphertext data not as expected");
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len + tdata->iv.len;
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -3844,7 +3796,8 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
RTE_CRYPTO_AUTH_SNOW3G_UIA2,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len);
+ tdata->auth_iv.len, tdata->digest.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -3865,16 +3818,14 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
/* Create SNOW 3G operation */
retval = create_wireless_algo_cipher_hash_operation(tdata->digest.data,
- tdata->digest.len, tdata->aad.data,
- tdata->aad.len, /*tdata->plaintext.len,*/
+ tdata->digest.len, tdata->auth_iv.data,
+ tdata->auth_iv.len,
plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_SNOW3G_UIA2,
- RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
- tdata->iv.data, tdata->iv.len,
+ tdata->cipher_iv.data, tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
- tdata->validCipherOffsetLenInBits.len,
+ 0,
tdata->validAuthLenInBits.len,
- tdata->validAuthOffsetLenInBits.len
+ 0
);
if (retval < 0)
return retval;
@@ -3884,8 +3835,7 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len + tdata->aad.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
@@ -3898,7 +3848,7 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
"SNOW 3G Ciphertext data not as expected");
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len + tdata->iv.len;
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -3927,7 +3877,8 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata)
RTE_CRYPTO_AUTH_SNOW3G_UIA2,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len);
+ tdata->auth_iv.len, tdata->digest.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3950,16 +3901,13 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata)
/* Create SNOW 3G operation */
retval = create_wireless_algo_auth_cipher_operation(
tdata->digest.len,
- tdata->iv.data, tdata->iv.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->cipher_iv.data, tdata->cipher_iv.len,
+ tdata->auth_iv.data, tdata->auth_iv.len,
plaintext_pad_len,
tdata->validCipherLenInBits.len,
- tdata->validCipherOffsetLenInBits.len,
+ 0,
tdata->validAuthLenInBits.len,
- tdata->validAuthOffsetLenInBits.len,
- RTE_CRYPTO_AUTH_SNOW3G_UIA2,
- RTE_CRYPTO_CIPHER_SNOW3G_UEA2
- );
+ 0);
if (retval < 0)
return retval;
@@ -3969,13 +3917,12 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->aad.len + tdata->iv.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len + tdata->iv.len;
+ + plaintext_pad_len;
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
/* Validate obuf */
@@ -4014,7 +3961,8 @@ test_kasumi_auth_cipher(const struct kasumi_test_data *tdata)
RTE_CRYPTO_AUTH_KASUMI_F9,
RTE_CRYPTO_CIPHER_KASUMI_F8,
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len);
+ 0, tdata->digest.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -4035,15 +3983,13 @@ test_kasumi_auth_cipher(const struct kasumi_test_data *tdata)
/* Create KASUMI operation */
retval = create_wireless_algo_auth_cipher_operation(tdata->digest.len,
- tdata->iv.data, tdata->iv.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->cipher_iv.data, tdata->cipher_iv.len,
+ NULL, 0,
plaintext_pad_len,
tdata->validCipherLenInBits.len,
- tdata->validCipherOffsetLenInBits.len,
+ tdata->validCipherOffsetInBits.len,
tdata->validAuthLenInBits.len,
- tdata->validAuthOffsetLenInBits.len,
- RTE_CRYPTO_AUTH_KASUMI_F9,
- RTE_CRYPTO_CIPHER_KASUMI_F8
+ 0
);
if (retval < 0)
@@ -4052,21 +3998,24 @@ test_kasumi_auth_cipher(const struct kasumi_test_data *tdata)
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
- ut_params->obuf = ut_params->op->sym->m_src;
- if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len + tdata->aad.len;
+ if (ut_params->op->sym->m_dst)
+ ut_params->obuf = ut_params->op->sym->m_dst;
else
- ciphertext = plaintext;
+ ut_params->obuf = ut_params->op->sym->m_src;
+
+ ciphertext = rte_pktmbuf_mtod_offset(ut_params->obuf, uint8_t *,
+ tdata->validCipherOffsetInBits.len >> 3);
+ const uint8_t *reference_ciphertext = tdata->ciphertext.data +
+ (tdata->validCipherOffsetInBits.len >> 3);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
ciphertext,
- tdata->ciphertext.data,
+ reference_ciphertext,
tdata->validCipherLenInBits.len,
"KASUMI Ciphertext data not as expected");
- ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len + tdata->iv.len;
+ ut_params->digest = rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *)
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -4097,7 +4046,8 @@ test_kasumi_cipher_auth(const struct kasumi_test_data *tdata)
RTE_CRYPTO_AUTH_KASUMI_F9,
RTE_CRYPTO_CIPHER_KASUMI_F8,
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len);
+ 0, tdata->digest.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -4119,16 +4069,13 @@ test_kasumi_cipher_auth(const struct kasumi_test_data *tdata)
/* Create KASUMI operation */
retval = create_wireless_algo_cipher_hash_operation(tdata->digest.data,
- tdata->digest.len, tdata->aad.data,
- tdata->aad.len,
+ tdata->digest.len, NULL, 0,
plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_KASUMI_F9,
- RTE_CRYPTO_CIPHER_KASUMI_F8,
- tdata->iv.data, tdata->iv.len,
- tdata->validCipherLenInBits.len,
- tdata->validCipherOffsetLenInBits.len,
+ tdata->cipher_iv.data, tdata->cipher_iv.len,
+ RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
+ tdata->validCipherOffsetInBits.len,
tdata->validAuthLenInBits.len,
- tdata->validAuthOffsetLenInBits.len
+ 0
);
if (retval < 0)
return retval;
@@ -4136,20 +4083,24 @@ test_kasumi_cipher_auth(const struct kasumi_test_data *tdata)
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
- ut_params->obuf = ut_params->op->sym->m_src;
- if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->aad.len + tdata->iv.len;
+
+ if (ut_params->op->sym->m_dst)
+ ut_params->obuf = ut_params->op->sym->m_dst;
else
- ciphertext = plaintext;
+ ut_params->obuf = ut_params->op->sym->m_src;
+
+ ciphertext = rte_pktmbuf_mtod_offset(ut_params->obuf, uint8_t *,
+ tdata->validCipherOffsetInBits.len >> 3);
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len + tdata->iv.len;
+ + plaintext_pad_len;
+ const uint8_t *reference_ciphertext = tdata->ciphertext.data +
+ (tdata->validCipherOffsetInBits.len >> 3);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
ciphertext,
- tdata->ciphertext.data,
+ reference_ciphertext,
tdata->validCipherLenInBits.len,
"KASUMI Ciphertext data not as expected");
@@ -4187,7 +4138,8 @@ test_zuc_encryption(const struct wireless_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_ZUC_EEA3,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -4208,10 +4160,10 @@ test_zuc_encryption(const struct wireless_test_data *tdata)
TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
/* Create ZUC operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data, tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->plaintext.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_ZUC_EEA3);
+ 0);
if (retval < 0)
return retval;
@@ -4221,8 +4173,7 @@ test_zuc_encryption(const struct wireless_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->iv.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
@@ -4284,7 +4235,8 @@ test_zuc_encryption_sgl(const struct wireless_test_data *tdata)
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_ZUC_EEA3,
- tdata->key.data, tdata->key.len);
+ tdata->key.data, tdata->key.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -4293,10 +4245,9 @@ test_zuc_encryption_sgl(const struct wireless_test_data *tdata)
pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
/* Create ZUC operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data,
- tdata->iv.len, tdata->plaintext.len,
- tdata->validCipherOffsetLenInBits.len,
- RTE_CRYPTO_CIPHER_ZUC_EEA3);
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len, tdata->plaintext.len,
+ 0);
if (retval < 0)
return retval;
@@ -4307,10 +4258,10 @@ test_zuc_encryption_sgl(const struct wireless_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
ciphertext = rte_pktmbuf_read(ut_params->obuf,
- tdata->iv.len, plaintext_len, ciphertext_buffer);
+ 0, plaintext_len, ciphertext_buffer);
else
ciphertext = rte_pktmbuf_read(ut_params->ibuf,
- tdata->iv.len, plaintext_len, ciphertext_buffer);
+ 0, plaintext_len, ciphertext_buffer);
/* Validate obuf */
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
@@ -4349,7 +4300,7 @@ test_zuc_authentication(const struct wireless_test_data *tdata)
/* Create ZUC session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
+ tdata->auth_iv.len, tdata->digest.len,
RTE_CRYPTO_AUTH_OP_GENERATE,
RTE_CRYPTO_AUTH_ZUC_EIA3);
if (retval < 0)
@@ -4371,11 +4322,10 @@ test_zuc_authentication(const struct wireless_test_data *tdata)
/* Create ZUC operation */
retval = create_wireless_algo_hash_operation(NULL, tdata->digest.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->auth_iv.data, tdata->auth_iv.len,
plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_ZUC_EIA3,
tdata->validAuthLenInBits.len,
- tdata->validAuthOffsetLenInBits.len);
+ 0);
if (retval < 0)
return retval;
@@ -4384,7 +4334,7 @@ test_zuc_authentication(const struct wireless_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_src;
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + ALIGN_POW2_ROUNDUP(tdata->aad.len, 8);
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -4690,8 +4640,11 @@ test_3DES_chain_qat_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_QAT_SYM_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
BLKCIPHER_3DES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -4706,8 +4659,11 @@ test_DES_cipheronly_qat_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_QAT_SYM_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
BLKCIPHER_DES_CIPHERONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -4722,8 +4678,11 @@ test_DES_docsis_openssl_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_OPENSSL_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
BLKCIPHER_DES_DOCSIS_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -4738,8 +4697,11 @@ test_3DES_chain_dpaa2_sec_all(void)
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,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
BLKCIPHER_3DES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -4754,8 +4716,11 @@ test_3DES_cipheronly_dpaa2_sec_all(void)
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,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
BLKCIPHER_3DES_CIPHERONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -4770,8 +4735,11 @@ test_3DES_cipheronly_qat_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_QAT_SYM_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
BLKCIPHER_3DES_CIPHERONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -4786,8 +4754,11 @@ test_3DES_chain_openssl_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_OPENSSL_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
BLKCIPHER_3DES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -4802,8 +4773,11 @@ test_3DES_cipheronly_openssl_all(void)
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
- ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_OPENSSL_PMD,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
BLKCIPHER_3DES_CIPHERONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
@@ -4814,51 +4788,38 @@ test_3DES_cipheronly_openssl_all(void)
/* ***** AES-GCM Tests ***** */
static int
-create_gcm_session(uint8_t dev_id, enum rte_crypto_cipher_operation op,
+create_gcm_session(uint8_t dev_id, enum rte_crypto_aead_operation op,
const uint8_t *key, const uint8_t key_len,
- const uint8_t aad_len, const uint8_t auth_len,
- enum rte_crypto_auth_operation auth_op)
+ const uint16_t aad_len, const uint8_t auth_len,
+ uint8_t iv_len)
{
- uint8_t cipher_key[key_len];
+ uint8_t aead_key[key_len];
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- memcpy(cipher_key, key, key_len);
+ memcpy(aead_key, key, key_len);
- /* Setup Cipher Parameters */
- ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- ut_params->cipher_xform.next = NULL;
-
- ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_GCM;
- ut_params->auth_xform.auth.op = auth_op;
- ut_params->cipher_xform.cipher.op = op;
- ut_params->cipher_xform.cipher.key.data = cipher_key;
- ut_params->cipher_xform.cipher.key.length = key_len;
+ /* Setup AEAD Parameters */
+ ut_params->aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
+ ut_params->aead_xform.next = NULL;
+ ut_params->aead_xform.aead.algo = RTE_CRYPTO_AEAD_AES_GCM;
+ ut_params->aead_xform.aead.op = op;
+ ut_params->aead_xform.aead.key.data = aead_key;
+ ut_params->aead_xform.aead.key.length = key_len;
+ ut_params->aead_xform.aead.iv.offset = IV_OFFSET;
+ ut_params->aead_xform.aead.iv.length = iv_len;
+ ut_params->aead_xform.aead.digest_length = auth_len;
+ ut_params->aead_xform.aead.aad_length = aad_len;
TEST_HEXDUMP(stdout, "key:", key, key_len);
- /* Setup Authentication Parameters */
- ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- ut_params->auth_xform.next = NULL;
-
- ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_AES_GCM;
-
- ut_params->auth_xform.auth.digest_length = auth_len;
- ut_params->auth_xform.auth.add_auth_data_length = aad_len;
- ut_params->auth_xform.auth.key.length = 0;
- ut_params->auth_xform.auth.key.data = NULL;
-
- if (op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
- ut_params->cipher_xform.next = &ut_params->auth_xform;
+ /* Create Crypto session*/
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->session_mpool);
- /* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
- &ut_params->cipher_xform);
- } else {/* Create Crypto session*/
- ut_params->auth_xform.next = &ut_params->cipher_xform;
- ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
- &ut_params->auth_xform);
- }
+ rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ &ut_params->aead_xform, ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
@@ -4867,47 +4828,42 @@ create_gcm_session(uint8_t dev_id, enum rte_crypto_cipher_operation op,
static int
create_gcm_xforms(struct rte_crypto_op *op,
- enum rte_crypto_cipher_operation cipher_op,
+ enum rte_crypto_aead_operation aead_op,
uint8_t *key, const uint8_t key_len,
const uint8_t aad_len, const uint8_t auth_len,
- enum rte_crypto_auth_operation auth_op)
+ uint8_t iv_len)
{
- TEST_ASSERT_NOT_NULL(rte_crypto_op_sym_xforms_alloc(op, 2),
- "failed to allocate space for crypto transforms");
+ TEST_ASSERT_NOT_NULL(rte_crypto_op_sym_xforms_alloc(op, 1),
+ "failed to allocate space for crypto transform");
struct rte_crypto_sym_op *sym_op = op->sym;
- /* Setup Cipher Parameters */
- sym_op->xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- sym_op->xform->cipher.algo = RTE_CRYPTO_CIPHER_AES_GCM;
- sym_op->xform->cipher.op = cipher_op;
- sym_op->xform->cipher.key.data = key;
- sym_op->xform->cipher.key.length = key_len;
+ /* Setup AEAD Parameters */
+ sym_op->xform->type = RTE_CRYPTO_SYM_XFORM_AEAD;
+ sym_op->xform->next = NULL;
+ sym_op->xform->aead.algo = RTE_CRYPTO_AEAD_AES_GCM;
+ sym_op->xform->aead.op = aead_op;
+ sym_op->xform->aead.key.data = key;
+ sym_op->xform->aead.key.length = key_len;
+ sym_op->xform->aead.iv.offset = IV_OFFSET;
+ sym_op->xform->aead.iv.length = iv_len;
+ sym_op->xform->aead.digest_length = auth_len;
+ sym_op->xform->aead.aad_length = aad_len;
TEST_HEXDUMP(stdout, "key:", key, key_len);
- /* Setup Authentication Parameters */
- sym_op->xform->next->type = RTE_CRYPTO_SYM_XFORM_AUTH;
- sym_op->xform->next->auth.algo = RTE_CRYPTO_AUTH_AES_GCM;
- sym_op->xform->next->auth.op = auth_op;
- sym_op->xform->next->auth.digest_length = auth_len;
- sym_op->xform->next->auth.add_auth_data_length = aad_len;
- sym_op->xform->next->auth.key.length = 0;
- sym_op->xform->next->auth.key.data = NULL;
- sym_op->xform->next->next = NULL;
-
return 0;
}
static int
-create_gcm_operation(enum rte_crypto_cipher_operation op,
+create_gcm_operation(enum rte_crypto_aead_operation op,
const struct gcm_test_data *tdata)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
uint8_t *plaintext, *ciphertext;
- unsigned int iv_pad_len, aad_pad_len, plaintext_pad_len;
+ unsigned int aad_pad_len, plaintext_pad_len;
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -4919,34 +4875,27 @@ create_gcm_operation(enum rte_crypto_cipher_operation op,
/* Append aad data */
aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len, 16);
- sym_op->auth.aad.data = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+ sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
aad_pad_len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
+ TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data,
"no room to append aad");
- sym_op->auth.aad.length = tdata->aad.len;
- sym_op->auth.aad.phys_addr =
+ sym_op->aead.aad.phys_addr =
rte_pktmbuf_mtophys(ut_params->ibuf);
- memcpy(sym_op->auth.aad.data, tdata->aad.data, tdata->aad.len);
- TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data,
- sym_op->auth.aad.length);
+ memcpy(sym_op->aead.aad.data, tdata->aad.data, tdata->aad.len);
+ TEST_HEXDUMP(stdout, "aad:", sym_op->aead.aad.data,
+ tdata->aad.len);
- /* Prepend iv */
- iv_pad_len = RTE_ALIGN_CEIL(tdata->iv.len, 16);
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, iv_pad_len);
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
+ /* Append IV at the end of the crypto operation*/
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op,
+ uint8_t *, IV_OFFSET);
- memset(sym_op->cipher.iv.data, 0, iv_pad_len);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = tdata->iv.len;
-
- rte_memcpy(sym_op->cipher.iv.data, tdata->iv.data, tdata->iv.len);
- TEST_HEXDUMP(stdout, "iv:", sym_op->cipher.iv.data,
- sym_op->cipher.iv.length);
+ rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len);
+ TEST_HEXDUMP(stdout, "iv:", iv_ptr,
+ tdata->iv.len);
/* Append plaintext/ciphertext */
- if (op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
+ if (op == RTE_CRYPTO_AEAD_OP_ENCRYPT) {
plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
plaintext_pad_len);
@@ -4959,12 +4908,11 @@ create_gcm_operation(enum rte_crypto_cipher_operation op,
if (ut_params->obuf) {
ciphertext = (uint8_t *)rte_pktmbuf_append(
ut_params->obuf,
- plaintext_pad_len + aad_pad_len +
- iv_pad_len);
+ plaintext_pad_len + aad_pad_len);
TEST_ASSERT_NOT_NULL(ciphertext,
"no room to append ciphertext");
- memset(ciphertext + aad_pad_len + iv_pad_len, 0,
+ memset(ciphertext + aad_pad_len, 0,
tdata->ciphertext.len);
}
} else {
@@ -4982,59 +4930,53 @@ create_gcm_operation(enum rte_crypto_cipher_operation op,
if (ut_params->obuf) {
plaintext = (uint8_t *)rte_pktmbuf_append(
ut_params->obuf,
- plaintext_pad_len + aad_pad_len +
- iv_pad_len);
+ plaintext_pad_len + aad_pad_len);
TEST_ASSERT_NOT_NULL(plaintext,
"no room to append plaintext");
- memset(plaintext + aad_pad_len + iv_pad_len, 0,
+ memset(plaintext + aad_pad_len, 0,
tdata->plaintext.len);
}
}
/* Append digest data */
- if (op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
- sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
+ if (op == RTE_CRYPTO_AEAD_OP_ENCRYPT) {
+ sym_op->aead.digest.data = (uint8_t *)rte_pktmbuf_append(
ut_params->obuf ? ut_params->obuf :
ut_params->ibuf,
tdata->auth_tag.len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
+ TEST_ASSERT_NOT_NULL(sym_op->aead.digest.data,
"no room to append digest");
- memset(sym_op->auth.digest.data, 0, tdata->auth_tag.len);
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ memset(sym_op->aead.digest.data, 0, tdata->auth_tag.len);
+ sym_op->aead.digest.phys_addr = rte_pktmbuf_mtophys_offset(
ut_params->obuf ? ut_params->obuf :
ut_params->ibuf,
plaintext_pad_len +
- aad_pad_len + iv_pad_len);
- sym_op->auth.digest.length = tdata->auth_tag.len;
+ aad_pad_len);
} else {
- sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
+ sym_op->aead.digest.data = (uint8_t *)rte_pktmbuf_append(
ut_params->ibuf, tdata->auth_tag.len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
+ TEST_ASSERT_NOT_NULL(sym_op->aead.digest.data,
"no room to append digest");
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->aead.digest.phys_addr = rte_pktmbuf_mtophys_offset(
ut_params->ibuf,
- plaintext_pad_len + aad_pad_len + iv_pad_len);
- sym_op->auth.digest.length = tdata->auth_tag.len;
+ plaintext_pad_len + aad_pad_len);
- rte_memcpy(sym_op->auth.digest.data, tdata->auth_tag.data,
+ rte_memcpy(sym_op->aead.digest.data, tdata->auth_tag.data,
tdata->auth_tag.len);
TEST_HEXDUMP(stdout, "digest:",
- sym_op->auth.digest.data,
- sym_op->auth.digest.length);
+ sym_op->aead.digest.data,
+ tdata->auth_tag.len);
}
- sym_op->cipher.data.length = tdata->plaintext.len;
- sym_op->cipher.data.offset = aad_pad_len + iv_pad_len;
-
- sym_op->auth.data.length = tdata->plaintext.len;
- sym_op->auth.data.offset = aad_pad_len + iv_pad_len;
+ sym_op->aead.data.length = tdata->plaintext.len;
+ sym_op->aead.data.offset = aad_pad_len;
return 0;
}
static int
-test_mb_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata)
+test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -5046,10 +4988,10 @@ test_mb_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata)
/* Create GCM session */
retval = create_gcm_session(ts_params->valid_devs[0],
- RTE_CRYPTO_CIPHER_OP_ENCRYPT,
+ RTE_CRYPTO_AEAD_OP_ENCRYPT,
tdata->key.data, tdata->key.len,
tdata->aad.len, tdata->auth_tag.len,
- RTE_CRYPTO_AUTH_OP_GENERATE);
+ tdata->iv.len);
if (retval < 0)
return retval;
@@ -5066,7 +5008,7 @@ test_mb_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata)
rte_pktmbuf_tailroom(ut_params->ibuf));
/* Create GCM operation */
- retval = create_gcm_operation(RTE_CRYPTO_CIPHER_OP_ENCRYPT, tdata);
+ retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata);
if (retval < 0)
return retval;
@@ -5116,103 +5058,145 @@ test_mb_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata)
}
static int
-test_mb_AES_GCM_authenticated_encryption_test_case_1(void)
+test_AES_GCM_authenticated_encryption_test_case_1(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_1);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_1);
}
static int
-test_mb_AES_GCM_authenticated_encryption_test_case_2(void)
+test_AES_GCM_authenticated_encryption_test_case_2(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_2);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_2);
}
static int
-test_mb_AES_GCM_authenticated_encryption_test_case_3(void)
+test_AES_GCM_authenticated_encryption_test_case_3(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_3);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_3);
}
static int
-test_mb_AES_GCM_authenticated_encryption_test_case_4(void)
+test_AES_GCM_authenticated_encryption_test_case_4(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_4);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_4);
}
static int
-test_mb_AES_GCM_authenticated_encryption_test_case_5(void)
+test_AES_GCM_authenticated_encryption_test_case_5(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_5);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_5);
}
static int
-test_mb_AES_GCM_authenticated_encryption_test_case_6(void)
+test_AES_GCM_authenticated_encryption_test_case_6(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_6);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_6);
}
static int
-test_mb_AES_GCM_authenticated_encryption_test_case_7(void)
+test_AES_GCM_authenticated_encryption_test_case_7(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_7);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_7);
}
static int
-test_mb_AES_GCM_auth_encryption_test_case_256_1(void)
+test_AES_GCM_auth_encryption_test_case_192_1(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_256_1);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_1);
}
static int
-test_mb_AES_GCM_auth_encryption_test_case_256_2(void)
+test_AES_GCM_auth_encryption_test_case_192_2(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_256_2);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_2);
}
static int
-test_mb_AES_GCM_auth_encryption_test_case_256_3(void)
+test_AES_GCM_auth_encryption_test_case_192_3(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_256_3);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_3);
}
static int
-test_mb_AES_GCM_auth_encryption_test_case_256_4(void)
+test_AES_GCM_auth_encryption_test_case_192_4(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_256_4);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_4);
}
static int
-test_mb_AES_GCM_auth_encryption_test_case_256_5(void)
+test_AES_GCM_auth_encryption_test_case_192_5(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_256_5);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_5);
}
static int
-test_mb_AES_GCM_auth_encryption_test_case_256_6(void)
+test_AES_GCM_auth_encryption_test_case_192_6(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_256_6);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_6);
}
static int
-test_mb_AES_GCM_auth_encryption_test_case_256_7(void)
+test_AES_GCM_auth_encryption_test_case_192_7(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_256_7);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_7);
}
static int
-test_mb_AES_GCM_auth_encryption_test_case_aad_1(void)
+test_AES_GCM_auth_encryption_test_case_256_1(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_aad_1);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_1);
}
static int
-test_mb_AES_GCM_auth_encryption_test_case_aad_2(void)
+test_AES_GCM_auth_encryption_test_case_256_2(void)
{
- return test_mb_AES_GCM_authenticated_encryption(&gcm_test_case_aad_2);
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_2);
}
static int
-test_mb_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata)
+test_AES_GCM_auth_encryption_test_case_256_3(void)
+{
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_3);
+}
+
+static int
+test_AES_GCM_auth_encryption_test_case_256_4(void)
+{
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_4);
+}
+
+static int
+test_AES_GCM_auth_encryption_test_case_256_5(void)
+{
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_5);
+}
+
+static int
+test_AES_GCM_auth_encryption_test_case_256_6(void)
+{
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_6);
+}
+
+static int
+test_AES_GCM_auth_encryption_test_case_256_7(void)
+{
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_7);
+}
+
+static int
+test_AES_GCM_auth_encryption_test_case_aad_1(void)
+{
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_aad_1);
+}
+
+static int
+test_AES_GCM_auth_encryption_test_case_aad_2(void)
+{
+ return test_AES_GCM_authenticated_encryption(&gcm_test_case_aad_2);
+}
+
+static int
+test_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -5223,10 +5207,10 @@ test_mb_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata)
/* Create GCM session */
retval = create_gcm_session(ts_params->valid_devs[0],
- RTE_CRYPTO_CIPHER_OP_DECRYPT,
+ RTE_CRYPTO_AEAD_OP_DECRYPT,
tdata->key.data, tdata->key.len,
tdata->aad.len, tdata->auth_tag.len,
- RTE_CRYPTO_AUTH_OP_VERIFY);
+ tdata->iv.len);
if (retval < 0)
return retval;
@@ -5243,7 +5227,7 @@ test_mb_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata)
rte_pktmbuf_tailroom(ut_params->ibuf));
/* Create GCM operation */
- retval = create_gcm_operation(RTE_CRYPTO_CIPHER_OP_DECRYPT, tdata);
+ retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata);
if (retval < 0)
return retval;
@@ -5282,99 +5266,141 @@ test_mb_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata)
}
static int
-test_mb_AES_GCM_authenticated_decryption_test_case_1(void)
+test_AES_GCM_authenticated_decryption_test_case_1(void)
+{
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_1);
+}
+
+static int
+test_AES_GCM_authenticated_decryption_test_case_2(void)
+{
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_2);
+}
+
+static int
+test_AES_GCM_authenticated_decryption_test_case_3(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_1);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_3);
}
static int
-test_mb_AES_GCM_authenticated_decryption_test_case_2(void)
+test_AES_GCM_authenticated_decryption_test_case_4(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_2);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_4);
}
static int
-test_mb_AES_GCM_authenticated_decryption_test_case_3(void)
+test_AES_GCM_authenticated_decryption_test_case_5(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_3);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_5);
}
static int
-test_mb_AES_GCM_authenticated_decryption_test_case_4(void)
+test_AES_GCM_authenticated_decryption_test_case_6(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_4);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_6);
}
static int
-test_mb_AES_GCM_authenticated_decryption_test_case_5(void)
+test_AES_GCM_authenticated_decryption_test_case_7(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_5);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_7);
}
static int
-test_mb_AES_GCM_authenticated_decryption_test_case_6(void)
+test_AES_GCM_auth_decryption_test_case_192_1(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_6);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_1);
}
static int
-test_mb_AES_GCM_authenticated_decryption_test_case_7(void)
+test_AES_GCM_auth_decryption_test_case_192_2(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_7);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_2);
}
static int
-test_mb_AES_GCM_auth_decryption_test_case_256_1(void)
+test_AES_GCM_auth_decryption_test_case_192_3(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_256_1);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_3);
}
static int
-test_mb_AES_GCM_auth_decryption_test_case_256_2(void)
+test_AES_GCM_auth_decryption_test_case_192_4(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_256_2);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_4);
}
static int
-test_mb_AES_GCM_auth_decryption_test_case_256_3(void)
+test_AES_GCM_auth_decryption_test_case_192_5(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_256_3);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_5);
}
static int
-test_mb_AES_GCM_auth_decryption_test_case_256_4(void)
+test_AES_GCM_auth_decryption_test_case_192_6(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_256_4);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_6);
}
static int
-test_mb_AES_GCM_auth_decryption_test_case_256_5(void)
+test_AES_GCM_auth_decryption_test_case_192_7(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_256_5);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_7);
}
static int
-test_mb_AES_GCM_auth_decryption_test_case_256_6(void)
+test_AES_GCM_auth_decryption_test_case_256_1(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_256_6);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_1);
}
static int
-test_mb_AES_GCM_auth_decryption_test_case_256_7(void)
+test_AES_GCM_auth_decryption_test_case_256_2(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_256_7);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_2);
}
static int
-test_mb_AES_GCM_auth_decryption_test_case_aad_1(void)
+test_AES_GCM_auth_decryption_test_case_256_3(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_aad_1);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_3);
}
static int
-test_mb_AES_GCM_auth_decryption_test_case_aad_2(void)
+test_AES_GCM_auth_decryption_test_case_256_4(void)
{
- return test_mb_AES_GCM_authenticated_decryption(&gcm_test_case_aad_2);
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_4);
+}
+
+static int
+test_AES_GCM_auth_decryption_test_case_256_5(void)
+{
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_5);
+}
+
+static int
+test_AES_GCM_auth_decryption_test_case_256_6(void)
+{
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_6);
+}
+
+static int
+test_AES_GCM_auth_decryption_test_case_256_7(void)
+{
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_7);
+}
+
+static int
+test_AES_GCM_auth_decryption_test_case_aad_1(void)
+{
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_aad_1);
+}
+
+static int
+test_AES_GCM_auth_decryption_test_case_aad_2(void)
+{
+ return test_AES_GCM_authenticated_decryption(&gcm_test_case_aad_2);
}
static int
@@ -5389,10 +5415,10 @@ test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata)
/* Create GCM session */
retval = create_gcm_session(ts_params->valid_devs[0],
- RTE_CRYPTO_CIPHER_OP_ENCRYPT,
+ RTE_CRYPTO_AEAD_OP_ENCRYPT,
tdata->key.data, tdata->key.len,
tdata->aad.len, tdata->auth_tag.len,
- RTE_CRYPTO_AUTH_OP_GENERATE);
+ tdata->iv.len);
if (retval < 0)
return retval;
@@ -5406,7 +5432,7 @@ test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata)
rte_pktmbuf_tailroom(ut_params->obuf));
/* Create GCM operation */
- retval = create_gcm_operation(RTE_CRYPTO_CIPHER_OP_ENCRYPT, tdata);
+ retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata);
if (retval < 0)
return retval;
@@ -5449,7 +5475,7 @@ test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata)
}
static int
-test_mb_AES_GCM_authenticated_encryption_oop(void)
+test_AES_GCM_authenticated_encryption_oop_test_case_1(void)
{
return test_AES_GCM_authenticated_encryption_oop(&gcm_test_case_5);
}
@@ -5465,10 +5491,10 @@ test_AES_GCM_authenticated_decryption_oop(const struct gcm_test_data *tdata)
/* Create GCM session */
retval = create_gcm_session(ts_params->valid_devs[0],
- RTE_CRYPTO_CIPHER_OP_DECRYPT,
+ RTE_CRYPTO_AEAD_OP_DECRYPT,
tdata->key.data, tdata->key.len,
tdata->aad.len, tdata->auth_tag.len,
- RTE_CRYPTO_AUTH_OP_VERIFY);
+ tdata->iv.len);
if (retval < 0)
return retval;
@@ -5482,7 +5508,7 @@ test_AES_GCM_authenticated_decryption_oop(const struct gcm_test_data *tdata)
rte_pktmbuf_tailroom(ut_params->obuf));
/* Create GCM operation */
- retval = create_gcm_operation(RTE_CRYPTO_CIPHER_OP_DECRYPT, tdata);
+ retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata);
if (retval < 0)
return retval;
@@ -5517,7 +5543,7 @@ test_AES_GCM_authenticated_decryption_oop(const struct gcm_test_data *tdata)
}
static int
-test_mb_AES_GCM_authenticated_decryption_oop(void)
+test_AES_GCM_authenticated_decryption_oop_test_case_1(void)
{
return test_AES_GCM_authenticated_decryption_oop(&gcm_test_case_5);
}
@@ -5541,24 +5567,24 @@ test_AES_GCM_authenticated_encryption_sessionless(
rte_pktmbuf_tailroom(ut_params->ibuf));
/* Create GCM operation */
- retval = create_gcm_operation(RTE_CRYPTO_CIPHER_OP_ENCRYPT, tdata);
+ retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata);
if (retval < 0)
return retval;
/* Create GCM xforms */
memcpy(key, tdata->key.data, tdata->key.len);
retval = create_gcm_xforms(ut_params->op,
- RTE_CRYPTO_CIPHER_OP_ENCRYPT,
+ RTE_CRYPTO_AEAD_OP_ENCRYPT,
key, tdata->key.len,
tdata->aad.len, tdata->auth_tag.len,
- RTE_CRYPTO_AUTH_OP_GENERATE);
+ tdata->iv.len);
if (retval < 0)
return retval;
ut_params->op->sym->m_src = ut_params->ibuf;
- TEST_ASSERT_EQUAL(ut_params->op->sym->sess_type,
- RTE_CRYPTO_SYM_OP_SESSIONLESS,
+ TEST_ASSERT_EQUAL(ut_params->op->sess_type,
+ RTE_CRYPTO_OP_SESSIONLESS,
"crypto op session type not sessionless");
/* Process crypto operation */
@@ -5597,7 +5623,7 @@ test_AES_GCM_authenticated_encryption_sessionless(
}
static int
-test_mb_AES_GCM_authenticated_encryption_sessionless(void)
+test_AES_GCM_authenticated_encryption_sessionless_test_case_1(void)
{
return test_AES_GCM_authenticated_encryption_sessionless(
&gcm_test_case_5);
@@ -5621,24 +5647,24 @@ test_AES_GCM_authenticated_decryption_sessionless(
rte_pktmbuf_tailroom(ut_params->ibuf));
/* Create GCM operation */
- retval = create_gcm_operation(RTE_CRYPTO_CIPHER_OP_DECRYPT, tdata);
+ retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata);
if (retval < 0)
return retval;
/* Create GCM xforms */
memcpy(key, tdata->key.data, tdata->key.len);
retval = create_gcm_xforms(ut_params->op,
- RTE_CRYPTO_CIPHER_OP_DECRYPT,
+ RTE_CRYPTO_AEAD_OP_DECRYPT,
key, tdata->key.len,
tdata->aad.len, tdata->auth_tag.len,
- RTE_CRYPTO_AUTH_OP_VERIFY);
+ tdata->iv.len);
if (retval < 0)
return retval;
ut_params->op->sym->m_src = ut_params->ibuf;
- TEST_ASSERT_EQUAL(ut_params->op->sym->sess_type,
- RTE_CRYPTO_SYM_OP_SESSIONLESS,
+ TEST_ASSERT_EQUAL(ut_params->op->sess_type,
+ RTE_CRYPTO_OP_SESSIONLESS,
"crypto op session type not sessionless");
/* Process crypto operation */
@@ -5669,7 +5695,7 @@ test_AES_GCM_authenticated_decryption_sessionless(
}
static int
-test_mb_AES_GCM_authenticated_decryption_sessionless(void)
+test_AES_GCM_authenticated_decryption_sessionless_test_case_1(void)
{
return test_AES_GCM_authenticated_decryption_sessionless(
&gcm_test_case_5);
@@ -5750,12 +5776,15 @@ static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_MD5_HMAC;
ut_params->auth_xform.auth.digest_length = MD5_DIGEST_LEN;
- ut_params->auth_xform.auth.add_auth_data_length = 0;
ut_params->auth_xform.auth.key.length = test_case->key.len;
ut_params->auth_xform.auth.key.data = key;
ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->valid_devs[0], &ut_params->auth_xform);
+ ts_params->session_mpool);
+
+ rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ ut_params->sess, &ut_params->auth_xform,
+ ts_params->session_mpool);
if (ut_params->sess == NULL)
return TEST_FAILED;
@@ -5790,7 +5819,6 @@ static int MD5_HMAC_create_op(struct crypto_unittest_params *ut_params,
"no room to append digest");
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
ut_params->ibuf, plaintext_pad_len);
- sym_op->auth.digest.length = MD5_DIGEST_LEN;
if (ut_params->auth_xform.auth.op == RTE_CRYPTO_AUTH_OP_VERIFY) {
rte_memcpy(sym_op->auth.digest.data, test_case->auth_tag.data,
@@ -5931,9 +5959,13 @@ test_multi_session(void)
/* Create multiple crypto sessions*/
for (i = 0; i < dev_info.sym.max_nb_sessions; i++) {
+
sessions[i] = rte_cryptodev_sym_session_create(
- ts_params->valid_devs[0],
- &ut_params->auth_xform);
+ ts_params->session_mpool);
+
+ rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ sessions[i], &ut_params->auth_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(sessions[i],
"Session creation failed at session number %u",
i);
@@ -5969,14 +6001,17 @@ test_multi_session(void)
}
/* Next session create should fail */
- sessions[i] = rte_cryptodev_sym_session_create(ts_params->valid_devs[0],
- &ut_params->auth_xform);
+ rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ sessions[i], &ut_params->auth_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NULL(sessions[i],
"Session creation succeeded unexpectedly!");
- for (i = 0; i < dev_info.sym.max_nb_sessions; i++)
- rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
+ for (i = 0; i < dev_info.sym.max_nb_sessions; i++) {
+ rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
sessions[i]);
+ rte_cryptodev_sym_session_free(sessions[i]);
+ }
rte_free(sessions);
@@ -6034,6 +6069,9 @@ test_multi_session_random_usage(void)
* dev_info.sym.max_nb_sessions) + 1, 0);
for (i = 0; i < MB_SESSION_NUMBER; i++) {
+ sessions[i] = rte_cryptodev_sym_session_create(
+ ts_params->session_mpool);
+
rte_memcpy(&ut_paramz[i].ut_params, &testsuite_params,
sizeof(struct crypto_unittest_params));
@@ -6042,9 +6080,11 @@ test_multi_session_random_usage(void)
ut_paramz[i].cipher_key, ut_paramz[i].hmac_key);
/* Create multiple crypto sessions*/
- sessions[i] = rte_cryptodev_sym_session_create(
+ rte_cryptodev_sym_session_init(
ts_params->valid_devs[0],
- &ut_paramz[i].ut_params.auth_xform);
+ sessions[i],
+ &ut_paramz[i].ut_params.auth_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(sessions[i],
"Session creation failed at session number %u",
@@ -6087,9 +6127,11 @@ test_multi_session_random_usage(void)
}
}
- for (i = 0; i < MB_SESSION_NUMBER; i++)
- rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
+ for (i = 0; i < MB_SESSION_NUMBER; i++) {
+ rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
sessions[i]);
+ rte_cryptodev_sym_session_free(sessions[i]);
+ }
rte_free(sessions);
@@ -6113,9 +6155,14 @@ test_null_cipher_only_operation(void)
ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
- /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->valid_devs[0], &ut_params->cipher_xform);
+ ts_params->session_mpool);
+
+ /* Create Crypto session*/
+ rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ ut_params->sess,
+ &ut_params->cipher_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
/* Generate Crypto op data structure */
@@ -6170,9 +6217,13 @@ test_null_auth_only_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->valid_devs[0], &ut_params->auth_xform);
+ ts_params->session_mpool);
+
+ /* Create Crypto session*/
+ rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ ut_params->sess, &ut_params->auth_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
/* Generate Crypto op data structure */
@@ -6226,9 +6277,13 @@ test_null_cipher_auth_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->valid_devs[0], &ut_params->cipher_xform);
+ ts_params->session_mpool);
+
+ /* Create Crypto session*/
+ rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ ut_params->sess, &ut_params->cipher_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
/* Generate Crypto op data structure */
@@ -6292,9 +6347,13 @@ test_null_auth_cipher_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->valid_devs[0], &ut_params->cipher_xform);
+ ts_params->session_mpool);
+
+ /* Create Crypto session*/
+ rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ ut_params->sess, &ut_params->cipher_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
/* Generate Crypto op data structure */
@@ -6340,6 +6399,7 @@ test_null_invalid_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
+ int ret;
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
@@ -6348,10 +6408,14 @@ test_null_invalid_operation(void)
ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
- /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->valid_devs[0], &ut_params->cipher_xform);
- TEST_ASSERT_NULL(ut_params->sess,
+ ts_params->session_mpool);
+
+ /* Create Crypto session*/
+ ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ ut_params->sess, &ut_params->cipher_xform,
+ ts_params->session_mpool);
+ TEST_ASSERT(ret < 0,
"Session creation succeeded unexpectedly");
@@ -6362,10 +6426,14 @@ test_null_invalid_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->valid_devs[0], &ut_params->auth_xform);
- TEST_ASSERT_NULL(ut_params->sess,
+ ts_params->session_mpool);
+
+ /* Create Crypto session*/
+ ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ ut_params->sess, &ut_params->auth_xform,
+ ts_params->session_mpool);
+ TEST_ASSERT(ret < 0,
"Session creation succeeded unexpectedly");
return TEST_SUCCESS;
@@ -6399,9 +6467,13 @@ test_null_burst_operation(void)
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- /* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->valid_devs[0], &ut_params->cipher_xform);
+ ts_params->session_mpool);
+
+ /* Create Crypto session*/
+ rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ ut_params->sess, &ut_params->cipher_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
@@ -6466,19 +6538,7 @@ create_gmac_operation(enum rte_crypto_auth_operation op,
struct crypto_unittest_params *ut_params = &unittest_params;
struct rte_crypto_sym_op *sym_op;
- unsigned iv_pad_len;
- unsigned aad_pad_len;
-
- iv_pad_len = RTE_ALIGN_CEIL(tdata->iv.len, 16);
- aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len, 16);
-
- /*
- * Runtime generate the large plain text instead of use hard code
- * plain text vector. It is done to avoid create huge source file
- * with the test vector.
- */
- if (tdata->aad.len == GMAC_LARGE_PLAINTEXT_LENGTH)
- generate_gmac_large_plaintext(tdata->aad.data);
+ uint32_t plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -6487,15 +6547,6 @@ create_gmac_operation(enum rte_crypto_auth_operation op,
"Failed to allocate symmetric crypto operation struct");
sym_op = ut_params->op->sym;
- sym_op->auth.aad.data = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
- aad_pad_len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
- "no room to append aad");
-
- sym_op->auth.aad.length = tdata->aad.len;
- sym_op->auth.aad.phys_addr =
- rte_pktmbuf_mtophys(ut_params->ibuf);
- memcpy(sym_op->auth.aad.data, tdata->aad.data, tdata->aad.len);
sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
ut_params->ibuf, tdata->gmac_tag.len);
@@ -6503,56 +6554,42 @@ create_gmac_operation(enum rte_crypto_auth_operation op,
"no room to append digest");
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
- ut_params->ibuf, aad_pad_len);
- sym_op->auth.digest.length = tdata->gmac_tag.len;
+ ut_params->ibuf, plaintext_pad_len);
if (op == RTE_CRYPTO_AUTH_OP_VERIFY) {
rte_memcpy(sym_op->auth.digest.data, tdata->gmac_tag.data,
tdata->gmac_tag.len);
TEST_HEXDUMP(stdout, "digest:",
sym_op->auth.digest.data,
- sym_op->auth.digest.length);
+ tdata->gmac_tag.len);
}
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, iv_pad_len);
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
-
- memset(sym_op->cipher.iv.data, 0, iv_pad_len);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = tdata->iv.len;
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op,
+ uint8_t *, IV_OFFSET);
- rte_memcpy(sym_op->cipher.iv.data, tdata->iv.data, tdata->iv.len);
+ rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len);
- TEST_HEXDUMP(stdout, "iv:", sym_op->cipher.iv.data, iv_pad_len);
+ TEST_HEXDUMP(stdout, "iv:", iv_ptr, tdata->iv.len);
sym_op->cipher.data.length = 0;
sym_op->cipher.data.offset = 0;
sym_op->auth.data.offset = 0;
- sym_op->auth.data.length = 0;
+ sym_op->auth.data.length = tdata->plaintext.len;
return 0;
}
static int create_gmac_session(uint8_t dev_id,
- enum rte_crypto_cipher_operation op,
const struct gmac_test_data *tdata,
enum rte_crypto_auth_operation auth_op)
{
- uint8_t cipher_key[tdata->key.len];
+ uint8_t auth_key[tdata->key.len];
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- memcpy(cipher_key, tdata->key.data, tdata->key.len);
-
- /* For GMAC we setup cipher parameters */
- ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- ut_params->cipher_xform.next = NULL;
- ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_GCM;
- ut_params->cipher_xform.cipher.op = op;
- ut_params->cipher_xform.cipher.key.data = cipher_key;
- ut_params->cipher_xform.cipher.key.length = tdata->key.len;
+ memcpy(auth_key, tdata->key.data, tdata->key.len);
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
ut_params->auth_xform.next = NULL;
@@ -6560,14 +6597,18 @@ static int create_gmac_session(uint8_t dev_id,
ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_AES_GMAC;
ut_params->auth_xform.auth.op = auth_op;
ut_params->auth_xform.auth.digest_length = tdata->gmac_tag.len;
- ut_params->auth_xform.auth.add_auth_data_length = 0;
- ut_params->auth_xform.auth.key.length = 0;
- ut_params->auth_xform.auth.key.data = NULL;
+ ut_params->auth_xform.auth.key.length = tdata->key.len;
+ ut_params->auth_xform.auth.key.data = auth_key;
+ ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
+ ut_params->auth_xform.auth.iv.length = tdata->iv.len;
- ut_params->cipher_xform.next = &ut_params->auth_xform;
- ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
- &ut_params->cipher_xform);
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->session_mpool);
+
+ rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ &ut_params->auth_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
@@ -6582,20 +6623,19 @@ test_AES_GMAC_authentication(const struct gmac_test_data *tdata)
int retval;
- uint8_t *auth_tag, *p;
- uint16_t aad_pad_len;
+ uint8_t *auth_tag, *plaintext;
+ uint16_t plaintext_pad_len;
TEST_ASSERT_NOT_EQUAL(tdata->gmac_tag.len, 0,
"No GMAC length in the source data");
retval = create_gmac_session(ts_params->valid_devs[0],
- RTE_CRYPTO_CIPHER_OP_ENCRYPT,
tdata, RTE_CRYPTO_AUTH_OP_GENERATE);
if (retval < 0)
return retval;
- if (tdata->aad.len > MBUF_SIZE)
+ if (tdata->plaintext.len > MBUF_SIZE)
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool);
else
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -6605,9 +6645,22 @@ test_AES_GMAC_authentication(const struct gmac_test_data *tdata)
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
- aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len, 16);
+ plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
+ /*
+ * Runtime generate the large plain text instead of use hard code
+ * plain text vector. It is done to avoid create huge source file
+ * with the test vector.
+ */
+ if (tdata->plaintext.len == GMAC_LARGE_PLAINTEXT_LENGTH)
+ generate_gmac_large_plaintext(tdata->plaintext.data);
- p = rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *);
+ plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+ plaintext_pad_len);
+ TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
+
+ memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len);
+ TEST_HEXDUMP(stdout, "plaintext:", plaintext,
+ tdata->plaintext.len);
retval = create_gmac_operation(RTE_CRYPTO_AUTH_OP_GENERATE,
tdata);
@@ -6627,9 +6680,9 @@ test_AES_GMAC_authentication(const struct gmac_test_data *tdata)
if (ut_params->op->sym->m_dst) {
auth_tag = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_dst,
- uint8_t *, aad_pad_len);
+ uint8_t *, plaintext_pad_len);
} else {
- auth_tag = p + aad_pad_len;
+ auth_tag = plaintext + plaintext_pad_len;
}
TEST_HEXDUMP(stdout, "auth tag:", auth_tag, tdata->gmac_tag.len);
@@ -6673,18 +6726,19 @@ test_AES_GMAC_authentication_verify(const struct gmac_test_data *tdata)
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
int retval;
+ uint32_t plaintext_pad_len;
+ uint8_t *plaintext;
TEST_ASSERT_NOT_EQUAL(tdata->gmac_tag.len, 0,
"No GMAC length in the source data");
retval = create_gmac_session(ts_params->valid_devs[0],
- RTE_CRYPTO_CIPHER_OP_DECRYPT,
tdata, RTE_CRYPTO_AUTH_OP_VERIFY);
if (retval < 0)
return retval;
- if (tdata->aad.len > MBUF_SIZE)
+ if (tdata->plaintext.len > MBUF_SIZE)
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool);
else
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -6694,6 +6748,24 @@ test_AES_GMAC_authentication_verify(const struct gmac_test_data *tdata)
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
+ plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
+
+ /*
+ * Runtime generate the large plain text instead of use hard code
+ * plain text vector. It is done to avoid create huge source file
+ * with the test vector.
+ */
+ if (tdata->plaintext.len == GMAC_LARGE_PLAINTEXT_LENGTH)
+ generate_gmac_large_plaintext(tdata->plaintext.data);
+
+ plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+ plaintext_pad_len);
+ TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
+
+ memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len);
+ TEST_HEXDUMP(stdout, "plaintext:", plaintext,
+ tdata->plaintext.len);
+
retval = create_gmac_operation(RTE_CRYPTO_AUTH_OP_VERIFY,
tdata);
@@ -6807,8 +6879,7 @@ hmac_sha1_test_crypto_vector = {
static const struct test_crypto_vector
aes128_gmac_test_vector = {
.auth_algo = RTE_CRYPTO_AUTH_AES_GMAC,
- .crypto_algo = RTE_CRYPTO_CIPHER_AES_GCM,
- .aad = {
+ .plaintext = {
.data = plaintext_hash,
.len = 512
},
@@ -6819,7 +6890,7 @@ aes128_gmac_test_vector = {
},
.len = 12
},
- .cipher_key = {
+ .auth_key = {
.data = {
0x42, 0x1A, 0x7D, 0x3D, 0xF5, 0x82, 0x80, 0xF1,
0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA
@@ -6897,6 +6968,7 @@ create_auth_session(struct crypto_unittest_params *ut_params,
const struct test_crypto_vector *reference,
enum rte_crypto_auth_operation auth_op)
{
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t auth_key[reference->auth_key.len + 1];
memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
@@ -6909,11 +6981,14 @@ create_auth_session(struct crypto_unittest_params *ut_params,
ut_params->auth_xform.auth.key.length = reference->auth_key.len;
ut_params->auth_xform.auth.key.data = auth_key;
ut_params->auth_xform.auth.digest_length = reference->digest.len;
- ut_params->auth_xform.auth.add_auth_data_length = reference->aad.len;
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
- &ut_params->auth_xform);
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->session_mpool);
+
+ rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ &ut_params->auth_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
@@ -6927,6 +7002,7 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
enum rte_crypto_auth_operation auth_op,
enum rte_crypto_cipher_operation cipher_op)
{
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
@@ -6937,24 +7013,35 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
/* Setup Authentication Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
ut_params->auth_xform.auth.op = auth_op;
- ut_params->auth_xform.next = &ut_params->cipher_xform;
ut_params->auth_xform.auth.algo = reference->auth_algo;
ut_params->auth_xform.auth.key.length = reference->auth_key.len;
ut_params->auth_xform.auth.key.data = auth_key;
ut_params->auth_xform.auth.digest_length = reference->digest.len;
- ut_params->auth_xform.auth.add_auth_data_length = reference->aad.len;
- /* Setup Cipher Parameters */
- ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- ut_params->cipher_xform.next = NULL;
- ut_params->cipher_xform.cipher.algo = reference->crypto_algo;
- ut_params->cipher_xform.cipher.op = cipher_op;
- ut_params->cipher_xform.cipher.key.data = cipher_key;
- ut_params->cipher_xform.cipher.key.length = reference->cipher_key.len;
+ if (reference->auth_algo == RTE_CRYPTO_AUTH_AES_GMAC) {
+ ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
+ ut_params->auth_xform.auth.iv.length = reference->iv.len;
+ } else {
+ ut_params->auth_xform.next = &ut_params->cipher_xform;
+
+ /* Setup Cipher Parameters */
+ ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ ut_params->cipher_xform.next = NULL;
+ ut_params->cipher_xform.cipher.algo = reference->crypto_algo;
+ ut_params->cipher_xform.cipher.op = cipher_op;
+ ut_params->cipher_xform.cipher.key.data = cipher_key;
+ ut_params->cipher_xform.cipher.key.length = reference->cipher_key.len;
+ ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
+ ut_params->cipher_xform.cipher.iv.length = reference->iv.len;
+ }
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
- &ut_params->auth_xform);
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->session_mpool);
+
+ rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
+ &ut_params->auth_xform,
+ ts_params->session_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
@@ -6990,7 +7077,6 @@ create_auth_operation(struct crypto_testsuite_params *ts_params,
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
ut_params->ibuf, reference->plaintext.len);
- sym_op->auth.digest.length = reference->digest.len;
if (auth_generate)
memset(sym_op->auth.digest.data, 0, reference->digest.len);
@@ -7001,7 +7087,7 @@ create_auth_operation(struct crypto_testsuite_params *ts_params,
TEST_HEXDUMP(stdout, "digest:",
sym_op->auth.digest.data,
- sym_op->auth.digest.length);
+ reference->digest.len);
sym_op->auth.data.length = reference->plaintext.len;
sym_op->auth.data.offset = 0;
@@ -7029,17 +7115,6 @@ create_auth_GMAC_operation(struct crypto_testsuite_params *ts_params,
/* set crypto operation source mbuf */
sym_op->m_src = ut_params->ibuf;
- /* aad */
- sym_op->auth.aad.data = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
- reference->aad.len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data, "no room to append AAD");
- memcpy(sym_op->auth.aad.data, reference->aad.data, reference->aad.len);
-
- TEST_HEXDUMP(stdout, "AAD:", sym_op->auth.aad.data, reference->aad.len);
-
- sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->auth.aad.length = reference->aad.len;
-
/* digest */
sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
ut_params->ibuf, reference->digest.len);
@@ -7049,7 +7124,6 @@ create_auth_GMAC_operation(struct crypto_testsuite_params *ts_params,
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
ut_params->ibuf, reference->ciphertext.len);
- sym_op->auth.digest.length = reference->digest.len;
if (auth_generate)
memset(sym_op->auth.digest.data, 0, reference->digest.len);
@@ -7060,21 +7134,15 @@ create_auth_GMAC_operation(struct crypto_testsuite_params *ts_params,
TEST_HEXDUMP(stdout, "digest:",
sym_op->auth.digest.data,
- sym_op->auth.digest.length);
-
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, reference->iv.len);
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
-
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = reference->iv.len;
+ reference->digest.len);
- memcpy(sym_op->cipher.iv.data, reference->iv.data, reference->iv.len);
+ rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
+ reference->iv.data, reference->iv.len);
sym_op->cipher.data.length = 0;
sym_op->cipher.data.offset = 0;
- sym_op->auth.data.length = 0;
+ sym_op->auth.data.length = reference->plaintext.len;
sym_op->auth.data.offset = 0;
return 0;
@@ -7109,7 +7177,6 @@ create_cipher_auth_operation(struct crypto_testsuite_params *ts_params,
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
ut_params->ibuf, reference->ciphertext.len);
- sym_op->auth.digest.length = reference->digest.len;
if (auth_generate)
memset(sym_op->auth.digest.data, 0, reference->digest.len);
@@ -7120,22 +7187,16 @@ create_cipher_auth_operation(struct crypto_testsuite_params *ts_params,
TEST_HEXDUMP(stdout, "digest:",
sym_op->auth.digest.data,
- sym_op->auth.digest.length);
-
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, reference->iv.len);
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
+ reference->digest.len);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = reference->iv.len;
-
- memcpy(sym_op->cipher.iv.data, reference->iv.data, reference->iv.len);
+ rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
+ reference->iv.data, reference->iv.len);
sym_op->cipher.data.length = reference->ciphertext.len;
- sym_op->cipher.data.offset = reference->iv.len;
+ sym_op->cipher.data.offset = 0;
sym_op->auth.data.length = reference->ciphertext.len;
- sym_op->auth.data.offset = reference->iv.len;
+ sym_op->auth.data.offset = 0;
return 0;
}
@@ -7231,6 +7292,7 @@ test_authentication_verify_GMAC_fail_when_corruption(
unsigned int data_corrupted)
{
int retval;
+ uint8_t *plaintext;
/* Create session */
retval = create_auth_cipher_session(ut_params,
@@ -7249,6 +7311,13 @@ test_authentication_verify_GMAC_fail_when_corruption(
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
+ plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+ reference->plaintext.len);
+ TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
+ memcpy(plaintext, reference->plaintext.data, reference->plaintext.len);
+
+ TEST_HEXDUMP(stdout, "plaintext:", plaintext, reference->plaintext.len);
+
/* Create operation */
retval = create_auth_verify_GMAC_operation(ts_params,
ut_params,
@@ -7258,10 +7327,9 @@ test_authentication_verify_GMAC_fail_when_corruption(
return retval;
if (data_corrupted)
- data_corruption(ut_params->op->sym->auth.aad.data);
+ data_corruption(plaintext);
else
- tag_corruption(ut_params->op->sym->auth.aad.data,
- reference->aad.len);
+ tag_corruption(plaintext, reference->aad.len);
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
@@ -7338,7 +7406,7 @@ test_authenticated_decryption_fail_when_corruption(
}
static int
-create_gcm_operation_SGL(enum rte_crypto_cipher_operation op,
+create_gcm_operation_SGL(enum rte_crypto_aead_operation op,
const struct gcm_test_data *tdata,
void *digest_mem, uint64_t digest_phys)
{
@@ -7349,8 +7417,6 @@ create_gcm_operation_SGL(enum rte_crypto_cipher_operation op,
const unsigned int iv_len = tdata->iv.len;
const unsigned int aad_len = tdata->aad.len;
- unsigned int iv_pad_len = 0;
-
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC);
@@ -7359,56 +7425,42 @@ create_gcm_operation_SGL(enum rte_crypto_cipher_operation op,
struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
- sym_op->auth.digest.data = digest_mem;
+ sym_op->aead.digest.data = digest_mem;
- TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
+ TEST_ASSERT_NOT_NULL(sym_op->aead.digest.data,
"no room to append digest");
- sym_op->auth.digest.phys_addr = digest_phys;
- sym_op->auth.digest.length = auth_tag_len;
+ sym_op->aead.digest.phys_addr = digest_phys;
- if (op == RTE_CRYPTO_CIPHER_OP_DECRYPT) {
- rte_memcpy(sym_op->auth.digest.data, tdata->auth_tag.data,
+ if (op == RTE_CRYPTO_AEAD_OP_DECRYPT) {
+ rte_memcpy(sym_op->aead.digest.data, tdata->auth_tag.data,
auth_tag_len);
TEST_HEXDUMP(stdout, "digest:",
- sym_op->auth.digest.data,
- sym_op->auth.digest.length);
+ sym_op->aead.digest.data,
+ auth_tag_len);
}
- iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16);
-
- sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, iv_pad_len);
-
- TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data,
- "no room to prepend iv");
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op,
+ uint8_t *, IV_OFFSET);
- memset(sym_op->cipher.iv.data, 0, iv_pad_len);
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
- sym_op->cipher.iv.length = iv_len;
+ rte_memcpy(iv_ptr, tdata->iv.data, iv_len);
- rte_memcpy(sym_op->cipher.iv.data, tdata->iv.data, iv_pad_len);
-
- sym_op->auth.aad.data = (uint8_t *)rte_pktmbuf_prepend(
+ sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_prepend(
ut_params->ibuf, aad_len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
+ TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data,
"no room to prepend aad");
- sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(
+ sym_op->aead.aad.phys_addr = rte_pktmbuf_mtophys(
ut_params->ibuf);
- sym_op->auth.aad.length = aad_len;
- memset(sym_op->auth.aad.data, 0, aad_len);
- rte_memcpy(sym_op->auth.aad.data, tdata->aad.data, aad_len);
+ memset(sym_op->aead.aad.data, 0, aad_len);
+ rte_memcpy(sym_op->aead.aad.data, tdata->aad.data, aad_len);
- TEST_HEXDUMP(stdout, "iv:", sym_op->cipher.iv.data, iv_pad_len);
+ TEST_HEXDUMP(stdout, "iv:", iv_ptr, iv_len);
TEST_HEXDUMP(stdout, "aad:",
- sym_op->auth.aad.data, aad_len);
-
- sym_op->cipher.data.length = tdata->plaintext.len;
- sym_op->cipher.data.offset = aad_len + iv_pad_len;
+ sym_op->aead.aad.data, aad_len);
- sym_op->auth.data.offset = aad_len + iv_pad_len;
- sym_op->auth.data.length = tdata->plaintext.len;
+ sym_op->aead.data.length = tdata->plaintext.len;
+ sym_op->aead.data.offset = aad_len;
return 0;
}
@@ -7441,8 +7493,7 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata,
int ecx = 0;
void *digest_mem = NULL;
- uint32_t prepend_len = ALIGN_POW2_ROUNDUP(tdata->iv.len, 16)
- + tdata->aad.len;
+ uint32_t prepend_len = tdata->aad.len;
if (tdata->plaintext.len % fragsz != 0) {
if (tdata->plaintext.len / fragsz + 1 > SGL_MAX_NO)
@@ -7464,10 +7515,10 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata,
/* Create GCM session */
retval = create_gcm_session(ts_params->valid_devs[0],
- RTE_CRYPTO_CIPHER_OP_ENCRYPT,
+ RTE_CRYPTO_AEAD_OP_ENCRYPT,
tdata->key.data, tdata->key.len,
tdata->aad.len, tdata->auth_tag.len,
- RTE_CRYPTO_AUTH_OP_GENERATE);
+ tdata->iv.len);
if (retval < 0)
return retval;
@@ -7593,7 +7644,7 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata,
}
/* Create GCM opertaion */
- retval = create_gcm_operation_SGL(RTE_CRYPTO_CIPHER_OP_ENCRYPT,
+ retval = create_gcm_operation_SGL(RTE_CRYPTO_AEAD_OP_ENCRYPT,
tdata, digest_mem, digest_phys);
if (retval < 0)
@@ -7818,8 +7869,9 @@ test_scheduler_attach_slave_op(void)
char vdev_name[32];
/* create 2 AESNI_MB if necessary */
- nb_devs = rte_cryptodev_count_devtype(
- RTE_CRYPTODEV_AESNI_MB_PMD);
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
if (nb_devs < 2) {
for (i = nb_devs; i < 2; i++) {
snprintf(vdev_name, sizeof(vdev_name), "%s_%u",
@@ -7840,9 +7892,37 @@ test_scheduler_attach_slave_op(void)
struct rte_cryptodev_info info;
rte_cryptodev_info_get(i, &info);
- if (info.dev_type != RTE_CRYPTODEV_AESNI_MB_PMD)
+ if (info.driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)))
continue;
+ /*
+ * Create the session mempool again, since now there are new devices
+ * to use the mempool.
+ */
+ if (ts_params->session_mpool) {
+ rte_mempool_free(ts_params->session_mpool);
+ ts_params->session_mpool = NULL;
+ }
+ unsigned int session_size = rte_cryptodev_get_private_session_size(i);
+
+ /*
+ * Create mempool with maximum number of sessions * 2,
+ * to include the session headers
+ */
+ if (ts_params->session_mpool == NULL) {
+ ts_params->session_mpool = rte_mempool_create(
+ "test_sess_mp",
+ info.sym.max_nb_sessions * 2,
+ session_size,
+ 0, 0, NULL, NULL, NULL,
+ NULL, SOCKET_ID_ANY,
+ 0);
+
+ TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+ "session mempool allocation failed");
+ }
+
ret = rte_cryptodev_scheduler_slave_attach(sched_id,
(uint8_t)i);
@@ -7954,6 +8034,7 @@ static struct unit_test_suite cryptodev_qat_testsuite = {
test_AES_docsis_qat_all),
TEST_CASE_ST(ut_setup, ut_teardown,
test_DES_docsis_qat_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_qat_all),
TEST_CASE_ST(ut_setup, ut_teardown, test_stats),
/** AES GCM Authenticated Encryption */
@@ -7964,35 +8045,83 @@ static struct unit_test_suite cryptodev_qat_testsuite = {
TEST_CASE_ST(ut_setup, ut_teardown,
test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_1),
+ test_AES_GCM_authenticated_encryption_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_2),
+ test_AES_GCM_authenticated_encryption_test_case_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_3),
+ test_AES_GCM_authenticated_encryption_test_case_3),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_4),
+ test_AES_GCM_authenticated_encryption_test_case_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_5),
+ test_AES_GCM_authenticated_encryption_test_case_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_6),
+ test_AES_GCM_authenticated_encryption_test_case_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_7),
+ test_AES_GCM_authenticated_encryption_test_case_7),
/** AES GCM Authenticated Decryption */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_1),
+ test_AES_GCM_authenticated_decryption_test_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_7),
+
+ /** AES GCM Authenticated Encryption 192 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_7),
+
+ /** AES GCM Authenticated Decryption 192 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_2),
+ test_AES_GCM_auth_decryption_test_case_192_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_3),
+ test_AES_GCM_auth_decryption_test_case_192_3),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_4),
+ test_AES_GCM_auth_decryption_test_case_192_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_5),
+ test_AES_GCM_auth_decryption_test_case_192_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_6),
+ test_AES_GCM_auth_decryption_test_case_192_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_7),
+ test_AES_GCM_auth_decryption_test_case_192_7),
+
+ /** AES GCM Authenticated Encryption 256 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_7),
/** AES GMAC Authentication */
TEST_CASE_ST(ut_setup, ut_teardown,
@@ -8099,10 +8228,31 @@ static struct unit_test_suite cryptodev_qat_testsuite = {
TEST_CASE_ST(ut_setup, ut_teardown,
test_null_auth_cipher_operation),
+ /** KASUMI tests */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_kasumi_hash_generate_test_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_kasumi_hash_generate_test_case_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_kasumi_hash_generate_test_case_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_kasumi_hash_generate_test_case_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_kasumi_hash_generate_test_case_5),
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_hash_generate_test_case_6),
- /** KASUMI tests */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_kasumi_hash_verify_test_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_kasumi_hash_verify_test_case_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_kasumi_hash_verify_test_case_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_kasumi_hash_verify_test_case_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_kasumi_hash_verify_test_case_5),
+
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_encryption_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
@@ -8167,35 +8317,100 @@ static struct unit_test_suite cryptodev_openssl_testsuite = {
/** AES GCM Authenticated Encryption */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_1),
+ test_AES_GCM_authenticated_encryption_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_2),
+ test_AES_GCM_authenticated_encryption_test_case_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_3),
+ test_AES_GCM_authenticated_encryption_test_case_3),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_4),
+ test_AES_GCM_authenticated_encryption_test_case_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_5),
+ test_AES_GCM_authenticated_encryption_test_case_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_6),
+ test_AES_GCM_authenticated_encryption_test_case_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_7),
+ test_AES_GCM_authenticated_encryption_test_case_7),
/** AES GCM Authenticated Decryption */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_1),
+ test_AES_GCM_authenticated_decryption_test_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_7),
+
+
+ /** AES GCM Authenticated Encryption 192 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_7),
+
+ /** AES GCM Authenticated Decryption 192 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_7),
+
+ /** AES GCM Authenticated Encryption 256 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_2),
+ test_AES_GCM_auth_encryption_test_case_256_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_3),
+ test_AES_GCM_auth_encryption_test_case_256_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_4),
+ test_AES_GCM_auth_encryption_test_case_256_7),
+
+ /** AES GCM Authenticated Decryption 256 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_256_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_256_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_256_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_256_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_5),
+ test_AES_GCM_auth_decryption_test_case_256_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_6),
+ test_AES_GCM_auth_decryption_test_case_256_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_7),
+ test_AES_GCM_auth_decryption_test_case_256_7),
/** AES GMAC Authentication */
TEST_CASE_ST(ut_setup, ut_teardown,
@@ -8244,79 +8459,111 @@ static struct unit_test_suite cryptodev_aesni_gcm_testsuite = {
.unit_test_cases = {
/** AES GCM Authenticated Encryption */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_1),
+ test_AES_GCM_authenticated_encryption_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_2),
+ test_AES_GCM_authenticated_encryption_test_case_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_3),
+ test_AES_GCM_authenticated_encryption_test_case_3),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_4),
+ test_AES_GCM_authenticated_encryption_test_case_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_5),
+ test_AES_GCM_authenticated_encryption_test_case_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_6),
+ test_AES_GCM_authenticated_encryption_test_case_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_test_case_7),
+ test_AES_GCM_authenticated_encryption_test_case_7),
/** AES GCM Authenticated Decryption */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_1),
+ test_AES_GCM_authenticated_decryption_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_2),
+ test_AES_GCM_authenticated_decryption_test_case_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_3),
+ test_AES_GCM_authenticated_decryption_test_case_3),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_4),
+ test_AES_GCM_authenticated_decryption_test_case_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_5),
+ test_AES_GCM_authenticated_decryption_test_case_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_6),
+ test_AES_GCM_authenticated_decryption_test_case_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_test_case_7),
+ test_AES_GCM_authenticated_decryption_test_case_7),
+
+ /** AES GCM Authenticated Encryption 192 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_7),
+
+ /** AES GCM Authenticated Decryption 192 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_7),
/** AES GCM Authenticated Encryption 256 bits key */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_encryption_test_case_256_1),
+ test_AES_GCM_auth_encryption_test_case_256_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_encryption_test_case_256_2),
+ test_AES_GCM_auth_encryption_test_case_256_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_encryption_test_case_256_3),
+ test_AES_GCM_auth_encryption_test_case_256_3),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_encryption_test_case_256_4),
+ test_AES_GCM_auth_encryption_test_case_256_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_encryption_test_case_256_5),
+ test_AES_GCM_auth_encryption_test_case_256_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_encryption_test_case_256_6),
+ test_AES_GCM_auth_encryption_test_case_256_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_encryption_test_case_256_7),
+ test_AES_GCM_auth_encryption_test_case_256_7),
/** AES GCM Authenticated Decryption 256 bits key */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_decryption_test_case_256_1),
+ test_AES_GCM_auth_decryption_test_case_256_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_decryption_test_case_256_2),
+ test_AES_GCM_auth_decryption_test_case_256_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_decryption_test_case_256_3),
+ test_AES_GCM_auth_decryption_test_case_256_3),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_decryption_test_case_256_4),
+ test_AES_GCM_auth_decryption_test_case_256_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_decryption_test_case_256_5),
+ test_AES_GCM_auth_decryption_test_case_256_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_decryption_test_case_256_6),
+ test_AES_GCM_auth_decryption_test_case_256_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_decryption_test_case_256_7),
+ test_AES_GCM_auth_decryption_test_case_256_7),
/** AES GCM Authenticated Encryption big aad size */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_encryption_test_case_aad_1),
+ test_AES_GCM_auth_encryption_test_case_aad_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_encryption_test_case_aad_2),
+ test_AES_GCM_auth_encryption_test_case_aad_2),
/** AES GCM Authenticated Decryption big aad size */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_decryption_test_case_aad_1),
+ test_AES_GCM_auth_decryption_test_case_aad_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_auth_decryption_test_case_aad_2),
+ test_AES_GCM_auth_decryption_test_case_aad_2),
/** AES GMAC Authentication */
TEST_CASE_ST(ut_setup, ut_teardown,
@@ -8340,15 +8587,15 @@ static struct unit_test_suite cryptodev_aesni_gcm_testsuite = {
/** Out of place tests */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_oop),
+ test_AES_GCM_authenticated_encryption_oop_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_oop),
+ test_AES_GCM_authenticated_decryption_oop_test_case_1),
/** Session-less tests */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_encryption_sessionless),
+ test_AES_GCM_authenticated_encryption_sessionless_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_mb_AES_GCM_authenticated_decryption_sessionless),
+ test_AES_GCM_authenticated_decryption_sessionless_test_case_1),
/** Scatter-Gather */
TEST_CASE_ST(ut_setup, ut_teardown,
@@ -8538,28 +8785,116 @@ static struct unit_test_suite cryptodev_dpaa2_sec_testsuite = {
.teardown = testsuite_teardown,
.unit_test_cases = {
TEST_CASE_ST(ut_setup, ut_teardown,
- test_device_configure_invalid_dev_id),
+ test_device_configure_invalid_dev_id),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_multi_session),
+ test_multi_session),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_chain_dpaa2_sec_all),
+ 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_3DES_chain_dpaa2_sec_all),
+ test_AES_cipheronly_dpaa2_sec_all),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_cipheronly_dpaa2_sec_all),
+ test_3DES_cipheronly_dpaa2_sec_all),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_3DES_cipheronly_dpaa2_sec_all),
+ test_authonly_dpaa2_sec_all),
- /** HMAC_MD5 Authentication */
+ /** AES GCM Authenticated Encryption */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_encryption_test_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_encryption_test_case_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_encryption_test_case_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_encryption_test_case_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_encryption_test_case_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_encryption_test_case_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_encryption_test_case_7),
+
+ /** AES GCM Authenticated Decryption */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_test_case_7),
+
+ /** AES GCM Authenticated Encryption 192 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_192_7),
+
+ /** AES GCM Authenticated Decryption 192 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_192_7),
+
+ /** AES GCM Authenticated Encryption 256 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_3),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_MD5_HMAC_generate_case_1),
+ test_AES_GCM_auth_encryption_test_case_256_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_MD5_HMAC_verify_case_1),
+ test_AES_GCM_auth_encryption_test_case_256_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_MD5_HMAC_generate_case_2),
+ test_AES_GCM_auth_encryption_test_case_256_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_MD5_HMAC_verify_case_2),
+ test_AES_GCM_auth_encryption_test_case_256_7),
+
+ /** AES GCM Authenticated Decryption 256 bits key */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_256_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_256_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_256_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_256_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_256_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_256_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_decryption_test_case_256_7),
TEST_CASES_END() /**< NULL terminate unit test array */
}
@@ -8607,14 +8942,31 @@ static struct unit_test_suite cryptodev_armv8_testsuite = {
static int
test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_QAT_SYM_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
+
return unit_test_suite_runner(&cryptodev_qat_testsuite);
}
static int
test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_AESNI_MB_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "AESNI MB PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_AESNI_MB is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_aesni_mb_testsuite);
}
@@ -8622,7 +8974,15 @@ test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/)
static int
test_cryptodev_openssl(void)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_OPENSSL_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "OPENSSL PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_OPENSSL is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_openssl_testsuite);
}
@@ -8630,7 +8990,15 @@ test_cryptodev_openssl(void)
static int
test_cryptodev_aesni_gcm(void)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_AESNI_GCM_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "AESNI GCM PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_aesni_gcm_testsuite);
}
@@ -8638,7 +9006,15 @@ test_cryptodev_aesni_gcm(void)
static int
test_cryptodev_null(void)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_NULL_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "NULL PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_NULL is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_null_testsuite);
}
@@ -8646,7 +9022,15 @@ test_cryptodev_null(void)
static int
test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_SNOW3G_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "SNOW3G PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_SNOW3G is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_sw_snow3g_testsuite);
}
@@ -8654,7 +9038,15 @@ test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/)
static int
test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_KASUMI_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "ZUC PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_KASUMI is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_sw_kasumi_testsuite);
}
@@ -8662,7 +9054,15 @@ test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/)
static int
test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_ZUC_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ZUC_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "ZUC PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_ZUC is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_sw_zuc_testsuite);
}
@@ -8670,7 +9070,15 @@ test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/)
static int
test_cryptodev_armv8(void)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_ARMV8_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "ARMV8 PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_ARMV8 is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_armv8_testsuite);
}
@@ -8680,7 +9088,22 @@ test_cryptodev_armv8(void)
static int
test_cryptodev_scheduler(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_SCHEDULER_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "SCHEDULER PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_SCHEDULER is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
+
+ if (rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) == -1) {
+ RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be"
+ " enabled in config file to run this testsuite.\n");
+ return TEST_FAILED;
+}
return unit_test_suite_runner(&cryptodev_scheduler_testsuite);
}
@@ -8691,7 +9114,16 @@ REGISTER_TEST_COMMAND(cryptodev_scheduler_autotest, test_cryptodev_scheduler);
static int
test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_DPAA2_SEC_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "DPAA2 SEC PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
+
return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite);
}
diff --git a/test/test/test_cryptodev.h b/test/test/test_cryptodev.h
index 67354a95..4509a09a 100644
--- a/test/test/test_cryptodev.h
+++ b/test/test/test_cryptodev.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ * Copyright(c) 2015-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -71,6 +71,24 @@
#define TRUNCATED_DIGEST_BYTE_LENGTH_SHA384 (24)
#define TRUNCATED_DIGEST_BYTE_LENGTH_SHA512 (32)
+#define MAXIMUM_IV_LENGTH (16)
+
+#define IV_OFFSET (sizeof(struct rte_crypto_op) + \
+ sizeof(struct rte_crypto_sym_op) + DEFAULT_NUM_XFORMS * \
+ sizeof(struct rte_crypto_sym_xform))
+
+#define CRYPTODEV_NAME_NULL_PMD crypto_null
+#define CRYPTODEV_NAME_AESNI_MB_PMD crypto_aesni_mb
+#define CRYPTODEV_NAME_AESNI_GCM_PMD crypto_aesni_gcm
+#define CRYPTODEV_NAME_OPENSSL_PMD crypto_openssl
+#define CRYPTODEV_NAME_QAT_SYM_PMD crypto_qat
+#define CRYPTODEV_NAME_SNOW3G_PMD crypto_snow3g
+#define CRYPTODEV_NAME_KASUMI_PMD crypto_kasumi
+#define CRYPTODEV_NAME_ZUC_PMD crypto_zuc
+#define CRYPTODEV_NAME_ARMV8_PMD crypto_armv8
+#define CRYPTODEV_NAME_DPAA2_SEC_PMD crypto_dpaa2_sec
+#define CRYPTODEV_NAME_SCHEDULER_PMD crypto_scheduler
+
/**
* Write (spread) data from buffer to mbuf data
*
diff --git a/test/test/test_cryptodev_aes_test_vectors.h b/test/test/test_cryptodev_aes_test_vectors.h
index 07d6eab2..e410018f 100644
--- a/test/test/test_cryptodev_aes_test_vectors.h
+++ b/test/test/test_cryptodev_aes_test_vectors.h
@@ -56,6 +56,17 @@ static const uint8_t ciphertext64_aes128ctr[] = {
0x79, 0x21, 0x70, 0xA0, 0xF3, 0x00, 0x9C, 0xEE
};
+static const uint8_t ciphertext64_aes128ctr_IV_12bytes[] = {
+ 0x28, 0x80, 0x28, 0xC7, 0x15, 0x99, 0xC5, 0xA8,
+ 0xDD, 0x53, 0xC2, 0x67, 0x1B, 0x86, 0xB8, 0x13,
+ 0xAB, 0x25, 0x39, 0x7A, 0xD2, 0x1F, 0x8B, 0x4B,
+ 0x94, 0x89, 0x2B, 0x65, 0xCF, 0x89, 0x1E, 0xDD,
+ 0xD4, 0x7C, 0xFD, 0x8D, 0x0E, 0xCD, 0x23, 0xA4,
+ 0xEB, 0x8C, 0x05, 0x58, 0x45, 0x4A, 0x63, 0x44,
+ 0x11, 0x42, 0x07, 0x17, 0xB4, 0xD2, 0xCC, 0x75,
+ 0xB7, 0x23, 0x99, 0xA9, 0xC5, 0x89, 0x7F, 0x66
+};
+
static const uint8_t plaintext_aes_docsis_bpi_cfb[] = {
0x00, 0x01, 0x02, 0x88, 0xEE, 0x59, 0x7E
};
@@ -98,6 +109,17 @@ static const uint8_t ciphertext64_aes192ctr[] = {
0x59, 0x5E, 0x9E, 0xA5, 0x7B, 0x2D, 0xD7, 0xF0
};
+static const uint8_t ciphertext64_aes192ctr_IV_12bytes[] = {
+ 0x67, 0x65, 0xa9, 0xee, 0xfd, 0x31, 0x62, 0xfc,
+ 0xad, 0xfd, 0xc7, 0x25, 0xb7, 0x25, 0x16, 0xbe,
+ 0x25, 0xce, 0xc0, 0x1d, 0xda, 0xa9, 0xd3, 0xda,
+ 0x1b, 0x7d, 0x68, 0x6a, 0x6f, 0x06, 0xea, 0x47,
+ 0xa0, 0xe0, 0x15, 0xf4, 0xbd, 0x1b, 0x70, 0x34,
+ 0xd4, 0x6d, 0x1c, 0x84, 0x17, 0x91, 0x46, 0x0c,
+ 0xe8, 0xbc, 0x7a, 0xfb, 0x9f, 0x2a, 0x8f, 0xb4,
+ 0xd4, 0xf3, 0x6e, 0x5b, 0x75, 0xa0, 0xce, 0x32
+};
+
static const uint8_t plaintext_aes256ctr[] = {
0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A,
@@ -120,6 +142,17 @@ static const uint8_t ciphertext64_aes256ctr[] = {
0x13, 0xC2, 0xDD, 0x08, 0x45, 0x79, 0x41, 0xA6
};
+static const uint8_t ciphertext64_aes256ctr_IV_12bytes[] = {
+ 0x7B, 0x7A, 0x7D, 0x83, 0x85, 0xF8, 0x81, 0xF3,
+ 0x32, 0x33, 0xD9, 0xFB, 0x04, 0x73, 0xD4, 0x2F,
+ 0x70, 0xDE, 0x90, 0x3E, 0xD0, 0xA9, 0x93, 0x8A,
+ 0x91, 0xF3, 0xB5, 0x29, 0x4D, 0x2A, 0x74, 0xD0,
+ 0xDC, 0x4E, 0x5C, 0x9B, 0x97, 0x24, 0xD8, 0x02,
+ 0xFE, 0xAB, 0x38, 0xE8, 0x73, 0x51, 0x29, 0x7E,
+ 0xF1, 0xF9, 0x40, 0x78, 0xB1, 0x04, 0x7A, 0x78,
+ 0x61, 0x07, 0x47, 0xE6, 0x8C, 0x0F, 0xA8, 0x76
+};
+
static const uint8_t plaintext_aes_common[] = {
"What a lousy earth! He wondered how many people "
"were destitute that same night even in his own "
@@ -352,6 +385,141 @@ static const struct blockcipher_test_data aes_test_data_3 = {
}
};
+/* AES128-CTR-SHA1 test vector (12-byte IV) */
+static const struct blockcipher_test_data aes_test_data_1_IV_12_bytes = {
+ .crypto_algo = RTE_CRYPTO_CIPHER_AES_CTR,
+ .cipher_key = {
+ .data = {
+ 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
+ 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
+ },
+ .len = 16
+ },
+ .iv = {
+ .data = {
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB
+ },
+ .len = 12
+ },
+ .plaintext = {
+ .data = plaintext_aes128ctr,
+ .len = 64
+ },
+ .ciphertext = {
+ .data = ciphertext64_aes128ctr_IV_12bytes,
+ .len = 64
+ },
+ .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
+ .auth_key = {
+ .data = {
+ 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
+ 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
+ 0xDE, 0xF4, 0xDE, 0xAD
+ },
+ .len = 20
+ },
+ .digest = {
+ .data = {
+ 0x5C, 0x34, 0x6B, 0xE4, 0x9A, 0x7F, 0x4A, 0xC3,
+ 0x82, 0xBE, 0xA0, 0x12, 0xD1, 0xF0, 0x15, 0xFA,
+ 0xCF, 0xC8, 0x7F, 0x60
+ },
+ .len = 20,
+ .truncated_len = 12
+ }
+};
+
+/** AES-192-CTR XCBC test vector (12-byte IV) */
+static const struct blockcipher_test_data aes_test_data_2_IV_12_bytes = {
+ .crypto_algo = RTE_CRYPTO_CIPHER_AES_CTR,
+ .cipher_key = {
+ .data = {
+ 0xCB, 0xC5, 0xED, 0x5B, 0xE7, 0x7C, 0xBD, 0x8C,
+ 0x50, 0xD9, 0x30, 0xF2, 0xB5, 0x6A, 0x0E, 0x5F,
+ 0xAA, 0xAE, 0xAD, 0xA2, 0x1F, 0x49, 0x52, 0xD4
+ },
+ .len = 24
+ },
+ .iv = {
+ .data = {
+ 0x3F, 0x69, 0xA8, 0xCD, 0xE8, 0xF0, 0xEF, 0x40,
+ 0xB8, 0x7A, 0x4B, 0xED
+ },
+ .len = 12
+ },
+ .plaintext = {
+ .data = plaintext_aes192ctr,
+ .len = 64
+ },
+ .ciphertext = {
+ .data = ciphertext64_aes192ctr_IV_12bytes,
+ .len = 64
+ },
+ .auth_algo = RTE_CRYPTO_AUTH_AES_XCBC_MAC,
+ .auth_key = {
+ .data = {
+ 0x87, 0x61, 0x54, 0x53, 0xC4, 0x6D, 0xDD, 0x51,
+ 0xE1, 0x9F, 0x86, 0x64, 0x39, 0x0A, 0xE6, 0x59
+ },
+ .len = 16
+ },
+ .digest = {
+ .data = {
+ 0x0C, 0xA1, 0xA5, 0xAF, 0x3E, 0x41, 0xD2, 0xF4,
+ 0x4C, 0x4C, 0xAB, 0x13
+ },
+ .len = 12,
+ .truncated_len = 12
+ }
+};
+
+/** AES-256-CTR SHA1 test vector (12-byte IV) */
+static const struct blockcipher_test_data aes_test_data_3_IV_12_bytes = {
+ .crypto_algo = RTE_CRYPTO_CIPHER_AES_CTR,
+ .cipher_key = {
+ .data = {
+ 0x60, 0x3D, 0xEB, 0x10, 0x15, 0xCA, 0x71, 0xBE,
+ 0x2B, 0x73, 0xAE, 0xF0, 0x85, 0x7D, 0x77, 0x81,
+ 0x1F, 0x35, 0x2C, 0x07, 0x3B, 0x61, 0x08, 0xD7,
+ 0x2D, 0x98, 0x10, 0xA3, 0x09, 0x14, 0xDF, 0xF4
+ },
+ .len = 32
+ },
+ .iv = {
+ .data = {
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB
+ },
+ .len = 12
+ },
+ .plaintext = {
+ .data = plaintext_aes256ctr,
+ .len = 64
+ },
+ .ciphertext = {
+ .data = ciphertext64_aes256ctr_IV_12bytes,
+ .len = 64
+ },
+ .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
+ .auth_key = {
+ .data = {
+ 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
+ 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
+ 0xDE, 0xF4, 0xDE, 0xAD
+ },
+ .len = 20
+ },
+ .digest = {
+ .data = {
+ 0x57, 0x9A, 0x52, 0x6E, 0x31, 0x17, 0x57, 0x49,
+ 0xE7, 0xA1, 0x88, 0x6C, 0x2E, 0x36, 0x67, 0x63,
+ 0x3F, 0x2D, 0xA3, 0xEF
+ },
+ .len = 20,
+ .truncated_len = 12
+ }
+};
/** AES-128-CBC SHA1 test vector */
static const struct blockcipher_test_data aes_test_data_4 = {
.crypto_algo = RTE_CRYPTO_CIPHER_AES_CBC,
@@ -1028,7 +1196,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CTR HMAC-SHA1 Decryption Digest "
@@ -1038,7 +1207,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-192-CTR XCBC Encryption Digest",
@@ -1074,7 +1244,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-256-CTR HMAC-SHA1 Decryption Digest "
@@ -1084,7 +1255,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest",
@@ -1094,7 +1266,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest "
@@ -1124,7 +1297,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
@@ -1141,7 +1315,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC HMAC-SHA256 Encryption Digest "
@@ -1159,7 +1334,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC HMAC-SHA256 Decryption Digest "
@@ -1175,7 +1351,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest "
@@ -1205,7 +1382,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC HMAC-SHA512 Decryption Digest "
@@ -1262,7 +1440,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC HMAC-SHA224 Decryption Digest "
@@ -1272,7 +1451,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC HMAC-SHA384 Encryption Digest",
@@ -1281,7 +1461,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC HMAC-SHA384 Decryption Digest "
@@ -1291,7 +1472,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest "
@@ -1322,7 +1504,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CBC Decryption",
@@ -1331,7 +1514,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-192-CBC Encryption",
@@ -1340,7 +1524,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-192-CBC Encryption Scater gather",
@@ -1357,7 +1542,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-256-CBC Encryption",
@@ -1366,7 +1552,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-256-CBC Decryption",
@@ -1375,7 +1562,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-256-CBC OOP Encryption",
@@ -1400,7 +1588,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-128-CTR Decryption",
@@ -1409,7 +1598,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-192-CTR Encryption",
@@ -1418,7 +1608,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-192-CTR Decryption",
@@ -1427,7 +1618,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-256-CTR Encryption",
@@ -1436,7 +1628,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "AES-256-CTR Decryption",
@@ -1445,8 +1638,27 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
+ {
+ .test_descr = "AES-128-CTR Encryption (12-byte IV)",
+ .test_data = &aes_test_data_1_IV_12_bytes,
+ .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
+ .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB
+ },
+ {
+ .test_descr = "AES-192-CTR Encryption (12-byte IV)",
+ .test_data = &aes_test_data_2_IV_12_bytes,
+ .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
+ .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB
+ },
+ {
+ .test_descr = "AES-256-CTR Encryption (12-byte IV)",
+ .test_data = &aes_test_data_3_IV_12_bytes,
+ .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
+ .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB
+ }
};
static const struct blockcipher_test_case aes_docsis_test_cases[] = {
diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c
index 603c7765..6089af4e 100644
--- a/test/test/test_cryptodev_blockcipher.c
+++ b/test/test/test_cryptodev_blockcipher.c
@@ -35,6 +35,7 @@
#include <rte_mbuf.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
+#include <rte_pause.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
@@ -46,14 +47,14 @@
#include "test_cryptodev_aes_test_vectors.h"
#include "test_cryptodev_des_test_vectors.h"
#include "test_cryptodev_hash_test_vectors.h"
-#include "test_cryptodev.h"
static int
test_blockcipher_one_case(const struct blockcipher_test_case *t,
struct rte_mempool *mbuf_pool,
struct rte_mempool *op_mpool,
+ struct rte_mempool *sess_mpool,
uint8_t dev_id,
- enum rte_cryptodev_type cryptodev_type,
+ int driver_id,
char *test_msg)
{
struct rte_mbuf *ibuf = NULL;
@@ -64,8 +65,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
struct rte_crypto_sym_xform *init_xform = NULL;
struct rte_crypto_sym_op *sym_op = NULL;
struct rte_crypto_op *op = NULL;
- struct rte_cryptodev_sym_session *sess = NULL;
struct rte_cryptodev_info dev_info;
+ struct rte_cryptodev_sym_session *sess = NULL;
int status = TEST_SUCCESS;
const struct blockcipher_test_data *tdata = t->test_data;
@@ -79,6 +80,19 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
uint8_t tmp_src_buf[MBUF_SIZE];
uint8_t tmp_dst_buf[MBUF_SIZE];
+ int openssl_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
+ int scheduler_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
+ int armv8_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
+ int aesni_mb_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
+ int qat_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
+ int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
+
int nb_segs = 1;
if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) {
@@ -99,17 +113,15 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
memcpy(auth_key, tdata->auth_key.data,
tdata->auth_key.len);
- switch (cryptodev_type) {
- case RTE_CRYPTODEV_QAT_SYM_PMD:
- case RTE_CRYPTODEV_OPENSSL_PMD:
- case RTE_CRYPTODEV_ARMV8_PMD: /* Fall through */
+ if (driver_id == dpaa2_sec_pmd ||
+ driver_id == qat_pmd ||
+ driver_id == openssl_pmd ||
+ driver_id == armv8_pmd) { /* Fall through */
digest_len = tdata->digest.len;
- break;
- case RTE_CRYPTODEV_AESNI_MB_PMD:
- case RTE_CRYPTODEV_SCHEDULER_PMD:
+ } else if (driver_id == aesni_mb_pmd ||
+ driver_id == scheduler_pmd) {
digest_len = tdata->digest.truncated_len;
- break;
- default:
+ } else {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
"line %u FAILED: %s",
__LINE__, "Unsupported PMD type");
@@ -118,8 +130,6 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
}
/* preparing data */
- if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
- buf_len += tdata->iv.len;
if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
buf_len += digest_len;
@@ -145,10 +155,6 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
tdata->ciphertext.data);
- if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
- rte_memcpy(rte_pktmbuf_prepend(ibuf, tdata->iv.len),
- tdata->iv.data, tdata->iv.len);
- }
buf_p = rte_pktmbuf_append(ibuf, digest_len);
if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
rte_memcpy(buf_p, tdata->digest.data, digest_len);
@@ -293,25 +299,19 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
RTE_CRYPTO_CIPHER_OP_DECRYPT;
cipher_xform->cipher.key.data = cipher_key;
cipher_xform->cipher.key.length = tdata->cipher_key.len;
+ cipher_xform->cipher.iv.offset = IV_OFFSET;
+ cipher_xform->cipher.iv.length = tdata->iv.len;
- sym_op->cipher.data.offset = tdata->iv.len;
+ sym_op->cipher.data.offset = 0;
sym_op->cipher.data.length = tdata->ciphertext.len;
- sym_op->cipher.iv.data = rte_pktmbuf_mtod(sym_op->m_src,
- uint8_t *);
- sym_op->cipher.iv.length = tdata->iv.len;
- sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(
- sym_op->m_src);
+ rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+ tdata->iv.data,
+ tdata->iv.len);
}
if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
- uint32_t auth_data_offset = 0;
uint32_t digest_offset = tdata->ciphertext.len;
- if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
- digest_offset += tdata->iv.len;
- auth_data_offset += tdata->iv.len;
- }
-
auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
auth_xform->auth.algo = tdata->auth_algo;
auth_xform->auth.key.length = tdata->auth_key.len;
@@ -334,15 +334,16 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
digest_offset);
}
- sym_op->auth.data.offset = auth_data_offset;
+ sym_op->auth.data.offset = 0;
sym_op->auth.data.length = tdata->ciphertext.len;
- sym_op->auth.digest.length = digest_len;
}
/* create session for sessioned op */
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
- sess = rte_cryptodev_sym_session_create(dev_id,
- init_xform);
+ sess = rte_cryptodev_sym_session_create(sess_mpool);
+
+ rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
+ sess_mpool);
if (!sess) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
"FAILED: %s", __LINE__,
@@ -421,7 +422,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
compare_len = tdata->plaintext.len;
}
- if (memcmp(rte_pktmbuf_read(iobuf, tdata->iv.len, compare_len,
+ if (memcmp(rte_pktmbuf_read(iobuf, 0, compare_len,
buffer), compare_ref, compare_len)) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
"FAILED: %s", __LINE__,
@@ -432,13 +433,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
}
if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
- uint8_t *auth_res;
-
- if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
- auth_res = pktmbuf_mtod_offset(iobuf,
- tdata->iv.len + tdata->ciphertext.len);
- else
- auth_res = pktmbuf_mtod_offset(iobuf,
+ uint8_t *auth_res = pktmbuf_mtod_offset(iobuf,
tdata->ciphertext.len);
if (memcmp(auth_res, tdata->digest.data, digest_len)) {
@@ -492,7 +487,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
sym_op->auth.data.offset;
changed_len = sym_op->auth.data.length;
if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
- changed_len += sym_op->auth.digest.length;
+ changed_len += digest_len;
} else {
/* cipher-only */
head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
@@ -534,7 +529,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
}
if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
- changed_len += sym_op->auth.digest.length;
+ changed_len += digest_len;
if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
/* white-box test: PMDs use some of the
@@ -568,8 +563,10 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
error_exit:
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
- if (sess)
- rte_cryptodev_sym_session_free(dev_id, sess);
+ if (sess) {
+ rte_cryptodev_sym_session_clear(dev_id, sess);
+ rte_cryptodev_sym_session_free(sess);
+ }
if (cipher_xform)
rte_free(cipher_xform);
if (auth_xform)
@@ -591,8 +588,9 @@ error_exit:
int
test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
struct rte_mempool *op_mpool,
+ struct rte_mempool *sess_mpool,
uint8_t dev_id,
- enum rte_cryptodev_type cryptodev_type,
+ int driver_id,
enum blockcipher_test_type test_type)
{
int status, overall_status = TEST_SUCCESS;
@@ -602,6 +600,19 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
uint32_t target_pmd_mask = 0;
const struct blockcipher_test_case *tcs = NULL;
+ int openssl_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
+ int dpaa2_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
+ int scheduler_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
+ int armv8_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
+ int aesni_mb_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
+ int qat_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
+
switch (test_type) {
case BLKCIPHER_AES_CHAIN_TYPE:
n_test_cases = sizeof(aes_chain_test_cases) /
@@ -647,29 +658,20 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
break;
}
- switch (cryptodev_type) {
- case RTE_CRYPTODEV_AESNI_MB_PMD:
+ if (driver_id == aesni_mb_pmd)
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
- break;
- case RTE_CRYPTODEV_QAT_SYM_PMD:
+ else if (driver_id == qat_pmd)
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
- break;
- case RTE_CRYPTODEV_OPENSSL_PMD:
+ else if (driver_id == openssl_pmd)
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
- break;
- case RTE_CRYPTODEV_ARMV8_PMD:
+ else if (driver_id == armv8_pmd)
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8;
- break;
- case RTE_CRYPTODEV_SCHEDULER_PMD:
+ else if (driver_id == scheduler_pmd)
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER;
- break;
- case RTE_CRYPTODEV_DPAA2_SEC_PMD:
+ else if (driver_id == dpaa2_pmd)
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC;
- break;
- default:
+ else
TEST_ASSERT(0, "Unrecognized cryptodev type");
- break;
- }
for (i = 0; i < n_test_cases; i++) {
const struct blockcipher_test_case *tc = &tcs[i];
@@ -678,7 +680,7 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
continue;
status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
- dev_id, cryptodev_type, test_msg);
+ sess_mpool, dev_id, driver_id, test_msg);
printf(" %u) TestCase %s %s\n", test_index ++,
tc->test_descr, test_msg);
diff --git a/test/test/test_cryptodev_blockcipher.h b/test/test/test_cryptodev_blockcipher.h
index 004122f2..22b8d206 100644
--- a/test/test/test_cryptodev_blockcipher.h
+++ b/test/test/test_cryptodev_blockcipher.h
@@ -125,8 +125,9 @@ struct blockcipher_test_data {
int
test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
struct rte_mempool *op_mpool,
+ struct rte_mempool *sess_mpool,
uint8_t dev_id,
- enum rte_cryptodev_type cryptodev_type,
+ int driver_id,
enum blockcipher_test_type test_type);
#endif /* TEST_CRYPTODEV_BLOCKCIPHER_H_ */
diff --git a/test/test/test_cryptodev_des_test_vectors.h b/test/test/test_cryptodev_des_test_vectors.h
index b226794f..0b6e0b8d 100644
--- a/test/test/test_cryptodev_des_test_vectors.h
+++ b/test/test/test_cryptodev_des_test_vectors.h
@@ -1058,14 +1058,16 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
.test_data = &triple_des128cbc_hmac_sha1_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "3DES-128-CBC HMAC-SHA1 Decryption Digest Verify",
.test_data = &triple_des128cbc_hmac_sha1_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "3DES-128-CBC SHA1 Encryption Digest",
@@ -1084,14 +1086,16 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
.test_data = &triple_des192cbc_hmac_sha1_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "3DES-192-CBC HMAC-SHA1 Decryption Digest Verify",
.test_data = &triple_des192cbc_hmac_sha1_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "3DES-192-CBC SHA1 Encryption Digest",
@@ -1199,28 +1203,32 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
.test_data = &triple_des128cbc_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "3DES-128-CBC Decryption",
.test_data = &triple_des128cbc_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "3DES-192-CBC Encryption",
.test_data = &triple_des192cbc_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "3DES-192-CBC Decryption",
.test_data = &triple_des192cbc_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
},
{
.test_descr = "3DES-128-CTR Encryption",
diff --git a/test/test/test_cryptodev_gcm_test_vectors.h b/test/test/test_cryptodev_gcm_test_vectors.h
index 5764edb1..7879c35b 100644
--- a/test/test/test_cryptodev_gcm_test_vectors.h
+++ b/test/test/test_cryptodev_gcm_test_vectors.h
@@ -92,11 +92,6 @@ struct gmac_test_data {
struct {
uint8_t *data;
unsigned len;
- } aad;
-
- struct {
- uint8_t *data;
- unsigned len;
} plaintext;
struct {
@@ -1002,6 +997,363 @@ static const struct gcm_test_data gcm_test_case_8 = {
}
};
+/** AES-192 Test Vectors */
+static const struct gcm_test_data gcm_test_case_192_1 = {
+ .key = {
+ .data = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ },
+ .len = 24
+ },
+ .iv = {
+ .data = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ },
+ .len = 12
+ },
+ .aad = {
+ .data = gcm_aad_zero_text,
+ .len = 0
+ },
+ .plaintext = {
+ .data = { 0x00 },
+ .len = 0
+ },
+ .ciphertext = {
+ .data = { 0x00 },
+ .len = 0
+ },
+ .auth_tag = {
+ .data = {
+ 0xCD, 0x33, 0xB2, 0x8A, 0xC7, 0x73, 0xF7, 0x4B,
+ 0xA0, 0x0E, 0xD1, 0xF3, 0x12, 0x57, 0x24, 0x35
+ },
+ .len = 16
+ }
+};
+
+static const struct gcm_test_data gcm_test_case_192_2 = {
+ .key = {
+ .data = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ },
+ .len = 24
+ },
+ .iv = {
+ .data = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ },
+ .len = 12
+ },
+ .aad = {
+ .data = gcm_aad_zero_text,
+ .len = 0
+ },
+ .plaintext = {
+ .data = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ },
+ .len = 16
+ },
+ .ciphertext = {
+ .data = {
+ 0x98, 0xE7, 0x24, 0x7C, 0x07, 0xF0, 0xFE, 0x41,
+ 0x1C, 0x26, 0x7E, 0x43, 0x84, 0xB0, 0xF6, 0x00
+ },
+ .len = 16
+ },
+ .auth_tag = {
+ .data = {
+ 0x2F, 0xF5, 0x8D, 0x80, 0x03, 0x39, 0x27, 0xAB,
+ 0x8E, 0xF4, 0xD4, 0x58, 0x75, 0x14, 0xF0, 0xFB
+
+ },
+ .len = 16
+ }
+};
+
+static const struct gcm_test_data gcm_test_case_192_3 = {
+ .key = {
+ .data = {
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C,
+ 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C
+ },
+ .len = 24
+ },
+ .iv = {
+ .data = {
+ 0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD,
+ 0xDE, 0xCA, 0xF8, 0x88
+ },
+ .len = 12
+ },
+ .aad = {
+ .data = gcm_aad_zero_text,
+ .len = 0
+ },
+ .plaintext = {
+ .data = {
+ 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5,
+ 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26, 0x9A,
+ 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA,
+ 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31, 0x8A, 0x72,
+ 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2F, 0xCF, 0x0E, 0x24, 0x49, 0xA6, 0xB5, 0x25,
+ 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57,
+ 0xBA, 0x63, 0x7B, 0x39, 0x1A, 0xAF, 0xD2, 0x55
+ },
+ .len = 64
+ },
+ .ciphertext = {
+ .data = {
+ 0x39, 0x80, 0xCA, 0x0B, 0x3C, 0x00, 0xE8, 0x41,
+ 0xEB, 0x06, 0xFA, 0xC4, 0x87, 0x2A, 0x27, 0x57,
+ 0x85, 0x9E, 0x1C, 0xEA, 0xA6, 0xEF, 0xD9, 0x84,
+ 0x62, 0x85, 0x93, 0xB4, 0x0C, 0xA1, 0xE1, 0x9C,
+ 0x7D, 0x77, 0x3D, 0x00, 0xC1, 0x44, 0xC5, 0x25,
+ 0xAC, 0x61, 0x9D, 0x18, 0xC8, 0x4A, 0x3F, 0x47,
+ 0x18, 0xE2, 0x44, 0x8B, 0x2F, 0xE3, 0x24, 0xD9,
+ 0xCC, 0xDA, 0x27, 0x10, 0xAC, 0xAD, 0xE2, 0x56
+ },
+ .len = 64
+ },
+ .auth_tag = {
+ .data = {
+ 0x99, 0x24, 0xA7, 0xC8, 0x58, 0x73, 0x36, 0xBF,
+ 0xB1, 0x18, 0x02, 0x4D, 0xB8, 0x67, 0x4A, 0x14
+ },
+ .len = 16
+ }
+};
+
+static const struct gcm_test_data gcm_test_case_192_4 = {
+ .key = {
+ .data = {
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C,
+ 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C
+ },
+ .len = 24
+ },
+ .iv = {
+ .data = {
+ 0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD,
+ 0xDE, 0xCA, 0xF8, 0x88
+ },
+ .len = 12
+ },
+ .aad = {
+ .data = gcm_aad_zero_text,
+ .len = 8
+ },
+ .plaintext = {
+ .data = {
+ 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5,
+ 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26, 0x9A,
+ 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA,
+ 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31, 0x8A, 0x72,
+ 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2F, 0xCF, 0x0E, 0x24, 0x49, 0xA6, 0xB5, 0x25,
+ 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57,
+ 0xBA, 0x63, 0x7B, 0x39
+ },
+ .len = 60
+ },
+ .ciphertext = {
+ .data = {
+ 0x39, 0x80, 0xCA, 0x0B, 0x3C, 0x00, 0xE8, 0x41,
+ 0xEB, 0x06, 0xFA, 0xC4, 0x87, 0x2A, 0x27, 0x57,
+ 0x85, 0x9E, 0x1C, 0xEA, 0xA6, 0xEF, 0xD9, 0x84,
+ 0x62, 0x85, 0x93, 0xB4, 0x0C, 0xA1, 0xE1, 0x9C,
+ 0x7D, 0x77, 0x3D, 0x00, 0xC1, 0x44, 0xC5, 0x25,
+ 0xAC, 0x61, 0x9D, 0x18, 0xC8, 0x4A, 0x3F, 0x47,
+ 0x18, 0xE2, 0x44, 0x8B, 0x2F, 0xE3, 0x24, 0xD9,
+ 0xCC, 0xDA, 0x27, 0x10
+ },
+ .len = 60
+ },
+ .auth_tag = {
+ .data = {
+ 0x57, 0x5F, 0x03, 0xA0, 0x8D, 0x8F, 0x40, 0x26,
+ 0xE5, 0x64, 0x1F, 0x5B, 0x5C, 0xC2, 0xFD, 0x4B
+ },
+ .len = 16
+ }
+};
+
+static const struct gcm_test_data gcm_test_case_192_5 = {
+ .key = {
+ .data = {
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C,
+ 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C
+ },
+ .len = 24
+ },
+ .iv = {
+ .data = {
+ 0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD,
+ 0xDE, 0xCA, 0xF8, 0x88
+ },
+ .len = 12
+ },
+ .aad = {
+ .data = gcm_aad_text,
+ .len = 8
+ },
+ .plaintext = {
+ .data = {
+ 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5,
+ 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26, 0x9A,
+ 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA,
+ 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31, 0x8A, 0x72,
+ 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2F, 0xCF, 0x0E, 0x24, 0x49, 0xA6, 0xB5, 0x25,
+ 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57,
+ 0xBA, 0x63, 0x7B, 0x39
+ },
+ .len = 60
+ },
+ .ciphertext = {
+ .data = {
+ 0x39, 0x80, 0xCA, 0x0B, 0x3C, 0x00, 0xE8, 0x41,
+ 0xEB, 0x06, 0xFA, 0xC4, 0x87, 0x2A, 0x27, 0x57,
+ 0x85, 0x9E, 0x1C, 0xEA, 0xA6, 0xEF, 0xD9, 0x84,
+ 0x62, 0x85, 0x93, 0xB4, 0x0C, 0xA1, 0xE1, 0x9C,
+ 0x7D, 0x77, 0x3D, 0x00, 0xC1, 0x44, 0xC5, 0x25,
+ 0xAC, 0x61, 0x9D, 0x18, 0xC8, 0x4A, 0x3F, 0x47,
+ 0x18, 0xE2, 0x44, 0x8B, 0x2F, 0xE3, 0x24, 0xD9,
+ 0xCC, 0xDA, 0x27, 0x10
+ },
+ .len = 60
+ },
+ .auth_tag = {
+ .data = {
+ 0xB6, 0x35, 0x56, 0xE7, 0xBA, 0x46, 0xA3, 0x38,
+ 0xED, 0xAD, 0x79, 0x9F, 0xB3, 0x5B, 0x34, 0xA8
+ },
+ .len = 16
+ }
+};
+
+static const struct gcm_test_data gcm_test_case_192_6 = {
+ .key = {
+ .data = {
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C,
+ 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C
+ },
+ .len = 24
+ },
+ .iv = {
+ .data = {
+ 0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD,
+ 0xDE, 0xCA, 0xF8, 0x88
+ },
+ .len = 12
+ },
+ .aad = {
+ .data = gcm_aad_zero_text,
+ .len = 12
+ },
+ .plaintext = {
+ .data = {
+ 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5,
+ 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26, 0x9A,
+ 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA,
+ 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31, 0x8A, 0x72,
+ 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2F, 0xCF, 0x0E, 0x24, 0x49, 0xA6, 0xB5, 0x25,
+ 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57,
+ 0xBA, 0x63, 0x7B, 0x39
+ },
+ .len = 60
+ },
+ .ciphertext = {
+ .data = {
+ 0x39, 0x80, 0xCA, 0x0B, 0x3C, 0x00, 0xE8, 0x41,
+ 0xEB, 0x06, 0xFA, 0xC4, 0x87, 0x2A, 0x27, 0x57,
+ 0x85, 0x9E, 0x1C, 0xEA, 0xA6, 0xEF, 0xD9, 0x84,
+ 0x62, 0x85, 0x93, 0xB4, 0x0C, 0xA1, 0xE1, 0x9C,
+ 0x7D, 0x77, 0x3D, 0x00, 0xC1, 0x44, 0xC5, 0x25,
+ 0xAC, 0x61, 0x9D, 0x18, 0xC8, 0x4A, 0x3F, 0x47,
+ 0x18, 0xE2, 0x44, 0x8B, 0x2F, 0xE3, 0x24, 0xD9,
+ 0xCC, 0xDA, 0x27, 0x10
+ },
+ .len = 60
+ },
+ .auth_tag = {
+ .data = {
+ 0xCA, 0x8A, 0x8A, 0x91, 0x5A, 0xF9, 0x76, 0xE3,
+ 0xFF, 0x2C, 0xE4, 0x7D, 0xE5, 0x62, 0x75, 0x18
+ },
+ .len = 16
+ }
+};
+
+static const struct gcm_test_data gcm_test_case_192_7 = {
+ .key = {
+ .data = {
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C,
+ 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C
+ },
+ .len = 24
+ },
+ .iv = {
+ .data = {
+ 0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD,
+ 0xDE, 0xCA, 0xF8, 0x88
+ },
+ .len = 12
+ },
+ .aad = {
+ .data = gcm_aad_text,
+ .len = 12
+ },
+ .plaintext = {
+ .data = {
+ 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5,
+ 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26, 0x9A,
+ 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA,
+ 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31, 0x8A, 0x72,
+ 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2F, 0xCF, 0x0E, 0x24, 0x49, 0xA6, 0xB5, 0x25,
+ 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57,
+ 0xBA, 0x63, 0x7B, 0x39
+ },
+ .len = 60
+ },
+ .ciphertext = {
+ .data = {
+ 0x39, 0x80, 0xCA, 0x0B, 0x3C, 0x00, 0xE8, 0x41,
+ 0xEB, 0x06, 0xFA, 0xC4, 0x87, 0x2A, 0x27, 0x57,
+ 0x85, 0x9E, 0x1C, 0xEA, 0xA6, 0xEF, 0xD9, 0x84,
+ 0x62, 0x85, 0x93, 0xB4, 0x0C, 0xA1, 0xE1, 0x9C,
+ 0x7D, 0x77, 0x3D, 0x00, 0xC1, 0x44, 0xC5, 0x25,
+ 0xAC, 0x61, 0x9D, 0x18, 0xC8, 0x4A, 0x3F, 0x47,
+ 0x18, 0xE2, 0x44, 0x8B, 0x2F, 0xE3, 0x24, 0xD9,
+ 0xCC, 0xDA, 0x27, 0x10
+ },
+ .len = 60
+ },
+ .auth_tag = {
+ .data = {
+ 0xC2, 0xD8, 0x4C, 0x6B, 0xA8, 0x3B, 0xA5, 0x6B,
+ 0x18, 0x9F, 0xE6, 0xEF, 0x66, 0x24, 0xDD, 0xDA
+ },
+ .len = 16
+ }
+};
+
/** AES-256 Test Vectors */
static const struct gcm_test_data gcm_test_case_256_1 = {
.key = {
@@ -1484,14 +1836,10 @@ static const struct gmac_test_data gmac_test_case_1 = {
0xde, 0xca, 0xf8, 0x88 },
.len = 12
},
- .aad = {
+ .plaintext = {
.data = gmac_plaintext,
.len = 160
},
- .plaintext = {
- .data = NULL,
- .len = 0
- },
.gmac_tag = {
.data = {
0x4C, 0x0C, 0x4F, 0x47, 0x2D, 0x78, 0xF6, 0xD8,
@@ -1516,14 +1864,10 @@ static const struct gmac_test_data gmac_test_case_2 = {
0x55, 0x61, 0xf0, 0x43, 0x15, },
.len = 12
},
- .aad = {
+ .plaintext = {
.data = gmac_plaintext,
.len = 80
},
- .plaintext = {
- .data = NULL,
- .len = 0
- },
.gmac_tag = {
.data = {
0xCF, 0x82, 0x80, 0x64, 0x02, 0x46, 0xF4, 0xFB,
@@ -1550,14 +1894,10 @@ static const struct gmac_test_data gmac_test_case_3 = {
},
.len = 12
},
- .aad = {
+ .plaintext = {
.data = gmac_plaintext,
.len = 65
},
- .plaintext = {
- .data = NULL,
- .len = 0
- },
.gmac_tag = {
.data = {
0x77, 0x46, 0x0D, 0x6F, 0xB1, 0x87, 0xDB, 0xA9,
@@ -2214,14 +2554,10 @@ static const struct gmac_test_data gmac_test_case_4 = {
},
.len = 12
},
- .aad = {
+ .plaintext = {
.data = gmac_plaintext,
.len = GMAC_LARGE_PLAINTEXT_LENGTH
},
- .plaintext = {
- .data = NULL,
- .len = 0
- },
.gmac_tag = {
.data = {
0x3f, 0x07, 0xcb, 0xb9, 0x86, 0x3a, 0xea, 0xc2,
diff --git a/test/test/test_cryptodev_hash_test_vectors.h b/test/test/test_cryptodev_hash_test_vectors.h
index 3214f9a6..b7fe9d9c 100644
--- a/test/test/test_cryptodev_hash_test_vectors.h
+++ b/test/test/test_cryptodev_hash_test_vectors.h
@@ -366,7 +366,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "HMAC-MD5 Digest Verify",
@@ -374,7 +376,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "SHA1 Digest",
@@ -394,7 +398,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "HMAC-SHA1 Digest Verify",
@@ -402,7 +408,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "SHA224 Digest",
@@ -422,7 +430,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "HMAC-SHA224 Digest Verify",
@@ -430,7 +440,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "SHA256 Digest",
@@ -450,7 +462,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "HMAC-SHA256 Digest Verify",
@@ -458,7 +472,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "SHA384 Digest",
@@ -478,7 +494,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "HMAC-SHA384 Digest Verify",
@@ -486,7 +504,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "SHA512 Digest",
@@ -506,7 +526,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "HMAC-SHA512 Digest Verify",
@@ -514,7 +536,9 @@ static const struct blockcipher_test_case hash_test_cases[] = {
.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+ BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
};
diff --git a/test/test/test_cryptodev_kasumi_hash_test_vectors.h b/test/test/test_cryptodev_kasumi_hash_test_vectors.h
index 69742faa..a6dd4f5c 100644
--- a/test/test/test_cryptodev_kasumi_hash_test_vectors.h
+++ b/test/test/test_cryptodev_kasumi_hash_test_vectors.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,28 +39,16 @@ struct kasumi_hash_test_data {
unsigned len;
} key;
- /* Includes: COUNT (4 bytes) and FRESH (4 bytes) */
- struct {
- uint8_t data[8];
- unsigned len;
- } aad;
-
- /* Includes message and DIRECTION (1 bit), plus 1 0*,
- * with enough 0s, so total length is multiple of 64 bits */
+ /*
+ * Includes COUNT (4 bytes), FRESH (4 bytes), message
+ * and DIRECTION (1 bit), plus 1 0*, with enough 0s,
+ * so total length is multiple of 8 or 64 bits
+ */
struct {
uint8_t data[2056];
unsigned len; /* length must be in Bits */
} plaintext;
- /* Actual length of data to be hashed */
- struct {
- unsigned len;
- } validAuthLenInBits;
-
- struct {
- unsigned len;
- } validAuthOffsetLenInBits;
-
struct {
uint8_t data[64];
unsigned len;
@@ -75,25 +63,14 @@ struct kasumi_hash_test_data kasumi_hash_test_case_1 = {
},
.len = 16
},
- .aad = {
- .data = {
- 0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
- },
- .len = 8
- },
.plaintext = {
.data = {
+ 0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
0x6B, 0x22, 0x77, 0x37, 0x29, 0x6F, 0x39, 0x3C,
0x80, 0x79, 0x35, 0x3E, 0xDC, 0x87, 0xE2, 0xE8,
0x05, 0xD2, 0xEC, 0x49, 0xA4, 0xF2, 0xD8, 0xE2
},
- .len = 192
- },
- .validAuthLenInBits = {
- .len = 189
- },
- .validAuthOffsetLenInBits = {
- .len = 64
+ .len = 256
},
.digest = {
.data = {0xF6, 0x3B, 0xD7, 0x2C},
@@ -109,26 +86,15 @@ struct kasumi_hash_test_data kasumi_hash_test_case_2 = {
},
.len = 16
},
- .aad = {
- .data = {
- 0x3E, 0xDC, 0x87, 0xE2, 0xA4, 0xF2, 0xD8, 0xE2,
- },
- .len = 8
- },
.plaintext = {
.data = {
+ 0x3E, 0xDC, 0x87, 0xE2, 0xA4, 0xF2, 0xD8, 0xE2,
0xB5, 0x92, 0x43, 0x84, 0x32, 0x8A, 0x4A, 0xE0,
0x0B, 0x73, 0x71, 0x09, 0xF8, 0xB6, 0xC8, 0xDD,
0x2B, 0x4D, 0xB6, 0x3D, 0xD5, 0x33, 0x98, 0x1C,
0xEB, 0x19, 0xAA, 0xD5, 0x2A, 0x5B, 0x2B, 0xC3
},
- .len = 256
- },
- .validAuthLenInBits = {
- .len = 254
- },
- .validAuthOffsetLenInBits = {
- .len = 64
+ .len = 320
},
.digest = {
.data = {0xA9, 0xDA, 0xF1, 0xFF},
@@ -144,14 +110,9 @@ struct kasumi_hash_test_data kasumi_hash_test_case_3 = {
},
.len = 16
},
- .aad = {
- .data = {
- 0x36, 0xAF, 0x61, 0x44, 0x98, 0x38, 0xF0, 0x3A,
- },
- .len = 8
- },
.plaintext = {
.data = {
+ 0x36, 0xAF, 0x61, 0x44, 0x98, 0x38, 0xF0, 0x3A,
0x59, 0x32, 0xBC, 0x0A, 0xCE, 0x2B, 0x0A, 0xBA,
0x33, 0xD8, 0xAC, 0x18, 0x8A, 0xC5, 0x4F, 0x34,
0x6F, 0xAD, 0x10, 0xBF, 0x9D, 0xEE, 0x29, 0x20,
@@ -159,13 +120,7 @@ struct kasumi_hash_test_data kasumi_hash_test_case_3 = {
0xDF, 0x6C, 0xAA, 0x72, 0x05, 0x3A, 0xBF, 0xF3,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
},
- .len = 384
- },
- .validAuthLenInBits = {
- .len = 319
- },
- .validAuthOffsetLenInBits = {
- .len = 64
+ .len = 448
},
.digest = {
.data = {0x15, 0x37, 0xD3, 0x16},
@@ -181,14 +136,9 @@ struct kasumi_hash_test_data kasumi_hash_test_case_4 = {
},
.len = 16
},
- .aad = {
- .data = {
- 0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD
- },
- .len = 8
- },
.plaintext = {
.data = {
+ 0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
0xD0, 0xA7, 0xD4, 0x63, 0xDF, 0x9F, 0xB2, 0xB2,
0x78, 0x83, 0x3F, 0xA0, 0x2E, 0x23, 0x5A, 0xA1,
0x72, 0xBD, 0x97, 0x0C, 0x14, 0x73, 0xE1, 0x29,
@@ -197,13 +147,7 @@ struct kasumi_hash_test_data kasumi_hash_test_case_4 = {
0xA4, 0x99, 0x27, 0x6A, 0x50, 0x42, 0x70, 0x09,
0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
},
- .len = 448
- },
- .validAuthLenInBits = {
- .len = 384
- },
- .validAuthOffsetLenInBits = {
- .len = 64
+ .len = 512
},
.digest = {
.data = {0xDD, 0x7D, 0xFA, 0xDD },
@@ -219,14 +163,9 @@ struct kasumi_hash_test_data kasumi_hash_test_case_5 = {
},
.len = 16
},
- .aad = {
- .data = {
- 0x29, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0x77, 0x37,
- },
- .len = 8
- },
.plaintext = {
.data = {
+ 0x29, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0x77, 0x37,
0x10, 0xBF, 0xFF, 0x83, 0x9E, 0x0C, 0x71, 0x65,
0x8D, 0xBB, 0x2D, 0x17, 0x07, 0xE1, 0x45, 0x72,
0x4F, 0x41, 0xC1, 0x6F, 0x48, 0xBF, 0x40, 0x3C,
@@ -244,13 +183,7 @@ struct kasumi_hash_test_data kasumi_hash_test_case_5 = {
0x3D, 0x7C, 0xFE, 0xE9, 0x45, 0x85, 0xB5, 0x88,
0x5C, 0xAC, 0x46, 0x06, 0x8B, 0xC0, 0x00, 0x00
},
- .len = 1024
- },
- .validAuthLenInBits = {
- .len = 1000
- },
- .validAuthOffsetLenInBits = {
- .len = 64
+ .len = 1088
},
.digest = {
.data = {0xC3, 0x83, 0x83, 0x9D},
@@ -266,14 +199,9 @@ struct kasumi_hash_test_data kasumi_hash_test_case_6 = {
},
.len = 16
},
- .aad = {
- .data = {
- 0x36, 0xAF, 0x61, 0x44, 0x4F, 0x30, 0x2A, 0xD2
- },
- .len = 8
- },
.plaintext = {
.data = {
+ 0x36, 0xAF, 0x61, 0x44, 0x4F, 0x30, 0x2A, 0xD2,
0x35, 0xC6, 0x87, 0x16, 0x63, 0x3C, 0x66, 0xFB,
0x75, 0x0C, 0x26, 0x68, 0x65, 0xD5, 0x3C, 0x11,
0xEA, 0x05, 0xB1, 0xE9, 0xFA, 0x49, 0xC8, 0x39,
@@ -288,13 +216,7 @@ struct kasumi_hash_test_data kasumi_hash_test_case_6 = {
0x74, 0xCD, 0xA5, 0xA4, 0x85, 0xF7, 0x4D, 0x7A,
0xC0
},
- .len = 776
- },
- .validAuthLenInBits = {
- .len = 768
- },
- .validAuthOffsetLenInBits = {
- .len = 64
+ .len = 840
},
.digest = {
.data = {0x95, 0xAE, 0x41, 0xBA},
@@ -310,24 +232,13 @@ struct kasumi_hash_test_data kasumi_hash_test_case_7 = {
},
.len = 16
},
- .aad = {
- .data = {
- 0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
- },
- .len = 8
- },
.plaintext = {
.data = {
+ 0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
0xAD, 0x9C, 0x44, 0x1F, 0x89, 0x0B, 0x38, 0xC4,
0x57, 0xA4, 0x9D, 0x42, 0x14, 0x07, 0xE8, 0xC0
},
- .len = 128
- },
- .validAuthLenInBits = {
- .len = 120
- },
- .validAuthOffsetLenInBits = {
- .len = 64
+ .len = 192
},
.digest = {
.data = {0x87, 0x5F, 0xE4, 0x89},
diff --git a/test/test/test_cryptodev_kasumi_test_vectors.h b/test/test/test_cryptodev_kasumi_test_vectors.h
index ef1dc6f3..0d042d0b 100644
--- a/test/test/test_cryptodev_kasumi_test_vectors.h
+++ b/test/test/test_cryptodev_kasumi_test_vectors.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,16 +42,15 @@ struct kasumi_test_data {
struct {
uint8_t data[64] __rte_aligned(16);
unsigned len;
- } iv;
+ } cipher_iv;
- /* Includes: COUNT (4 bytes) and FRESH (4 bytes) */
+ /*
+ * Data may include COUNT (4 bytes), FRESH (4 bytes),
+ * DIRECTION (1 bit), plus 1 0*, with enough 0s,
+ * so total length is multiple of 8 or 64 bits
+ */
struct {
- uint8_t data[8];
- unsigned len;
- } aad;
-
- struct {
- uint8_t data[1024]; /* Data may include direction bit */
+ uint8_t data[1024];
unsigned len; /* length must be in Bits */
} plaintext;
@@ -69,8 +68,8 @@ struct kasumi_test_data {
} validCipherLenInBits;
struct {
- unsigned len;
- } validCipherOffsetLenInBits;
+ unsigned int len;
+ } validCipherOffsetInBits;
/* Actual length of data to be hashed */
struct {
@@ -78,10 +77,6 @@ struct kasumi_test_data {
} validAuthLenInBits;
struct {
- unsigned len;
- } validAuthOffsetLenInBits;
-
- struct {
uint8_t data[64];
unsigned len;
} digest;
@@ -96,7 +91,7 @@ struct kasumi_test_data kasumi_test_case_1 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00
},
@@ -141,9 +136,9 @@ struct kasumi_test_data kasumi_test_case_1 = {
.validCipherLenInBits = {
.len = 798
},
- .validCipherOffsetLenInBits = {
- .len = 64
- },
+ .validCipherOffsetInBits = {
+ .len = 0
+ }
};
struct kasumi_test_data kasumi_test_case_2 = {
@@ -154,7 +149,7 @@ struct kasumi_test_data kasumi_test_case_2 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xE2, 0x8B, 0xCF, 0x7B, 0xC0, 0x00, 0x00, 0x00
},
@@ -189,8 +184,8 @@ struct kasumi_test_data kasumi_test_case_2 = {
.validCipherLenInBits = {
.len = 510
},
- .validCipherOffsetLenInBits = {
- .len = 64
+ .validCipherOffsetInBits = {
+ .len = 0
}
};
@@ -202,45 +197,38 @@ struct kasumi_test_data kasumi_test_case_3 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
},
.len = 8
},
- .aad = {
- .data = {
- 0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49
- },
- .len = 8
- },
.plaintext = {
.data = {
+ 0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
0xAD, 0x9C, 0x44, 0x1F, 0x89, 0x0B, 0x38, 0xC4,
0x57, 0xA4, 0x9D, 0x42, 0x14, 0x07, 0xE8, 0xC0
},
- .len = 128
+ .len = 192
},
.ciphertext = {
.data = {
+ 0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
0x9B, 0xC9, 0x2C, 0xA8, 0x03, 0xC6, 0x7B, 0x28,
- 0xA1, 0x1A, 0x4B, 0xEE, 0x5A, 0x0C, 0x25
+ 0xA1, 0x1A, 0x4B, 0xEE, 0x5A, 0x0C, 0x25, 0xC0
},
- .len = 120
+ .len = 192
},
.validDataLenInBits = {
- .len = 128
+ .len = 192
},
.validCipherLenInBits = {
.len = 120
},
- .validCipherOffsetLenInBits = {
- .len = 64
- },
.validAuthLenInBits = {
- .len = 120
+ .len = 192
},
- .validAuthOffsetLenInBits = {
+ .validCipherOffsetInBits = {
.len = 64
},
.digest = {
@@ -257,7 +245,7 @@ struct kasumi_test_data kasumi_test_case_4 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x39, 0x8A, 0x59, 0xB4, 0x2C, 0x00, 0x00, 0x00,
},
@@ -284,8 +272,8 @@ struct kasumi_test_data kasumi_test_case_4 = {
.validCipherLenInBits = {
.len = 253
},
- .validCipherOffsetLenInBits = {
- .len = 64
+ .validCipherOffsetInBits = {
+ .len = 0
}
};
@@ -297,7 +285,7 @@ struct kasumi_test_data kasumi_test_case_5 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x72, 0xA4, 0xF2, 0x0F, 0x48, 0x00, 0x00, 0x00
},
@@ -344,9 +332,9 @@ struct kasumi_test_data kasumi_test_case_5 = {
.validCipherLenInBits = {
.len = 837
},
- .validCipherOffsetLenInBits = {
- .len = 64
- },
+ .validCipherOffsetInBits = {
+ .len = 0
+ }
};
struct kasumi_test_data kasumi_test_case_6 = {
@@ -357,51 +345,43 @@ struct kasumi_test_data kasumi_test_case_6 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
},
.len = 8
},
- .aad = {
- .data = {
- 0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49
- },
- .len = 8
- },
.plaintext = {
.data = {
+ 0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
0xAD, 0x9C, 0x44, 0x1F, 0x89, 0x0B, 0x38, 0xC4,
0x57, 0xA4, 0x9D, 0x42, 0x14, 0x07, 0xE8, 0xC0
},
- .len = 128
+ .len = 192
},
.ciphertext = {
.data = {
+ 0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
0x9B, 0xC9, 0x2C, 0xA8, 0x03, 0xC6, 0x7B, 0x28,
- 0xA1, 0x1A, 0x4B, 0xEE, 0x5A, 0x0C, 0x25
+ 0xA1, 0x1A, 0x4B, 0xEE, 0x5A, 0x0C, 0x25, 0xC0
},
- .len = 120
+ .len = 192
},
.validDataLenInBits = {
- .len = 128
+ .len = 192
},
.validCipherLenInBits = {
.len = 120
},
- .validCipherOffsetLenInBits = {
+ .validCipherOffsetInBits = {
.len = 64
},
.validAuthLenInBits = {
- .len = 120
- },
- .validAuthOffsetLenInBits = {
- .len = 64
+ .len = 192
},
.digest = {
.data = {0x0F, 0xD2, 0xAA, 0xB5},
.len = 4
}
};
-
#endif /* TEST_CRYPTODEV_KASUMI_TEST_VECTORS_H_ */
diff --git a/test/test/test_cryptodev_perf.c b/test/test/test_cryptodev_perf.c
index d60028db..3b57e6d0 100644
--- a/test/test/test_cryptodev_perf.c
+++ b/test/test/test_cryptodev_perf.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ * Copyright(c) 2015-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -43,6 +43,9 @@
#include "test_cryptodev.h"
#include "test_cryptodev_gcm_test_vectors.h"
+#define AES_CIPHER_IV_LENGTH 16
+#define TRIPLE_DES_CIPHER_IV_LENGTH 8
+#define AES_GCM_AAD_LENGTH 16
#define PERF_NUM_OPS_INFLIGHT (128)
#define DEFAULT_NUM_REQS_TO_SUBMIT (10000000)
@@ -50,6 +53,7 @@
struct crypto_testsuite_params {
struct rte_mempool *mbuf_mp;
struct rte_mempool *op_mpool;
+ struct rte_mempool *sess_mp;
uint16_t nb_queue_pairs;
@@ -62,16 +66,13 @@ enum chain_mode {
CIPHER_HASH,
HASH_CIPHER,
CIPHER_ONLY,
- HASH_ONLY
+ HASH_ONLY,
+ AEAD
};
struct symmetric_op {
- const uint8_t *iv_data;
- uint32_t iv_len;
-
const uint8_t *aad_data;
- uint32_t aad_len;
const uint8_t *p_data;
uint32_t p_len;
@@ -87,6 +88,7 @@ struct symmetric_op {
struct symmetric_session_attrs {
enum rte_crypto_cipher_operation cipher;
enum rte_crypto_auth_operation auth;
+ enum rte_crypto_aead_operation aead;
enum rte_crypto_cipher_algorithm cipher_algorithm;
const uint8_t *key_cipher_data;
@@ -96,9 +98,18 @@ struct symmetric_session_attrs {
const uint8_t *key_auth_data;
uint32_t key_auth_len;
+ enum rte_crypto_aead_algorithm aead_algorithm;
+ const uint8_t *key_aead_data;
+ uint32_t key_aead_len;
+
+ const uint8_t *iv_data;
+ uint16_t iv_len;
+ uint16_t aad_len;
uint32_t digest_len;
};
+static struct rte_cryptodev_sym_session *test_crypto_session;
+
#define ALIGN_POW2_ROUNDUP(num, align) \
(((num) + (align) - 1) & ~((align) - 1))
@@ -110,7 +121,6 @@ struct symmetric_session_attrs {
struct crypto_params {
uint8_t *aad;
- uint8_t *iv;
uint8_t *digest;
};
@@ -123,8 +133,9 @@ struct perf_test_params {
enum chain_mode chain;
enum rte_crypto_cipher_algorithm cipher_algo;
- unsigned cipher_key_length;
+ unsigned int key_length;
enum rte_crypto_auth_algorithm auth_algo;
+ enum rte_crypto_aead_algorithm aead_algo;
struct symmetric_session_attrs *session_attrs;
@@ -147,17 +158,18 @@ struct crypto_unittest_params {
uint8_t *digest;
};
-static struct rte_cryptodev_sym_session *
+static int
test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
enum rte_crypto_cipher_algorithm cipher_algo,
unsigned int cipher_key_len,
enum rte_crypto_auth_algorithm auth_algo);
-static struct rte_cryptodev_sym_session *
+static int
test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
enum rte_crypto_cipher_algorithm cipher_algo,
unsigned int cipher_key_len,
- enum rte_crypto_auth_algorithm auth_algo);
-static struct rte_cryptodev_sym_session *
+ enum rte_crypto_auth_algorithm auth_algo,
+ enum rte_crypto_aead_algorithm aead_algo);
+static int
test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
enum rte_crypto_cipher_algorithm cipher_algo,
unsigned int cipher_key_len,
@@ -167,20 +179,19 @@ static struct rte_mbuf *
test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz);
static inline struct rte_crypto_op *
test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess, unsigned data_len,
- unsigned digest_len);
+ struct rte_cryptodev_sym_session *sess, unsigned int data_len);
static inline struct rte_crypto_op *
test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- unsigned int digest_len, enum chain_mode chain);
+ enum chain_mode chain);
static inline struct rte_crypto_op *
test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- unsigned int digest_len, enum chain_mode chain __rte_unused);
+ enum chain_mode chain __rte_unused);
static inline struct rte_crypto_op *
test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m,
struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- unsigned int digest_len, enum chain_mode chain __rte_unused);
+ enum chain_mode chain __rte_unused);
static uint32_t get_auth_digest_length(enum rte_crypto_auth_algorithm algo);
@@ -191,78 +202,40 @@ static const char *chain_mode_name(enum chain_mode mode)
case HASH_CIPHER: return "hash_cipher"; break;
case CIPHER_ONLY: return "cipher_only"; break;
case HASH_ONLY: return "hash_only"; break;
+ case AEAD: return "aead"; break;
default: return ""; break;
}
}
-static const char *pmd_name(enum rte_cryptodev_type pmd)
+static const char *pmd_name(uint8_t driver_id)
{
- switch (pmd) {
- case RTE_CRYPTODEV_NULL_PMD: return RTE_STR(CRYPTODEV_NAME_NULL_PMD); break;
- case RTE_CRYPTODEV_AESNI_GCM_PMD:
+ uint8_t null_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD));
+ uint8_t dpaa2_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
+ uint8_t snow3g_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
+ uint8_t aesni_gcm_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
+ uint8_t aesni_mb_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
+ uint8_t qat_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
+
+ if (driver_id == null_pmd)
+ return RTE_STR(CRYPTODEV_NAME_NULL_PMD);
+ else if (driver_id == aesni_gcm_pmd)
return RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD);
- case RTE_CRYPTODEV_AESNI_MB_PMD:
+ else if (driver_id == aesni_mb_pmd)
return RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD);
- case RTE_CRYPTODEV_QAT_SYM_PMD:
+ else if (driver_id == qat_pmd)
return RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD);
- case RTE_CRYPTODEV_SNOW3G_PMD:
+ else if (driver_id == snow3g_pmd)
return RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD);
- case RTE_CRYPTODEV_DPAA2_SEC_PMD:
+ else if (driver_id == dpaa2_pmd)
return RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD);
- default:
+ else
return "";
- }
-}
-
-static const char *cipher_algo_name(enum rte_crypto_cipher_algorithm cipher_algo)
-{
- switch (cipher_algo) {
- case RTE_CRYPTO_CIPHER_NULL: return "NULL";
- case RTE_CRYPTO_CIPHER_3DES_CBC: return "3DES_CBC";
- case RTE_CRYPTO_CIPHER_3DES_CTR: return "3DES_CTR";
- case RTE_CRYPTO_CIPHER_3DES_ECB: return "3DES_ECB";
- case RTE_CRYPTO_CIPHER_AES_CBC: return "AES_CBC";
- case RTE_CRYPTO_CIPHER_AES_CCM: return "AES_CCM";
- case RTE_CRYPTO_CIPHER_AES_CTR: return "AES_CTR";
- case RTE_CRYPTO_CIPHER_AES_ECB: return "AES_ECB";
- case RTE_CRYPTO_CIPHER_AES_F8: return "AES_F8";
- case RTE_CRYPTO_CIPHER_AES_GCM: return "AES_GCM";
- case RTE_CRYPTO_CIPHER_AES_XTS: return "AES_XTS";
- case RTE_CRYPTO_CIPHER_ARC4: return "ARC4";
- case RTE_CRYPTO_CIPHER_KASUMI_F8: return "KASUMI_F8";
- case RTE_CRYPTO_CIPHER_SNOW3G_UEA2: return "SNOW3G_UEA2";
- case RTE_CRYPTO_CIPHER_ZUC_EEA3: return "ZUC_EEA3";
- default: return "Another cipher algo";
- }
-}
-
-static const char *auth_algo_name(enum rte_crypto_auth_algorithm auth_algo)
-{
- switch (auth_algo) {
- case RTE_CRYPTO_AUTH_NULL: return "NULL"; break;
- case RTE_CRYPTO_AUTH_AES_CBC_MAC: return "AES_CBC_MAC"; break;
- case RTE_CRYPTO_AUTH_AES_CCM: return "AES_CCM"; break;
- case RTE_CRYPTO_AUTH_AES_CMAC: return "AES_CMAC,"; break;
- case RTE_CRYPTO_AUTH_AES_GCM: return "AES_GCM"; break;
- case RTE_CRYPTO_AUTH_AES_GMAC: return "AES_GMAC"; break;
- case RTE_CRYPTO_AUTH_AES_XCBC_MAC: return "AES_XCBC_MAC"; break;
- case RTE_CRYPTO_AUTH_KASUMI_F9: return "KASUMI_F9"; break;
- case RTE_CRYPTO_AUTH_MD5: return "MD5"; break;
- case RTE_CRYPTO_AUTH_MD5_HMAC: return "MD5_HMAC,"; break;
- case RTE_CRYPTO_AUTH_SHA1: return "SHA1"; break;
- case RTE_CRYPTO_AUTH_SHA1_HMAC: return "SHA1_HMAC"; break;
- case RTE_CRYPTO_AUTH_SHA224: return "SHA224"; break;
- case RTE_CRYPTO_AUTH_SHA224_HMAC: return "SHA224_HMAC"; break;
- case RTE_CRYPTO_AUTH_SHA256: return "SHA256"; break;
- case RTE_CRYPTO_AUTH_SHA256_HMAC: return "SHA256_HMAC"; break;
- case RTE_CRYPTO_AUTH_SHA384: return "SHA384,"; break;
- case RTE_CRYPTO_AUTH_SHA384_HMAC: return "SHA384_HMAC,"; break;
- case RTE_CRYPTO_AUTH_SHA512: return "SHA512,"; break;
- case RTE_CRYPTO_AUTH_SHA512_HMAC: return "SHA512_HMAC,"; break;
- case RTE_CRYPTO_AUTH_SNOW3G_UIA2: return "SNOW3G_UIA2"; break;
- case RTE_CRYPTO_AUTH_ZUC_EIA3: return "RTE_CRYPTO_AUTH_ZUC_EIA3"; break;
- default: return "Another auth algo"; break;
- };
}
static struct rte_mbuf *
@@ -287,7 +260,7 @@ setup_test_string(struct rte_mempool *mpool,
static struct crypto_testsuite_params testsuite_params = { NULL };
static struct crypto_unittest_params unittest_params;
-static enum rte_cryptodev_type gbl_cryptodev_perftest_devtype;
+static int gbl_driver_id;
static int
testsuite_setup(void)
@@ -316,7 +289,8 @@ testsuite_setup(void)
RTE_CRYPTO_OP_TYPE_SYMMETRIC,
NUM_MBUFS, MBUF_CACHE_SIZE,
DEFAULT_NUM_XFORMS *
- sizeof(struct rte_crypto_sym_xform),
+ sizeof(struct rte_crypto_sym_xform) +
+ MAXIMUM_IV_LENGTH,
rte_socket_id());
if (ts_params->op_mpool == NULL) {
RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
@@ -324,13 +298,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_MB_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
if (nb_devs < 1) {
ret = rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
@@ -342,13 +314,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_GCM_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD)));
if (nb_devs < 1) {
ret = rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL);
@@ -360,13 +330,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)));
if (nb_devs < 1) {
ret = rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL);
@@ -378,14 +346,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(
- RTE_CRYPTODEV_OPENSSL_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)));
if (nb_devs < 1) {
ret = rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
@@ -398,14 +363,11 @@ testsuite_setup(void)
}
/* 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"
- " enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
-#endif
- nb_devs = rte_cryptodev_count_devtype(
- RTE_CRYPTODEV_ARMV8_PMD);
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ARMV8_PMD))) {
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)));
if (nb_devs < 1) {
ret = rte_vdev_init(
RTE_STR(CRYPTODEV_NAME_ARMV8_PMD),
@@ -417,14 +379,6 @@ testsuite_setup(void)
}
}
-#ifndef RTE_LIBRTE_PMD_QAT
- if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_QAT_SYM_PMD) {
- RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_QAT must be enabled "
- "in config file to run this testsuite.\n");
- return TEST_FAILED;
- }
-#endif
-
nb_devs = rte_cryptodev_count();
if (nb_devs < 1) {
RTE_LOG(ERR, USER1, "No crypto devices found?\n");
@@ -434,7 +388,7 @@ testsuite_setup(void)
/* Search for the first valid */
for (i = 0; i < nb_devs; i++) {
rte_cryptodev_info_get(i, &info);
- if (info.dev_type == gbl_cryptodev_perftest_devtype) {
+ if (info.driver_id == (uint8_t) gbl_driver_id) {
ts_params->dev_id = i;
valid_dev_id = 1;
break;
@@ -453,7 +407,20 @@ testsuite_setup(void)
ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
ts_params->conf.socket_id = SOCKET_ID_ANY;
- ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions;
+
+ unsigned int session_size = sizeof(struct rte_cryptodev_sym_session) +
+ rte_cryptodev_get_private_session_size(ts_params->dev_id);
+
+ ts_params->sess_mp = rte_mempool_create(
+ "test_sess_mp_perf",
+ info.sym.max_nb_sessions,
+ session_size,
+ 0, 0, NULL, NULL, NULL,
+ NULL, SOCKET_ID_ANY,
+ 0);
+
+ TEST_ASSERT_NOT_NULL(ts_params->sess_mp,
+ "session mempool allocation failed");
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->dev_id,
&ts_params->conf),
@@ -466,7 +433,8 @@ testsuite_setup(void)
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->dev_id, qp_id,
&ts_params->qp_conf,
- rte_cryptodev_socket_id(ts_params->dev_id)),
+ rte_cryptodev_socket_id(ts_params->dev_id),
+ ts_params->sess_mp),
"Failed to setup queue pair %u on cryptodev %u",
qp_id, ts_params->dev_id);
}
@@ -485,6 +453,12 @@ testsuite_teardown(void)
if (ts_params->op_mpool != NULL)
RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_OP POOL count %u\n",
rte_mempool_avail_count(ts_params->op_mpool));
+ /* Free session mempool */
+ if (ts_params->sess_mp != NULL) {
+ rte_mempool_free(ts_params->sess_mp);
+ ts_params->sess_mp = NULL;
+ }
+
}
static int
@@ -516,9 +490,11 @@ ut_teardown(void)
unsigned i;
/* free crypto session structure */
- if (ut_params->sess)
- rte_cryptodev_sym_session_free(ts_params->dev_id,
+ if (ut_params->sess) {
+ rte_cryptodev_sym_session_clear(ts_params->dev_id,
ut_params->sess);
+ rte_cryptodev_sym_session_free(ut_params->sess);
+ }
/* free crypto operation structure */
if (ut_params->op)
@@ -1984,7 +1960,8 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
ut_params->cipher_xform.cipher.key.data = aes_cbc_128_key;
ut_params->cipher_xform.cipher.key.length = CIPHER_IV_LENGTH_AES_CBC;
-
+ ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
+ ut_params->cipher_xform.cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
/* Setup HMAC Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -1997,10 +1974,13 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA256;
/* Create Crypto session*/
- ut_params->sess = rte_cryptodev_sym_session_create(ts_params->dev_id,
- &ut_params->cipher_xform);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
+ test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
+
+ rte_cryptodev_sym_session_init(ts_params->dev_id, test_crypto_session,
+ &ut_params->cipher_xform, ts_params->sess_mp);
+
+ TEST_ASSERT_NOT_NULL(test_crypto_session, "Session creation failed");
/* Generate Crypto op data structure(s) */
for (i = 0; i < num_to_submit ; i++) {
@@ -2022,26 +2002,19 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
rte_crypto_op_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC);
- rte_crypto_op_attach_sym_session(op, ut_params->sess);
+ rte_crypto_op_attach_sym_session(op, test_crypto_session);
op->sym->auth.digest.data = ut_params->digest;
op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
data_params[0].length);
- op->sym->auth.digest.length = DIGEST_BYTE_LENGTH_SHA256;
- op->sym->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC;
+ op->sym->auth.data.offset = 0;
op->sym->auth.data.length = data_params[0].length;
+ rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+ aes_cbc_128_iv, CIPHER_IV_LENGTH_AES_CBC);
- op->sym->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(m,
- CIPHER_IV_LENGTH_AES_CBC);
- op->sym->cipher.iv.phys_addr = rte_pktmbuf_mtophys(m);
- op->sym->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
-
- rte_memcpy(op->sym->cipher.iv.data, aes_cbc_128_iv,
- CIPHER_IV_LENGTH_AES_CBC);
-
- op->sym->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC;
+ op->sym->cipher.data.offset = 0;
op->sym->cipher.data.length = data_params[0].length;
op->sym->m_src = m;
@@ -2093,8 +2066,9 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
}
while (num_received != num_to_submit) {
- if (gbl_cryptodev_perftest_devtype ==
- RTE_CRYPTODEV_AESNI_MB_PMD)
+ if (gbl_driver_id ==
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)))
rte_cryptodev_enqueue_burst(dev_num, 0,
NULL, 0);
@@ -2139,9 +2113,12 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
}
/* Create Crypto session*/
- sess = test_perf_create_snow3g_session(ts_params->dev_id,
+ if (test_perf_create_snow3g_session(ts_params->dev_id,
pparams->chain, pparams->cipher_algo,
- pparams->cipher_key_length, pparams->auth_algo);
+ pparams->key_length, pparams->auth_algo) == 0)
+ sess = test_crypto_session;
+ else
+ sess = NULL;
TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
/* Generate Crypto op data structure(s)*/
@@ -2156,20 +2133,28 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
RTE_CRYPTO_OP_TYPE_SYMMETRIC);
TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
- op = test_perf_set_crypto_op_snow3g(op, m, sess, pparams->buf_size,
- get_auth_digest_length(pparams->auth_algo));
+ op = test_perf_set_crypto_op_snow3g(op, m, sess, pparams->buf_size);
TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
c_ops[i] = op;
}
- printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, auth_algo:%s, "
+ if (pparams->chain == AEAD)
+ printf("\nOn %s dev%u qp%u, %s, aead algo:%s, "
+ "Packet Size %u bytes",
+ pmd_name(gbl_driver_id),
+ ts_params->dev_id, 0,
+ chain_mode_name(pparams->chain),
+ rte_crypto_aead_algorithm_strings[pparams->aead_algo],
+ pparams->buf_size);
+ else
+ printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, auth_algo:%s, "
"Packet Size %u bytes",
- pmd_name(gbl_cryptodev_perftest_devtype),
+ pmd_name(gbl_driver_id),
ts_params->dev_id, 0,
chain_mode_name(pparams->chain),
- cipher_algo_name(pparams->cipher_algo),
- auth_algo_name(pparams->auth_algo),
+ rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
+ rte_crypto_auth_algorithm_strings[pparams->auth_algo],
pparams->buf_size);
printf("\nOps Tx\tOps Rx\tOps/burst ");
printf("Retries EmptyPolls\tIACycles/CyOp\tIACycles/Burst\tIACycles/Byte");
@@ -2209,8 +2194,9 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
}
while (num_ops_received != num_to_submit) {
- if (gbl_cryptodev_perftest_devtype ==
- RTE_CRYPTODEV_AESNI_MB_PMD)
+ if (gbl_driver_id ==
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)))
rte_cryptodev_enqueue_burst(ts_params->dev_id, 0,
NULL, 0);
start_cycles = rte_rdtsc_precise();
@@ -2236,7 +2222,10 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
rte_pktmbuf_free(c_ops[i]->sym->m_src);
rte_crypto_op_free(c_ops[i]);
}
- rte_cryptodev_sym_session_free(ts_params->dev_id, sess);
+
+ rte_cryptodev_sym_session_clear(ts_params->dev_id,
+ sess);
+ rte_cryptodev_sym_session_free(sess);
return TEST_SUCCESS;
}
@@ -2253,14 +2242,14 @@ test_perf_snow3G_vary_burst_size(void)
{
.chain = CIPHER_ONLY,
.cipher_algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_NULL,
},
{
.chain = HASH_ONLY,
.cipher_algo = RTE_CRYPTO_CIPHER_NULL,
.auth_algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
- .cipher_key_length = 16
+ .key_length = 16
},
};
@@ -2306,20 +2295,22 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
static struct rte_crypto_op *(*test_perf_set_crypto_op)
(struct rte_crypto_op *, struct rte_mbuf *,
struct rte_cryptodev_sym_session *,
- unsigned int, unsigned int,
+ unsigned int,
enum chain_mode);
- unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
-
if (rte_cryptodev_count() == 0) {
printf("\nNo crypto devices found. Is PMD build configured?\n");
return TEST_FAILED;
}
/* Create Crypto session*/
- sess = test_perf_create_openssl_session(ts_params->dev_id,
+ if (test_perf_create_openssl_session(ts_params->dev_id,
pparams->chain, pparams->cipher_algo,
- pparams->cipher_key_length, pparams->auth_algo);
+ pparams->key_length, pparams->auth_algo,
+ pparams->aead_algo) == 0)
+ sess = test_crypto_session;
+ else
+ sess = NULL;
TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
/* Generate Crypto op data structure(s)*/
@@ -2334,38 +2325,49 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
RTE_CRYPTO_OP_TYPE_SYMMETRIC);
TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
- switch (pparams->cipher_algo) {
- case RTE_CRYPTO_CIPHER_3DES_CBC:
- case RTE_CRYPTO_CIPHER_3DES_CTR:
- test_perf_set_crypto_op = test_perf_set_crypto_op_3des;
- break;
- case RTE_CRYPTO_CIPHER_AES_CBC:
- case RTE_CRYPTO_CIPHER_AES_CTR:
- test_perf_set_crypto_op = test_perf_set_crypto_op_aes;
- break;
- case RTE_CRYPTO_CIPHER_AES_GCM:
+ if (pparams->chain == AEAD)
test_perf_set_crypto_op =
test_perf_set_crypto_op_aes_gcm;
- break;
- default:
- return TEST_FAILED;
+ else {
+ switch (pparams->cipher_algo) {
+ case RTE_CRYPTO_CIPHER_3DES_CBC:
+ case RTE_CRYPTO_CIPHER_3DES_CTR:
+ test_perf_set_crypto_op = test_perf_set_crypto_op_3des;
+ break;
+ case RTE_CRYPTO_CIPHER_AES_CBC:
+ case RTE_CRYPTO_CIPHER_AES_CTR:
+ test_perf_set_crypto_op = test_perf_set_crypto_op_aes;
+ break;
+ default:
+ return TEST_FAILED;
+ }
}
op = test_perf_set_crypto_op(op, m, sess, pparams->buf_size,
- digest_length, pparams->chain);
+ pparams->chain);
TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
c_ops[i] = op;
}
- printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, cipher key length:%u, "
- "auth_algo:%s, Packet Size %u bytes",
- pmd_name(gbl_cryptodev_perftest_devtype),
+ if (pparams->chain == AEAD)
+ printf("\nOn %s dev%u qp%u, %s, aead_algo:%s, "
+ "key length:%u, Packet Size %u bytes",
+ pmd_name(gbl_driver_id),
+ ts_params->dev_id, 0,
+ chain_mode_name(pparams->chain),
+ rte_crypto_aead_algorithm_strings[pparams->aead_algo],
+ pparams->key_length,
+ pparams->buf_size);
+ else
+ printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, auth_algo:%s, "
+ "key length:%u, Packet Size %u bytes",
+ pmd_name(gbl_driver_id),
ts_params->dev_id, 0,
chain_mode_name(pparams->chain),
- cipher_algo_name(pparams->cipher_algo),
- pparams->cipher_key_length,
- auth_algo_name(pparams->auth_algo),
+ rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
+ rte_crypto_auth_algorithm_strings[pparams->auth_algo],
+ pparams->key_length,
pparams->buf_size);
printf("\nOps Tx\tOps Rx\tOps/burst ");
printf("Retries EmptyPolls\tIACycles/CyOp\tIACycles/Burst\t"
@@ -2440,7 +2442,9 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
rte_pktmbuf_free(c_ops[i]->sym->m_src);
rte_crypto_op_free(c_ops[i]);
}
- rte_cryptodev_sym_session_free(ts_params->dev_id, sess);
+
+ rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
+ rte_cryptodev_sym_session_free(sess);
return TEST_SUCCESS;
}
@@ -2461,18 +2465,18 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
static struct rte_cryptodev_sym_session *sess;
- unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
-
if (rte_cryptodev_count() == 0) {
printf("\nNo crypto devices found. Is PMD build configured?\n");
return TEST_FAILED;
}
/* Create Crypto session*/
- sess = test_perf_create_armv8_session(ts_params->dev_id,
+ if (test_perf_create_armv8_session(ts_params->dev_id,
pparams->chain, pparams->cipher_algo,
- pparams->cipher_key_length, pparams->auth_algo);
- TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
+ pparams->key_length, pparams->auth_algo) == 0)
+ sess = test_crypto_session;
+ else
+ sess = NULL;
/* Generate Crypto op data structure(s)*/
for (i = 0; i < num_to_submit ; i++) {
@@ -2487,7 +2491,7 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
op = test_perf_set_crypto_op_aes(op, m, sess, pparams->buf_size,
- digest_length, pparams->chain);
+ pparams->chain);
TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
c_ops[i] = op;
@@ -2495,12 +2499,12 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, cipher key length:%u, "
"auth_algo:%s, Packet Size %u bytes",
- pmd_name(gbl_cryptodev_perftest_devtype),
+ pmd_name(gbl_driver_id),
ts_params->dev_id, 0,
chain_mode_name(pparams->chain),
- cipher_algo_name(pparams->cipher_algo),
- pparams->cipher_key_length,
- auth_algo_name(pparams->auth_algo),
+ rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
+ pparams->key_length,
+ rte_crypto_auth_algorithm_strings[pparams->auth_algo],
pparams->buf_size);
printf("\nOps Tx\tOps Rx\tOps/burst ");
printf("Retries "
@@ -2593,8 +2597,6 @@ static uint32_t get_auth_key_max_length(enum rte_crypto_auth_algorithm algo)
return 128;
case RTE_CRYPTO_AUTH_SHA512_HMAC:
return 128;
- case RTE_CRYPTO_AUTH_AES_GCM:
- return 0;
default:
return 0;
}
@@ -2615,7 +2617,15 @@ static uint32_t get_auth_digest_length(enum rte_crypto_auth_algorithm algo)
return TRUNCATED_DIGEST_BYTE_LENGTH_SHA384;
case RTE_CRYPTO_AUTH_SHA512_HMAC:
return TRUNCATED_DIGEST_BYTE_LENGTH_SHA512;
- case RTE_CRYPTO_AUTH_AES_GCM:
+ default:
+ return 0;
+ }
+}
+
+static uint32_t get_aead_digest_length(enum rte_crypto_aead_algorithm algo)
+{
+ switch (algo) {
+ case RTE_CRYPTO_AEAD_AES_GCM:
return DIGEST_BYTE_LENGTH_AES_GCM;
default:
return 0;
@@ -2634,6 +2644,11 @@ static uint8_t aes_iv[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
+static uint8_t aes_gcm_aad[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
static uint8_t triple_des_key[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -2678,12 +2693,13 @@ static uint8_t snow3g_hash_key[] = {
0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E
};
-static struct rte_cryptodev_sym_session *
+static int
test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain,
enum rte_crypto_cipher_algorithm cipher_algo,
unsigned cipher_key_len,
enum rte_crypto_auth_algorithm auth_algo)
{
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
struct rte_crypto_sym_xform cipher_xform = { 0 };
struct rte_crypto_sym_xform auth_xform = { 0 };
@@ -2695,6 +2711,8 @@ test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain,
cipher_xform.cipher.key.data = aes_key;
cipher_xform.cipher.key.length = cipher_key_len;
+ cipher_xform.cipher.iv.offset = IV_OFFSET;
+ cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH;
if (chain != CIPHER_ONLY) {
/* Setup HMAC Parameters */
auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -2705,33 +2723,42 @@ test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain,
auth_xform.auth.digest_length =
get_auth_digest_length(auth_algo);
}
+
+ test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
switch (chain) {
case CIPHER_HASH:
cipher_xform.next = &auth_xform;
auth_xform.next = NULL;
/* Create Crypto session*/
- return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &cipher_xform,
+ ts_params->sess_mp);
case HASH_CIPHER:
auth_xform.next = &cipher_xform;
cipher_xform.next = NULL;
/* Create Crypto session*/
- return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &auth_xform,
+ ts_params->sess_mp);
case CIPHER_ONLY:
cipher_xform.next = NULL;
/* Create Crypto session*/
- return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &cipher_xform,
+ ts_params->sess_mp);
default:
- return NULL;
+ return -1;
}
}
#define SNOW3G_CIPHER_IV_LENGTH 16
-static struct rte_cryptodev_sym_session *
+static int
test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
enum rte_crypto_cipher_algorithm cipher_algo, unsigned cipher_key_len,
enum rte_crypto_auth_algorithm auth_algo)
{
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
struct rte_crypto_sym_xform cipher_xform = {0};
struct rte_crypto_sym_xform auth_xform = {0};
@@ -2743,112 +2770,160 @@ test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
cipher_xform.cipher.key.data = snow3g_cipher_key;
cipher_xform.cipher.key.length = cipher_key_len;
+ cipher_xform.cipher.iv.offset = IV_OFFSET;
+ cipher_xform.cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH;
+
/* Setup HMAC Parameters */
auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
auth_xform.auth.algo = auth_algo;
- auth_xform.auth.add_auth_data_length = SNOW3G_CIPHER_IV_LENGTH;
auth_xform.auth.key.data = snow3g_hash_key;
auth_xform.auth.key.length = get_auth_key_max_length(auth_algo);
auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
+ /* Auth IV will be after cipher IV */
+ auth_xform.auth.iv.offset = IV_OFFSET + SNOW3G_CIPHER_IV_LENGTH;
+ auth_xform.auth.iv.length = SNOW3G_CIPHER_IV_LENGTH;
+ test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
switch (chain) {
case CIPHER_HASH:
cipher_xform.next = &auth_xform;
auth_xform.next = NULL;
/* Create Crypto session*/
- return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &cipher_xform,
+ ts_params->sess_mp);
case HASH_CIPHER:
auth_xform.next = &cipher_xform;
cipher_xform.next = NULL;
/* Create Crypto session*/
- return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &auth_xform,
+ ts_params->sess_mp);
case CIPHER_ONLY:
cipher_xform.next = NULL;
/* Create Crypto session*/
- return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &cipher_xform,
+ ts_params->sess_mp);
case HASH_ONLY:
auth_xform.next = NULL;
/* Create Crypto session */
- return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &auth_xform,
+ ts_params->sess_mp);
default:
- return NULL;
+ return -1;
}
}
-static struct rte_cryptodev_sym_session *
+static int
test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
enum rte_crypto_cipher_algorithm cipher_algo,
- unsigned int cipher_key_len,
- enum rte_crypto_auth_algorithm auth_algo)
+ unsigned int key_len,
+ enum rte_crypto_auth_algorithm auth_algo,
+ enum rte_crypto_aead_algorithm aead_algo)
{
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
struct rte_crypto_sym_xform cipher_xform = { 0 };
struct rte_crypto_sym_xform auth_xform = { 0 };
+ struct rte_crypto_sym_xform aead_xform = { 0 };
- /* Setup Cipher Parameters */
- cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- cipher_xform.cipher.algo = cipher_algo;
- cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+ if (chain == CIPHER_HASH || chain == HASH_CIPHER) {
+ /* Setup Cipher Parameters */
+ cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cipher_xform.cipher.algo = cipher_algo;
+ cipher_xform.cipher.iv.offset = IV_OFFSET;
+ cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
- switch (cipher_algo) {
- case RTE_CRYPTO_CIPHER_3DES_CBC:
- case RTE_CRYPTO_CIPHER_3DES_CTR:
- cipher_xform.cipher.key.data = triple_des_key;
- break;
- case RTE_CRYPTO_CIPHER_AES_CBC:
- case RTE_CRYPTO_CIPHER_AES_CTR:
- case RTE_CRYPTO_CIPHER_AES_GCM:
- cipher_xform.cipher.key.data = aes_key;
- break;
- default:
- return NULL;
- }
+ switch (cipher_algo) {
+ case RTE_CRYPTO_CIPHER_3DES_CBC:
+ case RTE_CRYPTO_CIPHER_3DES_CTR:
+ cipher_xform.cipher.key.data = triple_des_key;
+ cipher_xform.cipher.iv.length = TRIPLE_DES_CIPHER_IV_LENGTH;
+ break;
+ case RTE_CRYPTO_CIPHER_AES_CBC:
+ case RTE_CRYPTO_CIPHER_AES_CTR:
+ cipher_xform.cipher.key.data = aes_key;
+ cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH;
+ break;
+ default:
+ return -1;
+ }
- cipher_xform.cipher.key.length = cipher_key_len;
+ cipher_xform.cipher.key.length = key_len;
- /* Setup Auth Parameters */
- auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- auth_xform.auth.algo = auth_algo;
+ /* Setup Auth Parameters */
+ auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
+ auth_xform.auth.algo = auth_algo;
- switch (auth_algo) {
- case RTE_CRYPTO_AUTH_SHA1_HMAC:
- auth_xform.auth.key.data = hmac_sha_key;
- break;
- case RTE_CRYPTO_AUTH_AES_GCM:
- auth_xform.auth.key.data = NULL;
- break;
- default:
- return NULL;
- }
+ switch (auth_algo) {
+ case RTE_CRYPTO_AUTH_SHA1_HMAC:
+ auth_xform.auth.key.data = hmac_sha_key;
+ break;
+ default:
+ return -1;
+ }
- auth_xform.auth.key.length = get_auth_key_max_length(auth_algo);
- auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
+ auth_xform.auth.key.length = get_auth_key_max_length(auth_algo);
+ auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
+ } else if (chain == AEAD) {
+ /* Setup AEAD Parameters */
+ aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
+ aead_xform.aead.op = RTE_CRYPTO_AEAD_OP_ENCRYPT;
+ aead_xform.aead.algo = aead_algo;
+ aead_xform.aead.iv.offset = IV_OFFSET;
+
+ switch (aead_algo) {
+ case RTE_CRYPTO_AEAD_AES_GCM:
+ aead_xform.aead.key.data = aes_key;
+ aead_xform.aead.iv.length = AES_CIPHER_IV_LENGTH;
+ aead_xform.aead.aad_length = AES_GCM_AAD_LENGTH;
+ aead_xform.aead.digest_length = get_aead_digest_length(aead_algo);
+ break;
+ default:
+ return -1;
+ }
+ aead_xform.aead.key.length = key_len;
+ }
+
+ test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
switch (chain) {
case CIPHER_HASH:
cipher_xform.next = &auth_xform;
auth_xform.next = NULL;
/* Create Crypto session*/
- return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &cipher_xform,
+ ts_params->sess_mp);
case HASH_CIPHER:
auth_xform.next = &cipher_xform;
cipher_xform.next = NULL;
/* Create Crypto session*/
- return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &auth_xform,
+ ts_params->sess_mp);
+ case AEAD:
+ /* Create Crypto session*/
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &aead_xform,
+ ts_params->sess_mp);
default:
- return NULL;
+ return -1;
}
}
-static struct rte_cryptodev_sym_session *
+static int
test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
enum rte_crypto_cipher_algorithm cipher_algo,
unsigned int cipher_key_len,
enum rte_crypto_auth_algorithm auth_algo)
{
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
struct rte_crypto_sym_xform cipher_xform = { 0 };
struct rte_crypto_sym_xform auth_xform = { 0 };
@@ -2861,10 +2936,12 @@ test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
cipher_xform.cipher.key.data = aes_cbc_128_key;
break;
default:
- return NULL;
+ return -1;
}
cipher_xform.cipher.key.length = cipher_key_len;
+ cipher_xform.cipher.iv.offset = IV_OFFSET;
+ cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH;
/* Setup Auth Parameters */
auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -2873,6 +2950,8 @@ test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
+ test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
+
switch (chain) {
case CIPHER_HASH:
cipher_xform.next = &auth_xform;
@@ -2880,25 +2959,23 @@ test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
/* Encrypt and hash the result */
cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
/* Create Crypto session*/
- return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &cipher_xform,
+ ts_params->sess_mp);
case HASH_CIPHER:
auth_xform.next = &cipher_xform;
cipher_xform.next = NULL;
/* Hash encrypted message and decrypt */
cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
/* Create Crypto session*/
- return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
+ return rte_cryptodev_sym_session_init(dev_id,
+ test_crypto_session, &auth_xform,
+ ts_params->sess_mp);
default:
- return NULL;
+ return -1;
}
}
-#define AES_BLOCK_SIZE 16
-#define AES_CIPHER_IV_LENGTH 16
-
-#define TRIPLE_DES_BLOCK_SIZE 8
-#define TRIPLE_DES_CIPHER_IV_LENGTH 8
-
static struct rte_mbuf *
test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz)
{
@@ -2917,7 +2994,7 @@ test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz)
static inline struct rte_crypto_op *
test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- unsigned int digest_len, enum chain_mode chain)
+ enum chain_mode chain)
{
if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
rte_crypto_op_free(op);
@@ -2928,32 +3005,24 @@ test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
if (chain == CIPHER_ONLY) {
op->sym->auth.digest.data = NULL;
op->sym->auth.digest.phys_addr = 0;
- op->sym->auth.digest.length = 0;
- op->sym->auth.aad.data = NULL;
- op->sym->auth.aad.length = 0;
op->sym->auth.data.offset = 0;
op->sym->auth.data.length = 0;
} else {
op->sym->auth.digest.data = rte_pktmbuf_mtod_offset(m,
- uint8_t *, AES_CIPHER_IV_LENGTH + data_len);
+ uint8_t *, data_len);
op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
- AES_CIPHER_IV_LENGTH + data_len);
- op->sym->auth.digest.length = digest_len;
- op->sym->auth.aad.data = aes_iv;
- op->sym->auth.aad.length = AES_CIPHER_IV_LENGTH;
- op->sym->auth.data.offset = AES_CIPHER_IV_LENGTH;
+ data_len);
+ op->sym->auth.data.offset = 0;
op->sym->auth.data.length = data_len;
}
- /* Cipher Parameters */
- op->sym->cipher.iv.data = rte_pktmbuf_mtod(m, uint8_t *);
- op->sym->cipher.iv.phys_addr = rte_pktmbuf_mtophys(m);
- op->sym->cipher.iv.length = AES_CIPHER_IV_LENGTH;
-
- rte_memcpy(op->sym->cipher.iv.data, aes_iv, AES_CIPHER_IV_LENGTH);
+ /* Copy the IV at the end of the crypto operation */
+ rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+ aes_iv, AES_CIPHER_IV_LENGTH);
- op->sym->cipher.data.offset = AES_CIPHER_IV_LENGTH;
+ /* Cipher Parameters */
+ op->sym->cipher.data.offset = 0;
op->sym->cipher.data.length = data_len;
op->sym->m_src = m;
@@ -2964,7 +3033,7 @@ test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
static inline struct rte_crypto_op *
test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- unsigned int digest_len, enum chain_mode chain __rte_unused)
+ enum chain_mode chain __rte_unused)
{
if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
rte_crypto_op_free(op);
@@ -2972,24 +3041,19 @@ test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
}
/* Authentication Parameters */
- op->sym->auth.digest.data = (uint8_t *)m->buf_addr +
+ op->sym->aead.digest.data = (uint8_t *)m->buf_addr +
(m->data_off + data_len);
- op->sym->auth.digest.phys_addr =
+ op->sym->aead.digest.phys_addr =
rte_pktmbuf_mtophys_offset(m, data_len);
- op->sym->auth.digest.length = digest_len;
- op->sym->auth.aad.data = aes_iv;
- op->sym->auth.aad.length = AES_CIPHER_IV_LENGTH;
+ op->sym->aead.aad.data = aes_gcm_aad;
- /* Cipher Parameters */
- op->sym->cipher.iv.data = aes_iv;
- op->sym->cipher.iv.length = AES_CIPHER_IV_LENGTH;
+ /* Copy IV at the end of the crypto operation */
+ rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+ aes_iv, AES_CIPHER_IV_LENGTH);
/* Data lengths/offsets Parameters */
- op->sym->auth.data.offset = AES_BLOCK_SIZE;
- op->sym->auth.data.length = data_len - AES_BLOCK_SIZE;
-
- op->sym->cipher.data.offset = AES_BLOCK_SIZE;
- op->sym->cipher.data.length = data_len - AES_BLOCK_SIZE;
+ op->sym->aead.data.offset = 0;
+ op->sym->aead.data.length = data_len;
op->sym->m_src = m;
@@ -2998,26 +3062,23 @@ test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
static inline struct rte_crypto_op *
test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess, unsigned data_len,
- unsigned digest_len)
+ struct rte_cryptodev_sym_session *sess, unsigned int data_len)
{
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op,
+ uint8_t *, IV_OFFSET);
+
if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
rte_crypto_op_free(op);
return NULL;
}
+ rte_memcpy(iv_ptr, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
+
/* Authentication Parameters */
op->sym->auth.digest.data = (uint8_t *)m->buf_addr +
(m->data_off + data_len);
op->sym->auth.digest.phys_addr =
rte_pktmbuf_mtophys_offset(m, data_len);
- op->sym->auth.digest.length = digest_len;
- op->sym->auth.aad.data = snow3g_iv;
- op->sym->auth.aad.length = SNOW3G_CIPHER_IV_LENGTH;
-
- /* Cipher Parameters */
- op->sym->cipher.iv.data = snow3g_iv;
- op->sym->cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH;
/* Data lengths/offsets Parameters */
op->sym->auth.data.offset = 0;
@@ -3042,15 +3103,18 @@ test_perf_set_crypto_op_snow3g_cipher(struct rte_crypto_op *op,
return NULL;
}
- /* Cipher Parameters */
- op->sym->cipher.iv.data = rte_pktmbuf_mtod(m, uint8_t *);
- op->sym->cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH;
- rte_memcpy(op->sym->cipher.iv.data, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
- op->sym->cipher.iv.phys_addr = rte_pktmbuf_mtophys(m);
+ /* Copy IV at the end of the crypto operation */
+ rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+ snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
- op->sym->cipher.data.offset = SNOW3G_CIPHER_IV_LENGTH;
+ /* Cipher Parameters */
+ op->sym->cipher.data.offset = 0;
op->sym->cipher.data.length = data_len << 3;
+ rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+ snow3g_iv,
+ SNOW3G_CIPHER_IV_LENGTH);
+
op->sym->m_src = m;
return op;
@@ -3061,14 +3125,18 @@ static inline struct rte_crypto_op *
test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op,
struct rte_mbuf *m,
struct rte_cryptodev_sym_session *sess,
- unsigned data_len,
- unsigned digest_len)
+ unsigned int data_len)
{
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op,
+ uint8_t *, IV_OFFSET);
+
if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
rte_crypto_op_free(op);
return NULL;
}
+ rte_memcpy(iv_ptr, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
+
/* Authentication Parameters */
op->sym->auth.digest.data =
@@ -3077,15 +3145,9 @@ test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op,
op->sym->auth.digest.phys_addr =
rte_pktmbuf_mtophys_offset(m, data_len +
SNOW3G_CIPHER_IV_LENGTH);
- op->sym->auth.digest.length = digest_len;
- op->sym->auth.aad.data = rte_pktmbuf_mtod(m, uint8_t *);
- op->sym->auth.aad.length = SNOW3G_CIPHER_IV_LENGTH;
- rte_memcpy(op->sym->auth.aad.data, snow3g_iv,
- SNOW3G_CIPHER_IV_LENGTH);
- op->sym->auth.aad.phys_addr = rte_pktmbuf_mtophys(m);
/* Data lengths/offsets Parameters */
- op->sym->auth.data.offset = SNOW3G_CIPHER_IV_LENGTH;
+ op->sym->auth.data.offset = 0;
op->sym->auth.data.length = data_len << 3;
op->sym->m_src = m;
@@ -3097,7 +3159,7 @@ test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op,
static inline struct rte_crypto_op *
test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m,
struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- unsigned int digest_len, enum chain_mode chain __rte_unused)
+ enum chain_mode chain __rte_unused)
{
if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
rte_crypto_op_free(op);
@@ -3109,20 +3171,17 @@ test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m,
(m->data_off + data_len);
op->sym->auth.digest.phys_addr =
rte_pktmbuf_mtophys_offset(m, data_len);
- op->sym->auth.digest.length = digest_len;
- op->sym->auth.aad.data = triple_des_iv;
- op->sym->auth.aad.length = TRIPLE_DES_CIPHER_IV_LENGTH;
- /* Cipher Parameters */
- op->sym->cipher.iv.data = triple_des_iv;
- op->sym->cipher.iv.length = TRIPLE_DES_CIPHER_IV_LENGTH;
+ /* Copy IV at the end of the crypto operation */
+ rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+ triple_des_iv, TRIPLE_DES_CIPHER_IV_LENGTH);
/* Data lengths/offsets Parameters */
op->sym->auth.data.offset = 0;
op->sym->auth.data.length = data_len;
- op->sym->cipher.data.offset = TRIPLE_DES_BLOCK_SIZE;
- op->sym->cipher.data.length = data_len - TRIPLE_DES_BLOCK_SIZE;
+ op->sym->cipher.data.offset = 0;
+ op->sym->cipher.data.length = data_len;
op->sym->m_src = m;
@@ -3163,9 +3222,12 @@ test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
}
/* Create Crypto session*/
- sess = test_perf_create_aes_sha_session(ts_params->dev_id,
+ if (test_perf_create_aes_sha_session(ts_params->dev_id,
pparams->chain, pparams->cipher_algo,
- pparams->cipher_key_length, pparams->auth_algo);
+ pparams->key_length, pparams->auth_algo) == 0)
+ sess = test_crypto_session;
+ else
+ sess = NULL;
TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
/* Generate a burst of crypto operations */
@@ -3181,10 +3243,9 @@ test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
return -1;
}
- /* Make room for Digest and IV in mbuf */
+ /* Make room for Digest in mbuf */
if (pparams->chain != CIPHER_ONLY)
rte_pktmbuf_append(mbufs[i], digest_length);
- rte_pktmbuf_prepend(mbufs[i], AES_CIPHER_IV_LENGTH);
}
@@ -3205,7 +3266,7 @@ test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
ops[i] = test_perf_set_crypto_op_aes(ops[i],
mbufs[i + (pparams->burst_size *
(j % NUM_MBUF_SETS))],
- sess, pparams->buf_size, digest_length,
+ sess, pparams->buf_size,
pparams->chain);
/* enqueue burst */
@@ -3261,7 +3322,9 @@ test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
rte_pktmbuf_free(mbufs[i]);
- rte_cryptodev_sym_session_free(dev_id, sess);
+
+ rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
+ rte_cryptodev_sym_session_free(sess);
printf("\n");
return TEST_SUCCESS;
@@ -3297,20 +3360,23 @@ test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
}
/* Create Crypto session*/
- sess = test_perf_create_snow3g_session(ts_params->dev_id,
+ if (test_perf_create_snow3g_session(ts_params->dev_id,
pparams->chain, pparams->cipher_algo,
- pparams->cipher_key_length, pparams->auth_algo);
+ pparams->key_length, pparams->auth_algo) == 0)
+ sess = test_crypto_session;
+ else
+ sess = NULL;
TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
/* Generate a burst of crypto operations */
for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
/*
- * Buffer size + iv/aad len is allocated, for perf tests they
+ * Buffer size is allocated, for perf tests they
* are equal + digest len.
*/
mbufs[i] = test_perf_create_pktmbuf(
ts_params->mbuf_mp,
- pparams->buf_size + SNOW3G_CIPHER_IV_LENGTH +
+ pparams->buf_size +
digest_length);
if (mbufs[i] == NULL) {
@@ -3347,7 +3413,7 @@ test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
mbufs[i +
(pparams->burst_size * (j % NUM_MBUF_SETS))],
sess,
- pparams->buf_size, digest_length);
+ pparams->buf_size);
else if (pparams->chain == CIPHER_ONLY)
ops[i+op_offset] =
test_perf_set_crypto_op_snow3g_cipher(ops[i+op_offset],
@@ -3410,7 +3476,8 @@ test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
double cycles_B = cycles_buff / pparams->buf_size;
double throughput = (ops_s * pparams->buf_size * 8) / 1000000;
- if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_QAT_SYM_PMD) {
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD))) {
/* Cycle count misleading on HW devices for this test, so don't print */
printf("%4u\t%6.2f\t%10.2f\t n/a \t\t n/a "
"\t\t n/a \t\t%8"PRIu64"\t%8"PRIu64,
@@ -3425,7 +3492,9 @@ test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
rte_pktmbuf_free(mbufs[i]);
- rte_cryptodev_sym_session_free(dev_id, sess);
+
+ rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
+ rte_cryptodev_sym_session_free(sess);
printf("\n");
return TEST_SUCCESS;
@@ -3443,8 +3512,6 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
uint64_t processed = 0, failed_polls = 0, retries = 0;
uint64_t tsc_start = 0, tsc_end = 0;
- unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
-
struct rte_crypto_op *ops[pparams->burst_size];
struct rte_crypto_op *proc_ops[pparams->burst_size];
@@ -3457,23 +3524,25 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
static struct rte_crypto_op *(*test_perf_set_crypto_op)
(struct rte_crypto_op *, struct rte_mbuf *,
struct rte_cryptodev_sym_session *,
- unsigned int, unsigned int,
+ unsigned int,
enum chain_mode);
- switch (pparams->cipher_algo) {
- case RTE_CRYPTO_CIPHER_3DES_CBC:
- case RTE_CRYPTO_CIPHER_3DES_CTR:
- test_perf_set_crypto_op = test_perf_set_crypto_op_3des;
- break;
- case RTE_CRYPTO_CIPHER_AES_CBC:
- case RTE_CRYPTO_CIPHER_AES_CTR:
- test_perf_set_crypto_op = test_perf_set_crypto_op_aes;
- break;
- case RTE_CRYPTO_CIPHER_AES_GCM:
- test_perf_set_crypto_op = test_perf_set_crypto_op_aes_gcm;
- break;
- default:
- return TEST_FAILED;
+ if (pparams->chain == AEAD)
+ test_perf_set_crypto_op =
+ test_perf_set_crypto_op_aes_gcm;
+ else {
+ switch (pparams->cipher_algo) {
+ case RTE_CRYPTO_CIPHER_3DES_CBC:
+ case RTE_CRYPTO_CIPHER_3DES_CTR:
+ test_perf_set_crypto_op = test_perf_set_crypto_op_3des;
+ break;
+ case RTE_CRYPTO_CIPHER_AES_CBC:
+ case RTE_CRYPTO_CIPHER_AES_CTR:
+ test_perf_set_crypto_op = test_perf_set_crypto_op_aes;
+ break;
+ default:
+ return TEST_FAILED;
+ }
}
if (rte_cryptodev_count() == 0) {
@@ -3482,9 +3551,13 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
}
/* Create Crypto session*/
- sess = test_perf_create_openssl_session(ts_params->dev_id,
+ if (test_perf_create_openssl_session(ts_params->dev_id,
pparams->chain, pparams->cipher_algo,
- pparams->cipher_key_length, pparams->auth_algo);
+ pparams->key_length, pparams->auth_algo,
+ pparams->aead_algo) == 0)
+ sess = test_crypto_session;
+ else
+ sess = NULL;
TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
/* Generate a burst of crypto operations */
@@ -3519,7 +3592,7 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
ops[i] = test_perf_set_crypto_op(ops[i],
mbufs[i + (pparams->burst_size *
(j % NUM_MBUF_SETS))],
- sess, pparams->buf_size, digest_length,
+ sess, pparams->buf_size,
pparams->chain);
/* enqueue burst */
@@ -3577,7 +3650,9 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
rte_pktmbuf_free(mbufs[i]);
- rte_cryptodev_sym_session_free(dev_id, sess);
+
+ rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
+ rte_cryptodev_sym_session_free(sess);
printf("\n");
return TEST_SUCCESS;
@@ -3597,8 +3672,6 @@ test_perf_armv8(uint8_t dev_id, uint16_t queue_id,
uint64_t processed = 0, failed_polls = 0, retries = 0;
uint64_t tsc_start = 0, tsc_end = 0;
- unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
-
struct rte_crypto_op *ops[pparams->burst_size];
struct rte_crypto_op *proc_ops[pparams->burst_size];
@@ -3614,9 +3687,12 @@ test_perf_armv8(uint8_t dev_id, uint16_t queue_id,
}
/* Create Crypto session*/
- sess = test_perf_create_armv8_session(ts_params->dev_id,
+ if (test_perf_create_armv8_session(ts_params->dev_id,
pparams->chain, pparams->cipher_algo,
- pparams->cipher_key_length, pparams->auth_algo);
+ pparams->key_length, pparams->auth_algo) == 0)
+ sess = test_crypto_session;
+ else
+ sess = NULL;
TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
/* Generate a burst of crypto operations */
@@ -3653,7 +3729,7 @@ test_perf_armv8(uint8_t dev_id, uint16_t queue_id,
ops[i] = test_perf_set_crypto_op_aes(ops[i],
mbufs[i + (pparams->burst_size *
(j % NUM_MBUF_SETS))], sess,
- pparams->buf_size, digest_length,
+ pparams->buf_size,
pparams->chain);
/* enqueue burst */
@@ -3742,48 +3818,48 @@ test_perf_aes_cbc_encrypt_digest_vary_pkt_size(void)
{
.chain = CIPHER_ONLY,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_NULL
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 32,
+ .key_length = 32,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 32,
+ .key_length = 32,
.auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 32,
+ .key_length = 32,
.auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC
},
};
@@ -3793,12 +3869,12 @@ test_perf_aes_cbc_encrypt_digest_vary_pkt_size(void)
params_set[i].total_operations = total_operations;
params_set[i].burst_size = burst_size;
printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
- " burst_size: %d ops\n",
- chain_mode_name(params_set[i].chain),
- cipher_algo_name(params_set[i].cipher_algo),
- auth_algo_name(params_set[i].auth_algo),
- params_set[i].cipher_key_length,
- burst_size);
+ " burst_size: %d ops\n",
+ chain_mode_name(params_set[i].chain),
+ rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo],
+ rte_crypto_auth_algorithm_strings[params_set[i].auth_algo],
+ params_set[i].key_length,
+ burst_size);
printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
"Retries\tEmptyPolls\n");
for (j = 0; j < RTE_DIM(buf_lengths); j++) {
@@ -3823,14 +3899,14 @@ test_perf_snow3G_vary_pkt_size(void)
{
.chain = CIPHER_ONLY,
.cipher_algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_NULL,
},
{
.chain = HASH_ONLY,
.cipher_algo = RTE_CRYPTO_CIPHER_NULL,
.auth_algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
- .cipher_key_length = 16
+ .key_length = 16
},
};
@@ -3843,13 +3919,17 @@ test_perf_snow3G_vary_pkt_size(void)
printf("\n\n");
params_set[i].total_operations = total_operations;
for (k = 0; k < RTE_DIM(burst_sizes); k++) {
+ enum rte_crypto_cipher_algorithm cipher_algo =
+ params_set[i].cipher_algo;
+ enum rte_crypto_auth_algorithm auth_algo =
+ params_set[i].auth_algo;
printf("\nOn %s dev%u qp%u, %s, "
"cipher algo:%s, auth algo:%s, burst_size: %d ops",
- pmd_name(gbl_cryptodev_perftest_devtype),
+ pmd_name(gbl_driver_id),
testsuite_params.dev_id, 0,
chain_mode_name(params_set[i].chain),
- cipher_algo_name(params_set[i].cipher_algo),
- auth_algo_name(params_set[i].auth_algo),
+ rte_crypto_cipher_algorithm_strings[cipher_algo],
+ rte_crypto_auth_algorithm_strings[auth_algo],
burst_sizes[k]);
params_set[i].burst_size = burst_sizes[k];
@@ -3881,63 +3961,77 @@ test_perf_openssl_vary_pkt_size(void)
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC,
- .cipher_key_length = 24,
+ .key_length = 24,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR,
- .cipher_key_length = 32,
+ .key_length = 32,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR,
- .cipher_key_length = 24,
+ .key_length = 24,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
- .chain = CIPHER_HASH,
+ .chain = AEAD,
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_GCM,
- .cipher_key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_AES_GCM
+ .aead_algo = RTE_CRYPTO_AEAD_AES_GCM,
+ .key_length = 16,
},
};
for (i = 0; i < RTE_DIM(params_set); i++) {
params_set[i].total_operations = total_operations;
params_set[i].burst_size = burst_size;
- printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
+ if (params_set[i].chain == AEAD) {
+ enum rte_crypto_aead_algorithm aead_algo =
+ params_set[i].aead_algo;
+ printf("\n%s. aead algo: %s key size=%u."
" burst_size: %d ops\n",
chain_mode_name(params_set[i].chain),
- cipher_algo_name(params_set[i].cipher_algo),
- auth_algo_name(params_set[i].auth_algo),
- params_set[i].cipher_key_length,
+ rte_crypto_aead_algorithm_strings[aead_algo],
+ params_set[i].key_length,
burst_size);
+ } else {
+ enum rte_crypto_cipher_algorithm cipher_algo =
+ params_set[i].cipher_algo;
+ enum rte_crypto_auth_algorithm auth_algo =
+ params_set[i].auth_algo;
+ printf("\n%s. cipher algo: %s auth algo: %s key size=%u."
+ " burst_size: %d ops\n",
+ chain_mode_name(params_set[i].chain),
+ rte_crypto_cipher_algorithm_strings[cipher_algo],
+ rte_crypto_auth_algorithm_strings[auth_algo],
+ params_set[i].key_length,
+ burst_size);
+ }
printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\tRetries\t"
"EmptyPolls\n");
for (j = 0; j < RTE_DIM(buf_lengths); j++) {
@@ -3962,50 +4056,49 @@ test_perf_openssl_vary_burst_size(void)
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC,
- .cipher_key_length = 24,
+ .key_length = 24,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR,
- .cipher_key_length = 32,
+ .key_length = 32,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR,
- .cipher_key_length = 24,
+ .key_length = 24,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
- .chain = CIPHER_HASH,
+ .chain = AEAD,
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_GCM,
- .cipher_key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_AES_GCM
+ .aead_algo = RTE_CRYPTO_AEAD_AES_GCM,
+ .key_length = 16,
},
};
@@ -4042,28 +4135,28 @@ test_perf_armv8_vary_pkt_size(void)
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = HASH_CIPHER,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
},
{
.chain = HASH_CIPHER,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
},
};
@@ -4072,12 +4165,12 @@ test_perf_armv8_vary_pkt_size(void)
params_set[i].total_operations = total_operations;
params_set[i].burst_size = burst_size;
printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
- " burst_size: %d ops\n",
- chain_mode_name(params_set[i].chain),
- cipher_algo_name(params_set[i].cipher_algo),
- auth_algo_name(params_set[i].auth_algo),
- params_set[i].cipher_key_length,
- burst_size);
+ " burst_size: %d ops\n",
+ chain_mode_name(params_set[i].chain),
+ rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo],
+ rte_crypto_auth_algorithm_strings[params_set[i].auth_algo],
+ params_set[i].key_length,
+ burst_size);
printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\tRetries\t"
"EmptyPolls\n");
for (j = 0; j < RTE_DIM(buf_lengths); j++) {
@@ -4102,28 +4195,28 @@ test_perf_armv8_vary_burst_size(void)
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = HASH_CIPHER,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
},
{
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
},
{
.chain = HASH_CIPHER,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
},
};
@@ -4157,48 +4250,32 @@ test_perf_aes_cbc_vary_burst_size(void)
static struct rte_cryptodev_sym_session *
test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams)
{
- static struct rte_cryptodev_sym_session *sess;
- struct rte_crypto_sym_xform cipher_xform = { 0 };
- struct rte_crypto_sym_xform auth_xform = { 0 };
-
- uint8_t cipher_key[pparams->session_attrs->key_cipher_len];
- uint8_t auth_key[pparams->session_attrs->key_auth_len];
-
- memcpy(cipher_key, pparams->session_attrs->key_cipher_data,
- pparams->session_attrs->key_cipher_len);
- memcpy(auth_key, pparams->session_attrs->key_auth_data,
- pparams->session_attrs->key_auth_len);
-
- cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- cipher_xform.next = NULL;
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct rte_crypto_sym_xform aead_xform = { 0 };
- cipher_xform.cipher.algo = pparams->session_attrs->cipher_algorithm;
- cipher_xform.cipher.op = pparams->session_attrs->cipher;
- cipher_xform.cipher.key.data = cipher_key;
- cipher_xform.cipher.key.length = pparams->session_attrs->key_cipher_len;
+ uint8_t aead_key[pparams->session_attrs->key_aead_len];
- auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- auth_xform.next = NULL;
+ memcpy(aead_key, pparams->session_attrs->key_aead_data,
+ pparams->session_attrs->key_aead_len);
- auth_xform.auth.op = pparams->session_attrs->auth;
- auth_xform.auth.algo = pparams->session_attrs->auth_algorithm;
+ aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
+ aead_xform.next = NULL;
- auth_xform.auth.digest_length = pparams->session_attrs->digest_len;
- auth_xform.auth.key.length = pparams->session_attrs->key_auth_len;
+ aead_xform.aead.algo = pparams->session_attrs->aead_algorithm;
+ aead_xform.aead.op = pparams->session_attrs->aead;
+ aead_xform.aead.key.data = aead_key;
+ aead_xform.aead.key.length = pparams->session_attrs->key_aead_len;
+ aead_xform.aead.iv.length = pparams->session_attrs->iv_len;
+ aead_xform.aead.iv.offset = IV_OFFSET;
+ aead_xform.aead.aad_length = pparams->session_attrs->aad_len;
+ aead_xform.aead.digest_length = pparams->session_attrs->digest_len;
+ test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
- cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
- if (cipher_xform.cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
- cipher_xform.next = &auth_xform;
- sess = rte_cryptodev_sym_session_create(dev_id,
- &cipher_xform);
- } else {
- auth_xform.next = &cipher_xform;
- sess = rte_cryptodev_sym_session_create(dev_id,
- &auth_xform);
- }
+ rte_cryptodev_sym_session_init(dev_id, test_crypto_session,
+ &aead_xform, ts_params->sess_mp);
- return sess;
+ return test_crypto_session;
}
static inline struct rte_crypto_op *
@@ -4207,47 +4284,35 @@ perf_gcm_set_crypto_op(struct rte_crypto_op *op, struct rte_mbuf *m,
struct crypto_params *m_hlp,
struct perf_test_params *params)
{
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op,
+ uint8_t *, IV_OFFSET);
+
if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
rte_crypto_op_free(op);
return NULL;
}
- uint16_t iv_pad_len = ALIGN_POW2_ROUNDUP(params->symmetric_op->iv_len,
- 16);
-
- op->sym->auth.digest.data = m_hlp->digest;
- op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ op->sym->aead.digest.data = m_hlp->digest;
+ op->sym->aead.digest.phys_addr = rte_pktmbuf_mtophys_offset(
m,
- params->symmetric_op->aad_len +
- iv_pad_len +
+ params->session_attrs->aad_len +
params->symmetric_op->p_len);
- op->sym->auth.digest.length = params->symmetric_op->t_len;
-
- op->sym->auth.aad.data = m_hlp->aad;
- op->sym->auth.aad.length = params->symmetric_op->aad_len;
- op->sym->auth.aad.phys_addr = rte_pktmbuf_mtophys_offset(
- m,
- iv_pad_len);
-
- rte_memcpy(op->sym->auth.aad.data, params->symmetric_op->aad_data,
- params->symmetric_op->aad_len);
- op->sym->cipher.iv.data = m_hlp->iv;
- rte_memcpy(op->sym->cipher.iv.data, params->symmetric_op->iv_data,
- params->symmetric_op->iv_len);
- if (params->symmetric_op->iv_len == 12)
- op->sym->cipher.iv.data[15] = 1;
+ op->sym->aead.aad.data = m_hlp->aad;
+ op->sym->aead.aad.phys_addr = rte_pktmbuf_mtophys(m);
- op->sym->cipher.iv.length = params->symmetric_op->iv_len;
+ rte_memcpy(op->sym->aead.aad.data, params->symmetric_op->aad_data,
+ params->session_attrs->aad_len);
- op->sym->auth.data.offset =
- iv_pad_len + params->symmetric_op->aad_len;
- op->sym->auth.data.length = params->symmetric_op->p_len;
+ rte_memcpy(iv_ptr, params->session_attrs->iv_data,
+ params->session_attrs->iv_len);
+ if (params->session_attrs->iv_len == 12)
+ iv_ptr[15] = 1;
- op->sym->cipher.data.offset =
- iv_pad_len + params->symmetric_op->aad_len;
- op->sym->cipher.data.length = params->symmetric_op->p_len;
+ op->sym->aead.data.offset =
+ params->session_attrs->aad_len;
+ op->sym->aead.data.length = params->symmetric_op->p_len;
op->sym->m_src = m;
@@ -4260,9 +4325,7 @@ test_perf_create_pktmbuf_fill(struct rte_mempool *mpool,
unsigned buf_sz, struct crypto_params *m_hlp)
{
struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
- uint16_t iv_pad_len =
- ALIGN_POW2_ROUNDUP(params->symmetric_op->iv_len, 16);
- uint16_t aad_len = params->symmetric_op->aad_len;
+ uint16_t aad_len = params->session_attrs->aad_len;
uint16_t digest_size = params->symmetric_op->t_len;
char *p;
@@ -4273,13 +4336,6 @@ test_perf_create_pktmbuf_fill(struct rte_mempool *mpool,
}
m_hlp->aad = (uint8_t *)p;
- p = rte_pktmbuf_append(m, iv_pad_len);
- if (p == NULL) {
- rte_pktmbuf_free(m);
- return NULL;
- }
- m_hlp->iv = (uint8_t *)p;
-
p = rte_pktmbuf_append(m, buf_sz);
if (p == NULL) {
rte_pktmbuf_free(m);
@@ -4398,23 +4454,21 @@ perf_AES_GCM(uint8_t dev_id, uint16_t queue_id,
for (m = 0; m < burst_dequeued; m++) {
if (test_ops) {
- uint16_t iv_pad_len = ALIGN_POW2_ROUNDUP
- (pparams->symmetric_op->iv_len, 16);
uint8_t *pkt = rte_pktmbuf_mtod(
proc_ops[m]->sym->m_src,
uint8_t *);
TEST_ASSERT_BUFFERS_ARE_EQUAL(
pparams->symmetric_op->c_data,
- pkt + iv_pad_len +
- pparams->symmetric_op->aad_len,
+ pkt +
+ pparams->session_attrs->aad_len,
pparams->symmetric_op->c_len,
"GCM Ciphertext data not as expected");
TEST_ASSERT_BUFFERS_ARE_EQUAL(
pparams->symmetric_op->t_data,
- pkt + iv_pad_len +
- pparams->symmetric_op->aad_len +
+ pkt +
+ pparams->session_attrs->aad_len +
pparams->symmetric_op->c_len,
pparams->symmetric_op->t_len,
"GCM MAC data not as expected");
@@ -4440,7 +4494,9 @@ perf_AES_GCM(uint8_t dev_id, uint16_t queue_id,
for (i = 0; i < burst; i++)
rte_pktmbuf_free(mbufs[i]);
- rte_cryptodev_sym_session_free(dev_id, sess);
+
+ rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
+ rte_cryptodev_sym_session_free(sess);
return 0;
}
@@ -4472,27 +4528,21 @@ test_perf_AES_GCM(int continual_buf_len, int continual_size)
gcm_test = gcm_tests[i];
- session_attrs[i].cipher =
- RTE_CRYPTO_CIPHER_OP_ENCRYPT;
- session_attrs[i].cipher_algorithm =
- RTE_CRYPTO_CIPHER_AES_GCM;
- session_attrs[i].key_cipher_data =
+ session_attrs[i].aead =
+ RTE_CRYPTO_AEAD_OP_ENCRYPT;
+ session_attrs[i].aead_algorithm =
+ RTE_CRYPTO_AEAD_AES_GCM;
+ session_attrs[i].key_aead_data =
gcm_test->key.data;
- session_attrs[i].key_cipher_len =
+ session_attrs[i].key_aead_len =
gcm_test->key.len;
- session_attrs[i].auth_algorithm =
- RTE_CRYPTO_AUTH_AES_GCM;
- session_attrs[i].auth =
- RTE_CRYPTO_AUTH_OP_GENERATE;
- session_attrs[i].key_auth_data = NULL;
- session_attrs[i].key_auth_len = 0;
+ session_attrs[i].aad_len = gcm_test->aad.len;
session_attrs[i].digest_len =
gcm_test->auth_tag.len;
+ session_attrs[i].iv_len = gcm_test->iv.len;
+ session_attrs[i].iv_data = gcm_test->iv.data;
ops_set[i].aad_data = gcm_test->aad.data;
- ops_set[i].aad_len = gcm_test->aad.len;
- ops_set[i].iv_data = gcm_test->iv.data;
- ops_set[i].iv_len = gcm_test->iv.len;
ops_set[i].p_data = gcm_test->plaintext.data;
ops_set[i].p_len = buf_lengths[i];
ops_set[i].c_data = gcm_test->ciphertext.data;
@@ -4500,7 +4550,7 @@ test_perf_AES_GCM(int continual_buf_len, int continual_size)
ops_set[i].t_data = gcm_test->auth_tags[i].data;
ops_set[i].t_len = gcm_test->auth_tags[i].len;
- params_set[i].chain = CIPHER_HASH;
+ params_set[i].chain = AEAD;
params_set[i].session_attrs = &session_attrs[i];
params_set[i].symmetric_op = &ops_set[i];
if (continual_buf_len)
@@ -4602,18 +4652,18 @@ test_perf_continual_performance_test(void)
.chain = CIPHER_HASH,
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_key_length = 16,
+ .key_length = 16,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
};
for (i = 1; i <= total_loops; ++i) {
printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
- " burst_size: %d ops\n",
- chain_mode_name(params_set.chain),
- cipher_algo_name(params_set.cipher_algo),
- auth_algo_name(params_set.auth_algo),
- params_set.cipher_key_length,
- burst_size);
+ " burst_size: %d ops\n",
+ chain_mode_name(params_set.chain),
+ rte_crypto_cipher_algorithm_strings[params_set.cipher_algo],
+ rte_crypto_auth_algorithm_strings[params_set.auth_algo],
+ params_set.key_length,
+ burst_size);
printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
"Retries\tEmptyPolls\n");
test_perf_aes_sha(testsuite_params.dev_id, 0,
@@ -4726,7 +4776,15 @@ static struct unit_test_suite cryptodev_armv8_testsuite = {
static int
perftest_aesni_gcm_cryptodev(void)
{
- gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_AESNI_GCM_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "AESNI GCM PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_gcm_testsuite);
}
@@ -4734,7 +4792,15 @@ perftest_aesni_gcm_cryptodev(void)
static int
perftest_aesni_mb_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_AESNI_MB_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "AESNI MB PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_AESNI_MB is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_aes_testsuite);
}
@@ -4742,7 +4808,15 @@ perftest_aesni_mb_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
static int
perftest_qat_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_testsuite);
}
@@ -4750,7 +4824,15 @@ perftest_qat_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
static int
perftest_sw_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_SNOW3G_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "SNOW3G PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_SNOW3G is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_snow3g_testsuite);
}
@@ -4758,7 +4840,15 @@ perftest_sw_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
static int
perftest_qat_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_snow3g_testsuite);
}
@@ -4766,7 +4856,15 @@ perftest_qat_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
static int
perftest_openssl_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_OPENSSL_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "OpenSSL PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_OPENSSL is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_openssl_testsuite);
}
@@ -4774,7 +4872,15 @@ perftest_openssl_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
static int
perftest_qat_continual_cryptodev(void)
{
- gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_qat_continual_testsuite);
}
@@ -4782,7 +4888,15 @@ perftest_qat_continual_cryptodev(void)
static int
perftest_sw_armv8_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_ARMV8_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "ARMV8 PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_ARMV8 is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_armv8_testsuite);
}
@@ -4790,7 +4904,15 @@ perftest_sw_armv8_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
static int
perftest_dpaa2_sec_cryptodev(void)
{
- gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_DPAA2_SEC_PMD;
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "DPAA2 SEC PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite);
}
diff --git a/test/test/test_cryptodev_snow3g_hash_test_vectors.h b/test/test/test_cryptodev_snow3g_hash_test_vectors.h
index a8a47db5..0bb274d1 100644
--- a/test/test/test_cryptodev_snow3g_hash_test_vectors.h
+++ b/test/test/test_cryptodev_snow3g_hash_test_vectors.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,7 +42,7 @@ struct snow3g_hash_test_data {
struct {
uint8_t data[64];
unsigned len;
- } aad;
+ } auth_iv;
struct {
uint8_t data[2056];
@@ -54,10 +54,6 @@ struct snow3g_hash_test_data {
} validAuthLenInBits;
struct {
- unsigned len;
- } validAuthOffsetLenInBits;
-
- struct {
uint8_t data[64];
unsigned len;
} digest;
@@ -71,7 +67,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_1 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD
@@ -92,9 +88,6 @@ struct snow3g_hash_test_data snow3g_hash_test_case_1 = {
.validAuthLenInBits = {
.len = 384
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0x38, 0xB5, 0x54, 0xC0 },
.len = 4
@@ -109,7 +102,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_2 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x29, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0x77, 0x37,
0xA9, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0xF7, 0x37
@@ -140,9 +133,6 @@ struct snow3g_hash_test_data snow3g_hash_test_case_2 = {
.validAuthLenInBits = {
.len = 1000
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0x06, 0x17, 0x45, 0xAE},
.len = 4
@@ -157,7 +147,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_3 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x29, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0x77, 0x37,
0xA9, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0xF7, 0x37
@@ -429,9 +419,6 @@ struct snow3g_hash_test_data snow3g_hash_test_case_3 = {
.validAuthLenInBits = {
.len = 16448
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0x17, 0x9F, 0x2F, 0xA6},
.len = 4
@@ -446,7 +433,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_4 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
@@ -464,9 +451,6 @@ struct snow3g_hash_test_data snow3g_hash_test_case_4 = {
.validAuthLenInBits = {
.len = 189
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0x2B, 0xCE, 0x18, 0x20},
.len = 4
@@ -481,7 +465,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_5 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x3E, 0xDC, 0x87, 0xE2, 0xA4, 0xF2, 0xD8, 0xE2,
0xBE, 0xDC, 0x87, 0xE2, 0xA4, 0xF2, 0x58, 0xE2
@@ -500,9 +484,6 @@ struct snow3g_hash_test_data snow3g_hash_test_case_5 = {
.validAuthLenInBits = {
.len = 254
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0xFC, 0x7B, 0x18, 0xBD},
.len = 4
@@ -517,7 +498,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_6 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x36, 0xAF, 0x61, 0x44, 0x98, 0x38, 0xF0, 0x3A,
0xB6, 0xAF, 0x61, 0x44, 0x98, 0x38, 0x70, 0x3A
@@ -537,9 +518,6 @@ struct snow3g_hash_test_data snow3g_hash_test_case_6 = {
.validAuthLenInBits = {
.len = 319
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0x02, 0xF1, 0xFA, 0xAF},
.len = 4
diff --git a/test/test/test_cryptodev_snow3g_test_vectors.h b/test/test/test_cryptodev_snow3g_test_vectors.h
index 51917c14..fed50dc2 100644
--- a/test/test/test_cryptodev_snow3g_test_vectors.h
+++ b/test/test/test_cryptodev_snow3g_test_vectors.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2015 Intel Corporation. All rights reserved.
+ * Copyright(c) 2015-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,7 +42,7 @@ struct snow3g_test_data {
struct {
uint8_t data[64] __rte_aligned(16);
unsigned len;
- } iv;
+ } cipher_iv;
struct {
uint8_t data[1024];
@@ -64,20 +64,12 @@ struct snow3g_test_data {
struct {
unsigned len;
- } validCipherOffsetLenInBits;
-
- struct {
- unsigned len;
} validAuthLenInBits;
struct {
- unsigned len;
- } validAuthOffsetLenInBits;
-
- struct {
uint8_t data[64];
unsigned len;
- } aad;
+ } auth_iv;
struct {
uint8_t data[64];
@@ -92,7 +84,7 @@ struct snow3g_test_data snow3g_test_case_1 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00,
0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00
@@ -141,10 +133,7 @@ struct snow3g_test_data snow3g_test_case_1 = {
.validCipherLenInBits = {
.len = 800
},
- .validCipherOffsetLenInBits = {
- .len = 128
- },
- .aad = {
+ .auth_iv = {
.data = {
0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00,
0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00
@@ -161,7 +150,7 @@ struct snow3g_test_data snow3g_test_case_2 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xE2, 0x8B, 0xCF, 0x7B, 0xC0, 0x00, 0x00, 0x00,
0xE2, 0x8B, 0xCF, 0x7B, 0xC0, 0x00, 0x00, 0x00
@@ -200,10 +189,7 @@ struct snow3g_test_data snow3g_test_case_2 = {
.validCipherLenInBits = {
.len = 512
},
- .validCipherOffsetLenInBits = {
- .len = 128
- },
- .aad = {
+ .auth_iv = {
.data = {
0xE2, 0x8B, 0xCF, 0x7B, 0xC0, 0x00, 0x00, 0x00,
0xE2, 0x8B, 0xCF, 0x7B, 0xC0, 0x00, 0x00, 0x00
@@ -220,7 +206,7 @@ struct snow3g_test_data snow3g_test_case_3 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00,
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
@@ -247,10 +233,7 @@ struct snow3g_test_data snow3g_test_case_3 = {
.validCipherLenInBits = {
.len = 120
},
- .validCipherOffsetLenInBits = {
- .len = 128
- },
- .aad = {
+ .auth_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00,
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
@@ -263,9 +246,6 @@ struct snow3g_test_data snow3g_test_case_3 = {
},
.validAuthLenInBits = {
.len = 120
- },
- .validAuthOffsetLenInBits = {
- .len = 128
}
};
@@ -277,7 +257,7 @@ struct snow3g_test_data snow3g_test_case_4 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x39, 0x8A, 0x59, 0xB4, 0x2C, 0x00, 0x00, 0x00,
0x39, 0x8A, 0x59, 0xB4, 0x2C, 0x00, 0x00, 0x00
@@ -307,9 +287,6 @@ struct snow3g_test_data snow3g_test_case_4 = {
},
.validCipherLenInBits = {
.len = 256
- },
- .validCipherOffsetLenInBits = {
- .len = 128
}
};
@@ -321,7 +298,7 @@ struct snow3g_test_data snow3g_test_case_5 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x72, 0xA4, 0xF2, 0x0F, 0x48, 0x00, 0x00, 0x00,
0x72, 0xA4, 0xF2, 0x0F, 0x48, 0x00, 0x00, 0x00
@@ -371,9 +348,6 @@ struct snow3g_test_data snow3g_test_case_5 = {
.validCipherLenInBits = {
.len = 840
},
- .validCipherOffsetLenInBits = {
- .len = 128
- }
};
struct snow3g_test_data snow3g_test_case_6 = {
.key = {
@@ -383,14 +357,14 @@ struct snow3g_test_data snow3g_test_case_6 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD
@@ -429,15 +403,9 @@ struct snow3g_test_data snow3g_test_case_6 = {
.validCipherLenInBits = {
.len = 384
},
- .validCipherOffsetLenInBits = {
- .len = 128
- },
.validAuthLenInBits = {
.len = 384
},
- .validAuthOffsetLenInBits = {
- .len = 128
- }
};
#endif /* TEST_CRYPTODEV_SNOW3G_TEST_VECTORS_H_ */
diff --git a/test/test/test_cryptodev_zuc_test_vectors.h b/test/test/test_cryptodev_zuc_test_vectors.h
index a900e916..a22e1edb 100644
--- a/test/test/test_cryptodev_zuc_test_vectors.h
+++ b/test/test/test_cryptodev_zuc_test_vectors.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,7 +42,7 @@ struct wireless_test_data {
struct {
uint8_t data[64] __rte_aligned(16);
unsigned len;
- } iv;
+ } cipher_iv;
struct {
uint8_t data[2048];
@@ -64,20 +64,12 @@ struct wireless_test_data {
struct {
unsigned len;
- } validCipherOffsetLenInBits;
-
- struct {
- unsigned len;
} validAuthLenInBits;
struct {
- unsigned len;
- } validAuthOffsetLenInBits;
-
- struct {
uint8_t data[64];
unsigned len;
- } aad;
+ } auth_iv;
struct {
uint8_t data[64];
@@ -92,7 +84,7 @@ static struct wireless_test_data zuc_test_case_cipher_193b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00,
0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00
@@ -122,9 +114,6 @@ static struct wireless_test_data zuc_test_case_cipher_193b = {
},
.validCipherLenInBits = {
.len = 193
- },
- .validCipherOffsetLenInBits = {
- .len = 128
}
};
@@ -136,7 +125,7 @@ static struct wireless_test_data zuc_test_case_cipher_800b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00,
0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00
@@ -184,9 +173,6 @@ static struct wireless_test_data zuc_test_case_cipher_800b = {
},
.validCipherLenInBits = {
.len = 800
- },
- .validCipherOffsetLenInBits = {
- .len = 128
}
};
@@ -198,7 +184,7 @@ static struct wireless_test_data zuc_test_case_cipher_1570b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x76, 0x45, 0x2E, 0xC1, 0x14, 0x00, 0x00, 0x00,
0x76, 0x45, 0x2E, 0xC1, 0x14, 0x00, 0x00, 0x00
@@ -270,10 +256,7 @@ static struct wireless_test_data zuc_test_case_cipher_1570b = {
},
.validCipherLenInBits = {
.len = 1570
- },
- .validCipherOffsetLenInBits = {
- .len = 128
- },
+ }
};
static struct wireless_test_data zuc_test_case_cipher_2798b = {
@@ -284,7 +267,7 @@ static struct wireless_test_data zuc_test_case_cipher_2798b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xE4, 0x85, 0x0F, 0xE1, 0x84, 0x00, 0x00, 0x00,
0xE4, 0x85, 0x0F, 0xE1, 0x84, 0x00, 0x00, 0x00
@@ -394,9 +377,6 @@ static struct wireless_test_data zuc_test_case_cipher_2798b = {
},
.validCipherLenInBits = {
.len = 2798
- },
- .validCipherOffsetLenInBits = {
- .len = 128
}
};
@@ -408,7 +388,7 @@ static struct wireless_test_data zuc_test_case_cipher_4019b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x27, 0x38, 0xCD, 0xAA, 0xD0, 0x00, 0x00, 0x00,
0x27, 0x38, 0xCD, 0xAA, 0xD0, 0x00, 0x00, 0x00
@@ -556,9 +536,6 @@ static struct wireless_test_data zuc_test_case_cipher_4019b = {
},
.validCipherLenInBits = {
.len = 4019
- },
- .validCipherOffsetLenInBits = {
- .len = 128
}
};
@@ -570,7 +547,7 @@ static struct wireless_test_data zuc_test_case_cipher_200b_auth_200b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00,
0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00
@@ -601,10 +578,7 @@ static struct wireless_test_data zuc_test_case_cipher_200b_auth_200b = {
.validCipherLenInBits = {
.len = 200
},
- .validCipherOffsetLenInBits = {
- .len = 128
- },
- .aad = {
+ .auth_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00,
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
@@ -617,9 +591,6 @@ static struct wireless_test_data zuc_test_case_cipher_200b_auth_200b = {
},
.validAuthLenInBits = {
.len = 200
- },
- .validAuthOffsetLenInBits = {
- .len = 128
}
};
@@ -631,7 +602,7 @@ static struct wireless_test_data zuc_test_case_cipher_800b_auth_120b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00,
0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00
@@ -680,10 +651,7 @@ static struct wireless_test_data zuc_test_case_cipher_800b_auth_120b = {
.validCipherLenInBits = {
.len = 800
},
- .validCipherOffsetLenInBits = {
- .len = 128
- },
- .aad = {
+ .auth_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00,
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
@@ -696,9 +664,6 @@ static struct wireless_test_data zuc_test_case_cipher_800b_auth_120b = {
},
.validAuthLenInBits = {
.len = 120
- },
- .validAuthOffsetLenInBits = {
- .len = 128
}
};
@@ -710,7 +675,7 @@ struct wireless_test_data zuc_test_case_auth_1b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@@ -724,9 +689,6 @@ struct wireless_test_data zuc_test_case_auth_1b = {
.validAuthLenInBits = {
.len = 1
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0xC8, 0xA9, 0x59, 0x5E},
.len = 4
@@ -741,7 +703,7 @@ struct wireless_test_data zuc_test_case_auth_90b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x56, 0x1E, 0xB2, 0xDD, 0xA0, 0x00, 0x00, 0x00,
0x56, 0x1E, 0xB2, 0xDD, 0xA0, 0x00, 0x00, 0x00
@@ -758,9 +720,6 @@ struct wireless_test_data zuc_test_case_auth_90b = {
.validAuthLenInBits = {
.len = 90
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0x67, 0x19, 0xA0, 0x88},
.len = 4
@@ -775,7 +734,7 @@ struct wireless_test_data zuc_test_case_auth_577b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0xA9, 0x40, 0x59, 0xDA, 0x50, 0x00, 0x00, 0x00,
0x29, 0x40, 0x59, 0xDA, 0x50, 0x00, 0x80, 0x00
@@ -800,9 +759,6 @@ struct wireless_test_data zuc_test_case_auth_577b = {
.validAuthLenInBits = {
.len = 577
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0xFA, 0xE8, 0xFF, 0x0B},
.len = 4
@@ -817,7 +773,7 @@ struct wireless_test_data zuc_test_case_auth_2079b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x05, 0x09, 0x78, 0x50, 0x80, 0x00, 0x00, 0x00,
0x85, 0x09, 0x78, 0x50, 0x80, 0x00, 0x80, 0x00
@@ -865,9 +821,6 @@ struct wireless_test_data zuc_test_case_auth_2079b = {
.validAuthLenInBits = {
.len = 2079
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0x00, 0x4A, 0xC4, 0xD6},
.len = 4
@@ -882,7 +835,7 @@ struct wireless_test_data zuc_test_auth_5670b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x56, 0x1E, 0xB2, 0xDD, 0xE0, 0x00, 0x00, 0x00,
0x56, 0x1E, 0xB2, 0xDD, 0xE0, 0x00, 0x00, 0x00
@@ -986,9 +939,6 @@ struct wireless_test_data zuc_test_auth_5670b = {
.validAuthLenInBits = {
.len = 5670
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0x0C, 0xA1, 0x27, 0x92},
.len = 4
@@ -1000,7 +950,7 @@ static struct wireless_test_data zuc_test_case_auth_128b = {
.data = { 0x0 },
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = { 0x0 },
.len = 16
},
@@ -1011,9 +961,6 @@ static struct wireless_test_data zuc_test_case_auth_128b = {
.validAuthLenInBits = {
.len = 8
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = { 0x39, 0x0a, 0x91, 0xb7 },
.len = 4
@@ -1028,7 +975,7 @@ static struct wireless_test_data zuc_test_case_auth_2080b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x05, 0x09, 0x78, 0x50, 0x80, 0x00, 0x00, 0x00,
0x85, 0x09, 0x78, 0x50, 0x80, 0x00, 0x80, 0x00
@@ -1076,9 +1023,6 @@ static struct wireless_test_data zuc_test_case_auth_2080b = {
.validAuthLenInBits = {
.len = 2080
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0x03, 0x95, 0x32, 0xe1},
.len = 4
@@ -1093,7 +1037,7 @@ static struct wireless_test_data zuc_test_case_auth_584b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0xa9, 0x40, 0x59, 0xda, 0x50, 0x0, 0x0, 0x0,
0x29, 0x40, 0x59, 0xda, 0x50, 0x0, 0x80, 0x0
@@ -1118,9 +1062,6 @@ static struct wireless_test_data zuc_test_case_auth_584b = {
.validAuthLenInBits = {
.len = 584
},
- .validAuthOffsetLenInBits = {
- .len = 128
- },
.digest = {
.data = {0x24, 0xa8, 0x42, 0xb3},
.len = 4
diff --git a/test/test/test_devargs.c b/test/test/test_devargs.c
index 63242f1c..18f54edc 100644
--- a/test/test/test_devargs.c
+++ b/test/test/test_devargs.c
@@ -90,8 +90,8 @@ test_devargs(void)
if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "net_ring1,k1=val,k2=val2") < 0)
goto fail;
devargs = TAILQ_FIRST(&devargs_list);
- if (strncmp(devargs->virt.drv_name, "net_ring1",
- sizeof(devargs->virt.drv_name)) != 0)
+ if (strncmp(devargs->name, "net_ring1",
+ sizeof(devargs->name)) != 0)
goto fail;
if (!devargs->args || strcmp(devargs->args, "k1=val,k2=val2") != 0)
goto fail;
@@ -101,10 +101,7 @@ test_devargs(void)
if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "04:00.1") < 0)
goto fail;
devargs = TAILQ_FIRST(&devargs_list);
- if (devargs->pci.addr.domain != 0 ||
- devargs->pci.addr.bus != 4 ||
- devargs->pci.addr.devid != 0 ||
- devargs->pci.addr.function != 1)
+ if (strcmp(devargs->name, "04:00.1") != 0)
goto fail;
if (!devargs->args || strcmp(devargs->args, "") != 0)
goto fail;
diff --git a/test/test/test_distributor.c b/test/test/test_distributor.c
index 890a8526..9fae688b 100644
--- a/test/test/test_distributor.c
+++ b/test/test/test_distributor.c
@@ -112,7 +112,7 @@ handle_work(void *arg)
/* do basic sanity testing of the distributor. This test tests the following:
* - send 32 packets through distributor with the same tag and ensure they
* all go to the one worker
- * - send 32 packets throught the distributor with two different tags and
+ * - send 32 packets through the distributor with two different tags and
* verify that they go equally to two different workers.
* - send 32 packets with different tags through the distributors and
* just verify we get all packets back.
diff --git a/test/test/test_distributor_perf.c b/test/test/test_distributor_perf.c
index 732d86d0..7d69887b 100644
--- a/test/test/test_distributor_perf.c
+++ b/test/test/test_distributor_perf.c
@@ -40,6 +40,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
#include <rte_distributor.h>
+#include <rte_pause.h>
#define ITER_POWER_CL 25 /* log 2 of how many iterations for Cache Line test */
#define ITER_POWER 21 /* log 2 of how many iterations we do when timing. */
diff --git a/test/test/test_eal_flags.c b/test/test/test_eal_flags.c
index 91b40664..594d79d7 100644
--- a/test/test/test_eal_flags.c
+++ b/test/test/test_eal_flags.c
@@ -38,7 +38,6 @@
#include <string.h>
#include <stdarg.h>
#include <libgen.h>
-#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
@@ -824,7 +823,7 @@ test_dom0_misc_flags(void)
/* check that some general flags don't prevent things from working.
* All cases, apart from the first, app should run.
- * No futher testing of output done.
+ * No further testing of output done.
*/
/* sanity check - failure with invalid option */
const char *argv0[] = {prgname, prefix, mp_flag, "-c", "1", "--invalid-opt"};
@@ -932,7 +931,7 @@ test_misc_flags(void)
/* check that some general flags don't prevent things from working.
* All cases, apart from the first, app should run.
- * No futher testing of output done.
+ * No further testing of output done.
*/
/* sanity check - failure with invalid option */
const char *argv0[] = {prgname, prefix, mp_flag, "-c", "1", "--invalid-opt"};
diff --git a/test/test/test_event_ring.c b/test/test/test_event_ring.c
new file mode 100644
index 00000000..c158c9b0
--- /dev/null
+++ b/test/test/test_event_ring.c
@@ -0,0 +1,276 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+
+#include <rte_event_ring.h>
+
+#include "test.h"
+
+/*
+ * Event Ring
+ * ===========
+ *
+ * Test some basic ops for the event rings.
+ * Does not fully test everything, since most code is reused from rte_ring
+ * library and tested as part of the normal ring autotests.
+ */
+
+#define RING_SIZE 4096
+#define MAX_BULK 32
+
+static struct rte_event_ring *r;
+
+/*
+ * ensure failure to create ring with a bad ring size
+ */
+static int
+test_event_ring_creation_with_wrong_size(void)
+{
+ struct rte_event_ring *rp = NULL;
+
+ /* Test if ring size is not power of 2 */
+ rp = rte_event_ring_create("test_bad_ring_size", RING_SIZE + 1,
+ SOCKET_ID_ANY, 0);
+ if (rp != NULL)
+ return -1;
+
+ /* Test if ring size is exceeding the limit */
+ rp = rte_event_ring_create("test_bad_ring_size", (RTE_RING_SZ_MASK + 1),
+ SOCKET_ID_ANY, 0);
+ if (rp != NULL)
+ return -1;
+ return 0;
+}
+
+/*
+ * Test to check if a non-power-of-2 count causes the create
+ * function to fail correctly
+ */
+static int
+test_create_count_odd(void)
+{
+ struct rte_event_ring *r = rte_event_ring_create("test_event_ring_count",
+ 4097, SOCKET_ID_ANY, 0);
+ if (r != NULL)
+ return -1;
+ return 0;
+}
+
+static int
+test_lookup_null(void)
+{
+ struct rte_event_ring *rlp = rte_event_ring_lookup("ring_not_found");
+ if (rlp == NULL && rte_errno != ENOENT) {
+ printf("test failed to return error on null pointer\n");
+ return -1;
+ }
+ return 0;
+}
+
+static int
+test_basic_event_enqueue_dequeue(void)
+{
+ struct rte_event_ring *sr = NULL;
+ struct rte_event evs[16];
+ uint16_t ret, free_count, used_count;
+
+ memset(evs, 0, sizeof(evs));
+ sr = rte_event_ring_create("spsc_ring", 32, rte_socket_id(),
+ RING_F_SP_ENQ | RING_F_SC_DEQ);
+ if (sr == NULL) {
+ printf("Failed to create sp/sc ring\n");
+ return -1;
+ }
+ if (rte_event_ring_get_capacity(sr) != 31) {
+ printf("Error, invalid capacity\n");
+ goto error;
+ }
+
+ /* test sp/sc ring */
+ if (rte_event_ring_count(sr) != 0) {
+ printf("Error, ring not empty as expected\n");
+ goto error;
+ }
+ if (rte_event_ring_free_count(sr) != rte_event_ring_get_capacity(sr)) {
+ printf("Error, ring free count not as expected\n");
+ goto error;
+ }
+
+ ret = rte_event_ring_enqueue_burst(sr, evs, RTE_DIM(evs), &free_count);
+ if (ret != RTE_DIM(evs) ||
+ free_count != rte_event_ring_get_capacity(sr) - ret) {
+ printf("Error, status after enqueue is unexpected\n");
+ goto error;
+ }
+
+ ret = rte_event_ring_enqueue_burst(sr, evs, RTE_DIM(evs), &free_count);
+ if (ret != RTE_DIM(evs) - 1 ||
+ free_count != 0) {
+ printf("Error, status after enqueue is unexpected\n");
+ goto error;
+ }
+
+ ret = rte_event_ring_dequeue_burst(sr, evs, RTE_DIM(evs), &used_count);
+ if (ret != RTE_DIM(evs) ||
+ used_count != rte_event_ring_get_capacity(sr) - ret) {
+ printf("Error, status after enqueue is unexpected\n");
+ goto error;
+ }
+ ret = rte_event_ring_dequeue_burst(sr, evs, RTE_DIM(evs), &used_count);
+ if (ret != RTE_DIM(evs) - 1 ||
+ used_count != 0) {
+ printf("Error, status after enqueue is unexpected\n");
+ goto error;
+ }
+
+ rte_event_ring_free(sr);
+ return 0;
+error:
+ rte_event_ring_free(sr);
+ return -1;
+}
+
+static int
+test_event_ring_with_exact_size(void)
+{
+ struct rte_event_ring *std_ring, *exact_sz_ring;
+ struct rte_event ev = { .mbuf = NULL };
+ struct rte_event ev_array[16];
+ static const unsigned int ring_sz = RTE_DIM(ev_array);
+ unsigned int i;
+
+ std_ring = rte_event_ring_create("std", ring_sz, rte_socket_id(),
+ RING_F_SP_ENQ | RING_F_SC_DEQ);
+ if (std_ring == NULL) {
+ printf("%s: error, can't create std ring\n", __func__);
+ return -1;
+ }
+ exact_sz_ring = rte_event_ring_create("exact sz",
+ ring_sz, rte_socket_id(),
+ RING_F_SP_ENQ | RING_F_SC_DEQ | RING_F_EXACT_SZ);
+ if (exact_sz_ring == NULL) {
+ printf("%s: error, can't create exact size ring\n", __func__);
+ return -1;
+ }
+
+ /*
+ * Check that the exact size ring is bigger than the standard ring
+ */
+ if (rte_event_ring_get_size(std_ring) >=
+ rte_event_ring_get_size(exact_sz_ring)) {
+ printf("%s: error, std ring (size: %u) is not smaller than exact size one (size %u)\n",
+ __func__,
+ rte_event_ring_get_size(std_ring),
+ rte_event_ring_get_size(exact_sz_ring));
+ return -1;
+ }
+ /*
+ * check that the exact_sz_ring can hold one more element than the
+ * standard ring. (16 vs 15 elements)
+ */
+ for (i = 0; i < ring_sz - 1; i++) {
+ rte_event_ring_enqueue_burst(std_ring, &ev, 1, NULL);
+ rte_event_ring_enqueue_burst(exact_sz_ring, &ev, 1, NULL);
+ }
+ if (rte_event_ring_enqueue_burst(std_ring, &ev, 1, NULL) != 0) {
+ printf("%s: error, unexpected successful enqueue\n", __func__);
+ return -1;
+ }
+ if (rte_event_ring_enqueue_burst(exact_sz_ring, &ev, 1, NULL) != 1) {
+ printf("%s: error, enqueue failed\n", __func__);
+ return -1;
+ }
+
+ /* check that dequeue returns the expected number of elements */
+ if (rte_event_ring_dequeue_burst(exact_sz_ring, ev_array,
+ RTE_DIM(ev_array), NULL) != ring_sz) {
+ printf("%s: error, failed to dequeue expected nb of elements\n",
+ __func__);
+ return -1;
+ }
+
+ /* check that the capacity function returns expected value */
+ if (rte_event_ring_get_capacity(exact_sz_ring) != ring_sz) {
+ printf("%s: error, incorrect ring capacity reported\n",
+ __func__);
+ return -1;
+ }
+
+ rte_event_ring_free(std_ring);
+ rte_event_ring_free(exact_sz_ring);
+ return 0;
+}
+
+static int
+test_event_ring(void)
+{
+ if (r == NULL)
+ r = rte_event_ring_create("ev_test", RING_SIZE,
+ SOCKET_ID_ANY, 0);
+ if (r == NULL)
+ return -1;
+
+ /* retrieve the ring from its name */
+ if (rte_event_ring_lookup("ev_test") != r) {
+ printf("Cannot lookup ring from its name\n");
+ return -1;
+ }
+
+ /* basic operations */
+ if (test_create_count_odd() < 0) {
+ printf("Test failed to detect odd count\n");
+ return -1;
+ }
+ printf("Test detected odd count\n");
+
+ if (test_lookup_null() < 0) {
+ printf("Test failed to detect NULL ring lookup\n");
+ return -1;
+ }
+ printf("Test detected NULL ring lookup\n");
+
+ /* test of creating ring with wrong size */
+ if (test_event_ring_creation_with_wrong_size() < 0)
+ return -1;
+
+ if (test_basic_event_enqueue_dequeue() < 0)
+ return -1;
+
+ if (test_event_ring_with_exact_size() < 0)
+ return -1;
+
+ return 0;
+}
+
+REGISTER_TEST_COMMAND(event_ring_autotest, test_event_ring);
diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index 88b80a92..f766191e 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2016 Cavium networks. All rights reserved.
+ * Copyright(c) 2016 Cavium, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -13,7 +13,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * * Neither the name of Cavium networks nor the names of its
+ * * Neither the name of Cavium, Inc nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -139,13 +139,6 @@ test_ethdev_config_run(struct rte_event_dev_config *dev_conf,
}
static void
-min_dequeue_limit(struct rte_event_dev_config *dev_conf,
- struct rte_event_dev_info *info)
-{
- dev_conf->dequeue_timeout_ns = info->min_dequeue_timeout_ns - 1;
-}
-
-static void
max_dequeue_limit(struct rte_event_dev_config *dev_conf,
struct rte_event_dev_info *info)
{
@@ -211,9 +204,6 @@ test_eventdev_configure(void)
/* Check limits */
TEST_ASSERT_EQUAL(-EINVAL,
- test_ethdev_config_run(&dev_conf, &info, min_dequeue_limit),
- "Config negative test failed");
- TEST_ASSERT_EQUAL(-EINVAL,
test_ethdev_config_run(&dev_conf, &info, max_dequeue_limit),
"Config negative test failed");
TEST_ASSERT_EQUAL(-EINVAL,
diff --git a/test/test/test_eventdev_octeontx.c b/test/test/test_eventdev_octeontx.c
index 9e95722b..774d0303 100644
--- a/test/test/test_eventdev_octeontx.c
+++ b/test/test/test_eventdev_octeontx.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2017 Cavium networks. All rights reserved.
+ * Copyright(c) 2017 Cavium, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -13,7 +13,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * * Neither the name of Cavium networks nor the names of its
+ * * Neither the name of Cavium, Inc nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -194,6 +194,11 @@ _eventdev_setup(int mode)
TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev");
if (mode == TEST_EVENTDEV_SETUP_PRIORITY) {
+ if (rte_event_queue_count(evdev) > 8) {
+ printf("test expects the unique priority per queue\n");
+ return -ENOTSUP;
+ }
+
/* Configure event queues(0 to n) with
* RTE_EVENT_DEV_PRIORITY_HIGHEST to
* RTE_EVENT_DEV_PRIORITY_LOWEST
diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c
index b187d029..ba8c053e 100644
--- a/test/test/test_eventdev_sw.c
+++ b/test/test/test_eventdev_sw.c
@@ -47,8 +47,9 @@
#include <rte_debug.h>
#include <rte_ethdev.h>
#include <rte_cycles.h>
-
#include <rte_eventdev.h>
+#include <rte_pause.h>
+
#include "test.h"
#define MAX_PORTS 16
@@ -548,6 +549,50 @@ test_single_directed_packet(struct test *t)
return 0;
}
+static int
+test_directed_forward_credits(struct test *t)
+{
+ uint32_t i;
+ int32_t err;
+
+ if (init(t, 1, 1) < 0 ||
+ create_ports(t, 1) < 0 ||
+ create_directed_qids(t, 1, t->port) < 0)
+ return -1;
+
+ if (rte_event_dev_start(evdev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ struct rte_event ev = {
+ .op = RTE_EVENT_OP_NEW,
+ .queue_id = 0,
+ };
+
+ for (i = 0; i < 1000; i++) {
+ err = rte_event_enqueue_burst(evdev, 0, &ev, 1);
+ if (err < 0) {
+ printf("%d: error failed to enqueue\n", __LINE__);
+ return -1;
+ }
+ rte_event_schedule(evdev);
+
+ uint32_t deq_pkts;
+ deq_pkts = rte_event_dequeue_burst(evdev, 0, &ev, 1, 0);
+ if (deq_pkts != 1) {
+ printf("%d: error failed to deq\n", __LINE__);
+ return -1;
+ }
+
+ /* re-write event to be a forward, and continue looping it */
+ ev.op = RTE_EVENT_OP_FORWARD;
+ }
+
+ cleanup(t);
+ return 0;
+}
+
static int
test_priority_directed(struct test *t)
@@ -877,8 +922,8 @@ xstats_tests(struct test *t)
ret = rte_event_dev_xstats_names_get(evdev,
RTE_EVENT_DEV_XSTATS_QUEUE,
0, xstats_names, ids, XSTATS_MAX);
- if (ret != 13) {
- printf("%d: expected 13 stats, got return %d\n", __LINE__, ret);
+ if (ret != 17) {
+ printf("%d: expected 17 stats, got return %d\n", __LINE__, ret);
return -1;
}
@@ -894,8 +939,8 @@ xstats_tests(struct test *t)
ret = rte_event_dev_xstats_get(evdev,
RTE_EVENT_DEV_XSTATS_QUEUE,
0, ids, values, ret);
- if (ret != 13) {
- printf("%d: expected 13 stats, got return %d\n", __LINE__, ret);
+ if (ret != 17) {
+ printf("%d: expected 17 stats, got return %d\n", __LINE__, ret);
return -1;
}
@@ -1059,7 +1104,11 @@ xstats_tests(struct test *t)
3 /* inflights */,
512 /* iq size */,
0, 0, 0, 0, /* iq 0, 1, 2, 3 used */
- 0, 0, 1, 0, /* qid_0_port_X_pinned_flows */
+ /* QID-to-Port: pinned_flows, packets */
+ 0, 0,
+ 0, 0,
+ 1, 3,
+ 0, 0,
};
for (i = 0; (signed int)i < ret; i++) {
if (queue_expected[i] != values[i]) {
@@ -1086,7 +1135,11 @@ xstats_tests(struct test *t)
3 /* inflight */,
512 /* iq size */,
0, 0, 0, 0, /* 4 iq used */
- 0, 0, 1, 0, /* qid to port pinned flows */
+ /* QID-to-Port: pinned_flows, packets */
+ 0, 0,
+ 0, 0,
+ 1, 0,
+ 0, 0,
};
ret = rte_event_dev_xstats_get(evdev, RTE_EVENT_DEV_XSTATS_QUEUE, 0,
@@ -1634,7 +1687,7 @@ xstats_id_reset_tests(struct test *t)
goto fail;
/* num queue stats */
-#define NUM_Q_STATS 13
+#define NUM_Q_STATS 17
/* queue offset from start of the devices whole xstats.
* This will break every time we add a statistic to a device/port/queue
*/
@@ -1665,9 +1718,13 @@ xstats_id_reset_tests(struct test *t)
"qid_0_iq_2_used",
"qid_0_iq_3_used",
"qid_0_port_0_pinned_flows",
+ "qid_0_port_0_packets",
"qid_0_port_1_pinned_flows",
+ "qid_0_port_1_packets",
"qid_0_port_2_pinned_flows",
+ "qid_0_port_2_packets",
"qid_0_port_3_pinned_flows",
+ "qid_0_port_3_packets",
};
uint64_t queue_expected[] = {
7, /* rx */
@@ -1679,10 +1736,11 @@ xstats_id_reset_tests(struct test *t)
0, /* iq 1 used */
0, /* iq 2 used */
0, /* iq 3 used */
- 0, /* qid 0 port 0 pinned flows */
- 0, /* qid 0 port 1 pinned flows */
- 1, /* qid 0 port 2 pinned flows */
- 0, /* qid 0 port 4 pinned flows */
+ /* QID-to-Port: pinned_flows, packets */
+ 0, 0,
+ 0, 0,
+ 1, 7,
+ 0, 0,
};
uint64_t queue_expected_zero[] = {
0, /* rx */
@@ -1694,12 +1752,14 @@ xstats_id_reset_tests(struct test *t)
0, /* iq 1 used */
0, /* iq 2 used */
0, /* iq 3 used */
- 0, /* qid 0 port 0 pinned flows */
- 0, /* qid 0 port 1 pinned flows */
- 1, /* qid 0 port 2 pinned flows */
- 0, /* qid 0 port 4 pinned flows */
+ /* QID-to-Port: pinned_flows, packets */
+ 0, 0,
+ 0, 0,
+ 1, 0,
+ 0, 0,
};
if (RTE_DIM(queue_expected) != NUM_Q_STATS ||
+ RTE_DIM(queue_expected_zero) != NUM_Q_STATS ||
RTE_DIM(queue_names) != NUM_Q_STATS) {
printf("%d : queue array of wrong size\n", __LINE__);
goto fail;
@@ -1718,9 +1778,9 @@ xstats_id_reset_tests(struct test *t)
failed = 1;
}
if (val != queue_expected[i]) {
- printf("%d: %s value incorrect, expected %"PRIu64
- " got %d\n", __LINE__, queue_names[i],
- queue_expected[i], id);
+ printf("%d: %d: %s value , expected %"PRIu64
+ " got %"PRIu64"\n", i, __LINE__,
+ queue_names[i], queue_expected[i], val);
failed = 1;
}
/* reset to zero */
@@ -3025,13 +3085,18 @@ test_sw_eventdev(void)
}
}
t->mbuf_pool = eventdev_func_mempool;
-
printf("*** Running Single Directed Packet test...\n");
ret = test_single_directed_packet(t);
if (ret != 0) {
printf("ERROR - Single Directed Packet test FAILED.\n");
return ret;
}
+ printf("*** Running Directed Forward Credit test...\n");
+ ret = test_directed_forward_credits(t);
+ if (ret != 0) {
+ printf("ERROR - Directed Forward Credit test FAILED.\n");
+ return ret;
+ }
printf("*** Running Single Load Balanced Packet test...\n");
ret = single_packet(t);
if (ret != 0) {
diff --git a/test/test/test_func_reentrancy.c b/test/test/test_func_reentrancy.c
index baa01ffc..95440dd1 100644
--- a/test/test/test_func_reentrancy.c
+++ b/test/test/test_func_reentrancy.c
@@ -138,7 +138,7 @@ ring_create_lookup(__attribute__((unused)) void *arg)
return -1;
}
- /* verify all ring created sucessful */
+ /* verify all ring created successful */
for (i = 0; i < MAX_ITER_TIMES; i++) {
snprintf(ring_name, sizeof(ring_name), "fr_test_%d_%d", lcore_self, i);
if (rte_ring_lookup(ring_name) == NULL)
@@ -192,7 +192,7 @@ mempool_create_lookup(__attribute__((unused)) void *arg)
return -1;
}
- /* verify all ring created sucessful */
+ /* verify all ring created successful */
for (i = 0; i < MAX_ITER_TIMES; i++) {
snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d", lcore_self, i);
if (rte_mempool_lookup(mempool_name) == NULL)
diff --git a/test/test/test_hash.c b/test/test/test_hash.c
index 2c87efe6..2fafc44b 100644
--- a/test/test/test_hash.c
+++ b/test/test/test_hash.c
@@ -1030,7 +1030,7 @@ static int test_hash_creation_with_bad_parameters(void)
handle = rte_hash_create(NULL);
if (handle != NULL) {
rte_hash_free(handle);
- printf("Impossible creating hash sucessfully without any parameter\n");
+ printf("Impossible creating hash successfully without any parameter\n");
return -1;
}
@@ -1040,7 +1040,7 @@ static int test_hash_creation_with_bad_parameters(void)
handle = rte_hash_create(&params);
if (handle != NULL) {
rte_hash_free(handle);
- printf("Impossible creating hash sucessfully with entries in parameter exceeded\n");
+ printf("Impossible creating hash successfully with entries in parameter exceeded\n");
return -1;
}
@@ -1050,7 +1050,7 @@ static int test_hash_creation_with_bad_parameters(void)
handle = rte_hash_create(&params);
if (handle != NULL) {
rte_hash_free(handle);
- printf("Impossible creating hash sucessfully if entries less than bucket_entries in parameter\n");
+ printf("Impossible creating hash successfully if entries less than bucket_entries in parameter\n");
return -1;
}
@@ -1060,7 +1060,7 @@ static int test_hash_creation_with_bad_parameters(void)
handle = rte_hash_create(&params);
if (handle != NULL) {
rte_hash_free(handle);
- printf("Impossible creating hash sucessfully if key_len in parameter is zero\n");
+ printf("Impossible creating hash successfully if key_len in parameter is zero\n");
return -1;
}
@@ -1070,7 +1070,7 @@ static int test_hash_creation_with_bad_parameters(void)
handle = rte_hash_create(&params);
if (handle != NULL) {
rte_hash_free(handle);
- printf("Impossible creating hash sucessfully with invalid socket\n");
+ printf("Impossible creating hash successfully with invalid socket\n");
return -1;
}
diff --git a/test/test/test_interrupts.c b/test/test/test_interrupts.c
index e0229e5e..e0cd8a82 100644
--- a/test/test/test_interrupts.c
+++ b/test/test/test_interrupts.c
@@ -409,7 +409,7 @@ test_interrupt(void)
printf("Check unknown valid interrupt full path\n");
if (test_interrupt_full_path_check(TEST_INTERRUPT_HANDLE_VALID) < 0) {
- printf("failure occured during checking unknown valid "
+ printf("failure occurred during checking unknown valid "
"interrupt full path\n");
goto out;
}
@@ -417,7 +417,7 @@ test_interrupt(void)
printf("Check valid UIO interrupt full path\n");
if (test_interrupt_full_path_check(TEST_INTERRUPT_HANDLE_VALID_UIO)
< 0) {
- printf("failure occured during checking valid UIO interrupt "
+ printf("failure occurred during checking valid UIO interrupt "
"full path\n");
goto out;
}
@@ -425,7 +425,7 @@ test_interrupt(void)
printf("Check valid alarm interrupt full path\n");
if (test_interrupt_full_path_check(TEST_INTERRUPT_HANDLE_VALID_ALARM)
< 0) {
- printf("failure occured during checking valid alarm "
+ printf("failure occurred during checking valid alarm "
"interrupt full path\n");
goto out;
}
diff --git a/test/test/test_link_bonding.c b/test/test/test_link_bonding.c
index 52d2d052..dc28cea5 100644
--- a/test/test/test_link_bonding.c
+++ b/test/test/test_link_bonding.c
@@ -83,7 +83,7 @@
#define MAX_PKT_BURST (512)
#define DEF_PKT_BURST (16)
-#define BONDED_DEV_NAME ("unit_test_bond_dev")
+#define BONDED_DEV_NAME ("net_bonding_ut")
#define INVALID_SOCKET_ID (-1)
#define INVALID_PORT_ID (-1)
@@ -221,6 +221,10 @@ static struct rte_eth_txconf tx_conf_default = {
};
+static void free_virtualpmd_tx_queue(void);
+
+
+
static int
configure_ethdev(uint8_t port_id, uint8_t start, uint8_t en_isr)
{
@@ -684,6 +688,7 @@ static int
remove_slaves_and_stop_bonded_device(void)
{
/* Clean up and remove slaves from bonded device */
+ free_virtualpmd_tx_queue();
while (test_params->bonded_slave_count > 0)
TEST_ASSERT_SUCCESS(test_remove_slave_from_bonded_device(),
"test_remove_slave_from_bonded_device failed");
@@ -939,7 +944,7 @@ test_set_bonded_port_initialization_mac_assignment(void)
/*
* 1. a - Create / configure bonded / slave ethdevs
*/
- bonded_port_id = rte_eth_bond_create("ethdev_bond_mac_ass_test",
+ bonded_port_id = rte_eth_bond_create("net_bonding_mac_ass_test",
BONDING_MODE_ACTIVE_BACKUP, rte_socket_id());
TEST_ASSERT(bonded_port_id > 0, "failed to create bonded device");
@@ -1173,15 +1178,19 @@ test_adding_slave_after_bonded_device_started(void)
int test_lsc_interrupt_count;
-static void
+static int
test_bonding_lsc_event_callback(uint8_t port_id __rte_unused,
- enum rte_eth_event_type type __rte_unused, void *param __rte_unused)
+ enum rte_eth_event_type type __rte_unused,
+ void *param __rte_unused,
+ void *ret_param __rte_unused)
{
pthread_mutex_lock(&mutex);
test_lsc_interrupt_count++;
pthread_cond_signal(&cvar);
pthread_mutex_unlock(&mutex);
+
+ return 0;
}
static inline int
@@ -1375,7 +1384,7 @@ test_roundrobin_tx_burst(void)
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_ROUND_ROBIN, 0, 2, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
burst_size = 20 * test_params->bonded_slave_count;
@@ -1464,7 +1473,7 @@ test_roundrobin_tx_burst_slave_tx_fail(void)
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_ROUND_ROBIN, 0,
TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
/* Generate test bursts of packets to transmit */
TEST_ASSERT_EQUAL(generate_test_burst(pkt_burst,
@@ -1617,9 +1626,6 @@ test_roundrobin_rx_burst_on_single_slave(void)
/* free mbufs */
for (i = 0; i < MAX_PKT_BURST; i++) {
- if (gen_pkt_burst[i] != NULL)
- rte_pktmbuf_free(gen_pkt_burst[i]);
-
if (rx_pkt_burst[i] != NULL)
rte_pktmbuf_free(rx_pkt_burst[i]);
}
@@ -1966,12 +1972,6 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void)
for (i = 0; i < MAX_PKT_BURST; i++) {
if (rx_pkt_burst[i] != NULL)
rte_pktmbuf_free(rx_pkt_burst[i]);
-
- if (gen_pkt_burst[1][i] != NULL)
- rte_pktmbuf_free(gen_pkt_burst[1][i]);
-
- if (gen_pkt_burst[3][i] != NULL)
- rte_pktmbuf_free(gen_pkt_burst[1][i]);
}
/* Clean up and remove slaves from bonded device */
@@ -2410,7 +2410,7 @@ test_activebackup_verify_slave_link_status_change_failover(void)
uint8_t slaves[RTE_MAX_ETHPORTS];
- int i, j, burst_size, slave_count, primary_port;
+ int i, burst_size, slave_count, primary_port;
burst_size = 21;
@@ -2543,16 +2543,6 @@ test_activebackup_verify_slave_link_status_change_failover(void)
"(%d) port_stats.opackets not as expected",
test_params->slave_port_ids[3]);
- /* free mbufs */
- for (i = 0; i < TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT; i++) {
- for (j = 0; j < MAX_PKT_BURST; j++) {
- if (pkt_burst[i][j] != NULL) {
- rte_pktmbuf_free(pkt_burst[i][j]);
- pkt_burst[i][j] = NULL;
- }
- }
- }
-
/* Clean up and remove slaves from bonded device */
return remove_slaves_and_stop_bonded_device();
}
@@ -2785,7 +2775,7 @@ balance_l23_tx_burst(uint8_t vlan_enabled, uint8_t ipv4,
static int
test_balance_l23_tx_burst_ipv4_toggle_ip_addr(void)
{
- return balance_l23_tx_burst(0, 1, 1, 0);
+ return balance_l23_tx_burst(0, 1, 0, 1);
}
static int
@@ -2951,7 +2941,7 @@ test_balance_tx_burst_slave_tx_fail(void)
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BALANCE, 0,
TEST_BAL_SLAVE_TX_FAIL_SLAVE_COUNT, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
TEST_ASSERT_SUCCESS(rte_eth_bond_xmit_policy_set(
test_params->bonded_port_id, BALANCE_XMIT_POLICY_LAYER2),
@@ -3082,7 +3072,7 @@ test_balance_rx_burst(void)
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BALANCE, 0, 3, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
/* Generate test bursts of packets to transmit */
for (i = 0; i < TEST_BALANCE_RX_BURST_SLAVE_COUNT; i++) {
@@ -3161,7 +3151,7 @@ test_balance_verify_promiscuous_enable_disable(void)
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BALANCE, 0, 4, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
rte_eth_promiscuous_enable(test_params->bonded_port_id);
@@ -3204,7 +3194,7 @@ test_balance_verify_mac_assignment(void)
/* Initialize bonded device with 2 slaves in active backup mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BALANCE, 0, 2, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
/* Verify that bonded MACs is that of first slave and that the other slave
* MAC hasn't been changed */
@@ -3314,14 +3304,14 @@ test_balance_verify_slave_link_status_change_behaviour(void)
uint8_t slaves[RTE_MAX_ETHPORTS];
- int i, j, burst_size, slave_count;
+ int i, burst_size, slave_count;
memset(pkt_burst, 0, sizeof(pkt_burst));
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BALANCE, 0, TEST_BALANCE_LINK_STATUS_SLAVE_COUNT, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
TEST_ASSERT_SUCCESS(rte_eth_bond_xmit_policy_set(
test_params->bonded_port_id, BALANCE_XMIT_POLICY_LAYER2),
@@ -3452,16 +3442,6 @@ test_balance_verify_slave_link_status_change_behaviour(void)
test_params->bonded_port_id, (int)port_stats.ipackets,
burst_size * 3);
- /* free mbufs allocate for rx testing */
- for (i = 0; i < TEST_BALANCE_RX_BURST_SLAVE_COUNT; i++) {
- for (j = 0; j < MAX_PKT_BURST; j++) {
- if (pkt_burst[i][j] != NULL) {
- rte_pktmbuf_free(pkt_burst[i][j]);
- pkt_burst[i][j] = NULL;
- }
- }
- }
-
/* Clean up and remove slaves from bonded device */
return remove_slaves_and_stop_bonded_device();
}
@@ -3476,7 +3456,7 @@ test_broadcast_tx_burst(void)
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BROADCAST, 0, 2, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
initialize_eth_header(test_params->pkt_eth_hdr,
(struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0,
@@ -3557,7 +3537,7 @@ test_broadcast_tx_burst_slave_tx_fail(void)
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BROADCAST, 0,
TEST_BCAST_SLAVE_TX_FAIL_SLAVE_COUNT, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
/* Generate test bursts for transmission */
TEST_ASSERT_EQUAL(generate_test_burst(pkts_burst,
@@ -3675,7 +3655,7 @@ test_broadcast_rx_burst(void)
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BROADCAST, 0, 3, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
/* Generate test bursts of packets to transmit */
for (i = 0; i < BROADCAST_RX_BURST_NUM_OF_SLAVES; i++) {
@@ -3754,7 +3734,7 @@ test_broadcast_verify_promiscuous_enable_disable(void)
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BROADCAST, 0, 4, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
rte_eth_promiscuous_enable(test_params->bonded_port_id);
@@ -3800,7 +3780,7 @@ test_broadcast_verify_mac_assignment(void)
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BROADCAST, 0, 4, 1),
- "Failed to intialise bonded device");
+ "Failed to initialise bonded device");
/* Verify that all MACs are the same as first slave added to bonded
* device */
@@ -3883,14 +3863,14 @@ test_broadcast_verify_slave_link_status_change_behaviour(void)
uint8_t slaves[RTE_MAX_ETHPORTS];
- int i, j, burst_size, slave_count;
+ int i, burst_size, slave_count;
memset(pkt_burst, 0, sizeof(pkt_burst));
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BROADCAST, 0, BROADCAST_LINK_STATUS_NUM_OF_SLAVES,
- 1), "Failed to intialise bonded device");
+ 1), "Failed to initialise bonded device");
/* Verify Current Slaves Count /Active Slave Count is */
slave_count = rte_eth_bond_slaves_get(test_params->bonded_port_id, slaves,
@@ -3980,16 +3960,6 @@ test_broadcast_verify_slave_link_status_change_behaviour(void)
"(%d) port_stats.ipackets not as expected\n",
test_params->bonded_port_id);
- /* free mbufs allocate for rx testing */
- for (i = 0; i < BROADCAST_LINK_STATUS_NUM_OF_SLAVES; i++) {
- for (j = 0; j < MAX_PKT_BURST; j++) {
- if (pkt_burst[i][j] != NULL) {
- rte_pktmbuf_free(pkt_burst[i][j]);
- pkt_burst[i][j] = NULL;
- }
- }
- }
-
/* Clean up and remove slaves from bonded device */
return remove_slaves_and_stop_bonded_device();
}
@@ -4372,7 +4342,7 @@ test_tlb_verify_mac_assignment(void)
/* Set explicit MAC address */
TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set(
test_params->bonded_port_id, (struct ether_addr *)bonded_mac),
- "failed to set MAC addres");
+ "failed to set MAC address");
rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr);
TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr,
@@ -4405,7 +4375,7 @@ test_tlb_verify_slave_link_status_change_failover(void)
uint8_t slaves[RTE_MAX_ETHPORTS];
- int i, j, burst_size, slave_count, primary_port;
+ int i, burst_size, slave_count, primary_port;
burst_size = 21;
@@ -4523,18 +4493,6 @@ test_tlb_verify_slave_link_status_change_failover(void)
"(%d) port_stats.ipackets not as expected\n",
test_params->bonded_port_id);
- /* free mbufs */
-
- for (i = 0; i < TEST_ADAPTIVE_TRANSMIT_LOAD_BALANCING_RX_BURST_SLAVE_COUNT; i++) {
- for (j = 0; j < MAX_PKT_BURST; j++) {
- if (pkt_burst[i][j] != NULL) {
- rte_pktmbuf_free(pkt_burst[i][j]);
- pkt_burst[i][j] = NULL;
- }
- }
- }
-
-
/* Clean up and remove slaves from bonded device */
return remove_slaves_and_stop_bonded_device();
}
diff --git a/test/test/test_link_bonding_mode4.c b/test/test/test_link_bonding_mode4.c
index 106ec624..8e9e23db 100644
--- a/test/test/test_link_bonding_mode4.c
+++ b/test/test/test_link_bonding_mode4.c
@@ -73,11 +73,11 @@
#define MAX_PKT_BURST (32)
#define DEF_PKT_BURST (16)
-#define BONDED_DEV_NAME ("unit_test_mode4_bond_dev")
+#define BONDED_DEV_NAME ("net_bonding_m4_bond_dev")
-#define SLAVE_DEV_NAME_FMT ("unit_test_mode4_slave_%d")
-#define SLAVE_RX_QUEUE_FMT ("unit_test_mode4_slave_%d_rx")
-#define SLAVE_TX_QUEUE_FMT ("unit_test_mode4_slave_%d_tx")
+#define SLAVE_DEV_NAME_FMT ("net_virt_%d")
+#define SLAVE_RX_QUEUE_FMT ("net_virt_%d_rx")
+#define SLAVE_TX_QUEUE_FMT ("net_virt_%d_tx")
#define INVALID_SOCKET_ID (-1)
#define INVALID_PORT_ID (0xFF)
@@ -682,6 +682,74 @@ test_mode4_lacp(void)
return TEST_SUCCESS;
}
+static int
+test_mode4_agg_mode_selection(void)
+{
+ int retval;
+ /* Test and verify for Stable mode */
+ retval = initialize_bonded_device_with_slaves(TEST_LACP_SLAVE_COUT, 0);
+ TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device");
+
+
+ retval = rte_eth_bond_8023ad_agg_selection_set(
+ test_params.bonded_port_id, AGG_STABLE);
+ TEST_ASSERT_SUCCESS(retval, "Failed to initialize bond aggregation mode");
+ retval = bond_handshake();
+ TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
+
+
+ retval = rte_eth_bond_8023ad_agg_selection_get(
+ test_params.bonded_port_id);
+ TEST_ASSERT_EQUAL(retval, AGG_STABLE,
+ "Wrong agg mode received from bonding device");
+
+ retval = remove_slaves_and_stop_bonded_device();
+ TEST_ASSERT_SUCCESS(retval, "Test cleanup failed.");
+
+
+ /* test and verify for Bandwidth mode */
+ retval = initialize_bonded_device_with_slaves(TEST_LACP_SLAVE_COUT, 0);
+ TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device");
+
+
+ retval = rte_eth_bond_8023ad_agg_selection_set(
+ test_params.bonded_port_id,
+ AGG_BANDWIDTH);
+ TEST_ASSERT_SUCCESS(retval,
+ "Failed to initialize bond aggregation mode");
+ retval = bond_handshake();
+ TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
+
+ retval = rte_eth_bond_8023ad_agg_selection_get(
+ test_params.bonded_port_id);
+ TEST_ASSERT_EQUAL(retval, AGG_BANDWIDTH,
+ "Wrong agg mode received from bonding device");
+
+ retval = remove_slaves_and_stop_bonded_device();
+ TEST_ASSERT_SUCCESS(retval, "Test cleanup failed.");
+
+ /* test and verify selection for count mode */
+ retval = initialize_bonded_device_with_slaves(TEST_LACP_SLAVE_COUT, 0);
+ TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device");
+
+
+ retval = rte_eth_bond_8023ad_agg_selection_set(
+ test_params.bonded_port_id, AGG_COUNT);
+ TEST_ASSERT_SUCCESS(retval,
+ "Failed to initialize bond aggregation mode");
+ retval = bond_handshake();
+ TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
+
+ retval = rte_eth_bond_8023ad_agg_selection_get(
+ test_params.bonded_port_id);
+ TEST_ASSERT_EQUAL(retval, AGG_COUNT,
+ "Wrong agg mode received from bonding device");
+
+ retval = remove_slaves_and_stop_bonded_device();
+ TEST_ASSERT_SUCCESS(retval, "Test cleanup failed.");
+
+ return TEST_SUCCESS;
+}
static int
generate_packets(struct ether_addr *src_mac,
@@ -821,7 +889,7 @@ test_mode4_rx(void)
TEST_ASSERT(cnt[0] == expected_pkts_cnt / 2 &&
cnt[1] == expected_pkts_cnt / 2,
"Expected %u packets with the same MAC and %u with different but "
- "got %u with the same and %u with diffrent MAC",
+ "got %u with the same and %u with different MAC",
expected_pkts_cnt / 2, expected_pkts_cnt / 2, cnt[1], cnt[0]);
} else if (retval > 0)
free_pkts(pkts, retval);
@@ -925,7 +993,7 @@ test_mode4_rx(void)
break;
}
- TEST_ASSERT(j < 5, "Failed to agregate slave after link up");
+ TEST_ASSERT(j < 5, "Failed to aggregate slave after link up");
}
remove_slaves_and_stop_bonded_device();
@@ -1263,7 +1331,7 @@ test_mode4_expired(void)
retval = bond_handshake_reply(slave);
TEST_ASSERT(retval >= 0, "Handshake failed");
- /* Remove replay for slave that supose to be expired. */
+ /* Remove replay for slave that suppose to be expired. */
if (slave == exp_slave) {
while (rte_ring_count(slave->rx_queue) > 0) {
void *pkt = NULL;
@@ -1535,6 +1603,11 @@ test_mode4_executor(int (*test_func)(void))
}
static int
+test_mode4_agg_mode_selection_wrapper(void){
+ return test_mode4_executor(&test_mode4_agg_mode_selection);
+}
+
+static int
test_mode4_lacp_wrapper(void)
{
return test_mode4_executor(&test_mode4_lacp);
@@ -1581,6 +1654,8 @@ static struct unit_test_suite link_bonding_mode4_test_suite = {
.setup = test_setup,
.teardown = testsuite_teardown,
.unit_test_cases = {
+ TEST_CASE_NAMED("test_mode4_agg_mode_selection",
+ test_mode4_agg_mode_selection_wrapper),
TEST_CASE_NAMED("test_mode4_lacp", test_mode4_lacp_wrapper),
TEST_CASE_NAMED("test_mode4_rx", test_mode4_rx_wrapper),
TEST_CASE_NAMED("test_mode4_tx_burst", test_mode4_tx_burst_wrapper),
diff --git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c
index d28db7d7..f8cf1cab 100644
--- a/test/test/test_link_bonding_rssconf.c
+++ b/test/test/test_link_bonding_rssconf.c
@@ -60,9 +60,9 @@
#define RXTX_RING_SIZE 1024
#define RXTX_QUEUE_COUNT 4
-#define BONDED_DEV_NAME ("rssconf_bond_dev")
+#define BONDED_DEV_NAME ("net_bonding_rss")
-#define SLAVE_DEV_NAME_FMT ("rssconf_slave%d")
+#define SLAVE_DEV_NAME_FMT ("net_null%d")
#define SLAVE_RXTX_QUEUE_FMT ("rssconf_slave%d_q%d")
#define NUM_MBUFS 8191
@@ -550,8 +550,7 @@ test_setup(void)
port_id = rte_eth_dev_count();
snprintf(name, sizeof(name), SLAVE_DEV_NAME_FMT, port_id);
- retval = rte_vdev_init(name,
- "driver=net_null,size=64,copy=0");
+ retval = rte_vdev_init(name, "size=64,copy=0");
TEST_ASSERT_SUCCESS(retval, "Failed to create null device '%s'\n",
name);
diff --git a/test/test/test_malloc.c b/test/test/test_malloc.c
index 0673d85b..013fd440 100644
--- a/test/test/test_malloc.c
+++ b/test/test/test_malloc.c
@@ -45,7 +45,6 @@
#include <rte_per_lcore.h>
#include <rte_launch.h>
#include <rte_eal.h>
-#include <rte_per_lcore.h>
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_cycles.h>
@@ -738,7 +737,7 @@ err_return:
return -1;
}
-/* Check if memory is avilable on a specific socket */
+/* Check if memory is available on a specific socket */
static int
is_mem_on_socket(int32_t socket)
{
diff --git a/test/test/test_mbuf.c b/test/test/test_mbuf.c
index d3ea812e..3396b4a9 100644
--- a/test/test/test_mbuf.c
+++ b/test/test/test_mbuf.c
@@ -43,7 +43,6 @@
#include <rte_common.h>
#include <rte_debug.h>
#include <rte_log.h>
-#include <rte_common.h>
#include <rte_memory.h>
#include <rte_memcpy.h>
#include <rte_memzone.h>
@@ -82,13 +81,8 @@
#define MAKE_STRING(x) # x
-static struct rte_mempool *pktmbuf_pool = NULL;
-static struct rte_mempool *pktmbuf_pool2 = NULL;
-
#ifdef RTE_MBUF_REFCNT_ATOMIC
-static struct rte_mempool *refcnt_pool = NULL;
-static struct rte_ring *refcnt_mbuf_ring = NULL;
static volatile uint32_t refcnt_stop_slaves;
static unsigned refcnt_lcore[RTE_MAX_LCORE];
@@ -144,7 +138,7 @@ static unsigned refcnt_lcore[RTE_MAX_LCORE];
* test data manipulation in mbuf with non-ascii data
*/
static int
-test_pktmbuf_with_non_ascii_data(void)
+test_pktmbuf_with_non_ascii_data(struct rte_mempool *pktmbuf_pool)
{
struct rte_mbuf *m = NULL;
char *data;
@@ -182,7 +176,7 @@ fail:
* test data manipulation in mbuf
*/
static int
-test_one_pktmbuf(void)
+test_one_pktmbuf(struct rte_mempool *pktmbuf_pool)
{
struct rte_mbuf *m = NULL;
char *data, *data2, *hdr;
@@ -328,7 +322,7 @@ fail:
}
static int
-testclone_testupdate_testdetach(void)
+testclone_testupdate_testdetach(struct rte_mempool *pktmbuf_pool)
{
struct rte_mbuf *m = NULL;
struct rte_mbuf *clone = NULL;
@@ -432,7 +426,8 @@ fail:
}
static int
-test_attach_from_different_pool(void)
+test_attach_from_different_pool(struct rte_mempool *pktmbuf_pool,
+ struct rte_mempool *pktmbuf_pool2)
{
struct rte_mbuf *m = NULL;
struct rte_mbuf *clone = NULL;
@@ -542,7 +537,7 @@ fail:
* test allocation and free of mbufs
*/
static int
-test_pktmbuf_pool(void)
+test_pktmbuf_pool(struct rte_mempool *pktmbuf_pool)
{
unsigned i;
struct rte_mbuf *m[NB_MBUF];
@@ -583,7 +578,7 @@ test_pktmbuf_pool(void)
* test that the pointer to the data on a packet mbuf is set properly
*/
static int
-test_pktmbuf_pool_ptr(void)
+test_pktmbuf_pool_ptr(struct rte_mempool *pktmbuf_pool)
{
unsigned i;
struct rte_mbuf *m[NB_MBUF];
@@ -636,7 +631,7 @@ test_pktmbuf_pool_ptr(void)
}
static int
-test_pktmbuf_free_segment(void)
+test_pktmbuf_free_segment(struct rte_mempool *pktmbuf_pool)
{
unsigned i;
struct rte_mbuf *m[NB_MBUF];
@@ -674,16 +669,17 @@ test_pktmbuf_free_segment(void)
/*
* Stress test for rte_mbuf atomic refcnt.
* Implies that RTE_MBUF_REFCNT_ATOMIC is defined.
- * For more efficency, recomended to run with RTE_LIBRTE_MBUF_DEBUG defined.
+ * For more efficiency, recommended to run with RTE_LIBRTE_MBUF_DEBUG defined.
*/
#ifdef RTE_MBUF_REFCNT_ATOMIC
static int
-test_refcnt_slave(__attribute__((unused)) void *arg)
+test_refcnt_slave(void *arg)
{
unsigned lcore, free;
void *mp = 0;
+ struct rte_ring *refcnt_mbuf_ring = arg;
lcore = rte_lcore_id();
printf("%s started at lcore %u\n", __func__, lcore);
@@ -704,7 +700,9 @@ test_refcnt_slave(__attribute__((unused)) void *arg)
}
static void
-test_refcnt_iter(unsigned lcore, unsigned iter)
+test_refcnt_iter(unsigned int lcore, unsigned int iter,
+ struct rte_mempool *refcnt_pool,
+ struct rte_ring *refcnt_mbuf_ring)
{
uint16_t ref;
unsigned i, n, tref, wn;
@@ -760,7 +758,8 @@ test_refcnt_iter(unsigned lcore, unsigned iter)
}
static int
-test_refcnt_master(void)
+test_refcnt_master(struct rte_mempool *refcnt_pool,
+ struct rte_ring *refcnt_mbuf_ring)
{
unsigned i, lcore;
@@ -768,7 +767,7 @@ test_refcnt_master(void)
printf("%s started at lcore %u\n", __func__, lcore);
for (i = 0; i != REFCNT_MAX_ITER; i++)
- test_refcnt_iter(lcore, i);
+ test_refcnt_iter(lcore, i, refcnt_pool, refcnt_mbuf_ring);
refcnt_stop_slaves = 1;
rte_wmb();
@@ -783,9 +782,10 @@ static int
test_refcnt_mbuf(void)
{
#ifdef RTE_MBUF_REFCNT_ATOMIC
-
unsigned lnum, master, slave, tref;
-
+ int ret = -1;
+ struct rte_mempool *refcnt_pool = NULL;
+ struct rte_ring *refcnt_mbuf_ring = NULL;
if ((lnum = rte_lcore_count()) == 1) {
printf("skipping %s, number of lcores: %u is not enough\n",
@@ -797,31 +797,31 @@ test_refcnt_mbuf(void)
/* create refcnt pool & ring if they don't exist */
- if (refcnt_pool == NULL &&
- (refcnt_pool = rte_pktmbuf_pool_create(
- MAKE_STRING(refcnt_pool),
- REFCNT_MBUF_NUM, 0, 0, 0,
- SOCKET_ID_ANY)) == NULL) {
+ refcnt_pool = rte_pktmbuf_pool_create(MAKE_STRING(refcnt_pool),
+ REFCNT_MBUF_NUM, 0, 0, 0,
+ SOCKET_ID_ANY);
+ if (refcnt_pool == NULL) {
printf("%s: cannot allocate " MAKE_STRING(refcnt_pool) "\n",
__func__);
return -1;
}
- if (refcnt_mbuf_ring == NULL &&
- (refcnt_mbuf_ring = rte_ring_create("refcnt_mbuf_ring",
+ refcnt_mbuf_ring = rte_ring_create("refcnt_mbuf_ring",
rte_align32pow2(REFCNT_RING_SIZE), SOCKET_ID_ANY,
- RING_F_SP_ENQ)) == NULL) {
+ RING_F_SP_ENQ);
+ if (refcnt_mbuf_ring == NULL) {
printf("%s: cannot allocate " MAKE_STRING(refcnt_mbuf_ring)
"\n", __func__);
- return -1;
+ goto err;
}
refcnt_stop_slaves = 0;
memset(refcnt_lcore, 0, sizeof (refcnt_lcore));
- rte_eal_mp_remote_launch(test_refcnt_slave, NULL, SKIP_MASTER);
+ rte_eal_mp_remote_launch(test_refcnt_slave, refcnt_mbuf_ring,
+ SKIP_MASTER);
- test_refcnt_master();
+ test_refcnt_master(refcnt_pool, refcnt_mbuf_ring);
rte_eal_mp_wait_lcore();
@@ -839,8 +839,15 @@ test_refcnt_mbuf(void)
rte_mempool_dump(stdout, refcnt_pool);
rte_ring_dump(stdout, refcnt_mbuf_ring);
-#endif
+ ret = 0;
+
+err:
+ rte_mempool_free(refcnt_pool);
+ rte_ring_free(refcnt_mbuf_ring);
+ return ret;
+#else
return 0;
+#endif
}
#include <unistd.h>
@@ -870,7 +877,7 @@ verify_mbuf_check_panics(struct rte_mbuf *buf)
}
static int
-test_failing_mbuf_sanity_check(void)
+test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool)
{
struct rte_mbuf *buf;
struct rte_mbuf badbuf;
@@ -931,7 +938,9 @@ test_failing_mbuf_sanity_check(void)
}
static int
-test_mbuf_linearize(int pkt_len, int nb_segs) {
+test_mbuf_linearize(struct rte_mempool *pktmbuf_pool, int pkt_len,
+ int nb_segs)
+{
struct rte_mbuf *m = NULL, *mbuf = NULL;
uint8_t *data;
@@ -1022,7 +1031,7 @@ fail:
}
static int
-test_mbuf_linearize_check(void)
+test_mbuf_linearize_check(struct rte_mempool *pktmbuf_pool)
{
struct test_mbuf_array {
int size;
@@ -1039,7 +1048,7 @@ test_mbuf_linearize_check(void)
printf("Test mbuf linearize API\n");
for (i = 0; i < RTE_DIM(mbuf_array); i++)
- if (test_mbuf_linearize(mbuf_array[i].size,
+ if (test_mbuf_linearize(pktmbuf_pool, mbuf_array[i].size,
mbuf_array[i].nb_segs)) {
printf("Test failed for %d, %d\n", mbuf_array[i].size,
mbuf_array[i].nb_segs);
@@ -1052,53 +1061,54 @@ test_mbuf_linearize_check(void)
static int
test_mbuf(void)
{
+ int ret = -1;
+ struct rte_mempool *pktmbuf_pool = NULL;
+ struct rte_mempool *pktmbuf_pool2 = NULL;
+
+
RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != RTE_CACHE_LINE_MIN_SIZE * 2);
/* create pktmbuf pool if it does not exist */
- if (pktmbuf_pool == NULL) {
- pktmbuf_pool = rte_pktmbuf_pool_create("test_pktmbuf_pool",
+ pktmbuf_pool = rte_pktmbuf_pool_create("test_pktmbuf_pool",
NB_MBUF, 32, 0, MBUF_DATA_SIZE, SOCKET_ID_ANY);
- }
if (pktmbuf_pool == NULL) {
printf("cannot allocate mbuf pool\n");
- return -1;
+ goto err;
}
/* create a specific pktmbuf pool with a priv_size != 0 and no data
* room size */
- if (pktmbuf_pool2 == NULL) {
- pktmbuf_pool2 = rte_pktmbuf_pool_create("test_pktmbuf_pool2",
+ pktmbuf_pool2 = rte_pktmbuf_pool_create("test_pktmbuf_pool2",
NB_MBUF, 32, MBUF2_PRIV_SIZE, 0, SOCKET_ID_ANY);
- }
if (pktmbuf_pool2 == NULL) {
printf("cannot allocate mbuf pool\n");
- return -1;
+ goto err;
}
/* test multiple mbuf alloc */
- if (test_pktmbuf_pool() < 0) {
+ if (test_pktmbuf_pool(pktmbuf_pool) < 0) {
printf("test_mbuf_pool() failed\n");
- return -1;
+ goto err;
}
/* do it another time to check that all mbufs were freed */
- if (test_pktmbuf_pool() < 0) {
+ if (test_pktmbuf_pool(pktmbuf_pool) < 0) {
printf("test_mbuf_pool() failed (2)\n");
- return -1;
+ goto err;
}
/* test that the pointer to the data on a packet mbuf is set properly */
- if (test_pktmbuf_pool_ptr() < 0) {
+ if (test_pktmbuf_pool_ptr(pktmbuf_pool) < 0) {
printf("test_pktmbuf_pool_ptr() failed\n");
- return -1;
+ goto err;
}
/* test data manipulation in mbuf */
- if (test_one_pktmbuf() < 0) {
+ if (test_one_pktmbuf(pktmbuf_pool) < 0) {
printf("test_one_mbuf() failed\n");
- return -1;
+ goto err;
}
@@ -1106,47 +1116,52 @@ test_mbuf(void)
* do it another time, to check that allocation reinitialize
* the mbuf correctly
*/
- if (test_one_pktmbuf() < 0) {
+ if (test_one_pktmbuf(pktmbuf_pool) < 0) {
printf("test_one_mbuf() failed (2)\n");
- return -1;
+ goto err;
}
- if (test_pktmbuf_with_non_ascii_data() < 0) {
+ if (test_pktmbuf_with_non_ascii_data(pktmbuf_pool) < 0) {
printf("test_pktmbuf_with_non_ascii_data() failed\n");
- return -1;
+ goto err;
}
/* test free pktmbuf segment one by one */
- if (test_pktmbuf_free_segment() < 0) {
+ if (test_pktmbuf_free_segment(pktmbuf_pool) < 0) {
printf("test_pktmbuf_free_segment() failed.\n");
- return -1;
+ goto err;
}
- if (testclone_testupdate_testdetach()<0){
+ if (testclone_testupdate_testdetach(pktmbuf_pool) < 0) {
printf("testclone_and_testupdate() failed \n");
- return -1;
+ goto err;
}
- if (test_attach_from_different_pool() < 0) {
+ if (test_attach_from_different_pool(pktmbuf_pool, pktmbuf_pool2) < 0) {
printf("test_attach_from_different_pool() failed\n");
- return -1;
+ goto err;
}
if (test_refcnt_mbuf()<0){
printf("test_refcnt_mbuf() failed \n");
- return -1;
+ goto err;
}
- if (test_failing_mbuf_sanity_check() < 0) {
+ if (test_failing_mbuf_sanity_check(pktmbuf_pool) < 0) {
printf("test_failing_mbuf_sanity_check() failed\n");
- return -1;
+ goto err;
}
- if (test_mbuf_linearize_check() < 0) {
+ if (test_mbuf_linearize_check(pktmbuf_pool) < 0) {
printf("test_mbuf_linearize_check() failed\n");
- return -1;
+ goto err;
}
- return 0;
+ ret = 0;
+
+err:
+ rte_mempool_free(pktmbuf_pool);
+ rte_mempool_free(pktmbuf_pool2);
+ return ret;
}
REGISTER_TEST_COMMAND(mbuf_autotest, test_mbuf);
diff --git a/test/test/test_mp_secondary.c b/test/test/test_mp_secondary.c
index 94042e57..0b93a2de 100644
--- a/test/test/test_mp_secondary.c
+++ b/test/test/test_mp_secondary.c
@@ -41,11 +41,7 @@
#include <inttypes.h>
#include <sys/queue.h>
#include <errno.h>
-#include <stdarg.h>
-#include <inttypes.h>
#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
#include <unistd.h>
#include <sys/wait.h>
#include <libgen.h>
diff --git a/test/test/test_per_lcore.c b/test/test/test_per_lcore.c
index 747513d4..247e1714 100644
--- a/test/test/test_per_lcore.c
+++ b/test/test/test_per_lcore.c
@@ -41,7 +41,6 @@
#include <rte_per_lcore.h>
#include <rte_launch.h>
#include <rte_eal.h>
-#include <rte_per_lcore.h>
#include <rte_lcore.h>
#include <rte_cycles.h>
diff --git a/test/test/test_reorder.c b/test/test/test_reorder.c
index e8a0a2f2..4ec22aca 100644
--- a/test/test/test_reorder.c
+++ b/test/test/test_reorder.c
@@ -31,9 +31,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "test.h"
-#include "stdio.h"
-
+#include <stdio.h>
#include <unistd.h>
#include <string.h>
diff --git a/test/test/test_ring.c b/test/test/test_ring.c
index 858ebc1d..d664b04b 100644
--- a/test/test/test_ring.c
+++ b/test/test/test_ring.c
@@ -54,7 +54,6 @@
#include <rte_malloc.h>
#include <rte_ring.h>
#include <rte_random.h>
-#include <rte_common.h>
#include <rte_errno.h>
#include <rte_hexdump.h>
@@ -770,6 +769,77 @@ fail_test:
}
static int
+test_ring_with_exact_size(void)
+{
+ struct rte_ring *std_ring = NULL, *exact_sz_ring = NULL;
+ void *ptr_array[16];
+ static const unsigned int ring_sz = RTE_DIM(ptr_array);
+ unsigned int i;
+ int ret = -1;
+
+ std_ring = rte_ring_create("std", ring_sz, rte_socket_id(),
+ RING_F_SP_ENQ | RING_F_SC_DEQ);
+ if (std_ring == NULL) {
+ printf("%s: error, can't create std ring\n", __func__);
+ goto end;
+ }
+ exact_sz_ring = rte_ring_create("exact sz", ring_sz, rte_socket_id(),
+ RING_F_SP_ENQ | RING_F_SC_DEQ | RING_F_EXACT_SZ);
+ if (exact_sz_ring == NULL) {
+ printf("%s: error, can't create exact size ring\n", __func__);
+ goto end;
+ }
+
+ /*
+ * Check that the exact size ring is bigger than the standard ring
+ */
+ if (rte_ring_get_size(std_ring) >= rte_ring_get_size(exact_sz_ring)) {
+ printf("%s: error, std ring (size: %u) is not smaller than exact size one (size %u)\n",
+ __func__,
+ rte_ring_get_size(std_ring),
+ rte_ring_get_size(exact_sz_ring));
+ goto end;
+ }
+ /*
+ * check that the exact_sz_ring can hold one more element than the
+ * standard ring. (16 vs 15 elements)
+ */
+ for (i = 0; i < ring_sz - 1; i++) {
+ rte_ring_enqueue(std_ring, NULL);
+ rte_ring_enqueue(exact_sz_ring, NULL);
+ }
+ if (rte_ring_enqueue(std_ring, NULL) != -ENOBUFS) {
+ printf("%s: error, unexpected successful enqueue\n", __func__);
+ goto end;
+ }
+ if (rte_ring_enqueue(exact_sz_ring, NULL) == -ENOBUFS) {
+ printf("%s: error, enqueue failed\n", __func__);
+ goto end;
+ }
+
+ /* check that dequeue returns the expected number of elements */
+ if (rte_ring_dequeue_burst(exact_sz_ring, ptr_array,
+ RTE_DIM(ptr_array), NULL) != ring_sz) {
+ printf("%s: error, failed to dequeue expected nb of elements\n",
+ __func__);
+ goto end;
+ }
+
+ /* check that the capacity function returns expected value */
+ if (rte_ring_get_capacity(exact_sz_ring) != ring_sz) {
+ printf("%s: error, incorrect ring capacity reported\n",
+ __func__);
+ goto end;
+ }
+
+ ret = 0; /* all ok if we get here */
+end:
+ rte_ring_free(std_ring);
+ rte_ring_free(exact_sz_ring);
+ return ret;
+}
+
+static int
test_ring(void)
{
/* some more basic operations */
@@ -820,6 +890,9 @@ test_ring(void)
if (test_ring_creation_with_an_used_name() < 0)
return -1;
+ if (test_ring_with_exact_size() < 0)
+ return -1;
+
/* dump the ring status */
rte_ring_list_dump(stdout);
diff --git a/test/test/test_ring_perf.c b/test/test/test_ring_perf.c
index ed89896b..84d20033 100644
--- a/test/test/test_ring_perf.c
+++ b/test/test/test_ring_perf.c
@@ -37,6 +37,7 @@
#include <rte_ring.h>
#include <rte_cycles.h>
#include <rte_launch.h>
+#include <rte_pause.h>
#include "test.h"
diff --git a/test/test/test_rwlock.c b/test/test/test_rwlock.c
index 50f58ade..3dd2ed4c 100644
--- a/test/test/test_rwlock.c
+++ b/test/test/test_rwlock.c
@@ -44,7 +44,6 @@
#include <rte_atomic.h>
#include <rte_rwlock.h>
#include <rte_eal.h>
-#include <rte_per_lcore.h>
#include <rte_lcore.h>
#include <rte_cycles.h>
diff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c
new file mode 100644
index 00000000..88fac8f4
--- /dev/null
+++ b/test/test/test_service_cores.c
@@ -0,0 +1,599 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <rte_common.h>
+#include <rte_hexdump.h>
+#include <rte_mbuf.h>
+#include <rte_malloc.h>
+#include <rte_memcpy.h>
+#include <rte_cycles.h>
+
+#include <rte_service.h>
+#include <rte_service_component.h>
+
+#include "test.h"
+
+/* used as the service core ID */
+static uint32_t slcore_id;
+/* used as timestamp to detect if a service core is running */
+static uint64_t service_tick;
+/* used as a flag to check if a function was run */
+static uint32_t service_remote_launch_flag;
+
+#define SERVICE_DELAY 1
+
+#define DUMMY_SERVICE_NAME "dummy_service"
+#define MT_SAFE_SERVICE_NAME "mt_safe_service"
+
+static int
+testsuite_setup(void)
+{
+ slcore_id = rte_get_next_lcore(/* start core */ -1,
+ /* skip master */ 1,
+ /* wrap */ 0);
+
+ return TEST_SUCCESS;
+}
+
+static void
+testsuite_teardown(void)
+{
+ /* release service cores? */
+}
+
+static int32_t dummy_cb(void *args)
+{
+ RTE_SET_USED(args);
+ service_tick++;
+ rte_delay_ms(SERVICE_DELAY);
+ return 0;
+}
+
+static int32_t dummy_mt_unsafe_cb(void *args)
+{
+ /* before running test, the initialization has set pass_test to 1.
+ * If the cmpset in service-cores is working correctly, the code here
+ * should never fail to take the lock. If the lock *is* taken, fail the
+ * test, because two threads are concurrently in a non-MT safe callback.
+ */
+ uint32_t *test_params = args;
+ uint32_t *atomic_lock = &test_params[0];
+ uint32_t *pass_test = &test_params[1];
+ int lock_taken = rte_atomic32_cmpset(atomic_lock, 0, 1);
+ if (lock_taken) {
+ /* delay with the lock held */
+ rte_delay_ms(250);
+ rte_atomic32_clear((rte_atomic32_t *)atomic_lock);
+ } else {
+ /* 2nd thread will fail to take lock, so set pass flag */
+ *pass_test = 0;
+ }
+
+ return 0;
+}
+
+
+static int32_t dummy_mt_safe_cb(void *args)
+{
+ /* Atomic checks to ensure MT safe services allow > 1 thread to
+ * concurrently run the callback. The concept is as follows;
+ * 1) if lock is available, take the lock then delay
+ * 2) if first lock is taken, and a thread arrives in the CB, we know
+ * that 2 threads are running the callback at the same time: MT safe
+ */
+ uint32_t *test_params = args;
+ uint32_t *atomic_lock = &test_params[0];
+ uint32_t *pass_test = &test_params[1];
+ int lock_taken = rte_atomic32_cmpset(atomic_lock, 0, 1);
+ if (lock_taken) {
+ /* delay with the lock held */
+ rte_delay_ms(250);
+ rte_atomic32_clear((rte_atomic32_t *)atomic_lock);
+ } else {
+ /* 2nd thread will fail to take lock, so set pass flag */
+ *pass_test = 1;
+ }
+
+ return 0;
+}
+
+/* unregister all services */
+static int
+unregister_all(void)
+{
+ uint32_t i;
+ struct rte_service_spec *dead = (struct rte_service_spec *)0xdead;
+
+ TEST_ASSERT_EQUAL(-EINVAL, rte_service_unregister(0),
+ "Unregistered NULL pointer");
+ TEST_ASSERT_EQUAL(-EINVAL, rte_service_unregister(dead),
+ "Unregistered invalid pointer");
+
+ uint32_t c = rte_service_get_count();
+ for (i = 0; i < c; i++) {
+ struct rte_service_spec *s = rte_service_get_by_id(i);
+ TEST_ASSERT_EQUAL(0, rte_service_unregister(s),
+ "Error unregistering a valid service");
+ }
+
+ rte_service_lcore_reset_all();
+
+ return TEST_SUCCESS;
+}
+
+/* register a single dummy service */
+static int
+dummy_register(void)
+{
+ /* make sure there are no remains from previous tests */
+ unregister_all();
+
+ struct rte_service_spec service;
+ memset(&service, 0, sizeof(struct rte_service_spec));
+
+ TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),
+ "Invalid callback");
+ service.callback = dummy_cb;
+
+ TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),
+ "Invalid name");
+ snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
+
+ TEST_ASSERT_EQUAL(0, rte_service_register(&service),
+ "Failed to register valid service");
+
+ return TEST_SUCCESS;
+}
+
+/* verify get_by_name() service lookup */
+static int
+service_get_by_name(void)
+{
+ unregister_all();
+
+ /* ensure with no services registered returns NULL */
+ TEST_ASSERT_EQUAL(0, rte_service_get_by_name(DUMMY_SERVICE_NAME),
+ "Service get by name should return NULL");
+
+ /* register service */
+ struct rte_service_spec service;
+ memset(&service, 0, sizeof(struct rte_service_spec));
+ TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),
+ "Invalid callback");
+ service.callback = dummy_cb;
+ TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),
+ "Invalid name");
+ snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
+ TEST_ASSERT_EQUAL(0, rte_service_register(&service),
+ "Failed to register valid service");
+
+ /* ensure with dummy services registered returns same ptr as ID */
+ struct rte_service_spec *s_by_id = rte_service_get_by_id(0);
+ TEST_ASSERT_EQUAL(s_by_id, rte_service_get_by_name(DUMMY_SERVICE_NAME),
+ "Service get_by_name should equal get_by_id()");
+
+ unregister_all();
+
+ /* ensure after unregister, get_by_name returns NULL */
+ TEST_ASSERT_EQUAL(0, rte_service_get_by_name(DUMMY_SERVICE_NAME),
+ "get by name should return NULL after unregister");
+
+ return TEST_SUCCESS;
+}
+
+/* verify probe of capabilities */
+static int
+service_probe_capability(void)
+{
+ unregister_all();
+
+ struct rte_service_spec service;
+ memset(&service, 0, sizeof(struct rte_service_spec));
+ service.callback = dummy_cb;
+ snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
+ service.capabilities |= RTE_SERVICE_CAP_MT_SAFE;
+ TEST_ASSERT_EQUAL(0, rte_service_register(&service),
+ "Register of MT SAFE service failed");
+
+ /* verify flag is enabled */
+ struct rte_service_spec *s = rte_service_get_by_id(0);
+ int32_t mt = rte_service_probe_capability(s, RTE_SERVICE_CAP_MT_SAFE);
+ TEST_ASSERT_EQUAL(1, mt, "MT SAFE capability flag not set.");
+
+
+ unregister_all();
+
+ memset(&service, 0, sizeof(struct rte_service_spec));
+ service.callback = dummy_cb;
+ snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
+ TEST_ASSERT_EQUAL(0, rte_service_register(&service),
+ "Register of non-MT safe service failed");
+
+ /* verify flag is enabled */
+ s = rte_service_get_by_id(0);
+ mt = rte_service_probe_capability(s, RTE_SERVICE_CAP_MT_SAFE);
+ TEST_ASSERT_EQUAL(0, mt, "MT SAFE cap flag set on non MT SAFE service");
+
+ return unregister_all();
+}
+
+/* verify the service name */
+static int
+service_name(void)
+{
+ struct rte_service_spec *service = rte_service_get_by_id(0);
+
+ int equal = strcmp(service->name, DUMMY_SERVICE_NAME);
+ TEST_ASSERT_EQUAL(0, equal, "Error: Service name not correct");
+
+ return unregister_all();
+}
+
+/* verify service dump */
+static int
+service_dump(void)
+{
+ struct rte_service_spec *service = rte_service_get_by_id(0);
+ rte_service_set_stats_enable(service, 1);
+ rte_service_dump(stdout, service);
+ rte_service_set_stats_enable(service, 0);
+ rte_service_dump(stdout, service);
+ return unregister_all();
+}
+
+/* start and stop a service */
+static int
+service_start_stop(void)
+{
+ struct rte_service_spec *service = rte_service_get_by_id(0);
+
+ /* is_running() returns if service is running and slcore is mapped */
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
+ "Service core add did not return zero");
+ int ret = rte_service_enable_on_lcore(service, slcore_id);
+ TEST_ASSERT_EQUAL(0, ret,
+ "Enabling service core, expected 0 got %d", ret);
+
+ TEST_ASSERT_EQUAL(0, rte_service_is_running(service),
+ "Error: Service should be stopped");
+
+ TEST_ASSERT_EQUAL(0, rte_service_stop(service),
+ "Error: Service stopped returned non-zero");
+
+ TEST_ASSERT_EQUAL(0, rte_service_is_running(service),
+ "Error: Service is running - should be stopped");
+
+ TEST_ASSERT_EQUAL(0, rte_service_start(service),
+ "Error: Service start returned non-zero");
+
+ TEST_ASSERT_EQUAL(1, rte_service_is_running(service),
+ "Error: Service is not running");
+
+ return unregister_all();
+}
+
+
+static int
+service_remote_launch_func(void *arg)
+{
+ RTE_SET_USED(arg);
+ service_remote_launch_flag = 1;
+ return 0;
+}
+
+/* enable and disable a lcore for a service */
+static int
+service_lcore_en_dis_able(void)
+{
+ struct rte_service_spec *s = rte_service_get_by_id(0);
+
+ /* expected failure cases */
+ TEST_ASSERT_EQUAL(-EINVAL, rte_service_enable_on_lcore(s, 100000),
+ "Enable on invalid core did not fail");
+ TEST_ASSERT_EQUAL(-EINVAL, rte_service_disable_on_lcore(s, 100000),
+ "Disable on invalid core did not fail");
+
+ /* add service core to allow enabling */
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
+ "Add service core failed when not in use before");
+
+ /* valid enable */
+ TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_id),
+ "Enabling valid service and core failed");
+ TEST_ASSERT_EQUAL(1, rte_service_get_enabled_on_lcore(s, slcore_id),
+ "Enabled core returned not-enabled");
+
+ /* valid disable */
+ TEST_ASSERT_EQUAL(0, rte_service_disable_on_lcore(s, slcore_id),
+ "Disabling valid service and lcore failed");
+ TEST_ASSERT_EQUAL(0, rte_service_get_enabled_on_lcore(s, slcore_id),
+ "Disabled core returned enabled");
+
+ /* call remote_launch to verify that app can launch ex-service lcore */
+ service_remote_launch_flag = 0;
+ int ret = rte_eal_remote_launch(service_remote_launch_func, NULL,
+ slcore_id);
+ TEST_ASSERT_EQUAL(0, ret, "Ex-service core remote launch failed.");
+ rte_eal_mp_wait_lcore();
+ TEST_ASSERT_EQUAL(1, service_remote_launch_flag,
+ "Ex-service core function call had no effect.");
+
+ return unregister_all();
+}
+
+static int
+service_lcore_running_check(void)
+{
+ uint64_t tick = service_tick;
+ rte_delay_ms(SERVICE_DELAY * 10);
+ /* if (tick != service_tick) we know the lcore as polled the service */
+ return tick != service_tick;
+}
+
+static int
+service_lcore_add_del(void)
+{
+ /* check initial count */
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_count(),
+ "Service lcore count has value before adding a lcore");
+
+ /* check service lcore add */
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
+ "Add service core failed when not in use before");
+ TEST_ASSERT_EQUAL(-EALREADY, rte_service_lcore_add(slcore_id),
+ "Add service core failed to refuse in-use lcore");
+
+ /* check count */
+ TEST_ASSERT_EQUAL(1, rte_service_lcore_count(),
+ "Service core count not equal to one");
+
+ /* retrieve core list, checking lcore ids */
+ const uint32_t size = 4;
+ uint32_t service_core_ids[size];
+ int32_t n = rte_service_lcore_list(service_core_ids, size);
+ TEST_ASSERT_EQUAL(1, n, "Service core list return should equal 1");
+ TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
+ "Service core list lcore must equal slcore_id");
+
+ /* recheck count, add more cores, and check count */
+ TEST_ASSERT_EQUAL(1, rte_service_lcore_count(),
+ "Service core count not equal to one");
+ uint32_t slcore_1 = rte_get_next_lcore(/* start core */ -1,
+ /* skip master */ 1,
+ /* wrap */ 0);
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_1),
+ "Service core add did not return zero");
+ uint32_t slcore_2 = rte_get_next_lcore(/* start core */ slcore_1,
+ /* skip master */ 1,
+ /* wrap */ 0);
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_2),
+ "Service core add did not return zero");
+
+ uint32_t count = rte_service_lcore_count();
+ const uint32_t cores_at_this_point = 3;
+ TEST_ASSERT_EQUAL(cores_at_this_point, count,
+ "Service core count %d, expected %d", count,
+ cores_at_this_point);
+
+ /* check longer service core list */
+ n = rte_service_lcore_list(service_core_ids, size);
+ TEST_ASSERT_EQUAL(3, n, "Service core list return should equal 3");
+ TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
+ "Service core list[0] lcore must equal 1");
+ TEST_ASSERT_EQUAL(slcore_1, service_core_ids[1],
+ "Service core list[1] lcore must equal 2");
+ TEST_ASSERT_EQUAL(slcore_2, service_core_ids[2],
+ "Service core list[2] lcore must equal 3");
+
+ /* recheck count, remove lcores, check remaining lcore_id is correct */
+ TEST_ASSERT_EQUAL(3, rte_service_lcore_count(),
+ "Service core count not equal to three");
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_del(slcore_1),
+ "Service core add did not return zero");
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_del(slcore_2),
+ "Service core add did not return zero");
+ TEST_ASSERT_EQUAL(1, rte_service_lcore_count(),
+ "Service core count not equal to one");
+ n = rte_service_lcore_list(service_core_ids, size);
+ TEST_ASSERT_EQUAL(1, n, "Service core list return should equal one");
+ TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
+ "Service core list[0] lcore must equal %d",
+ slcore_id);
+
+ return unregister_all();
+}
+
+static int
+service_threaded_test(int mt_safe)
+{
+ unregister_all();
+
+ /* add next 2 cores */
+ uint32_t slcore_1 = rte_get_next_lcore(/* start core */ -1,
+ /* skip master */ 1,
+ /* wrap */ 0);
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_1),
+ "mt safe lcore add fail");
+ uint32_t slcore_2 = rte_get_next_lcore(/* start core */ slcore_1,
+ /* skip master */ 1,
+ /* wrap */ 0);
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_2),
+ "mt safe lcore add fail");
+
+ /* Use atomic locks to verify that two threads are in the same function
+ * at the same time. These are passed to the unit tests through the
+ * callback userdata parameter
+ */
+ uint32_t test_params[2];
+ memset(test_params, 0, sizeof(uint32_t) * 2);
+
+ /* register MT safe service. */
+ struct rte_service_spec service;
+ memset(&service, 0, sizeof(struct rte_service_spec));
+ service.callback_userdata = test_params;
+ snprintf(service.name, sizeof(service.name), MT_SAFE_SERVICE_NAME);
+
+ if (mt_safe) {
+ service.callback = dummy_mt_safe_cb;
+ service.capabilities |= RTE_SERVICE_CAP_MT_SAFE;
+ } else {
+ /* initialize to pass, see callback comment for details */
+ test_params[1] = 1;
+ service.callback = dummy_mt_unsafe_cb;
+ }
+
+ TEST_ASSERT_EQUAL(0, rte_service_register(&service),
+ "Register of MT SAFE service failed");
+
+ struct rte_service_spec *s = rte_service_get_by_id(0);
+ TEST_ASSERT_EQUAL(0, rte_service_start(s),
+ "Starting valid service failed");
+ TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_1),
+ "Failed to enable lcore 1 on mt safe service");
+ TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_2),
+ "Failed to enable lcore 2 on mt safe service");
+ rte_service_lcore_start(slcore_1);
+ rte_service_lcore_start(slcore_2);
+
+ /* wait for the worker threads to run */
+ rte_delay_ms(500);
+ rte_service_lcore_stop(slcore_1);
+ rte_service_lcore_stop(slcore_2);
+
+ TEST_ASSERT_EQUAL(1, test_params[1],
+ "MT Safe service not run by two cores concurrently");
+
+ TEST_ASSERT_EQUAL(0, rte_service_stop(s),
+ "Failed to stop MT Safe service");
+
+ unregister_all();
+
+ /* return the value of the callback pass_test variable to caller */
+ return test_params[1];
+}
+
+/* tests an MT SAFE service with two cores. The callback function ensures that
+ * two threads access the callback concurrently.
+ */
+static int
+service_mt_safe_poll(void)
+{
+ int mt_safe = 1;
+ TEST_ASSERT_EQUAL(1, service_threaded_test(mt_safe),
+ "Error: MT Safe service not run by two cores concurrently");
+ return TEST_SUCCESS;
+}
+
+/* tests a NON mt safe service with two cores, the callback is serialized
+ * using the atomic cmpset.
+ */
+static int
+service_mt_unsafe_poll(void)
+{
+ int mt_safe = 0;
+ TEST_ASSERT_EQUAL(1, service_threaded_test(mt_safe),
+ "Error: NON MT Safe service run by two cores concurrently");
+ return TEST_SUCCESS;
+}
+
+/* start and stop a service core - ensuring it goes back to sleep */
+static int
+service_lcore_start_stop(void)
+{
+ /* start service core and service, create mapping so tick() runs */
+ struct rte_service_spec *s = rte_service_get_by_id(0);
+ TEST_ASSERT_EQUAL(0, rte_service_start(s),
+ "Starting valid service failed");
+ TEST_ASSERT_EQUAL(-EINVAL, rte_service_enable_on_lcore(s, slcore_id),
+ "Enabling valid service on non-service core must fail");
+
+ /* core start */
+ TEST_ASSERT_EQUAL(-EINVAL, rte_service_lcore_start(slcore_id),
+ "Service core start without add should return EINVAL");
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
+ "Service core add did not return zero");
+ TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_id),
+ "Enabling valid service on valid core failed");
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_start(slcore_id),
+ "Service core start after add failed");
+ TEST_ASSERT_EQUAL(-EALREADY, rte_service_lcore_start(slcore_id),
+ "Service core expected as running but was stopped");
+
+ /* ensures core really is running the service function */
+ TEST_ASSERT_EQUAL(1, service_lcore_running_check(),
+ "Service core expected to poll service but it didn't");
+
+ /* core stop */
+ TEST_ASSERT_EQUAL(-EINVAL, rte_service_lcore_stop(100000),
+ "Invalid Service core stop should return -EINVAL");
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_stop(slcore_id),
+ "Service core stop expected to return 0");
+ TEST_ASSERT_EQUAL(-EALREADY, rte_service_lcore_stop(slcore_id),
+ "Already stopped service core should return -EALREADY");
+
+ /* ensure service is not longer running */
+ TEST_ASSERT_EQUAL(0, service_lcore_running_check(),
+ "Service core expected to poll service but it didn't");
+
+ TEST_ASSERT_EQUAL(0, rte_service_lcore_del(slcore_id),
+ "Service core del did not return zero");
+
+ return unregister_all();
+}
+
+static struct unit_test_suite service_tests = {
+ .suite_name = "service core test suite",
+ .setup = testsuite_setup,
+ .teardown = testsuite_teardown,
+ .unit_test_cases = {
+ TEST_CASE_ST(dummy_register, NULL, unregister_all),
+ TEST_CASE_ST(dummy_register, NULL, service_name),
+ TEST_CASE_ST(dummy_register, NULL, service_get_by_name),
+ TEST_CASE_ST(dummy_register, NULL, service_dump),
+ TEST_CASE_ST(dummy_register, NULL, service_probe_capability),
+ TEST_CASE_ST(dummy_register, NULL, service_start_stop),
+ TEST_CASE_ST(dummy_register, NULL, service_lcore_add_del),
+ TEST_CASE_ST(dummy_register, NULL, service_lcore_start_stop),
+ TEST_CASE_ST(dummy_register, NULL, service_lcore_en_dis_able),
+ TEST_CASE_ST(dummy_register, NULL, service_mt_unsafe_poll),
+ TEST_CASE_ST(dummy_register, NULL, service_mt_safe_poll),
+ TEST_CASES_END() /**< NULL terminate unit test array */
+ }
+};
+
+static int
+test_service_common(void)
+{
+ return unit_test_suite_runner(&service_tests);
+}
+
+REGISTER_TEST_COMMAND(service_autotest, test_service_common);
diff --git a/test/test/test_spinlock.c b/test/test/test_spinlock.c
index 2d94eecc..a93f1baa 100644
--- a/test/test/test_spinlock.c
+++ b/test/test/test_spinlock.c
@@ -44,7 +44,6 @@
#include <rte_per_lcore.h>
#include <rte_launch.h>
#include <rte_eal.h>
-#include <rte_per_lcore.h>
#include <rte_lcore.h>
#include <rte_cycles.h>
#include <rte_spinlock.h>
@@ -202,7 +201,7 @@ test_spinlock_perf(void)
/*
* Use rte_spinlock_trylock() to trylock a spinlock object,
- * If it could not lock the object sucessfully, it would
+ * If it could not lock the object successfully, it would
* return immediately and the variable of "count" would be
* increased by one per times. the value of "count" could be
* checked as the result later.
diff --git a/test/test/test_timer.c b/test/test/test_timer.c
index 2f6525a5..de0c312f 100644
--- a/test/test/test_timer.c
+++ b/test/test/test_timer.c
@@ -136,6 +136,7 @@
#include <rte_timer.h>
#include <rte_random.h>
#include <rte_malloc.h>
+#include <rte_pause.h>
#define TEST_DURATION_S 1 /* in seconds */
#define NB_TIMER 4
diff --git a/test/test/test_timer_perf.c b/test/test/test_timer_perf.c
index fa77efbd..467ae13d 100644
--- a/test/test/test_timer_perf.c
+++ b/test/test/test_timer_perf.c
@@ -42,6 +42,7 @@
#include <rte_lcore.h>
#include <rte_random.h>
#include <rte_malloc.h>
+#include <rte_pause.h>
#define MAX_ITERATIONS 1000000
diff --git a/test/test/test_timer_racecond.c b/test/test/test_timer_racecond.c
index 7824ec4b..5e08f06b 100644
--- a/test/test/test_timer_racecond.c
+++ b/test/test/test_timer_racecond.c
@@ -42,6 +42,7 @@
#include <rte_lcore.h>
#include <rte_random.h>
#include <rte_malloc.h>
+#include <rte_pause.h>
#undef TEST_TIMER_RACECOND_VERBOSE
diff --git a/test/test/test_xmmt_ops.h b/test/test/test_xmmt_ops.h
index 42174d2c..2d6d800a 100644
--- a/test/test/test_xmmt_ops.h
+++ b/test/test/test_xmmt_ops.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2015 Cavium Networks. All rights reserved.
+ * Copyright(c) 2015 Cavium, Inc. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * * Neither the name of Cavium Networks nor the names of its
+ * * Neither the name of Cavium, Inc nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -44,7 +44,7 @@
#define vect_loadu_sil128(p) vld1q_s32((const int32_t *)p)
/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
-static inline xmm_t __attribute__((always_inline))
+static __rte_always_inline xmm_t
vect_set_epi32(int i3, int i2, int i1, int i0)
{
int32_t data[4] = {i0, i1, i2, i3};
@@ -70,7 +70,7 @@ vect_set_epi32(int i3, int i2, int i1, int i0)
#define vect_loadu_sil128(p) vec_ld(0, p)
/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */
-static inline xmm_t __attribute__((always_inline))
+static __rte_always_inline xmm_t
vect_set_epi32(int i3, int i2, int i1, int i0)
{
xmm_t data = (xmm_t){i0, i1, i2, i3};
diff --git a/test/test/virtual_pmd.c b/test/test/virtual_pmd.c
index e9dd8ac3..9d46ad56 100644
--- a/test/test/virtual_pmd.c
+++ b/test/test/virtual_pmd.c
@@ -33,6 +33,7 @@
#include <rte_mbuf.h>
#include <rte_ethdev.h>
+#include <rte_pci.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_memory.h>
@@ -484,7 +485,8 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_t port_id,
vrtl_eth_dev->data->dev_link.link_status = link_status;
- _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
+ _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC,
+ NULL, NULL);
}
int
@@ -511,20 +513,6 @@ virtual_ethdev_get_mbufs_from_tx_queue(uint8_t port_id,
burst_length, NULL);
}
-static uint8_t
-get_number_of_sockets(void)
-{
- int sockets = 0;
- int i;
- const struct rte_memseg *ms = rte_eal_get_physmem_layout();
-
- for (i = 0; i < RTE_MAX_MEMSEG && ms[i].addr != NULL; i++) {
- if (sockets < ms[i].socket_id)
- sockets = ms[i].socket_id;
- }
- /* Number of sockets = maximum socket_id + 1 */
- return ++sockets;
-}
int
virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
@@ -542,9 +530,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
* and internal (dev_private) data
*/
- if (socket_id >= get_number_of_sockets())
- goto err;
-
pci_dev = rte_zmalloc_socket(name, sizeof(*pci_dev), 0, socket_id);
if (pci_dev == NULL)
goto err;
@@ -580,6 +565,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
pci_dev->device.numa_node = socket_id;
+ pci_dev->device.name = eth_dev->data->name;
pci_drv->driver.name = virtual_ethdev_driver_name;
pci_drv->id_table = id_table;