aboutsummaryrefslogtreecommitdiffstats
path: root/app/test-crypto-perf
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2018-06-01 09:09:08 +0200
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2018-06-01 09:12:07 +0200
commit1bd9b61222f3a81ffe770fc00b70ded6e760c42b (patch)
tree0bf7d996cf0664796687c1be6d22958fcf6a8096 /app/test-crypto-perf
parentbb4e158029645f37809fcf81a3acddd6fa11f88a (diff)
New upstream version 18.05
Change-Id: Icd4170ddc4f63aeae5d0559490e5195b5349f9c2 Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Diffstat (limited to 'app/test-crypto-perf')
-rw-r--r--app/test-crypto-perf/Makefile1
-rw-r--r--app/test-crypto-perf/cperf_options.h3
-rw-r--r--app/test-crypto-perf/cperf_test_common.c8
-rw-r--r--app/test-crypto-perf/cperf_test_pmd_cyclecount.c2
-rw-r--r--app/test-crypto-perf/cperf_test_vector_parsing.c7
-rw-r--r--app/test-crypto-perf/main.c16
-rw-r--r--app/test-crypto-perf/meson.build15
7 files changed, 40 insertions, 12 deletions
diff --git a/app/test-crypto-perf/Makefile b/app/test-crypto-perf/Makefile
index 3935aec4..28a0cd03 100644
--- a/app/test-crypto-perf/Makefile
+++ b/app/test-crypto-perf/Makefile
@@ -7,6 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
APP = dpdk-test-crypto-perf
CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
# all source are stored in SRCS-y
SRCS-y := main.c
diff --git a/app/test-crypto-perf/cperf_options.h b/app/test-crypto-perf/cperf_options.h
index 54a3ad5c..350ad7e1 100644
--- a/app/test-crypto-perf/cperf_options.h
+++ b/app/test-crypto-perf/cperf_options.h
@@ -1,3 +1,6 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
#ifndef _CPERF_OPTIONS_
#define _CPERF_OPTIONS_
diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c
index 21cb1c22..423782cb 100644
--- a/app/test-crypto-perf/cperf_test_common.c
+++ b/app/test-crypto-perf/cperf_test_common.c
@@ -3,6 +3,7 @@
*/
#include <rte_malloc.h>
+#include <rte_mbuf_pool_ops.h>
#include "cperf_test_common.h"
@@ -91,7 +92,7 @@ mempool_obj_init(struct rte_mempool *mp,
op->type = RTE_CRYPTO_OP_TYPE_SYMMETRIC;
op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
op->sess_type = RTE_CRYPTO_OP_WITH_SESSION;
- op->phys_addr = rte_mem_virt2phy(obj);
+ op->phys_addr = rte_mem_virt2iova(obj);
op->mempool = mp;
/* Set source buffer */
@@ -124,6 +125,7 @@ cperf_alloc_common_memory(const struct cperf_options *options,
uint32_t *dst_buf_offset,
struct rte_mempool **pool)
{
+ const char *mp_ops_name;
char pool_name[32] = "";
int ret;
@@ -193,8 +195,10 @@ cperf_alloc_common_memory(const struct cperf_options *options,
return -1;
}
+ mp_ops_name = rte_mbuf_best_mempool_ops();
+
ret = rte_mempool_set_ops_byname(*pool,
- RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL);
+ mp_ops_name, NULL);
if (ret != 0) {
RTE_LOG(ERR, USER1,
"Error setting mempool handler for device %u\n",
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index 8f761608..c8d16db6 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -145,7 +145,7 @@ pmd_cyclecount_bench_ops(struct pmd_cyclecount_state *state, uint32_t cur_op,
for (cur_iter_op = 0; cur_iter_op < iter_ops_needed;
cur_iter_op += test_burst_size) {
- uint32_t burst_size = RTE_MIN(state->opts->total_ops - cur_op,
+ uint32_t burst_size = RTE_MIN(iter_ops_needed - cur_iter_op,
test_burst_size);
struct rte_crypto_op **ops = &state->ctx->ops[cur_iter_op];
diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c
index 26321d00..92932a23 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.c
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
@@ -506,8 +506,7 @@ parse_file(struct cperf_test_vector *vector, struct cperf_options *opts)
if (entry == NULL)
return -1;
- memset(entry, 0, strlen(line) + 1);
- strncpy(entry, line, strlen(line));
+ strcpy(entry, line);
/* check if entry ends with , or = */
if (entry[strlen(entry) - 1] == ','
@@ -524,8 +523,8 @@ parse_file(struct cperf_test_vector *vector, struct cperf_options *opts)
if (entry_extended == NULL)
goto err;
entry = entry_extended;
-
- strncat(entry, line, strlen(line));
+ /* entry has been allocated accordingly */
+ strcpy(&entry[strlen(entry)], line);
if (entry[strlen(entry) - 1] != ',')
break;
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 019d8359..4ae14390 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -80,18 +80,24 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
nb_lcores = rte_lcore_count() - 1;
- if (enabled_cdev_count > nb_lcores) {
- printf("Number of capable crypto devices (%d) "
- "has to be less or equal to number of slave "
- "cores (%d)\n", enabled_cdev_count, nb_lcores);
+ if (nb_lcores < 1) {
+ RTE_LOG(ERR, USER1,
+ "Number of enabled cores need to be higher than 1\n");
return -EINVAL;
}
+ /*
+ * Use less number of devices,
+ * if there are more available than cores.
+ */
+ if (enabled_cdev_count > nb_lcores)
+ enabled_cdev_count = nb_lcores;
+
/* Create a mempool shared by all the devices */
uint32_t max_sess_size = 0, sess_size;
for (cdev_id = 0; cdev_id < rte_cryptodev_count(); cdev_id++) {
- sess_size = rte_cryptodev_get_private_session_size(cdev_id);
+ sess_size = rte_cryptodev_sym_get_private_session_size(cdev_id);
if (sess_size > max_sess_size)
max_sess_size = sess_size;
}
diff --git a/app/test-crypto-perf/meson.build b/app/test-crypto-perf/meson.build
new file mode 100644
index 00000000..eacd7a0f
--- /dev/null
+++ b/app/test-crypto-perf/meson.build
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+
+allow_experimental_apis = true
+sources = files('cperf_ops.c',
+ 'cperf_options_parsing.c',
+ 'cperf_test_common.c',
+ 'cperf_test_latency.c',
+ 'cperf_test_pmd_cyclecount.c',
+ 'cperf_test_throughput.c',
+ 'cperf_test_vector_parsing.c',
+ 'cperf_test_vectors.c',
+ 'cperf_test_verify.c',
+ 'main.c')
+deps = ['cryptodev']