[v1,4/6] app/crypto-perf: add function to check asymmetric operation
Checks
Commit Message
Replace checking input option for every asymmetric test case by
a function.
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
app/test-crypto-perf/cperf_test_common.c | 12 +++++++++++-
app/test-crypto-perf/cperf_test_common.h | 2 ++
app/test-crypto-perf/cperf_test_latency.c | 7 ++++---
app/test-crypto-perf/cperf_test_throughput.c | 2 +-
app/test-crypto-perf/cperf_test_verify.c | 2 +-
app/test-crypto-perf/main.c | 8 ++++----
6 files changed, 23 insertions(+), 10 deletions(-)
Comments
> Subject: [PATCH v1 4/6] app/crypto-perf: add function to check asymmetric
> operation
>
> Replace checking input option for every asymmetric test case by
> a function.
>
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
> Subject: [PATCH v1 4/6] app/crypto-perf: add function to check asymmetric
> operation
>
> Replace checking input option for every asymmetric test case by
> a function.
>
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Please fix
ninja: Entering directory `./build-gcc-static'
[1/7] Compiling C object 'app/a172ced@@dpdk-test-crypto-perf@exe/test-crypto-perf_cperf_test_common.c.o'.
FAILED: app/a172ced@@dpdk-test-crypto-perf@exe/test-crypto-perf_cperf_test_common.c.o
ccache gcc -Iapp/a172ced@@dpdk-test-crypto-perf@exe -Iapp -I../app -Ilib/cryptodev -I../lib/cryptodev -I. -I../ -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/log -I../lib/log -Ilib/telemetry/../metrics -I../lib/telemetry/../metrics -Ilib/telemetry -I../lib/telemetry -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/rcu -I../lib/rcu -Ilib/net -I../lib/net -Ilib/security -I../lib/security -Idrivers/crypto/scheduler -I../drivers/crypto/scheduler -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/reorder -I../lib/reorder -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -O2 -g -include rte_config.h -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-packed-not-aligned -Wno-missing-field-initializers -D_GNU_SOURCE -march=native -mrtm -DALLOW_EXPERIMENTAL_API -MD -MQ 'app/a172ced@@dpdk-test-crypto-perf@exe/test-crypto-perf_cperf_test_common.c.o' -MF 'app/a172ced@@dpdk-test-crypto-perf@exe/test-crypto-perf_cperf_test_common.c.o.d' -o 'app/a172ced@@dpdk-test-crypto-perf@exe/test-crypto-perf_cperf_test_common.c.o' -c ../app/test-crypto-perf/cperf_test_common.c
../app/test-crypto-perf/cperf_test_common.c: In function 'cperf_is_asym_test':
../app/test-crypto-perf/cperf_test_common.c:309:26: error: 'CPERF_ASYM_SM2' undeclared (first use in this function); did you mean 'CPERF_ASYM_MODEX'?
309 | options->op_type == CPERF_ASYM_SM2)
| ^~~~~~~~~~~~~~
| CPERF_ASYM_MODEX
../app/test-crypto-perf/cperf_test_common.c:309:26: note: each undeclared identifier is reported only once for each function it appears in
[6/7] Compiling C object 'app/a172ced@@dpdk-test-crypto-perf@exe/test-crypto-perf_main.c.o'.
@@ -152,7 +152,7 @@ cperf_alloc_common_memory(const struct cperf_options *options,
uint16_t crypto_op_size = sizeof(struct rte_crypto_op);
uint16_t crypto_op_private_size;
- if (options->op_type == CPERF_ASYM_MODEX) {
+ if (cperf_is_asym_test(options)) {
crypto_op_size += sizeof(struct rte_crypto_asym_op);
snprintf(pool_name, RTE_MEMPOOL_NAMESIZE, "perf_asym_op_pool%u",
rte_socket_id());
@@ -301,3 +301,13 @@ cperf_mbuf_set(struct rte_mbuf *mbuf,
mbuf = mbuf->next;
}
}
+
+bool
+cperf_is_asym_test(const struct cperf_options *options)
+{
+ if (options->op_type == CPERF_ASYM_MODEX ||
+ options->op_type == CPERF_ASYM_SM2)
+ return true;
+
+ return false;
+}
@@ -26,4 +26,6 @@ cperf_mbuf_set(struct rte_mbuf *mbuf,
const struct cperf_options *options,
const struct cperf_test_vector *test_vector);
+bool
+cperf_is_asym_test(const struct cperf_options *options);
#endif /* _CPERF_TEST_COMMON_H_ */
@@ -47,7 +47,7 @@ cperf_latency_test_free(struct cperf_latency_ctx *ctx)
return;
if (ctx->sess != NULL) {
- if (ctx->options->op_type == CPERF_ASYM_MODEX)
+ if (cperf_is_asym_test(ctx->options))
rte_cryptodev_asym_session_free(ctx->dev_id, ctx->sess);
#ifdef RTE_LIB_SECURITY
else if (ctx->options->op_type == CPERF_PDCP ||
@@ -217,8 +217,9 @@ cperf_latency_test_runner(void *arg)
&imix_idx, &tsc_start);
/* Populate the mbuf with the test vector */
- for (i = 0; i < burst_size; i++)
- cperf_mbuf_set(ops[i]->sym->m_src,
+ if (!cperf_is_asym_test(ctx->options))
+ for (i = 0; i < burst_size; i++)
+ cperf_mbuf_set(ops[i]->sym->m_src,
ctx->options,
ctx->test_vector);
@@ -37,7 +37,7 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
if (!ctx)
return;
if (ctx->sess) {
- if (ctx->options->op_type == CPERF_ASYM_MODEX)
+ if (cperf_is_asym_test(ctx->options))
rte_cryptodev_asym_session_free(ctx->dev_id,
(void *)ctx->sess);
#ifdef RTE_LIB_SECURITY
@@ -42,7 +42,7 @@ cperf_verify_test_free(struct cperf_verify_ctx *ctx)
return;
if (ctx->sess != NULL) {
- if (ctx->options->op_type == CPERF_ASYM_MODEX)
+ if (cperf_is_asym_test(ctx->options))
rte_cryptodev_asym_session_free(ctx->dev_id, ctx->sess);
#ifdef RTE_LIB_SECURITY
else if (ctx->options->op_type == CPERF_PDCP ||
@@ -18,6 +18,7 @@
#include "cperf.h"
#include "cperf_options.h"
#include "cperf_test_vector_parsing.h"
+#include "cperf_test_common.h"
#include "cperf_test_throughput.h"
#include "cperf_test_latency.h"
#include "cperf_test_verify.h"
@@ -203,7 +204,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
rte_cryptodev_info_get(cdev_id, &cdev_info);
- if (opts->op_type == CPERF_ASYM_MODEX) {
+ if (cperf_is_asym_test(opts)) {
if ((cdev_info.feature_flags &
RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) == 0)
continue;
@@ -289,7 +290,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
return -ENOTSUP;
}
- if (opts->op_type == CPERF_ASYM_MODEX)
+ if (cperf_is_asym_test(opts))
ret = create_asym_op_pool_socket(socket_id,
sessions_needed);
else
@@ -300,9 +301,8 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
- if (opts->op_type == CPERF_ASYM_MODEX) {
+ if (cperf_is_asym_test(opts))
qp_conf.mp_session = NULL;
- }
ret = rte_cryptodev_configure(cdev_id, &conf);
if (ret < 0) {