* [dpdk-dev] [PATCH v1 0/7] add multiple cores feature to test-compress-perf
@ 2019-05-30 8:06 Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
` (8 more replies)
0 siblings, 9 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-05-30 8:06 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm.gmail.com, shallyv
This patchset adds multiple cores feature to compression perf tool.
All structures have been aligned and are consistent
with crypto perf tool. All test cases have constructor, runner
and destructor and can use more cores and compression devices at
the same time.
Tomasz Jozwiak (7):
app/test-compress-perf: add weak functions for multi-cores test
app/test-compress-perf: add ptest command line option
app/test-compress-perf: add verification test case
app/test-compress-perf: add benchmark test case
doc: update dpdk-test-compress-perf description
app/test-compress-perf: add force process termination
doc: update release notes for 19.08
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf.h | 61 +++
app/test-compress-perf/comp_perf_options.h | 46 +-
app/test-compress-perf/comp_perf_options_parse.c | 58 +-
app/test-compress-perf/comp_perf_test_benchmark.c | 152 ++++--
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +-
app/test-compress-perf/comp_perf_test_common.c | 285 ++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/comp_perf_test_verify.c | 136 +++--
app/test-compress-perf/comp_perf_test_verify.h | 24 +-
app/test-compress-perf/main.c | 630 ++++++++++------------
app/test-compress-perf/meson.build | 3 +-
doc/guides/rel_notes/release_19_08.rst | 3 +
doc/guides/tools/comp_perf.rst | 34 +-
14 files changed, 1033 insertions(+), 466 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v1 1/7] app/test-compress-perf: add weak functions for multi-cores test
2019-05-30 8:06 [dpdk-dev] [PATCH v1 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
@ 2019-05-30 8:06 ` Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
` (7 subsequent siblings)
8 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-05-30 8:06 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm.gmail.com, shallyv
This patch adds a template functions for multi-cores performance
version of compress-perf-tool.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 3 +-
app/test-compress-perf/comp_perf.h | 61 +++
app/test-compress-perf/comp_perf_options.h | 45 +-
app/test-compress-perf/comp_perf_options_parse.c | 24 +-
app/test-compress-perf/comp_perf_test_common.c | 285 +++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/main.c | 624 ++++++++++-------------
app/test-compress-perf/meson.build | 3 +-
8 files changed, 685 insertions(+), 401 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index d20e17e..de74129 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,7 +12,6 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
-SRCS-y += comp_perf_test_verify.c
-SRCS-y += comp_perf_test_benchmark.c
+SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf.h b/app/test-compress-perf/comp_perf.h
new file mode 100644
index 0000000..144ad8a
--- /dev/null
+++ b/app/test-compress-perf/comp_perf.h
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_
+#define _COMP_PERF_
+
+#include <rte_mempool.h>
+
+struct comp_test_data;
+
+typedef void *(*cperf_constructor_t)(
+ uint8_t dev_id,
+ uint16_t qp_id,
+ struct comp_test_data *options);
+
+typedef int (*cperf_runner_t)(void *test_ctx);
+typedef void (*cperf_destructor_t)(void *test_ctx);
+
+struct cperf_test {
+ cperf_constructor_t constructor;
+ cperf_runner_t runner;
+ cperf_destructor_t destructor;
+};
+
+/* Needed for weak functions*/
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_benchmark_test_destructor(void *arg __rte_unused);
+
+int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_verify_test_destructor(void *arg __rte_unused);
+
+int
+cperf_verify_test_runner(void *test_ctx __rte_unused);
+
+void *
+cperf_pmd_cyclecount_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_pmd_cyclecount_test_destructor(void *arg __rte_unused);
+
+int
+cperf_pmd_cyclecount_test_runner(void *test_ctx __rte_unused);
+
+#endif /* _COMP_PERF_ */
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index f87751d..79e63d5 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -13,6 +13,24 @@
#define MAX_MBUF_DATA_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM)
#define MAX_SEG_SIZE ((int)(MAX_MBUF_DATA_SIZE / EXPANSE_RATIO))
+extern const char *cperf_test_type_strs[];
+
+/* Cleanup state machine */
+enum cleanup_st {
+ ST_CLEAR = 0,
+ ST_TEST_DATA,
+ ST_COMPDEV,
+ ST_INPUT_DATA,
+ ST_MEMORY_ALLOC,
+ ST_DURING_TEST
+};
+
+enum cperf_perf_test_type {
+ CPERF_TEST_TYPE_BENCHMARK,
+ CPERF_TEST_TYPE_VERIFY,
+ CPERF_TEST_TYPE_PMDCC
+};
+
enum comp_operation {
COMPRESS_ONLY,
DECOMPRESS_ONLY,
@@ -30,37 +48,26 @@ struct range_list {
struct comp_test_data {
char driver_name[64];
char input_file[64];
- struct rte_mbuf **comp_bufs;
- struct rte_mbuf **decomp_bufs;
- uint32_t total_bufs;
+ enum cperf_perf_test_type test;
+
uint8_t *input_data;
size_t input_data_sz;
- uint8_t *compressed_data;
- uint8_t *decompressed_data;
- struct rte_mempool *comp_buf_pool;
- struct rte_mempool *decomp_buf_pool;
- struct rte_mempool *op_pool;
- int8_t cdev_id;
+ uint16_t nb_qps;
uint16_t seg_sz;
uint16_t out_seg_sz;
uint16_t burst_sz;
uint32_t pool_sz;
uint32_t num_iter;
uint16_t max_sgl_segs;
+
enum rte_comp_huffman huffman_enc;
enum comp_operation test_op;
int window_sz;
- struct range_list level;
- /* Store TSC duration for all levels (including level 0) */
- uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- size_t comp_data_sz;
- size_t decomp_data_sz;
+ struct range_list level_lst;
+ uint8_t level;
+
double ratio;
- double comp_gbps;
- double decomp_gbps;
- double comp_tsc_byte;
- double decomp_tsc_byte;
+ enum cleanup_st cleanup;
};
int
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 2fb6fb4..bc4b98a 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -466,19 +466,20 @@ parse_level(struct comp_test_data *test_data, const char *arg)
* Try parsing the argument as a range, if it fails,
* arse it as a list
*/
- if (parse_range(arg, &test_data->level.min, &test_data->level.max,
- &test_data->level.inc) < 0) {
- ret = parse_list(arg, test_data->level.list,
- &test_data->level.min,
- &test_data->level.max);
+ if (parse_range(arg, &test_data->level_lst.min,
+ &test_data->level_lst.max,
+ &test_data->level_lst.inc) < 0) {
+ ret = parse_list(arg, test_data->level_lst.list,
+ &test_data->level_lst.min,
+ &test_data->level_lst.max);
if (ret < 0) {
RTE_LOG(ERR, USER1,
"Failed to parse compression level/s\n");
return -1;
}
- test_data->level.count = ret;
+ test_data->level_lst.count = ret;
- if (test_data->level.max > RTE_COMP_LEVEL_MAX) {
+ if (test_data->level_lst.max > RTE_COMP_LEVEL_MAX) {
RTE_LOG(ERR, USER1, "Level cannot be higher than %u\n",
RTE_COMP_LEVEL_MAX);
return -1;
@@ -498,7 +499,6 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
-
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -572,7 +572,6 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv)
void
comp_perf_options_default(struct comp_test_data *test_data)
{
- test_data->cdev_id = -1;
test_data->seg_sz = 2048;
test_data->burst_sz = 32;
test_data->pool_sz = 8192;
@@ -581,9 +580,10 @@ comp_perf_options_default(struct comp_test_data *test_data)
test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
test_data->test_op = COMPRESS_DECOMPRESS;
test_data->window_sz = -1;
- test_data->level.min = 1;
- test_data->level.max = 9;
- test_data->level.inc = 1;
+ test_data->level_lst.min = 1;
+ test_data->level_lst.max = 9;
+ test_data->level_lst.inc = 1;
+ test_data->test = CPERF_TEST_TYPE_BENCHMARK;
}
int
diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
new file mode 100644
index 0000000..1d2b25e
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -0,0 +1,285 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_malloc.h>
+#include <rte_eal.h>
+#include <rte_log.h>
+#include <rte_compressdev.h>
+
+#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
+
+#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range)
+{
+ unsigned int next_size;
+
+ /* Check lower/upper bounds */
+ if (size < range->min)
+ return -1;
+
+ if (size > range->max)
+ return -1;
+
+ /* If range is actually only one value, size is correct */
+ if (range->increment == 0)
+ return 0;
+
+ /* Check if value is one of the supported sizes */
+ for (next_size = range->min; next_size <= range->max;
+ next_size += range->increment)
+ if (size == next_size)
+ return 0;
+
+ return -1;
+}
+
+static uint32_t
+find_buf_size(uint32_t input_size)
+{
+ uint32_t i;
+
+ /* From performance point of view the buffer size should be a
+ * power of 2 but also should be enough to store incompressible data
+ */
+
+ /* We're looking for nearest power of 2 buffer size, which is greather
+ * than input_size
+ */
+ uint32_t size =
+ !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
+
+ for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
+ ;
+
+ return i > ((UINT16_MAX + 1) >> 1)
+ ? (uint32_t)((float)input_size * EXPANSE_RATIO)
+ : i;
+}
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem)
+{
+ uint32_t i;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ rte_pktmbuf_free(mem->comp_bufs[i]);
+ rte_pktmbuf_free(mem->decomp_bufs[i]);
+ }
+
+ rte_free(mem->decomp_bufs);
+ rte_free(mem->comp_bufs);
+ rte_free(mem->decompressed_data);
+ rte_free(mem->compressed_data);
+ rte_mempool_free(mem->op_pool);
+ rte_mempool_free(mem->decomp_buf_pool);
+ rte_mempool_free(mem->comp_buf_pool);
+}
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem)
+{
+ test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
+ /* Number of segments for input and output
+ * (compression and decompression)
+ */
+ uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
+ test_data->seg_sz);
+ char pool_name[32] = "";
+
+ snprintf(pool_name, sizeof(pool_name), "comp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->comp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0,
+ test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->comp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ snprintf(pool_name, sizeof(pool_name), "decomp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->decomp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->decomp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ mem->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+
+ snprintf(pool_name, sizeof(pool_name), "op_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->op_pool = rte_comp_op_pool_create(pool_name,
+ mem->total_bufs,
+ 0, 0, rte_socket_id());
+ if (mem->op_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
+ return -1;
+ }
+
+ /*
+ * Compressed data might be a bit larger than input data,
+ * if data cannot be compressed
+ */
+ mem->compressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz * EXPANSE_RATIO
+ + MIN_COMPRESSED_BUF_SIZE, 0,
+ rte_socket_id());
+ if (mem->compressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->decompressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz, 0,
+ rte_socket_id());
+ if (mem->decompressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->comp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->comp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+
+ mem->decomp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->decomp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+ return 0;
+}
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
+{
+ uint32_t remaining_data = test_data->input_data_sz;
+ uint8_t *input_data_ptr = test_data->input_data;
+ size_t data_sz;
+ uint8_t *data_addr;
+ uint32_t i, j;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ /* Allocate data in input mbuf and copy data from input file */
+ mem->decomp_bufs[i] =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+ if (mem->decomp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->decomp_bufs[i], data_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ /* Already one segment in the mbuf */
+ uint16_t segs_per_mbuf = 1;
+
+ /* Chain mbufs if needed for input mbufs */
+ while (segs_per_mbuf < test_data->max_sgl_segs
+ && remaining_data > 0) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ data_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ if (rte_pktmbuf_chain(mem->decomp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ segs_per_mbuf++;
+ }
+
+ /* Allocate data in output mbuf */
+ mem->comp_bufs[i] =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+ if (mem->comp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->comp_bufs[i],
+ test_data->out_seg_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ /* Chain mbufs if needed for output mbufs */
+ for (j = 1; j < segs_per_mbuf; j++) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ test_data->out_seg_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ if (rte_pktmbuf_chain(mem->comp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test-compress-perf/comp_perf_test_common.h
new file mode 100644
index 0000000..9c11e3a
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_TEST_COMMON_H_
+#define _COMP_PERF_TEST_COMMON_H_
+
+#include <stdint.h>
+
+#include <rte_mempool.h>
+
+struct cperf_mem_resources {
+ uint8_t dev_id;
+ uint16_t qp_id;
+ uint8_t lcore_id;
+ uint32_t total_bufs;
+ uint8_t *compressed_data;
+ uint8_t *decompressed_data;
+
+ struct rte_mbuf **comp_bufs;
+ struct rte_mbuf **decomp_bufs;
+
+ struct rte_mempool *comp_buf_pool;
+ struct rte_mempool *decomp_buf_pool;
+ struct rte_mempool *op_pool;
+};
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range);
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem);
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem);
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem);
+
+#endif /* _COMP_PERF_TEST_COMMON_H_ */
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index c2a45d1..f393c1b 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,56 +8,44 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
-#include "comp_perf_test_verify.h"
-#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
#define NUM_MAX_XFORMS 16
#define NUM_MAX_INFLIGHT_OPS 512
-#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
-
-/* Cleanup state machine */
-static enum cleanup_st {
- ST_CLEAR = 0,
- ST_TEST_DATA,
- ST_COMPDEV,
- ST_INPUT_DATA,
- ST_MEMORY_ALLOC,
- ST_PREPARE_BUF,
- ST_DURING_TEST
-} cleanup = ST_CLEAR;
-
-static int
-param_range_check(uint16_t size, const struct rte_param_log2_range *range)
-{
- unsigned int next_size;
-
- /* Check lower/upper bounds */
- if (size < range->min)
- return -1;
-
- if (size > range->max)
- return -1;
-
- /* If range is actually only one value, size is correct */
- if (range->increment == 0)
- return 0;
-
- /* Check if value is one of the supported sizes */
- for (next_size = range->min; next_size <= range->max;
- next_size += range->increment)
- if (size == next_size)
- return 0;
-
- return -1;
-}
+__extension__
+const char *cperf_test_type_strs[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = "benchmark",
+ [CPERF_TEST_TYPE_VERIFY] = "verify",
+ [CPERF_TEST_TYPE_PMDCC] = "pmd-cyclecount"
+};
+
+__extension__
+static const struct cperf_test cperf_testmap[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = {
+ cperf_benchmark_test_constructor,
+ cperf_benchmark_test_runner,
+ cperf_benchmark_test_destructor
+ },
+ [CPERF_TEST_TYPE_VERIFY] = {
+ cperf_verify_test_constructor,
+ cperf_verify_test_runner,
+ cperf_verify_test_destructor
+ },
+ [CPERF_TEST_TYPE_PMDCC] = {
+ cperf_pmd_cyclecount_test_constructor,
+ cperf_pmd_cyclecount_test_runner,
+ cperf_pmd_cyclecount_test_destructor
+ }
+};
static int
-comp_perf_check_capabilities(struct comp_test_data *test_data)
+comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
const struct rte_compressdev_capabilities *cap;
- cap = rte_compressdev_capability_get(test_data->cdev_id,
+ cap = rte_compressdev_capability_get(cdev_id,
RTE_COMP_ALGO_DEFLATE);
if (cap == NULL) {
@@ -105,7 +93,7 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
}
/* Level 0 support */
- if (test_data->level.min == 0 &&
+ if (test_data->level_lst.min == 0 &&
(comp_flags & RTE_COMP_FF_NONCOMPRESSED_BLOCKS) == 0) {
RTE_LOG(ERR, USER1, "Compress device does not support "
"level 0 (no compression)\n");
@@ -115,110 +103,105 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
return 0;
}
-static uint32_t
-find_buf_size(uint32_t input_size)
+static int
+comp_perf_initialize_compressdev(struct comp_test_data *test_data,
+ uint8_t *enabled_cdevs)
{
- uint32_t i;
-
- /* From performance point of view the buffer size should be a
- * power of 2 but also should be enough to store incompressible data
- */
+ uint8_t enabled_cdev_count, nb_lcores, cdev_id;
+ unsigned int i, j;
+ int ret;
- /* We're looking for nearest power of 2 buffer size, which is greather
- * than input_size
- */
- uint32_t size =
- !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
+ enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
+ enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
+ if (enabled_cdev_count == 0) {
+ RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
+ test_data->driver_name);
+ return -EINVAL;
+ }
- for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
- ;
+ nb_lcores = rte_lcore_count() - 1;
+ /*
+ * Use fewer devices,
+ * if there are more available than cores.
+ */
+ if (enabled_cdev_count > nb_lcores) {
+ enabled_cdev_count = nb_lcores;
+ RTE_LOG(INFO, USER1,
+ " There's more available devices than cores!"
+ " The number of devices has been aligned to %d cores\n",
+ nb_lcores);
+ }
- return i > ((UINT16_MAX + 1) >> 1)
- ? (uint32_t)((float)input_size * EXPANSE_RATIO)
- : i;
-}
+ /*
+ * Calculate number of needed queue pairs, based on the amount
+ * of available number of logical cores and compression devices.
+ * For instance, if there are 4 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device.
+ * One queue pair per one core.
+ * if e.g.: there're 3 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device but one queue pair
+ * will left unused in the last one device
+ */
+ test_data->nb_qps = (nb_lcores % enabled_cdev_count) ?
+ (nb_lcores / enabled_cdev_count) + 1 :
+ nb_lcores / enabled_cdev_count;
-static int
-comp_perf_allocate_memory(struct comp_test_data *test_data)
-{
+ for (i = 0; i < enabled_cdev_count &&
+ i < RTE_COMPRESS_MAX_DEVS; i++) {
+ cdev_id = enabled_cdevs[i];
- test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
- /* Number of segments for input and output
- * (compression and decompression)
- */
- uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
- test_data->seg_sz);
- test_data->comp_buf_pool = rte_pktmbuf_pool_create("comp_buf_pool",
- total_segs,
- 0, 0,
- test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->comp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ struct rte_compressdev_info cdev_info;
+ uint8_t socket_id = rte_compressdev_socket_id(cdev_id);
- cleanup = ST_MEMORY_ALLOC;
- test_data->decomp_buf_pool = rte_pktmbuf_pool_create("decomp_buf_pool",
- total_segs,
- 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->decomp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ rte_compressdev_info_get(cdev_id, &cdev_info);
+ if (test_data->nb_qps > cdev_info.max_nb_queue_pairs) {
+ RTE_LOG(ERR, USER1,
+ "Number of needed queue pairs is higher "
+ "than the maximum number of queue pairs "
+ "per device.\n");
+ RTE_LOG(ERR, USER1,
+ "Lower the number of cores or increase "
+ "the number of crypto devices\n");
+ return -EINVAL;
+ }
- test_data->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+ if (comp_perf_check_capabilities(test_data, cdev_id) < 0)
+ return -EINVAL;
- test_data->op_pool = rte_comp_op_pool_create("op_pool",
- test_data->total_bufs,
- 0, 0, rte_socket_id());
- if (test_data->op_pool == NULL) {
- RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
- return -1;
- }
+ /* Configure compressdev */
+ struct rte_compressdev_config config = {
+ .socket_id = socket_id,
+ .nb_queue_pairs = test_data->nb_qps,
+ .max_nb_priv_xforms = NUM_MAX_XFORMS,
+ .max_nb_streams = 0
+ };
- /*
- * Compressed data might be a bit larger than input data,
- * if data cannot be compressed
- */
- test_data->compressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz * EXPANSE_RATIO
- + MIN_COMPRESSED_BUF_SIZE, 0,
- rte_socket_id());
- if (test_data->compressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ if (rte_compressdev_configure(cdev_id, &config) < 0) {
+ RTE_LOG(ERR, USER1, "Device configuration failed\n");
+ return -EINVAL;
+ }
- test_data->decompressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz, 0,
- rte_socket_id());
- if (test_data->decompressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ for (j = 0; j < test_data->nb_qps; j++) {
+ ret = rte_compressdev_queue_pair_setup(cdev_id, j,
+ NUM_MAX_INFLIGHT_OPS, socket_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to setup queue pair %u on compressdev %u",
+ j, cdev_id);
+ return -EINVAL;
+ }
+ }
- test_data->comp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->comp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
- " could not be allocated\n");
- return -1;
+ ret = rte_compressdev_start(cdev_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to start device %u: error %d\n",
+ cdev_id, ret);
+ return -EPERM;
+ }
}
- test_data->decomp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->decomp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
- " could not be allocated\n");
- return -1;
- }
- return 0;
+ return enabled_cdev_count;
}
static int
@@ -244,7 +227,8 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
if (test_data->input_data_sz == 0)
test_data->input_data_sz = actual_file_sz;
- if (fseek(f, 0, SEEK_SET) != 0) {
+ if (test_data->input_data_sz <= 0 || actual_file_sz <= 0 ||
+ fseek(f, 0, SEEK_SET) != 0) {
RTE_LOG(ERR, USER1, "Size of input could not be calculated\n");
goto end;
}
@@ -294,187 +278,18 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
-static int
-comp_perf_initialize_compressdev(struct comp_test_data *test_data)
-{
- uint8_t enabled_cdev_count;
- uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
-
- enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
- enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
- if (enabled_cdev_count == 0) {
- RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
- test_data->driver_name);
- return -EINVAL;
- }
-
- if (enabled_cdev_count > 1)
- RTE_LOG(INFO, USER1,
- "Only the first compress device will be used\n");
-
- test_data->cdev_id = enabled_cdevs[0];
-
- if (comp_perf_check_capabilities(test_data) < 0)
- return -1;
-
- /* Configure compressdev (one device, one queue pair) */
- struct rte_compressdev_config config = {
- .socket_id = rte_socket_id(),
- .nb_queue_pairs = 1,
- .max_nb_priv_xforms = NUM_MAX_XFORMS,
- .max_nb_streams = 0
- };
-
- if (rte_compressdev_configure(test_data->cdev_id, &config) < 0) {
- RTE_LOG(ERR, USER1, "Device configuration failed\n");
- return -1;
- }
-
- if (rte_compressdev_queue_pair_setup(test_data->cdev_id, 0,
- NUM_MAX_INFLIGHT_OPS, rte_socket_id()) < 0) {
- RTE_LOG(ERR, USER1, "Queue pair setup failed\n");
- return -1;
- }
-
- if (rte_compressdev_start(test_data->cdev_id) < 0) {
- RTE_LOG(ERR, USER1, "Device could not be started\n");
- return -1;
- }
-
- return 0;
-}
-
-static int
-prepare_bufs(struct comp_test_data *test_data)
-{
- uint32_t remaining_data = test_data->input_data_sz;
- uint8_t *input_data_ptr = test_data->input_data;
- size_t data_sz;
- uint8_t *data_addr;
- uint32_t i, j;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- /* Allocate data in input mbuf and copy data from input file */
- test_data->decomp_bufs[i] =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
- if (test_data->decomp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
-
- cleanup = ST_PREPARE_BUF;
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->decomp_bufs[i], data_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
- rte_memcpy(data_addr, input_data_ptr, data_sz);
-
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- /* Already one segment in the mbuf */
- uint16_t segs_per_mbuf = 1;
-
- /* Chain mbufs if needed for input mbufs */
- while (segs_per_mbuf < test_data->max_sgl_segs
- && remaining_data > 0) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- data_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- rte_memcpy(data_addr, input_data_ptr, data_sz);
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- if (rte_pktmbuf_chain(test_data->decomp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- segs_per_mbuf++;
- }
-
- /* Allocate data in output mbuf */
- test_data->comp_bufs[i] =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
- if (test_data->comp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->comp_bufs[i],
- test_data->out_seg_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- /* Chain mbufs if needed for output mbufs */
- for (j = 1; j < segs_per_mbuf; j++) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- test_data->out_seg_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- if (rte_pktmbuf_chain(test_data->comp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- }
- }
-
- return 0;
-}
-
-static void
-free_bufs(struct comp_test_data *test_data)
-{
- uint32_t i;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- rte_pktmbuf_free(test_data->comp_bufs[i]);
- rte_pktmbuf_free(test_data->decomp_bufs[i]);
- }
-}
-
-
-
int
main(int argc, char **argv)
{
- uint8_t level, level_idx = 0;
+ uint8_t level_idx = 0;
int ret, i;
struct comp_test_data *test_data;
+ void *ctx[RTE_MAX_LCORE] = {};
+ uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
+ int nb_compressdevs = 0;
+ uint16_t total_nb_qps = 0;
+ uint8_t cdev_id;
+ uint32_t lcore_id;
/* Initialise DPDK EAL */
ret = rte_eal_init(argc, argv);
@@ -491,7 +306,7 @@ main(int argc, char **argv)
rte_socket_id());
ret = EXIT_SUCCESS;
- cleanup = ST_TEST_DATA;
+ test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
if (comp_perf_options_parse(test_data, argc, argv) < 0) {
@@ -506,96 +321,111 @@ main(int argc, char **argv)
goto end;
}
- if (comp_perf_initialize_compressdev(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ nb_compressdevs =
+ comp_perf_initialize_compressdev(test_data, enabled_cdevs);
- cleanup = ST_COMPDEV;
- if (comp_perf_dump_input_data(test_data) < 0) {
+ if (nb_compressdevs < 1) {
ret = EXIT_FAILURE;
goto end;
}
- cleanup = ST_INPUT_DATA;
- if (comp_perf_allocate_memory(test_data) < 0) {
+ test_data->cleanup = ST_COMPDEV;
+ if (comp_perf_dump_input_data(test_data) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (prepare_bufs(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ test_data->cleanup = ST_INPUT_DATA;
- if (test_data->level.inc != 0)
- level = test_data->level.min;
+ if (test_data->level_lst.inc != 0)
+ test_data->level = test_data->level_lst.min;
else
- level = test_data->level.list[0];
+ test_data->level = test_data->level_lst.list[0];
printf("Burst size = %u\n", test_data->burst_sz);
printf("File size = %zu\n", test_data->input_data_sz);
- printf("%6s%12s%17s%19s%21s%15s%21s%23s%16s\n",
- "Level", "Comp size", "Comp ratio [%]",
- "Comp [Cycles/it]", "Comp [Cycles/Byte]", "Comp [Gbps]",
- "Decomp [Cycles/it]", "Decomp [Cycles/Byte]", "Decomp [Gbps]");
+ test_data->cleanup = ST_DURING_TEST;
+ total_nb_qps = nb_compressdevs * test_data->nb_qps;
- cleanup = ST_DURING_TEST;
- while (level <= test_data->level.max) {
+ i = 0;
+ uint8_t qp_id = 0, cdev_index = 0;
- /*
- * Run a first iteration, to verify compression and
- * get the compression ratio for the level
- */
- if (cperf_verification(test_data, level) != EXIT_SUCCESS)
- break;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
- /*
- * Run benchmarking test
- */
- if (cperf_benchmark(test_data, level) != EXIT_SUCCESS)
+ if (i == total_nb_qps)
break;
- printf("%6u%12zu%17.2f%19"PRIu64"%21.2f"
- "%15.2f%21"PRIu64"%23.2f%16.2f\n",
- level, test_data->comp_data_sz, test_data->ratio,
- test_data->comp_tsc_duration[level],
- test_data->comp_tsc_byte, test_data->comp_gbps,
- test_data->decomp_tsc_duration[level],
- test_data->decomp_tsc_byte, test_data->decomp_gbps);
+ cdev_id = enabled_cdevs[cdev_index];
+ ctx[i] = cperf_testmap[test_data->test].constructor(
+ cdev_id, qp_id,
+ test_data);
+ if (ctx[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Test run constructor failed\n");
+ goto end;
+ }
+ qp_id = (qp_id + 1) % test_data->nb_qps;
+ if (qp_id == 0)
+ cdev_index++;
+ i++;
+ }
+
+ while (test_data->level <= test_data->level_lst.max) {
+
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
- if (test_data->level.inc != 0)
- level += test_data->level.inc;
+ rte_eal_remote_launch(
+ cperf_testmap[test_data->test].runner,
+ ctx[i], lcore_id);
+ i++;
+ }
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+ ret |= rte_eal_wait_lcore(lcore_id);
+ i++;
+ }
+
+ if (ret != EXIT_SUCCESS)
+ break;
+
+ if (test_data->level_lst.inc != 0)
+ test_data->level += test_data->level_lst.inc;
else {
- if (++level_idx == test_data->level.count)
+ if (++level_idx == test_data->level_lst.count)
break;
- level = test_data->level.list[level_idx];
+ test_data->level = test_data->level_lst.list[level_idx];
}
}
end:
- switch (cleanup) {
+ switch (test_data->cleanup) {
case ST_DURING_TEST:
- case ST_PREPARE_BUF:
- free_bufs(test_data);
- /* fallthrough */
- case ST_MEMORY_ALLOC:
- rte_free(test_data->decomp_bufs);
- rte_free(test_data->comp_bufs);
- rte_free(test_data->decompressed_data);
- rte_free(test_data->compressed_data);
- rte_mempool_free(test_data->op_pool);
- rte_mempool_free(test_data->decomp_buf_pool);
- rte_mempool_free(test_data->comp_buf_pool);
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (i == total_nb_qps)
+ break;
+
+ if (ctx[i] && cperf_testmap[test_data->test].destructor)
+ cperf_testmap[test_data->test].destructor(
+ ctx[i]);
+ i++;
+ }
/* fallthrough */
case ST_INPUT_DATA:
rte_free(test_data->input_data);
/* fallthrough */
case ST_COMPDEV:
- if (test_data->cdev_id != -1)
- rte_compressdev_stop(test_data->cdev_id);
+ for (i = 0; i < nb_compressdevs &&
+ i < RTE_COMPRESS_MAX_DEVS; i++)
+ rte_compressdev_stop(enabled_cdevs[i]);
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
@@ -612,3 +442,65 @@ main(int argc, char **argv)
}
return ret;
}
+
+__rte_weak void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Benchmark test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_benchmark_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+__rte_weak void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Verify test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_verify_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_verify_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+
+__rte_weak void *
+cperf_pmd_cyclecount_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Pmd_cyclecount test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_pmd_cyclecount_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_pmd_cyclecount_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index ec73e5e..00413c6 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,6 +4,5 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
- 'comp_perf_test_verify.c',
- 'comp_perf_test_benchmark.c')
+ 'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v1 2/7] app/test-compress-perf: add ptest command line option
2019-05-30 8:06 [dpdk-dev] [PATCH v1 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
@ 2019-05-30 8:06 ` Tomasz Jozwiak
2019-06-03 13:35 ` [dpdk-dev] [EXT] " Shally Verma
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
` (6 subsequent siblings)
8 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-05-30 8:06 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm.gmail.com, shallyv
This patch adds --ptest option to make possible a choose
of test case from command line.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/comp_perf_options_parse.c | 36 ++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index bc4b98a..07672b2 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -15,6 +15,7 @@
#include "comp_perf_options.h"
+#define CPERF_PTEST_TYPE ("ptest")
#define CPERF_DRIVER_NAME ("driver-name")
#define CPERF_TEST_FILE ("input-file")
#define CPERF_SEG_SIZE ("seg-sz")
@@ -37,6 +38,7 @@ static void
usage(char *progname)
{
printf("%s [EAL options] --\n"
+ " --ptest benchmark / verify :"
" --driver-name NAME: compress driver to use\n"
" --input-file NAME: file to compress and decompress\n"
" --extended-input-sz N: extend file data up to this size (default: no extension)\n"
@@ -76,6 +78,37 @@ get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
}
static int
+parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
+{
+ struct name_id_map cperftest_namemap[] = {
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
+ CPERF_TEST_TYPE_BENCHMARK
+ },
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
+ CPERF_TEST_TYPE_VERIFY
+ },
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_PMDCC],
+ CPERF_TEST_TYPE_PMDCC
+ }
+ };
+
+ int id = get_str_key_id_mapping(
+ (struct name_id_map *)cperftest_namemap,
+ RTE_DIM(cperftest_namemap), arg);
+ if (id < 0) {
+ RTE_LOG(ERR, USER1, "failed to parse test type");
+ return -1;
+ }
+
+ test_data->test = (enum cperf_perf_test_type)id;
+
+ return 0;
+}
+
+static int
parse_uint32_t(uint32_t *value, const char *arg)
{
char *end = NULL;
@@ -499,6 +532,8 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
+
+ { CPERF_PTEST_TYPE, required_argument, 0, 0 },
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -517,6 +552,7 @@ static int
comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
{
struct long_opt_parser parsermap[] = {
+ { CPERF_PTEST_TYPE, parse_cperf_test_type },
{ CPERF_DRIVER_NAME, parse_driver_name },
{ CPERF_TEST_FILE, parse_test_file },
{ CPERF_SEG_SIZE, parse_seg_sz },
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v1 3/7] app/test-compress-perf: add verification test case
2019-05-30 8:06 [dpdk-dev] [PATCH v1 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
@ 2019-05-30 8:06 ` Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
` (5 subsequent siblings)
8 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-05-30 8:06 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm.gmail.com, shallyv
This patch adds a verification part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_verify.c | 122 ++++++++++++++++++-------
app/test-compress-perf/comp_perf_test_verify.h | 24 ++++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 112 insertions(+), 37 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index de74129..f54d9a4 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,6 +12,7 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
+SRCS-y += comp_perf_test_verify.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 28a0fe8..c2aab70 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -8,14 +8,48 @@
#include <rte_compressdev.h>
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_common.h"
+
+void
+cperf_verify_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)->mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_verify_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);
+
+ if (ctx != NULL) {
+ ctx->mem.dev_id = dev_id;
+ ctx->mem.qp_id = qp_id;
+ ctx->options = options;
+
+ if (!comp_perf_allocate_memory(ctx->options, &ctx->mem) &&
+ !prepare_bufs(ctx->options, &ctx->mem))
+ return ctx;
+ }
+
+ cperf_verify_test_destructor(ctx);
+ return NULL;
+}
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type,
- uint8_t *output_data_ptr,
- size_t *output_data_sz)
+main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->options;
+ uint8_t *output_data_ptr;
+ size_t *output_data_sz;
+ struct cperf_mem_resources *mem = &ctx->mem;
+
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -33,7 +67,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -42,7 +76,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -50,14 +84,16 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ output_data_ptr = ctx->mem.compressed_data;
+ output_data_sz = &ctx->comp_data_sz;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -69,8 +105,10 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ output_data_ptr = ctx->mem.decompressed_data;
+ output_data_sz = &ctx->decomp_data_sz;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -85,8 +123,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
num_iter = 1;
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +151,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +187,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +204,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -220,15 +260,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -291,7 +333,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
@@ -300,45 +342,45 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (output_data_sz)
*output_data_sz = output_size;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
-
-
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level)
+cperf_verify_test_runner(void *test_ctx)
{
+ struct cperf_verify_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->options;
int ret = EXIT_SUCCESS;
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+ uint32_t lcore = rte_lcore_id();
+
+ ctx->mem.lcore_id = lcore;
test_data->ratio = 0;
- if (main_loop(test_data, level, RTE_COMP_COMPRESS,
- test_data->compressed_data,
- &test_data->comp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS,
- test_data->decompressed_data,
- &test_data->decomp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (test_data->decomp_data_sz != test_data->input_data_sz) {
+ if (ctx->decomp_data_sz != test_data->input_data_sz) {
RTE_LOG(ERR, USER1,
"Decompressed data length not equal to input data length\n");
RTE_LOG(ERR, USER1,
"Decompressed size = %zu, expected = %zu\n",
- test_data->decomp_data_sz, test_data->input_data_sz);
+ ctx->decomp_data_sz, test_data->input_data_sz);
ret = EXIT_FAILURE;
goto end;
} else {
- if (memcmp(test_data->decompressed_data,
+ if (memcmp(ctx->mem.decompressed_data,
test_data->input_data,
test_data->input_data_sz) != 0) {
RTE_LOG(ERR, USER1,
@@ -348,9 +390,19 @@ cperf_verification(struct comp_test_data *test_data, uint8_t level)
}
}
- test_data->ratio = (double) test_data->comp_data_sz /
+ ctx->ratio = (double) ctx->comp_data_sz /
test_data->input_data_sz * 100;
+ if (!ctx->silent) {
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]");
+ }
+ printf("%12u%6u%12zu%17.2f\n",
+ ctx->mem.lcore_id,
+ test_data->level, ctx->comp_data_sz, ctx->ratio);
+ }
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.h b/app/test-compress-perf/comp_perf_test_verify.h
index 67c6b49..ae8b742 100644
--- a/app/test-compress-perf/comp_perf_test_verify.h
+++ b/app/test-compress-perf/comp_perf_test_verify.h
@@ -1,13 +1,33 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018-2019 Intel Corporation
*/
#ifndef _COMP_PERF_TEST_VERIFY_
#define _COMP_PERF_TEST_VERIFY_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+
+struct cperf_verify_ctx {
+ struct cperf_mem_resources mem;
+ struct comp_test_data *options;
+
+ int silent;
+ size_t comp_data_sz;
+ size_t decomp_data_sz;
+ double ratio;
+};
+
+void
+cperf_verify_test_destructor(void *arg);
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level);
+cperf_verify_test_runner(void *test_ctx);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index f393c1b..813b205 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,6 +8,7 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index 00413c6..c6246e5 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,5 +4,6 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
+ 'comp_perf_test_verify.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v1 4/7] app/test-compress-perf: add benchmark test case
2019-05-30 8:06 [dpdk-dev] [PATCH v1 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (2 preceding siblings ...)
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
@ 2019-05-30 8:06 ` Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
` (4 subsequent siblings)
8 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-05-30 8:06 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm.gmail.com, shallyv
This patch adds a benchmark part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 139 ++++++++++++++++------
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 129 insertions(+), 38 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index f54d9a4..d1a6820 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -13,6 +13,7 @@ CFLAGS += -O3
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
SRCS-y += comp_perf_test_verify.c
+SRCS-y += comp_perf_test_benchmark.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 5752906..9b0b146 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -10,11 +10,45 @@
#include "comp_perf_test_benchmark.h"
+void
+cperf_benchmark_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(
+ &((struct cperf_benchmark_ctx *)arg)->ver.mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_benchmark_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_benchmark_ctx), 0);
+
+ if (ctx != NULL) {
+ ctx->ver.mem.dev_id = dev_id;
+ ctx->ver.mem.qp_id = qp_id;
+ ctx->ver.options = options;
+ ctx->ver.silent = 1; /* ver. part will be silent */
+
+ if (!comp_perf_allocate_memory(ctx->ver.options, &ctx->ver.mem)
+ && !prepare_bufs(ctx->ver.options, &ctx->ver.mem))
+ return ctx;
+ }
+
+ cperf_benchmark_test_destructor(ctx);
+ return NULL;
+}
+
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type)
+main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->ver.options;
+ struct cperf_mem_resources *mem = &ctx->ver.mem;
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -31,7 +65,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -40,7 +74,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -48,14 +82,14 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -67,8 +101,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -82,13 +116,13 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
uint64_t tsc_start, tsc_end, tsc_duration;
- tsc_start = tsc_end = tsc_duration = 0;
- tsc_start = rte_rdtsc();
num_iter = test_data->num_iter;
+ tsc_start = tsc_end = tsc_duration = 0;
+ tsc_start = rte_rdtsc_precise();
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +147,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +183,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +200,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -177,7 +213,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -198,15 +234,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -226,7 +264,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -247,65 +285,92 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
}
- tsc_end = rte_rdtsc();
+ tsc_end = rte_rdtsc_precise();
tsc_duration = tsc_end - tsc_start;
if (type == RTE_COMP_COMPRESS)
- test_data->comp_tsc_duration[level] =
+ ctx->comp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
else
- test_data->decomp_tsc_duration[level] =
+ ctx->decomp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level)
+cperf_benchmark_test_runner(void *test_ctx)
{
+ struct cperf_benchmark_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->ver.options;
+ uint32_t lcore = rte_lcore_id();
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+
+ ctx->ver.mem.lcore_id = lcore;
int i, ret = EXIT_SUCCESS;
/*
+ * First the verification part is needed
+ */
+ if (cperf_verify_test_runner(&ctx->ver)) {
+ ret = EXIT_FAILURE;
+ goto end;
+ }
+
+ /*
* Run the tests twice, discarding the first performance
* results, before the cache is warmed up
*/
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_COMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
- test_data->comp_tsc_byte =
- (double)(test_data->comp_tsc_duration[level]) /
+ ctx->comp_tsc_byte =
+ (double)(ctx->comp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->decomp_tsc_byte =
- (double)(test_data->decomp_tsc_duration[level]) /
+ ctx->decomp_tsc_byte =
+ (double)(ctx->decomp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->comp_gbps = rte_get_tsc_hz() / test_data->comp_tsc_byte * 8 /
+ ctx->comp_gbps = rte_get_tsc_hz() / (ctx->comp_tsc_byte * 8) /
+ 1000000000;
+
+ ctx->decomp_gbps = rte_get_tsc_hz() / (ctx->decomp_tsc_byte * 8) /
1000000000;
- test_data->decomp_gbps = rte_get_tsc_hz() / test_data->decomp_tsc_byte
- * 8 / 1000000000;
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s%15s%16s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]",
+ "Comp [Gbps]", "Decomp [Gbps]");
+ }
+
+ printf("%12u%6u%12zu%17.2f%15.2f%16.2f\n",
+ ctx->ver.mem.lcore_id,
+ test_data->level, ctx->ver.comp_data_sz, ctx->ver.ratio,
+ ctx->comp_gbps,
+ ctx->decomp_gbps);
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.h b/app/test-compress-perf/comp_perf_test_benchmark.h
index b193445..d9b2694 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.h
+++ b/app/test-compress-perf/comp_perf_test_benchmark.h
@@ -5,9 +5,32 @@
#ifndef _COMP_PERF_TEST_BENCHMARK_
#define _COMP_PERF_TEST_BENCHMARK_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+#include "comp_perf_test_verify.h"
+
+struct cperf_benchmark_ctx {
+ struct cperf_verify_ctx ver;
+
+ /* Store TSC duration for all levels (including level 0) */
+ uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ double comp_gbps;
+ double decomp_gbps;
+ double comp_tsc_byte;
+ double decomp_tsc_byte;
+};
+
+void
+cperf_benchmark_test_destructor(void *arg);
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level);
+cperf_benchmark_test_runner(void *test_ctx);
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 813b205..c8be84e 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -9,6 +9,7 @@
#include "comp_perf_options.h"
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index c6246e5..1136f04 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -5,5 +5,6 @@ allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
'comp_perf_test_verify.c',
+ 'comp_perf_test_benchmark.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v1 5/7] doc: update dpdk-test-compress-perf description
2019-05-30 8:06 [dpdk-dev] [PATCH v1 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (3 preceding siblings ...)
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
@ 2019-05-30 8:06 ` Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
` (3 subsequent siblings)
8 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-05-30 8:06 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm.gmail.com, shallyv
This patch updates a dpdk-test-compress-perf documentation.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
doc/guides/tools/comp_perf.rst | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/doc/guides/tools/comp_perf.rst b/doc/guides/tools/comp_perf.rst
index 52869c1..71eef18 100644
--- a/doc/guides/tools/comp_perf.rst
+++ b/doc/guides/tools/comp_perf.rst
@@ -6,7 +6,9 @@ dpdk-test-compress-perf Tool
The ``dpdk-test-compress-perf`` tool is a Data Plane Development Kit (DPDK)
utility that allows measuring performance parameters of PMDs available in the
-compress tree. The tool reads the data from a file (--input-file),
+compress tree. User can use multiple cores to run tests on but only
+one type of compression PMD can be measured during single application
+execution. The tool reads the data from a file (--input-file),
dumps all the file into a buffer and fills out the data of input mbufs,
which are passed to compress device with compression operations.
Then, the output buffers are fed into the decompression stage, and the resulting
@@ -26,9 +28,35 @@ Limitations
* Stateful operation is not supported in this version.
+EAL Options
+~~~~~~~~~~~
+
+The following are the EAL command-line options that can be used in conjunction
+with the ``dpdk-test-compress-perf`` application.
+See the DPDK Getting Started Guides for more information on these options.
+
+* ``-c <COREMASK>`` or ``-l <CORELIST>``
+
+ Set the hexadecimal bitmask of the cores to run on. The corelist is a
+ list cores to use.
+
+.. Note::
+
+ One lcore is needed for process admin, tests are run on all other cores.
+ To run tests on two lcores, three lcores must be passed to the tool.
+
+* ``-w <PCI>``
+
+ Add a PCI device in white list.
+
+* ``--vdev <driver><id>``
+
+ Add a virtual device.
+
+Appication Options
+~~~~~~~~~~~~~~~~~~
-Command line options
---------------------
+ ``--ptest [benchmark/verify]``: set test type (default: benchmark)
``--driver-name NAME``: compress driver to use
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v1 6/7] app/test-compress-perf: add force process termination
2019-05-30 8:06 [dpdk-dev] [PATCH v1 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (4 preceding siblings ...)
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
@ 2019-05-30 8:06 ` Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
` (2 subsequent siblings)
8 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-05-30 8:06 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm.gmail.com, shallyv
This patch adds a possibility to force controlled process termination
as a result of two signals: SIGTERM and SIGINT
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/comp_perf_options.h | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 13 ++++++++++++
app/test-compress-perf/comp_perf_test_verify.c | 14 ++++++++++++
app/test-compress-perf/main.c | 26 +++++++++++++++++++++--
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 79e63d5..534212d 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -68,6 +68,7 @@ struct comp_test_data {
double ratio;
enum cleanup_st cleanup;
+ int perf_comp_force_stop;
};
int
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 9b0b146..b38b33c 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -183,6 +183,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -241,6 +244,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -305,6 +311,13 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
return res;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index c2aab70..b2cd7a0 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -187,6 +187,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -267,6 +270,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -345,6 +351,14 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
+
return res;
}
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index c8be84e..98acd02 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -2,6 +2,10 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include <rte_malloc.h>
#include <rte_eal.h>
#include <rte_log.h>
@@ -42,6 +46,8 @@ static const struct cperf_test cperf_testmap[] = {
}
};
+static struct comp_test_data *test_data;
+
static int
comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
@@ -280,12 +286,24 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
+static void
+comp_perf_cleanup_on_signal(int signalNumber __rte_unused)
+{
+ test_data->perf_comp_force_stop = 1;
+}
+
+static void
+comp_perf_register_cleanup_on_signal(void)
+{
+ signal(SIGTERM, comp_perf_cleanup_on_signal);
+ signal(SIGINT, comp_perf_cleanup_on_signal);
+}
+
int
main(int argc, char **argv)
{
uint8_t level_idx = 0;
int ret, i;
- struct comp_test_data *test_data;
void *ctx[RTE_MAX_LCORE] = {};
uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
int nb_compressdevs = 0;
@@ -307,6 +325,8 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d\n",
rte_socket_id());
+ comp_perf_register_cleanup_on_signal();
+
ret = EXIT_SUCCESS;
test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
@@ -426,8 +446,10 @@ main(int argc, char **argv)
/* fallthrough */
case ST_COMPDEV:
for (i = 0; i < nb_compressdevs &&
- i < RTE_COMPRESS_MAX_DEVS; i++)
+ i < RTE_COMPRESS_MAX_DEVS; i++) {
rte_compressdev_stop(enabled_cdevs[i]);
+ rte_compressdev_close(enabled_cdevs[i]);
+ }
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v1 7/7] doc: update release notes for 19.08
2019-05-30 8:06 [dpdk-dev] [PATCH v1 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (5 preceding siblings ...)
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
@ 2019-05-30 8:06 ` Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
[not found] ` <1560031175-13787-1-git-send-email-tjozwiakgm@gmail.com>
8 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-05-30 8:06 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm.gmail.com, shallyv
Added release note entry for test-compress-perf application
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
doc/guides/rel_notes/release_19_08.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/doc/guides/rel_notes/release_19_08.rst b/doc/guides/rel_notes/release_19_08.rst
index b9510f9..543e7d3 100644
--- a/doc/guides/rel_notes/release_19_08.rst
+++ b/doc/guides/rel_notes/release_19_08.rst
@@ -54,6 +54,9 @@ New Features
Also, make sure to start the actual text at the margin.
=========================================================
+* **Updated test-compress-perf tool application.**
+
+ Added multiple cores feature to compression perf tool application.
Removed Items
-------------
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v1 2/7] app/test-compress-perf: add ptest command line option
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
@ 2019-06-03 13:35 ` Shally Verma
0 siblings, 0 replies; 87+ messages in thread
From: Shally Verma @ 2019-06-03 13:35 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, fiona.trahe, tjozwiakgm.gmail.com
> -----Original Message-----
> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> Sent: Thursday, May 30, 2019 1:36 PM
> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm.gmail.com@mx0a-
> 0016f401.pphosted.com; Shally Verma <shallyv@marvell.com>
> Subject: [EXT] [PATCH v1 2/7] app/test-compress-perf: add ptest command line
> option
>
> External Email
>
> ----------------------------------------------------------------------
> This patch adds --ptest option to make possible a choose of test case from
> command line.
>
> Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> ---
> app/test-compress-perf/comp_perf_options_parse.c | 36
> ++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-
> compress-perf/comp_perf_options_parse.c
> index bc4b98a..07672b2 100644
> --- a/app/test-compress-perf/comp_perf_options_parse.c
> +++ b/app/test-compress-perf/comp_perf_options_parse.c
> @@ -15,6 +15,7 @@
>
> #include "comp_perf_options.h"
>
> +#define CPERF_PTEST_TYPE ("ptest")
Why name cant be just CPERF_TEST_TYPE instead of PTEST_TYPE?
..
> 2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf
2019-05-30 8:06 [dpdk-dev] [PATCH v1 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (6 preceding siblings ...)
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
@ 2019-06-08 22:22 ` Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
` (7 more replies)
[not found] ` <1560031175-13787-1-git-send-email-tjozwiakgm@gmail.com>
8 siblings, 8 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-08 22:22 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv
This patchset adds multiple cores feature to compression perf tool.
All structures have been aligned and are consistent
with crypto perf tool. All test cases have constructor, runner
and destructor and can use more cores and compression devices at
the same time.
v2 changes:
- fixed checkpatch warning
- fixed max_nb_queue_pairs detection. Based on compression API
if max_nb_queue_pairs = 0 that means there is no limit in
maximum number of queue pairs
- fixed qp setup on the last device
Tomasz Jozwiak (7):
app/test-compress-perf: add weak functions for multi-cores test
app/test-compress-perf: add ptest command line option
app/test-compress-perf: add verification test case
app/test-compress-perf: add benchmark test case
doc: update dpdk-test-compress-perf description
app/test-compress-perf: add force process termination
doc: update release notes for 19.08
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf.h | 61 +++
app/test-compress-perf/comp_perf_options.h | 46 +-
app/test-compress-perf/comp_perf_options_parse.c | 58 +-
app/test-compress-perf/comp_perf_test_benchmark.c | 152 ++++--
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +-
app/test-compress-perf/comp_perf_test_common.c | 285 ++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/comp_perf_test_verify.c | 136 +++--
app/test-compress-perf/comp_perf_test_verify.h | 24 +-
app/test-compress-perf/main.c | 633 ++++++++++------------
app/test-compress-perf/meson.build | 3 +-
doc/guides/rel_notes/release_19_08.rst | 3 +
doc/guides/tools/comp_perf.rst | 34 +-
14 files changed, 1036 insertions(+), 466 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 1/7] app/test-compress-perf: add weak functions for multi-cores test
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
@ 2019-06-08 22:22 ` Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
` (6 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-08 22:22 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a template functions for multi-cores performance
version of compress-perf-tool.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 3 +-
app/test-compress-perf/comp_perf.h | 61 +++
app/test-compress-perf/comp_perf_options.h | 45 +-
app/test-compress-perf/comp_perf_options_parse.c | 24 +-
app/test-compress-perf/comp_perf_test_common.c | 285 +++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/main.c | 627 ++++++++++-------------
app/test-compress-perf/meson.build | 3 +-
8 files changed, 688 insertions(+), 401 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index d20e17e..de74129 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,7 +12,6 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
-SRCS-y += comp_perf_test_verify.c
-SRCS-y += comp_perf_test_benchmark.c
+SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf.h b/app/test-compress-perf/comp_perf.h
new file mode 100644
index 0000000..144ad8a
--- /dev/null
+++ b/app/test-compress-perf/comp_perf.h
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_
+#define _COMP_PERF_
+
+#include <rte_mempool.h>
+
+struct comp_test_data;
+
+typedef void *(*cperf_constructor_t)(
+ uint8_t dev_id,
+ uint16_t qp_id,
+ struct comp_test_data *options);
+
+typedef int (*cperf_runner_t)(void *test_ctx);
+typedef void (*cperf_destructor_t)(void *test_ctx);
+
+struct cperf_test {
+ cperf_constructor_t constructor;
+ cperf_runner_t runner;
+ cperf_destructor_t destructor;
+};
+
+/* Needed for weak functions*/
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_benchmark_test_destructor(void *arg __rte_unused);
+
+int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_verify_test_destructor(void *arg __rte_unused);
+
+int
+cperf_verify_test_runner(void *test_ctx __rte_unused);
+
+void *
+cperf_pmd_cyclecount_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_pmd_cyclecount_test_destructor(void *arg __rte_unused);
+
+int
+cperf_pmd_cyclecount_test_runner(void *test_ctx __rte_unused);
+
+#endif /* _COMP_PERF_ */
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index f87751d..79e63d5 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -13,6 +13,24 @@
#define MAX_MBUF_DATA_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM)
#define MAX_SEG_SIZE ((int)(MAX_MBUF_DATA_SIZE / EXPANSE_RATIO))
+extern const char *cperf_test_type_strs[];
+
+/* Cleanup state machine */
+enum cleanup_st {
+ ST_CLEAR = 0,
+ ST_TEST_DATA,
+ ST_COMPDEV,
+ ST_INPUT_DATA,
+ ST_MEMORY_ALLOC,
+ ST_DURING_TEST
+};
+
+enum cperf_perf_test_type {
+ CPERF_TEST_TYPE_BENCHMARK,
+ CPERF_TEST_TYPE_VERIFY,
+ CPERF_TEST_TYPE_PMDCC
+};
+
enum comp_operation {
COMPRESS_ONLY,
DECOMPRESS_ONLY,
@@ -30,37 +48,26 @@ struct range_list {
struct comp_test_data {
char driver_name[64];
char input_file[64];
- struct rte_mbuf **comp_bufs;
- struct rte_mbuf **decomp_bufs;
- uint32_t total_bufs;
+ enum cperf_perf_test_type test;
+
uint8_t *input_data;
size_t input_data_sz;
- uint8_t *compressed_data;
- uint8_t *decompressed_data;
- struct rte_mempool *comp_buf_pool;
- struct rte_mempool *decomp_buf_pool;
- struct rte_mempool *op_pool;
- int8_t cdev_id;
+ uint16_t nb_qps;
uint16_t seg_sz;
uint16_t out_seg_sz;
uint16_t burst_sz;
uint32_t pool_sz;
uint32_t num_iter;
uint16_t max_sgl_segs;
+
enum rte_comp_huffman huffman_enc;
enum comp_operation test_op;
int window_sz;
- struct range_list level;
- /* Store TSC duration for all levels (including level 0) */
- uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- size_t comp_data_sz;
- size_t decomp_data_sz;
+ struct range_list level_lst;
+ uint8_t level;
+
double ratio;
- double comp_gbps;
- double decomp_gbps;
- double comp_tsc_byte;
- double decomp_tsc_byte;
+ enum cleanup_st cleanup;
};
int
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 2fb6fb4..bc4b98a 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -466,19 +466,20 @@ parse_level(struct comp_test_data *test_data, const char *arg)
* Try parsing the argument as a range, if it fails,
* arse it as a list
*/
- if (parse_range(arg, &test_data->level.min, &test_data->level.max,
- &test_data->level.inc) < 0) {
- ret = parse_list(arg, test_data->level.list,
- &test_data->level.min,
- &test_data->level.max);
+ if (parse_range(arg, &test_data->level_lst.min,
+ &test_data->level_lst.max,
+ &test_data->level_lst.inc) < 0) {
+ ret = parse_list(arg, test_data->level_lst.list,
+ &test_data->level_lst.min,
+ &test_data->level_lst.max);
if (ret < 0) {
RTE_LOG(ERR, USER1,
"Failed to parse compression level/s\n");
return -1;
}
- test_data->level.count = ret;
+ test_data->level_lst.count = ret;
- if (test_data->level.max > RTE_COMP_LEVEL_MAX) {
+ if (test_data->level_lst.max > RTE_COMP_LEVEL_MAX) {
RTE_LOG(ERR, USER1, "Level cannot be higher than %u\n",
RTE_COMP_LEVEL_MAX);
return -1;
@@ -498,7 +499,6 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
-
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -572,7 +572,6 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv)
void
comp_perf_options_default(struct comp_test_data *test_data)
{
- test_data->cdev_id = -1;
test_data->seg_sz = 2048;
test_data->burst_sz = 32;
test_data->pool_sz = 8192;
@@ -581,9 +580,10 @@ comp_perf_options_default(struct comp_test_data *test_data)
test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
test_data->test_op = COMPRESS_DECOMPRESS;
test_data->window_sz = -1;
- test_data->level.min = 1;
- test_data->level.max = 9;
- test_data->level.inc = 1;
+ test_data->level_lst.min = 1;
+ test_data->level_lst.max = 9;
+ test_data->level_lst.inc = 1;
+ test_data->test = CPERF_TEST_TYPE_BENCHMARK;
}
int
diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
new file mode 100644
index 0000000..1d2b25e
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -0,0 +1,285 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_malloc.h>
+#include <rte_eal.h>
+#include <rte_log.h>
+#include <rte_compressdev.h>
+
+#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
+
+#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range)
+{
+ unsigned int next_size;
+
+ /* Check lower/upper bounds */
+ if (size < range->min)
+ return -1;
+
+ if (size > range->max)
+ return -1;
+
+ /* If range is actually only one value, size is correct */
+ if (range->increment == 0)
+ return 0;
+
+ /* Check if value is one of the supported sizes */
+ for (next_size = range->min; next_size <= range->max;
+ next_size += range->increment)
+ if (size == next_size)
+ return 0;
+
+ return -1;
+}
+
+static uint32_t
+find_buf_size(uint32_t input_size)
+{
+ uint32_t i;
+
+ /* From performance point of view the buffer size should be a
+ * power of 2 but also should be enough to store incompressible data
+ */
+
+ /* We're looking for nearest power of 2 buffer size, which is greather
+ * than input_size
+ */
+ uint32_t size =
+ !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
+
+ for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
+ ;
+
+ return i > ((UINT16_MAX + 1) >> 1)
+ ? (uint32_t)((float)input_size * EXPANSE_RATIO)
+ : i;
+}
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem)
+{
+ uint32_t i;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ rte_pktmbuf_free(mem->comp_bufs[i]);
+ rte_pktmbuf_free(mem->decomp_bufs[i]);
+ }
+
+ rte_free(mem->decomp_bufs);
+ rte_free(mem->comp_bufs);
+ rte_free(mem->decompressed_data);
+ rte_free(mem->compressed_data);
+ rte_mempool_free(mem->op_pool);
+ rte_mempool_free(mem->decomp_buf_pool);
+ rte_mempool_free(mem->comp_buf_pool);
+}
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem)
+{
+ test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
+ /* Number of segments for input and output
+ * (compression and decompression)
+ */
+ uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
+ test_data->seg_sz);
+ char pool_name[32] = "";
+
+ snprintf(pool_name, sizeof(pool_name), "comp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->comp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0,
+ test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->comp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ snprintf(pool_name, sizeof(pool_name), "decomp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->decomp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->decomp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ mem->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+
+ snprintf(pool_name, sizeof(pool_name), "op_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->op_pool = rte_comp_op_pool_create(pool_name,
+ mem->total_bufs,
+ 0, 0, rte_socket_id());
+ if (mem->op_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
+ return -1;
+ }
+
+ /*
+ * Compressed data might be a bit larger than input data,
+ * if data cannot be compressed
+ */
+ mem->compressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz * EXPANSE_RATIO
+ + MIN_COMPRESSED_BUF_SIZE, 0,
+ rte_socket_id());
+ if (mem->compressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->decompressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz, 0,
+ rte_socket_id());
+ if (mem->decompressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->comp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->comp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+
+ mem->decomp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->decomp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+ return 0;
+}
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
+{
+ uint32_t remaining_data = test_data->input_data_sz;
+ uint8_t *input_data_ptr = test_data->input_data;
+ size_t data_sz;
+ uint8_t *data_addr;
+ uint32_t i, j;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ /* Allocate data in input mbuf and copy data from input file */
+ mem->decomp_bufs[i] =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+ if (mem->decomp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->decomp_bufs[i], data_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ /* Already one segment in the mbuf */
+ uint16_t segs_per_mbuf = 1;
+
+ /* Chain mbufs if needed for input mbufs */
+ while (segs_per_mbuf < test_data->max_sgl_segs
+ && remaining_data > 0) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ data_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ if (rte_pktmbuf_chain(mem->decomp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ segs_per_mbuf++;
+ }
+
+ /* Allocate data in output mbuf */
+ mem->comp_bufs[i] =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+ if (mem->comp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->comp_bufs[i],
+ test_data->out_seg_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ /* Chain mbufs if needed for output mbufs */
+ for (j = 1; j < segs_per_mbuf; j++) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ test_data->out_seg_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ if (rte_pktmbuf_chain(mem->comp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test-compress-perf/comp_perf_test_common.h
new file mode 100644
index 0000000..9c11e3a
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_TEST_COMMON_H_
+#define _COMP_PERF_TEST_COMMON_H_
+
+#include <stdint.h>
+
+#include <rte_mempool.h>
+
+struct cperf_mem_resources {
+ uint8_t dev_id;
+ uint16_t qp_id;
+ uint8_t lcore_id;
+ uint32_t total_bufs;
+ uint8_t *compressed_data;
+ uint8_t *decompressed_data;
+
+ struct rte_mbuf **comp_bufs;
+ struct rte_mbuf **decomp_bufs;
+
+ struct rte_mempool *comp_buf_pool;
+ struct rte_mempool *decomp_buf_pool;
+ struct rte_mempool *op_pool;
+};
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range);
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem);
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem);
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem);
+
+#endif /* _COMP_PERF_TEST_COMMON_H_ */
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index c2a45d1..c65d609 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,56 +8,44 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
-#include "comp_perf_test_verify.h"
-#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
#define NUM_MAX_XFORMS 16
#define NUM_MAX_INFLIGHT_OPS 512
-#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
-
-/* Cleanup state machine */
-static enum cleanup_st {
- ST_CLEAR = 0,
- ST_TEST_DATA,
- ST_COMPDEV,
- ST_INPUT_DATA,
- ST_MEMORY_ALLOC,
- ST_PREPARE_BUF,
- ST_DURING_TEST
-} cleanup = ST_CLEAR;
-
-static int
-param_range_check(uint16_t size, const struct rte_param_log2_range *range)
-{
- unsigned int next_size;
-
- /* Check lower/upper bounds */
- if (size < range->min)
- return -1;
-
- if (size > range->max)
- return -1;
-
- /* If range is actually only one value, size is correct */
- if (range->increment == 0)
- return 0;
-
- /* Check if value is one of the supported sizes */
- for (next_size = range->min; next_size <= range->max;
- next_size += range->increment)
- if (size == next_size)
- return 0;
-
- return -1;
-}
+__extension__
+const char *cperf_test_type_strs[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = "benchmark",
+ [CPERF_TEST_TYPE_VERIFY] = "verify",
+ [CPERF_TEST_TYPE_PMDCC] = "pmd-cyclecount"
+};
+
+__extension__
+static const struct cperf_test cperf_testmap[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = {
+ cperf_benchmark_test_constructor,
+ cperf_benchmark_test_runner,
+ cperf_benchmark_test_destructor
+ },
+ [CPERF_TEST_TYPE_VERIFY] = {
+ cperf_verify_test_constructor,
+ cperf_verify_test_runner,
+ cperf_verify_test_destructor
+ },
+ [CPERF_TEST_TYPE_PMDCC] = {
+ cperf_pmd_cyclecount_test_constructor,
+ cperf_pmd_cyclecount_test_runner,
+ cperf_pmd_cyclecount_test_destructor
+ }
+};
static int
-comp_perf_check_capabilities(struct comp_test_data *test_data)
+comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
const struct rte_compressdev_capabilities *cap;
- cap = rte_compressdev_capability_get(test_data->cdev_id,
+ cap = rte_compressdev_capability_get(cdev_id,
RTE_COMP_ALGO_DEFLATE);
if (cap == NULL) {
@@ -105,7 +93,7 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
}
/* Level 0 support */
- if (test_data->level.min == 0 &&
+ if (test_data->level_lst.min == 0 &&
(comp_flags & RTE_COMP_FF_NONCOMPRESSED_BLOCKS) == 0) {
RTE_LOG(ERR, USER1, "Compress device does not support "
"level 0 (no compression)\n");
@@ -115,110 +103,108 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
return 0;
}
-static uint32_t
-find_buf_size(uint32_t input_size)
+static int
+comp_perf_initialize_compressdev(struct comp_test_data *test_data,
+ uint8_t *enabled_cdevs)
{
- uint32_t i;
+ uint8_t enabled_cdev_count, nb_lcores, cdev_id;
+ unsigned int i, j;
+ int ret;
- /* From performance point of view the buffer size should be a
- * power of 2 but also should be enough to store incompressible data
- */
+ enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
+ enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
+ if (enabled_cdev_count == 0) {
+ RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
+ test_data->driver_name);
+ return -EINVAL;
+ }
- /* We're looking for nearest power of 2 buffer size, which is greather
- * than input_size
+ nb_lcores = rte_lcore_count() - 1;
+ /*
+ * Use fewer devices,
+ * if there are more available than cores.
*/
- uint32_t size =
- !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
-
- for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
- ;
-
- return i > ((UINT16_MAX + 1) >> 1)
- ? (uint32_t)((float)input_size * EXPANSE_RATIO)
- : i;
-}
-
-static int
-comp_perf_allocate_memory(struct comp_test_data *test_data)
-{
+ if (enabled_cdev_count > nb_lcores) {
+ enabled_cdev_count = nb_lcores;
+ RTE_LOG(INFO, USER1,
+ " There's more available devices than cores!"
+ " The number of devices has been aligned to %d cores\n",
+ nb_lcores);
+ }
- test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
- /* Number of segments for input and output
- * (compression and decompression)
+ /*
+ * Calculate number of needed queue pairs, based on the amount
+ * of available number of logical cores and compression devices.
+ * For instance, if there are 4 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device.
+ * One queue pair per one core.
+ * if e.g.: there're 3 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device but one queue pair
+ * will left unused in the last one device
*/
- uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
- test_data->seg_sz);
- test_data->comp_buf_pool = rte_pktmbuf_pool_create("comp_buf_pool",
- total_segs,
- 0, 0,
- test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->comp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ test_data->nb_qps = (nb_lcores % enabled_cdev_count) ?
+ (nb_lcores / enabled_cdev_count) + 1 :
+ nb_lcores / enabled_cdev_count;
- cleanup = ST_MEMORY_ALLOC;
- test_data->decomp_buf_pool = rte_pktmbuf_pool_create("decomp_buf_pool",
- total_segs,
- 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->decomp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ for (i = 0; i < enabled_cdev_count &&
+ i < RTE_COMPRESS_MAX_DEVS; i++,
+ nb_lcores -= test_data->nb_qps) {
+ cdev_id = enabled_cdevs[i];
- test_data->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+ struct rte_compressdev_info cdev_info;
+ uint8_t socket_id = rte_compressdev_socket_id(cdev_id);
- test_data->op_pool = rte_comp_op_pool_create("op_pool",
- test_data->total_bufs,
- 0, 0, rte_socket_id());
- if (test_data->op_pool == NULL) {
- RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
- return -1;
- }
+ rte_compressdev_info_get(cdev_id, &cdev_info);
+ if (cdev_info.max_nb_queue_pairs &&
+ test_data->nb_qps > cdev_info.max_nb_queue_pairs) {
+ RTE_LOG(ERR, USER1,
+ "Number of needed queue pairs is higher "
+ "than the maximum number of queue pairs "
+ "per device.\n");
+ RTE_LOG(ERR, USER1,
+ "Lower the number of cores or increase "
+ "the number of crypto devices\n");
+ return -EINVAL;
+ }
- /*
- * Compressed data might be a bit larger than input data,
- * if data cannot be compressed
- */
- test_data->compressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz * EXPANSE_RATIO
- + MIN_COMPRESSED_BUF_SIZE, 0,
- rte_socket_id());
- if (test_data->compressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ if (comp_perf_check_capabilities(test_data, cdev_id) < 0)
+ return -EINVAL;
+
+ /* Configure compressdev */
+ struct rte_compressdev_config config = {
+ .socket_id = socket_id,
+ .nb_queue_pairs = nb_lcores > test_data->nb_qps
+ ? test_data->nb_qps : nb_lcores,
+ .max_nb_priv_xforms = NUM_MAX_XFORMS,
+ .max_nb_streams = 0
+ };
+
+ if (rte_compressdev_configure(cdev_id, &config) < 0) {
+ RTE_LOG(ERR, USER1, "Device configuration failed\n");
+ return -EINVAL;
+ }
- test_data->decompressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz, 0,
- rte_socket_id());
- if (test_data->decompressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ for (j = 0; j < test_data->nb_qps; j++) {
+ ret = rte_compressdev_queue_pair_setup(cdev_id, j,
+ NUM_MAX_INFLIGHT_OPS, socket_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to setup queue pair %u on compressdev %u",
+ j, cdev_id);
+ return -EINVAL;
+ }
+ }
- test_data->comp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->comp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
- " could not be allocated\n");
- return -1;
+ ret = rte_compressdev_start(cdev_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to start device %u: error %d\n",
+ cdev_id, ret);
+ return -EPERM;
+ }
}
- test_data->decomp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->decomp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
- " could not be allocated\n");
- return -1;
- }
- return 0;
+ return enabled_cdev_count;
}
static int
@@ -244,7 +230,8 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
if (test_data->input_data_sz == 0)
test_data->input_data_sz = actual_file_sz;
- if (fseek(f, 0, SEEK_SET) != 0) {
+ if (test_data->input_data_sz <= 0 || actual_file_sz <= 0 ||
+ fseek(f, 0, SEEK_SET) != 0) {
RTE_LOG(ERR, USER1, "Size of input could not be calculated\n");
goto end;
}
@@ -294,187 +281,18 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
-static int
-comp_perf_initialize_compressdev(struct comp_test_data *test_data)
-{
- uint8_t enabled_cdev_count;
- uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
-
- enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
- enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
- if (enabled_cdev_count == 0) {
- RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
- test_data->driver_name);
- return -EINVAL;
- }
-
- if (enabled_cdev_count > 1)
- RTE_LOG(INFO, USER1,
- "Only the first compress device will be used\n");
-
- test_data->cdev_id = enabled_cdevs[0];
-
- if (comp_perf_check_capabilities(test_data) < 0)
- return -1;
-
- /* Configure compressdev (one device, one queue pair) */
- struct rte_compressdev_config config = {
- .socket_id = rte_socket_id(),
- .nb_queue_pairs = 1,
- .max_nb_priv_xforms = NUM_MAX_XFORMS,
- .max_nb_streams = 0
- };
-
- if (rte_compressdev_configure(test_data->cdev_id, &config) < 0) {
- RTE_LOG(ERR, USER1, "Device configuration failed\n");
- return -1;
- }
-
- if (rte_compressdev_queue_pair_setup(test_data->cdev_id, 0,
- NUM_MAX_INFLIGHT_OPS, rte_socket_id()) < 0) {
- RTE_LOG(ERR, USER1, "Queue pair setup failed\n");
- return -1;
- }
-
- if (rte_compressdev_start(test_data->cdev_id) < 0) {
- RTE_LOG(ERR, USER1, "Device could not be started\n");
- return -1;
- }
-
- return 0;
-}
-
-static int
-prepare_bufs(struct comp_test_data *test_data)
-{
- uint32_t remaining_data = test_data->input_data_sz;
- uint8_t *input_data_ptr = test_data->input_data;
- size_t data_sz;
- uint8_t *data_addr;
- uint32_t i, j;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- /* Allocate data in input mbuf and copy data from input file */
- test_data->decomp_bufs[i] =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
- if (test_data->decomp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
-
- cleanup = ST_PREPARE_BUF;
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->decomp_bufs[i], data_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
- rte_memcpy(data_addr, input_data_ptr, data_sz);
-
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- /* Already one segment in the mbuf */
- uint16_t segs_per_mbuf = 1;
-
- /* Chain mbufs if needed for input mbufs */
- while (segs_per_mbuf < test_data->max_sgl_segs
- && remaining_data > 0) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- data_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- rte_memcpy(data_addr, input_data_ptr, data_sz);
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- if (rte_pktmbuf_chain(test_data->decomp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- segs_per_mbuf++;
- }
-
- /* Allocate data in output mbuf */
- test_data->comp_bufs[i] =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
- if (test_data->comp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->comp_bufs[i],
- test_data->out_seg_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- /* Chain mbufs if needed for output mbufs */
- for (j = 1; j < segs_per_mbuf; j++) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- test_data->out_seg_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- if (rte_pktmbuf_chain(test_data->comp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- }
- }
-
- return 0;
-}
-
-static void
-free_bufs(struct comp_test_data *test_data)
-{
- uint32_t i;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- rte_pktmbuf_free(test_data->comp_bufs[i]);
- rte_pktmbuf_free(test_data->decomp_bufs[i]);
- }
-}
-
-
-
int
main(int argc, char **argv)
{
- uint8_t level, level_idx = 0;
+ uint8_t level_idx = 0;
int ret, i;
struct comp_test_data *test_data;
+ void *ctx[RTE_MAX_LCORE] = {};
+ uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
+ int nb_compressdevs = 0;
+ uint16_t total_nb_qps = 0;
+ uint8_t cdev_id;
+ uint32_t lcore_id;
/* Initialise DPDK EAL */
ret = rte_eal_init(argc, argv);
@@ -491,7 +309,7 @@ main(int argc, char **argv)
rte_socket_id());
ret = EXIT_SUCCESS;
- cleanup = ST_TEST_DATA;
+ test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
if (comp_perf_options_parse(test_data, argc, argv) < 0) {
@@ -506,96 +324,111 @@ main(int argc, char **argv)
goto end;
}
- if (comp_perf_initialize_compressdev(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ nb_compressdevs =
+ comp_perf_initialize_compressdev(test_data, enabled_cdevs);
- cleanup = ST_COMPDEV;
- if (comp_perf_dump_input_data(test_data) < 0) {
+ if (nb_compressdevs < 1) {
ret = EXIT_FAILURE;
goto end;
}
- cleanup = ST_INPUT_DATA;
- if (comp_perf_allocate_memory(test_data) < 0) {
+ test_data->cleanup = ST_COMPDEV;
+ if (comp_perf_dump_input_data(test_data) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (prepare_bufs(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ test_data->cleanup = ST_INPUT_DATA;
- if (test_data->level.inc != 0)
- level = test_data->level.min;
+ if (test_data->level_lst.inc != 0)
+ test_data->level = test_data->level_lst.min;
else
- level = test_data->level.list[0];
+ test_data->level = test_data->level_lst.list[0];
printf("Burst size = %u\n", test_data->burst_sz);
printf("File size = %zu\n", test_data->input_data_sz);
- printf("%6s%12s%17s%19s%21s%15s%21s%23s%16s\n",
- "Level", "Comp size", "Comp ratio [%]",
- "Comp [Cycles/it]", "Comp [Cycles/Byte]", "Comp [Gbps]",
- "Decomp [Cycles/it]", "Decomp [Cycles/Byte]", "Decomp [Gbps]");
+ test_data->cleanup = ST_DURING_TEST;
+ total_nb_qps = nb_compressdevs * test_data->nb_qps;
- cleanup = ST_DURING_TEST;
- while (level <= test_data->level.max) {
+ i = 0;
+ uint8_t qp_id = 0, cdev_index = 0;
- /*
- * Run a first iteration, to verify compression and
- * get the compression ratio for the level
- */
- if (cperf_verification(test_data, level) != EXIT_SUCCESS)
- break;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
- /*
- * Run benchmarking test
- */
- if (cperf_benchmark(test_data, level) != EXIT_SUCCESS)
+ if (i == total_nb_qps)
break;
- printf("%6u%12zu%17.2f%19"PRIu64"%21.2f"
- "%15.2f%21"PRIu64"%23.2f%16.2f\n",
- level, test_data->comp_data_sz, test_data->ratio,
- test_data->comp_tsc_duration[level],
- test_data->comp_tsc_byte, test_data->comp_gbps,
- test_data->decomp_tsc_duration[level],
- test_data->decomp_tsc_byte, test_data->decomp_gbps);
+ cdev_id = enabled_cdevs[cdev_index];
+ ctx[i] = cperf_testmap[test_data->test].constructor(
+ cdev_id, qp_id,
+ test_data);
+ if (ctx[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Test run constructor failed\n");
+ goto end;
+ }
+ qp_id = (qp_id + 1) % test_data->nb_qps;
+ if (qp_id == 0)
+ cdev_index++;
+ i++;
+ }
+
+ while (test_data->level <= test_data->level_lst.max) {
+
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
- if (test_data->level.inc != 0)
- level += test_data->level.inc;
+ rte_eal_remote_launch(
+ cperf_testmap[test_data->test].runner,
+ ctx[i], lcore_id);
+ i++;
+ }
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+ ret |= rte_eal_wait_lcore(lcore_id);
+ i++;
+ }
+
+ if (ret != EXIT_SUCCESS)
+ break;
+
+ if (test_data->level_lst.inc != 0)
+ test_data->level += test_data->level_lst.inc;
else {
- if (++level_idx == test_data->level.count)
+ if (++level_idx == test_data->level_lst.count)
break;
- level = test_data->level.list[level_idx];
+ test_data->level = test_data->level_lst.list[level_idx];
}
}
end:
- switch (cleanup) {
+ switch (test_data->cleanup) {
case ST_DURING_TEST:
- case ST_PREPARE_BUF:
- free_bufs(test_data);
- /* fallthrough */
- case ST_MEMORY_ALLOC:
- rte_free(test_data->decomp_bufs);
- rte_free(test_data->comp_bufs);
- rte_free(test_data->decompressed_data);
- rte_free(test_data->compressed_data);
- rte_mempool_free(test_data->op_pool);
- rte_mempool_free(test_data->decomp_buf_pool);
- rte_mempool_free(test_data->comp_buf_pool);
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (i == total_nb_qps)
+ break;
+
+ if (ctx[i] && cperf_testmap[test_data->test].destructor)
+ cperf_testmap[test_data->test].destructor(
+ ctx[i]);
+ i++;
+ }
/* fallthrough */
case ST_INPUT_DATA:
rte_free(test_data->input_data);
/* fallthrough */
case ST_COMPDEV:
- if (test_data->cdev_id != -1)
- rte_compressdev_stop(test_data->cdev_id);
+ for (i = 0; i < nb_compressdevs &&
+ i < RTE_COMPRESS_MAX_DEVS; i++)
+ rte_compressdev_stop(enabled_cdevs[i]);
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
@@ -612,3 +445,65 @@ main(int argc, char **argv)
}
return ret;
}
+
+__rte_weak void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Benchmark test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_benchmark_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+__rte_weak void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Verify test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_verify_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_verify_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+
+__rte_weak void *
+cperf_pmd_cyclecount_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Pmd_cyclecount test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_pmd_cyclecount_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_pmd_cyclecount_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index ec73e5e..00413c6 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,6 +4,5 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
- 'comp_perf_test_verify.c',
- 'comp_perf_test_benchmark.c')
+ 'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 2/7] app/test-compress-perf: add ptest command line option
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
@ 2019-06-08 22:22 ` Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
` (5 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-08 22:22 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds --ptest option to make possible a choose
of test case from command line.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/comp_perf_options_parse.c | 36 ++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index bc4b98a..07672b2 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -15,6 +15,7 @@
#include "comp_perf_options.h"
+#define CPERF_PTEST_TYPE ("ptest")
#define CPERF_DRIVER_NAME ("driver-name")
#define CPERF_TEST_FILE ("input-file")
#define CPERF_SEG_SIZE ("seg-sz")
@@ -37,6 +38,7 @@ static void
usage(char *progname)
{
printf("%s [EAL options] --\n"
+ " --ptest benchmark / verify :"
" --driver-name NAME: compress driver to use\n"
" --input-file NAME: file to compress and decompress\n"
" --extended-input-sz N: extend file data up to this size (default: no extension)\n"
@@ -76,6 +78,37 @@ get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
}
static int
+parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
+{
+ struct name_id_map cperftest_namemap[] = {
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
+ CPERF_TEST_TYPE_BENCHMARK
+ },
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
+ CPERF_TEST_TYPE_VERIFY
+ },
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_PMDCC],
+ CPERF_TEST_TYPE_PMDCC
+ }
+ };
+
+ int id = get_str_key_id_mapping(
+ (struct name_id_map *)cperftest_namemap,
+ RTE_DIM(cperftest_namemap), arg);
+ if (id < 0) {
+ RTE_LOG(ERR, USER1, "failed to parse test type");
+ return -1;
+ }
+
+ test_data->test = (enum cperf_perf_test_type)id;
+
+ return 0;
+}
+
+static int
parse_uint32_t(uint32_t *value, const char *arg)
{
char *end = NULL;
@@ -499,6 +532,8 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
+
+ { CPERF_PTEST_TYPE, required_argument, 0, 0 },
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -517,6 +552,7 @@ static int
comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
{
struct long_opt_parser parsermap[] = {
+ { CPERF_PTEST_TYPE, parse_cperf_test_type },
{ CPERF_DRIVER_NAME, parse_driver_name },
{ CPERF_TEST_FILE, parse_test_file },
{ CPERF_SEG_SIZE, parse_seg_sz },
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 3/7] app/test-compress-perf: add verification test case
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
@ 2019-06-08 22:22 ` Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
` (4 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-08 22:22 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a verification part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_verify.c | 122 ++++++++++++++++++-------
app/test-compress-perf/comp_perf_test_verify.h | 24 ++++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 112 insertions(+), 37 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index de74129..f54d9a4 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,6 +12,7 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
+SRCS-y += comp_perf_test_verify.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 28a0fe8..c2aab70 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -8,14 +8,48 @@
#include <rte_compressdev.h>
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_common.h"
+
+void
+cperf_verify_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)->mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_verify_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);
+
+ if (ctx != NULL) {
+ ctx->mem.dev_id = dev_id;
+ ctx->mem.qp_id = qp_id;
+ ctx->options = options;
+
+ if (!comp_perf_allocate_memory(ctx->options, &ctx->mem) &&
+ !prepare_bufs(ctx->options, &ctx->mem))
+ return ctx;
+ }
+
+ cperf_verify_test_destructor(ctx);
+ return NULL;
+}
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type,
- uint8_t *output_data_ptr,
- size_t *output_data_sz)
+main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->options;
+ uint8_t *output_data_ptr;
+ size_t *output_data_sz;
+ struct cperf_mem_resources *mem = &ctx->mem;
+
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -33,7 +67,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -42,7 +76,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -50,14 +84,16 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ output_data_ptr = ctx->mem.compressed_data;
+ output_data_sz = &ctx->comp_data_sz;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -69,8 +105,10 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ output_data_ptr = ctx->mem.decompressed_data;
+ output_data_sz = &ctx->decomp_data_sz;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -85,8 +123,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
num_iter = 1;
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +151,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +187,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +204,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -220,15 +260,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -291,7 +333,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
@@ -300,45 +342,45 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (output_data_sz)
*output_data_sz = output_size;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
-
-
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level)
+cperf_verify_test_runner(void *test_ctx)
{
+ struct cperf_verify_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->options;
int ret = EXIT_SUCCESS;
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+ uint32_t lcore = rte_lcore_id();
+
+ ctx->mem.lcore_id = lcore;
test_data->ratio = 0;
- if (main_loop(test_data, level, RTE_COMP_COMPRESS,
- test_data->compressed_data,
- &test_data->comp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS,
- test_data->decompressed_data,
- &test_data->decomp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (test_data->decomp_data_sz != test_data->input_data_sz) {
+ if (ctx->decomp_data_sz != test_data->input_data_sz) {
RTE_LOG(ERR, USER1,
"Decompressed data length not equal to input data length\n");
RTE_LOG(ERR, USER1,
"Decompressed size = %zu, expected = %zu\n",
- test_data->decomp_data_sz, test_data->input_data_sz);
+ ctx->decomp_data_sz, test_data->input_data_sz);
ret = EXIT_FAILURE;
goto end;
} else {
- if (memcmp(test_data->decompressed_data,
+ if (memcmp(ctx->mem.decompressed_data,
test_data->input_data,
test_data->input_data_sz) != 0) {
RTE_LOG(ERR, USER1,
@@ -348,9 +390,19 @@ cperf_verification(struct comp_test_data *test_data, uint8_t level)
}
}
- test_data->ratio = (double) test_data->comp_data_sz /
+ ctx->ratio = (double) ctx->comp_data_sz /
test_data->input_data_sz * 100;
+ if (!ctx->silent) {
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]");
+ }
+ printf("%12u%6u%12zu%17.2f\n",
+ ctx->mem.lcore_id,
+ test_data->level, ctx->comp_data_sz, ctx->ratio);
+ }
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.h b/app/test-compress-perf/comp_perf_test_verify.h
index 67c6b49..ae8b742 100644
--- a/app/test-compress-perf/comp_perf_test_verify.h
+++ b/app/test-compress-perf/comp_perf_test_verify.h
@@ -1,13 +1,33 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018-2019 Intel Corporation
*/
#ifndef _COMP_PERF_TEST_VERIFY_
#define _COMP_PERF_TEST_VERIFY_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+
+struct cperf_verify_ctx {
+ struct cperf_mem_resources mem;
+ struct comp_test_data *options;
+
+ int silent;
+ size_t comp_data_sz;
+ size_t decomp_data_sz;
+ double ratio;
+};
+
+void
+cperf_verify_test_destructor(void *arg);
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level);
+cperf_verify_test_runner(void *test_ctx);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index c65d609..42ffb0d 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,6 +8,7 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index 00413c6..c6246e5 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,5 +4,6 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
+ 'comp_perf_test_verify.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 4/7] app/test-compress-perf: add benchmark test case
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (2 preceding siblings ...)
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
@ 2019-06-08 22:22 ` Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
` (3 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-08 22:22 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a benchmark part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 139 ++++++++++++++++------
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 129 insertions(+), 38 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index f54d9a4..d1a6820 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -13,6 +13,7 @@ CFLAGS += -O3
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
SRCS-y += comp_perf_test_verify.c
+SRCS-y += comp_perf_test_benchmark.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 5752906..9b0b146 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -10,11 +10,45 @@
#include "comp_perf_test_benchmark.h"
+void
+cperf_benchmark_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(
+ &((struct cperf_benchmark_ctx *)arg)->ver.mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_benchmark_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_benchmark_ctx), 0);
+
+ if (ctx != NULL) {
+ ctx->ver.mem.dev_id = dev_id;
+ ctx->ver.mem.qp_id = qp_id;
+ ctx->ver.options = options;
+ ctx->ver.silent = 1; /* ver. part will be silent */
+
+ if (!comp_perf_allocate_memory(ctx->ver.options, &ctx->ver.mem)
+ && !prepare_bufs(ctx->ver.options, &ctx->ver.mem))
+ return ctx;
+ }
+
+ cperf_benchmark_test_destructor(ctx);
+ return NULL;
+}
+
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type)
+main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->ver.options;
+ struct cperf_mem_resources *mem = &ctx->ver.mem;
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -31,7 +65,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -40,7 +74,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -48,14 +82,14 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -67,8 +101,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -82,13 +116,13 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
uint64_t tsc_start, tsc_end, tsc_duration;
- tsc_start = tsc_end = tsc_duration = 0;
- tsc_start = rte_rdtsc();
num_iter = test_data->num_iter;
+ tsc_start = tsc_end = tsc_duration = 0;
+ tsc_start = rte_rdtsc_precise();
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +147,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +183,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +200,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -177,7 +213,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -198,15 +234,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -226,7 +264,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -247,65 +285,92 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
}
- tsc_end = rte_rdtsc();
+ tsc_end = rte_rdtsc_precise();
tsc_duration = tsc_end - tsc_start;
if (type == RTE_COMP_COMPRESS)
- test_data->comp_tsc_duration[level] =
+ ctx->comp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
else
- test_data->decomp_tsc_duration[level] =
+ ctx->decomp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level)
+cperf_benchmark_test_runner(void *test_ctx)
{
+ struct cperf_benchmark_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->ver.options;
+ uint32_t lcore = rte_lcore_id();
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+
+ ctx->ver.mem.lcore_id = lcore;
int i, ret = EXIT_SUCCESS;
/*
+ * First the verification part is needed
+ */
+ if (cperf_verify_test_runner(&ctx->ver)) {
+ ret = EXIT_FAILURE;
+ goto end;
+ }
+
+ /*
* Run the tests twice, discarding the first performance
* results, before the cache is warmed up
*/
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_COMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
- test_data->comp_tsc_byte =
- (double)(test_data->comp_tsc_duration[level]) /
+ ctx->comp_tsc_byte =
+ (double)(ctx->comp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->decomp_tsc_byte =
- (double)(test_data->decomp_tsc_duration[level]) /
+ ctx->decomp_tsc_byte =
+ (double)(ctx->decomp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->comp_gbps = rte_get_tsc_hz() / test_data->comp_tsc_byte * 8 /
+ ctx->comp_gbps = rte_get_tsc_hz() / (ctx->comp_tsc_byte * 8) /
+ 1000000000;
+
+ ctx->decomp_gbps = rte_get_tsc_hz() / (ctx->decomp_tsc_byte * 8) /
1000000000;
- test_data->decomp_gbps = rte_get_tsc_hz() / test_data->decomp_tsc_byte
- * 8 / 1000000000;
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s%15s%16s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]",
+ "Comp [Gbps]", "Decomp [Gbps]");
+ }
+
+ printf("%12u%6u%12zu%17.2f%15.2f%16.2f\n",
+ ctx->ver.mem.lcore_id,
+ test_data->level, ctx->ver.comp_data_sz, ctx->ver.ratio,
+ ctx->comp_gbps,
+ ctx->decomp_gbps);
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.h b/app/test-compress-perf/comp_perf_test_benchmark.h
index b193445..d9b2694 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.h
+++ b/app/test-compress-perf/comp_perf_test_benchmark.h
@@ -5,9 +5,32 @@
#ifndef _COMP_PERF_TEST_BENCHMARK_
#define _COMP_PERF_TEST_BENCHMARK_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+#include "comp_perf_test_verify.h"
+
+struct cperf_benchmark_ctx {
+ struct cperf_verify_ctx ver;
+
+ /* Store TSC duration for all levels (including level 0) */
+ uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ double comp_gbps;
+ double decomp_gbps;
+ double comp_tsc_byte;
+ double decomp_tsc_byte;
+};
+
+void
+cperf_benchmark_test_destructor(void *arg);
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level);
+cperf_benchmark_test_runner(void *test_ctx);
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 42ffb0d..f8e5f15 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -9,6 +9,7 @@
#include "comp_perf_options.h"
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index c6246e5..1136f04 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -5,5 +5,6 @@ allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
'comp_perf_test_verify.c',
+ 'comp_perf_test_benchmark.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 5/7] doc: update dpdk-test-compress-perf description
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (3 preceding siblings ...)
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
@ 2019-06-08 22:22 ` Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
` (2 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-08 22:22 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch updates a dpdk-test-compress-perf documentation.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
doc/guides/tools/comp_perf.rst | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/doc/guides/tools/comp_perf.rst b/doc/guides/tools/comp_perf.rst
index 52869c1..71eef18 100644
--- a/doc/guides/tools/comp_perf.rst
+++ b/doc/guides/tools/comp_perf.rst
@@ -6,7 +6,9 @@ dpdk-test-compress-perf Tool
The ``dpdk-test-compress-perf`` tool is a Data Plane Development Kit (DPDK)
utility that allows measuring performance parameters of PMDs available in the
-compress tree. The tool reads the data from a file (--input-file),
+compress tree. User can use multiple cores to run tests on but only
+one type of compression PMD can be measured during single application
+execution. The tool reads the data from a file (--input-file),
dumps all the file into a buffer and fills out the data of input mbufs,
which are passed to compress device with compression operations.
Then, the output buffers are fed into the decompression stage, and the resulting
@@ -26,9 +28,35 @@ Limitations
* Stateful operation is not supported in this version.
+EAL Options
+~~~~~~~~~~~
+
+The following are the EAL command-line options that can be used in conjunction
+with the ``dpdk-test-compress-perf`` application.
+See the DPDK Getting Started Guides for more information on these options.
+
+* ``-c <COREMASK>`` or ``-l <CORELIST>``
+
+ Set the hexadecimal bitmask of the cores to run on. The corelist is a
+ list cores to use.
+
+.. Note::
+
+ One lcore is needed for process admin, tests are run on all other cores.
+ To run tests on two lcores, three lcores must be passed to the tool.
+
+* ``-w <PCI>``
+
+ Add a PCI device in white list.
+
+* ``--vdev <driver><id>``
+
+ Add a virtual device.
+
+Appication Options
+~~~~~~~~~~~~~~~~~~
-Command line options
---------------------
+ ``--ptest [benchmark/verify]``: set test type (default: benchmark)
``--driver-name NAME``: compress driver to use
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 6/7] app/test-compress-perf: add force process termination
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (4 preceding siblings ...)
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
@ 2019-06-08 22:22 ` Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-08 22:22 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a possibility to force controlled process termination
as a result of two signals: SIGTERM and SIGINT
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/comp_perf_options.h | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 13 ++++++++++++
app/test-compress-perf/comp_perf_test_verify.c | 14 ++++++++++++
app/test-compress-perf/main.c | 26 +++++++++++++++++++++--
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 79e63d5..534212d 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -68,6 +68,7 @@ struct comp_test_data {
double ratio;
enum cleanup_st cleanup;
+ int perf_comp_force_stop;
};
int
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 9b0b146..b38b33c 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -183,6 +183,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -241,6 +244,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -305,6 +311,13 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
return res;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index c2aab70..b2cd7a0 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -187,6 +187,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -267,6 +270,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -345,6 +351,14 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
+
return res;
}
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index f8e5f15..a9022f6 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -2,6 +2,10 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include <rte_malloc.h>
#include <rte_eal.h>
#include <rte_log.h>
@@ -42,6 +46,8 @@ static const struct cperf_test cperf_testmap[] = {
}
};
+static struct comp_test_data *test_data;
+
static int
comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
@@ -283,12 +289,24 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
+static void
+comp_perf_cleanup_on_signal(int signalNumber __rte_unused)
+{
+ test_data->perf_comp_force_stop = 1;
+}
+
+static void
+comp_perf_register_cleanup_on_signal(void)
+{
+ signal(SIGTERM, comp_perf_cleanup_on_signal);
+ signal(SIGINT, comp_perf_cleanup_on_signal);
+}
+
int
main(int argc, char **argv)
{
uint8_t level_idx = 0;
int ret, i;
- struct comp_test_data *test_data;
void *ctx[RTE_MAX_LCORE] = {};
uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
int nb_compressdevs = 0;
@@ -310,6 +328,8 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d\n",
rte_socket_id());
+ comp_perf_register_cleanup_on_signal();
+
ret = EXIT_SUCCESS;
test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
@@ -429,8 +449,10 @@ main(int argc, char **argv)
/* fallthrough */
case ST_COMPDEV:
for (i = 0; i < nb_compressdevs &&
- i < RTE_COMPRESS_MAX_DEVS; i++)
+ i < RTE_COMPRESS_MAX_DEVS; i++) {
rte_compressdev_stop(enabled_cdevs[i]);
+ rte_compressdev_close(enabled_cdevs[i]);
+ }
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 7/7] doc: update release notes for 19.08
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (5 preceding siblings ...)
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
@ 2019-06-08 22:22 ` Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-08 22:22 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Added release note entry for test-compress-perf application
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
doc/guides/rel_notes/release_19_08.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/doc/guides/rel_notes/release_19_08.rst b/doc/guides/rel_notes/release_19_08.rst
index b9510f9..543e7d3 100644
--- a/doc/guides/rel_notes/release_19_08.rst
+++ b/doc/guides/rel_notes/release_19_08.rst
@@ -54,6 +54,9 @@ New Features
Also, make sure to start the actual text at the margin.
=========================================================
+* **Updated test-compress-perf tool application.**
+
+ Added multiple cores feature to compression perf tool application.
Removed Items
-------------
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v2 0/7] add multiple cores feature to test-compress-perf
[not found] ` <1560031175-13787-1-git-send-email-tjozwiakgm@gmail.com>
@ 2019-06-09 4:53 ` Shally Verma
0 siblings, 0 replies; 87+ messages in thread
From: Shally Verma @ 2019-06-09 4:53 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, fiona.trahe
> -----Original Message-----
> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
> Sent: Sunday, June 9, 2019 3:29 AM
> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm@gmail.com; Shally
> Verma <shallyv@marvell.com>
> Subject: [EXT] [PATCH v2 0/7] add multiple cores feature to test-compress-
> perf
>
> External Email
>
> ----------------------------------------------------------------------
> This patchset adds multiple cores feature to compression perf tool.
> All structures have been aligned and are consistent with crypto perf tool. All
> test cases have constructor, runner and destructor and can use more cores
> and compression devices at the same time.
>
> v2 changes:
>
> - fixed checkpatch warning
> - fixed max_nb_queue_pairs detection. Based on compression API
> if max_nb_queue_pairs = 0 that means there is no limit in
> maximum number of queue pairs
It should mean implementation defined/specific
> - fixed qp setup on the last device
>
>
> Tomasz Jozwiak (7):
> app/test-compress-perf: add weak functions for multi-cores test
> app/test-compress-perf: add ptest command line option
> app/test-compress-perf: add verification test case
> app/test-compress-perf: add benchmark test case
> doc: update dpdk-test-compress-perf description
> app/test-compress-perf: add force process termination
> doc: update release notes for 19.08
>
> app/test-compress-perf/Makefile | 1 +
> app/test-compress-perf/comp_perf.h | 61 +++
> app/test-compress-perf/comp_perf_options.h | 46 +-
> app/test-compress-perf/comp_perf_options_parse.c | 58 +-
> app/test-compress-perf/comp_perf_test_benchmark.c | 152 ++++--
> app/test-compress-perf/comp_perf_test_benchmark.h | 25 +-
> app/test-compress-perf/comp_perf_test_common.c | 285 ++++++++++
> app/test-compress-perf/comp_perf_test_common.h | 41 ++
> app/test-compress-perf/comp_perf_test_verify.c | 136 +++--
> app/test-compress-perf/comp_perf_test_verify.h | 24 +-
> app/test-compress-perf/main.c | 633 ++++++++++------------
> app/test-compress-perf/meson.build | 3 +-
> doc/guides/rel_notes/release_19_08.rst | 3 +
> doc/guides/tools/comp_perf.rst | 34 +-
> 14 files changed, 1036 insertions(+), 466 deletions(-)
> create mode 100644 app/test-compress-perf/comp_perf.h
> create mode 100644 app/test-compress-perf/comp_perf_test_common.c
> create mode 100644 app/test-compress-perf/comp_perf_test_common.h
>
> --
> 2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (6 preceding siblings ...)
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
@ 2019-06-26 16:30 ` Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
` (7 more replies)
7 siblings, 8 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-26 16:30 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
This patchset adds multiple cores feature to compression perf tool.
All structures have been aligned and are consistent
with crypto perf tool. All test cases have constructor, runner
and destructor and can use more cores and compression devices at
the same time.
v2 changes:
- fixed checkpatch warning
- fixed max_nb_queue_pairs detection. Based on compression API
if max_nb_queue_pairs = 0 that means there is no limit in
maximum number of queue pairs
- fixed qp setup on the last device
v3 changes:
- merged with commit 767350e7ede791932cc050bf2a192f6527b70c15
app/compress-perf: add prints for socket id
- fixed wrong compression/decompression throughput calculation
Tomasz Jozwiak (7):
app/test-compress-perf: add weak functions for multi-cores test
app/test-compress-perf: add ptest command line option
app/test-compress-perf: add verification test case
app/test-compress-perf: add benchmark test case
doc: update dpdk-test-compress-perf description
app/test-compress-perf: add force process termination
doc: update release notes for 19.08
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf.h | 61 +++
app/test-compress-perf/comp_perf_options.h | 46 +-
app/test-compress-perf/comp_perf_options_parse.c | 58 +-
app/test-compress-perf/comp_perf_test_benchmark.c | 152 ++++--
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +-
app/test-compress-perf/comp_perf_test_common.c | 285 ++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/comp_perf_test_verify.c | 136 +++--
app/test-compress-perf/comp_perf_test_verify.h | 24 +-
app/test-compress-perf/main.c | 632 ++++++++++------------
app/test-compress-perf/meson.build | 3 +-
doc/guides/rel_notes/release_19_08.rst | 3 +
doc/guides/tools/comp_perf.rst | 34 +-
14 files changed, 1034 insertions(+), 467 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 1/7] app/test-compress-perf: add weak functions for multi-cores test
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
@ 2019-06-26 16:30 ` Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
` (6 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-26 16:30 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a template functions for multi-cores performance
version of compress-perf-tool.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 3 +-
app/test-compress-perf/comp_perf.h | 61 +++
app/test-compress-perf/comp_perf_options.h | 45 +-
app/test-compress-perf/comp_perf_options_parse.c | 24 +-
app/test-compress-perf/comp_perf_test_common.c | 285 +++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/main.c | 626 ++++++++++-------------
app/test-compress-perf/meson.build | 3 +-
8 files changed, 686 insertions(+), 402 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index d20e17e..de74129 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,7 +12,6 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
-SRCS-y += comp_perf_test_verify.c
-SRCS-y += comp_perf_test_benchmark.c
+SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf.h b/app/test-compress-perf/comp_perf.h
new file mode 100644
index 0000000..144ad8a
--- /dev/null
+++ b/app/test-compress-perf/comp_perf.h
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_
+#define _COMP_PERF_
+
+#include <rte_mempool.h>
+
+struct comp_test_data;
+
+typedef void *(*cperf_constructor_t)(
+ uint8_t dev_id,
+ uint16_t qp_id,
+ struct comp_test_data *options);
+
+typedef int (*cperf_runner_t)(void *test_ctx);
+typedef void (*cperf_destructor_t)(void *test_ctx);
+
+struct cperf_test {
+ cperf_constructor_t constructor;
+ cperf_runner_t runner;
+ cperf_destructor_t destructor;
+};
+
+/* Needed for weak functions*/
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_benchmark_test_destructor(void *arg __rte_unused);
+
+int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_verify_test_destructor(void *arg __rte_unused);
+
+int
+cperf_verify_test_runner(void *test_ctx __rte_unused);
+
+void *
+cperf_pmd_cyclecount_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_pmd_cyclecount_test_destructor(void *arg __rte_unused);
+
+int
+cperf_pmd_cyclecount_test_runner(void *test_ctx __rte_unused);
+
+#endif /* _COMP_PERF_ */
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index f87751d..79e63d5 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -13,6 +13,24 @@
#define MAX_MBUF_DATA_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM)
#define MAX_SEG_SIZE ((int)(MAX_MBUF_DATA_SIZE / EXPANSE_RATIO))
+extern const char *cperf_test_type_strs[];
+
+/* Cleanup state machine */
+enum cleanup_st {
+ ST_CLEAR = 0,
+ ST_TEST_DATA,
+ ST_COMPDEV,
+ ST_INPUT_DATA,
+ ST_MEMORY_ALLOC,
+ ST_DURING_TEST
+};
+
+enum cperf_perf_test_type {
+ CPERF_TEST_TYPE_BENCHMARK,
+ CPERF_TEST_TYPE_VERIFY,
+ CPERF_TEST_TYPE_PMDCC
+};
+
enum comp_operation {
COMPRESS_ONLY,
DECOMPRESS_ONLY,
@@ -30,37 +48,26 @@ struct range_list {
struct comp_test_data {
char driver_name[64];
char input_file[64];
- struct rte_mbuf **comp_bufs;
- struct rte_mbuf **decomp_bufs;
- uint32_t total_bufs;
+ enum cperf_perf_test_type test;
+
uint8_t *input_data;
size_t input_data_sz;
- uint8_t *compressed_data;
- uint8_t *decompressed_data;
- struct rte_mempool *comp_buf_pool;
- struct rte_mempool *decomp_buf_pool;
- struct rte_mempool *op_pool;
- int8_t cdev_id;
+ uint16_t nb_qps;
uint16_t seg_sz;
uint16_t out_seg_sz;
uint16_t burst_sz;
uint32_t pool_sz;
uint32_t num_iter;
uint16_t max_sgl_segs;
+
enum rte_comp_huffman huffman_enc;
enum comp_operation test_op;
int window_sz;
- struct range_list level;
- /* Store TSC duration for all levels (including level 0) */
- uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- size_t comp_data_sz;
- size_t decomp_data_sz;
+ struct range_list level_lst;
+ uint8_t level;
+
double ratio;
- double comp_gbps;
- double decomp_gbps;
- double comp_tsc_byte;
- double decomp_tsc_byte;
+ enum cleanup_st cleanup;
};
int
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 2fb6fb4..bc4b98a 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -466,19 +466,20 @@ parse_level(struct comp_test_data *test_data, const char *arg)
* Try parsing the argument as a range, if it fails,
* arse it as a list
*/
- if (parse_range(arg, &test_data->level.min, &test_data->level.max,
- &test_data->level.inc) < 0) {
- ret = parse_list(arg, test_data->level.list,
- &test_data->level.min,
- &test_data->level.max);
+ if (parse_range(arg, &test_data->level_lst.min,
+ &test_data->level_lst.max,
+ &test_data->level_lst.inc) < 0) {
+ ret = parse_list(arg, test_data->level_lst.list,
+ &test_data->level_lst.min,
+ &test_data->level_lst.max);
if (ret < 0) {
RTE_LOG(ERR, USER1,
"Failed to parse compression level/s\n");
return -1;
}
- test_data->level.count = ret;
+ test_data->level_lst.count = ret;
- if (test_data->level.max > RTE_COMP_LEVEL_MAX) {
+ if (test_data->level_lst.max > RTE_COMP_LEVEL_MAX) {
RTE_LOG(ERR, USER1, "Level cannot be higher than %u\n",
RTE_COMP_LEVEL_MAX);
return -1;
@@ -498,7 +499,6 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
-
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -572,7 +572,6 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv)
void
comp_perf_options_default(struct comp_test_data *test_data)
{
- test_data->cdev_id = -1;
test_data->seg_sz = 2048;
test_data->burst_sz = 32;
test_data->pool_sz = 8192;
@@ -581,9 +580,10 @@ comp_perf_options_default(struct comp_test_data *test_data)
test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
test_data->test_op = COMPRESS_DECOMPRESS;
test_data->window_sz = -1;
- test_data->level.min = 1;
- test_data->level.max = 9;
- test_data->level.inc = 1;
+ test_data->level_lst.min = 1;
+ test_data->level_lst.max = 9;
+ test_data->level_lst.inc = 1;
+ test_data->test = CPERF_TEST_TYPE_BENCHMARK;
}
int
diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
new file mode 100644
index 0000000..1d2b25e
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -0,0 +1,285 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_malloc.h>
+#include <rte_eal.h>
+#include <rte_log.h>
+#include <rte_compressdev.h>
+
+#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
+
+#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range)
+{
+ unsigned int next_size;
+
+ /* Check lower/upper bounds */
+ if (size < range->min)
+ return -1;
+
+ if (size > range->max)
+ return -1;
+
+ /* If range is actually only one value, size is correct */
+ if (range->increment == 0)
+ return 0;
+
+ /* Check if value is one of the supported sizes */
+ for (next_size = range->min; next_size <= range->max;
+ next_size += range->increment)
+ if (size == next_size)
+ return 0;
+
+ return -1;
+}
+
+static uint32_t
+find_buf_size(uint32_t input_size)
+{
+ uint32_t i;
+
+ /* From performance point of view the buffer size should be a
+ * power of 2 but also should be enough to store incompressible data
+ */
+
+ /* We're looking for nearest power of 2 buffer size, which is greather
+ * than input_size
+ */
+ uint32_t size =
+ !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
+
+ for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
+ ;
+
+ return i > ((UINT16_MAX + 1) >> 1)
+ ? (uint32_t)((float)input_size * EXPANSE_RATIO)
+ : i;
+}
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem)
+{
+ uint32_t i;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ rte_pktmbuf_free(mem->comp_bufs[i]);
+ rte_pktmbuf_free(mem->decomp_bufs[i]);
+ }
+
+ rte_free(mem->decomp_bufs);
+ rte_free(mem->comp_bufs);
+ rte_free(mem->decompressed_data);
+ rte_free(mem->compressed_data);
+ rte_mempool_free(mem->op_pool);
+ rte_mempool_free(mem->decomp_buf_pool);
+ rte_mempool_free(mem->comp_buf_pool);
+}
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem)
+{
+ test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
+ /* Number of segments for input and output
+ * (compression and decompression)
+ */
+ uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
+ test_data->seg_sz);
+ char pool_name[32] = "";
+
+ snprintf(pool_name, sizeof(pool_name), "comp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->comp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0,
+ test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->comp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ snprintf(pool_name, sizeof(pool_name), "decomp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->decomp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->decomp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ mem->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+
+ snprintf(pool_name, sizeof(pool_name), "op_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->op_pool = rte_comp_op_pool_create(pool_name,
+ mem->total_bufs,
+ 0, 0, rte_socket_id());
+ if (mem->op_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
+ return -1;
+ }
+
+ /*
+ * Compressed data might be a bit larger than input data,
+ * if data cannot be compressed
+ */
+ mem->compressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz * EXPANSE_RATIO
+ + MIN_COMPRESSED_BUF_SIZE, 0,
+ rte_socket_id());
+ if (mem->compressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->decompressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz, 0,
+ rte_socket_id());
+ if (mem->decompressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->comp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->comp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+
+ mem->decomp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->decomp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+ return 0;
+}
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
+{
+ uint32_t remaining_data = test_data->input_data_sz;
+ uint8_t *input_data_ptr = test_data->input_data;
+ size_t data_sz;
+ uint8_t *data_addr;
+ uint32_t i, j;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ /* Allocate data in input mbuf and copy data from input file */
+ mem->decomp_bufs[i] =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+ if (mem->decomp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->decomp_bufs[i], data_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ /* Already one segment in the mbuf */
+ uint16_t segs_per_mbuf = 1;
+
+ /* Chain mbufs if needed for input mbufs */
+ while (segs_per_mbuf < test_data->max_sgl_segs
+ && remaining_data > 0) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ data_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ if (rte_pktmbuf_chain(mem->decomp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ segs_per_mbuf++;
+ }
+
+ /* Allocate data in output mbuf */
+ mem->comp_bufs[i] =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+ if (mem->comp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->comp_bufs[i],
+ test_data->out_seg_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ /* Chain mbufs if needed for output mbufs */
+ for (j = 1; j < segs_per_mbuf; j++) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ test_data->out_seg_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ if (rte_pktmbuf_chain(mem->comp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test-compress-perf/comp_perf_test_common.h
new file mode 100644
index 0000000..9c11e3a
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_TEST_COMMON_H_
+#define _COMP_PERF_TEST_COMMON_H_
+
+#include <stdint.h>
+
+#include <rte_mempool.h>
+
+struct cperf_mem_resources {
+ uint8_t dev_id;
+ uint16_t qp_id;
+ uint8_t lcore_id;
+ uint32_t total_bufs;
+ uint8_t *compressed_data;
+ uint8_t *decompressed_data;
+
+ struct rte_mbuf **comp_bufs;
+ struct rte_mbuf **decomp_bufs;
+
+ struct rte_mempool *comp_buf_pool;
+ struct rte_mempool *decomp_buf_pool;
+ struct rte_mempool *op_pool;
+};
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range);
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem);
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem);
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem);
+
+#endif /* _COMP_PERF_TEST_COMMON_H_ */
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 7b9ee74..d142b91 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,56 +8,44 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
-#include "comp_perf_test_verify.h"
-#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
#define NUM_MAX_XFORMS 16
#define NUM_MAX_INFLIGHT_OPS 512
-#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
-
-/* Cleanup state machine */
-static enum cleanup_st {
- ST_CLEAR = 0,
- ST_TEST_DATA,
- ST_COMPDEV,
- ST_INPUT_DATA,
- ST_MEMORY_ALLOC,
- ST_PREPARE_BUF,
- ST_DURING_TEST
-} cleanup = ST_CLEAR;
-
-static int
-param_range_check(uint16_t size, const struct rte_param_log2_range *range)
-{
- unsigned int next_size;
-
- /* Check lower/upper bounds */
- if (size < range->min)
- return -1;
-
- if (size > range->max)
- return -1;
-
- /* If range is actually only one value, size is correct */
- if (range->increment == 0)
- return 0;
-
- /* Check if value is one of the supported sizes */
- for (next_size = range->min; next_size <= range->max;
- next_size += range->increment)
- if (size == next_size)
- return 0;
-
- return -1;
-}
+__extension__
+const char *cperf_test_type_strs[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = "benchmark",
+ [CPERF_TEST_TYPE_VERIFY] = "verify",
+ [CPERF_TEST_TYPE_PMDCC] = "pmd-cyclecount"
+};
+
+__extension__
+static const struct cperf_test cperf_testmap[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = {
+ cperf_benchmark_test_constructor,
+ cperf_benchmark_test_runner,
+ cperf_benchmark_test_destructor
+ },
+ [CPERF_TEST_TYPE_VERIFY] = {
+ cperf_verify_test_constructor,
+ cperf_verify_test_runner,
+ cperf_verify_test_destructor
+ },
+ [CPERF_TEST_TYPE_PMDCC] = {
+ cperf_pmd_cyclecount_test_constructor,
+ cperf_pmd_cyclecount_test_runner,
+ cperf_pmd_cyclecount_test_destructor
+ }
+};
static int
-comp_perf_check_capabilities(struct comp_test_data *test_data)
+comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
const struct rte_compressdev_capabilities *cap;
- cap = rte_compressdev_capability_get(test_data->cdev_id,
+ cap = rte_compressdev_capability_get(cdev_id,
RTE_COMP_ALGO_DEFLATE);
if (cap == NULL) {
@@ -105,7 +93,7 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
}
/* Level 0 support */
- if (test_data->level.min == 0 &&
+ if (test_data->level_lst.min == 0 &&
(comp_flags & RTE_COMP_FF_NONCOMPRESSED_BLOCKS) == 0) {
RTE_LOG(ERR, USER1, "Compress device does not support "
"level 0 (no compression)\n");
@@ -115,110 +103,108 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
return 0;
}
-static uint32_t
-find_buf_size(uint32_t input_size)
+static int
+comp_perf_initialize_compressdev(struct comp_test_data *test_data,
+ uint8_t *enabled_cdevs)
{
- uint32_t i;
+ uint8_t enabled_cdev_count, nb_lcores, cdev_id;
+ unsigned int i, j;
+ int ret;
- /* From performance point of view the buffer size should be a
- * power of 2 but also should be enough to store incompressible data
- */
+ enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
+ enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
+ if (enabled_cdev_count == 0) {
+ RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
+ test_data->driver_name);
+ return -EINVAL;
+ }
- /* We're looking for nearest power of 2 buffer size, which is greather
- * than input_size
+ nb_lcores = rte_lcore_count() - 1;
+ /*
+ * Use fewer devices,
+ * if there are more available than cores.
*/
- uint32_t size =
- !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
-
- for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
- ;
-
- return i > ((UINT16_MAX + 1) >> 1)
- ? (uint32_t)((float)input_size * EXPANSE_RATIO)
- : i;
-}
-
-static int
-comp_perf_allocate_memory(struct comp_test_data *test_data)
-{
+ if (enabled_cdev_count > nb_lcores) {
+ enabled_cdev_count = nb_lcores;
+ RTE_LOG(INFO, USER1,
+ " There's more available devices than cores!"
+ " The number of devices has been aligned to %d cores\n",
+ nb_lcores);
+ }
- test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
- /* Number of segments for input and output
- * (compression and decompression)
+ /*
+ * Calculate number of needed queue pairs, based on the amount
+ * of available number of logical cores and compression devices.
+ * For instance, if there are 4 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device.
+ * One queue pair per one core.
+ * if e.g.: there're 3 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device but one queue pair
+ * will left unused in the last one device
*/
- uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
- test_data->seg_sz);
- test_data->comp_buf_pool = rte_pktmbuf_pool_create("comp_buf_pool",
- total_segs,
- 0, 0,
- test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->comp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ test_data->nb_qps = (nb_lcores % enabled_cdev_count) ?
+ (nb_lcores / enabled_cdev_count) + 1 :
+ nb_lcores / enabled_cdev_count;
- cleanup = ST_MEMORY_ALLOC;
- test_data->decomp_buf_pool = rte_pktmbuf_pool_create("decomp_buf_pool",
- total_segs,
- 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->decomp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ for (i = 0; i < enabled_cdev_count &&
+ i < RTE_COMPRESS_MAX_DEVS; i++,
+ nb_lcores -= test_data->nb_qps) {
+ cdev_id = enabled_cdevs[i];
- test_data->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+ struct rte_compressdev_info cdev_info;
+ uint8_t socket_id = rte_compressdev_socket_id(cdev_id);
- test_data->op_pool = rte_comp_op_pool_create("op_pool",
- test_data->total_bufs,
- 0, 0, rte_socket_id());
- if (test_data->op_pool == NULL) {
- RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
- return -1;
- }
+ rte_compressdev_info_get(cdev_id, &cdev_info);
+ if (cdev_info.max_nb_queue_pairs &&
+ test_data->nb_qps > cdev_info.max_nb_queue_pairs) {
+ RTE_LOG(ERR, USER1,
+ "Number of needed queue pairs is higher "
+ "than the maximum number of queue pairs "
+ "per device.\n");
+ RTE_LOG(ERR, USER1,
+ "Lower the number of cores or increase "
+ "the number of crypto devices\n");
+ return -EINVAL;
+ }
- /*
- * Compressed data might be a bit larger than input data,
- * if data cannot be compressed
- */
- test_data->compressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz * EXPANSE_RATIO
- + MIN_COMPRESSED_BUF_SIZE, 0,
- rte_socket_id());
- if (test_data->compressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ if (comp_perf_check_capabilities(test_data, cdev_id) < 0)
+ return -EINVAL;
+
+ /* Configure compressdev */
+ struct rte_compressdev_config config = {
+ .socket_id = socket_id,
+ .nb_queue_pairs = nb_lcores > test_data->nb_qps
+ ? test_data->nb_qps : nb_lcores,
+ .max_nb_priv_xforms = NUM_MAX_XFORMS,
+ .max_nb_streams = 0
+ };
+
+ if (rte_compressdev_configure(cdev_id, &config) < 0) {
+ RTE_LOG(ERR, USER1, "Device configuration failed\n");
+ return -EINVAL;
+ }
- test_data->decompressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz, 0,
- rte_socket_id());
- if (test_data->decompressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ for (j = 0; j < test_data->nb_qps; j++) {
+ ret = rte_compressdev_queue_pair_setup(cdev_id, j,
+ NUM_MAX_INFLIGHT_OPS, socket_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to setup queue pair %u on compressdev %u",
+ j, cdev_id);
+ return -EINVAL;
+ }
+ }
- test_data->comp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->comp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
- " could not be allocated\n");
- return -1;
+ ret = rte_compressdev_start(cdev_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to start device %u: error %d\n",
+ cdev_id, ret);
+ return -EPERM;
+ }
}
- test_data->decomp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->decomp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
- " could not be allocated\n");
- return -1;
- }
- return 0;
+ return enabled_cdev_count;
}
static int
@@ -295,187 +281,18 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
-static int
-comp_perf_initialize_compressdev(struct comp_test_data *test_data)
-{
- uint8_t enabled_cdev_count;
- uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
-
- enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
- enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
- if (enabled_cdev_count == 0) {
- RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
- test_data->driver_name);
- return -EINVAL;
- }
-
- if (enabled_cdev_count > 1)
- RTE_LOG(INFO, USER1,
- "Only the first compress device will be used\n");
-
- test_data->cdev_id = enabled_cdevs[0];
-
- if (comp_perf_check_capabilities(test_data) < 0)
- return -1;
-
- /* Configure compressdev (one device, one queue pair) */
- struct rte_compressdev_config config = {
- .socket_id = rte_socket_id(),
- .nb_queue_pairs = 1,
- .max_nb_priv_xforms = NUM_MAX_XFORMS,
- .max_nb_streams = 0
- };
-
- if (rte_compressdev_configure(test_data->cdev_id, &config) < 0) {
- RTE_LOG(ERR, USER1, "Device configuration failed\n");
- return -1;
- }
-
- if (rte_compressdev_queue_pair_setup(test_data->cdev_id, 0,
- NUM_MAX_INFLIGHT_OPS, rte_socket_id()) < 0) {
- RTE_LOG(ERR, USER1, "Queue pair setup failed\n");
- return -1;
- }
-
- if (rte_compressdev_start(test_data->cdev_id) < 0) {
- RTE_LOG(ERR, USER1, "Device could not be started\n");
- return -1;
- }
-
- return 0;
-}
-
-static int
-prepare_bufs(struct comp_test_data *test_data)
-{
- uint32_t remaining_data = test_data->input_data_sz;
- uint8_t *input_data_ptr = test_data->input_data;
- size_t data_sz;
- uint8_t *data_addr;
- uint32_t i, j;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- /* Allocate data in input mbuf and copy data from input file */
- test_data->decomp_bufs[i] =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
- if (test_data->decomp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
-
- cleanup = ST_PREPARE_BUF;
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->decomp_bufs[i], data_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
- rte_memcpy(data_addr, input_data_ptr, data_sz);
-
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- /* Already one segment in the mbuf */
- uint16_t segs_per_mbuf = 1;
-
- /* Chain mbufs if needed for input mbufs */
- while (segs_per_mbuf < test_data->max_sgl_segs
- && remaining_data > 0) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- data_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- rte_memcpy(data_addr, input_data_ptr, data_sz);
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- if (rte_pktmbuf_chain(test_data->decomp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- segs_per_mbuf++;
- }
-
- /* Allocate data in output mbuf */
- test_data->comp_bufs[i] =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
- if (test_data->comp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->comp_bufs[i],
- test_data->out_seg_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- /* Chain mbufs if needed for output mbufs */
- for (j = 1; j < segs_per_mbuf; j++) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- test_data->out_seg_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- if (rte_pktmbuf_chain(test_data->comp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- }
- }
-
- return 0;
-}
-
-static void
-free_bufs(struct comp_test_data *test_data)
-{
- uint32_t i;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- rte_pktmbuf_free(test_data->comp_bufs[i]);
- rte_pktmbuf_free(test_data->decomp_bufs[i]);
- }
-}
-
-
-
int
main(int argc, char **argv)
{
- uint8_t level, level_idx = 0;
+ uint8_t level_idx = 0;
int ret, i;
struct comp_test_data *test_data;
+ void *ctx[RTE_MAX_LCORE] = {};
+ uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
+ int nb_compressdevs = 0;
+ uint16_t total_nb_qps = 0;
+ uint8_t cdev_id;
+ uint32_t lcore_id;
/* Initialise DPDK EAL */
ret = rte_eal_init(argc, argv);
@@ -492,7 +309,7 @@ main(int argc, char **argv)
rte_socket_id());
ret = EXIT_SUCCESS;
- cleanup = ST_TEST_DATA;
+ test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
if (comp_perf_options_parse(test_data, argc, argv) < 0) {
@@ -507,99 +324,112 @@ main(int argc, char **argv)
goto end;
}
- if (comp_perf_initialize_compressdev(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ nb_compressdevs =
+ comp_perf_initialize_compressdev(test_data, enabled_cdevs);
- cleanup = ST_COMPDEV;
- if (comp_perf_dump_input_data(test_data) < 0) {
+ if (nb_compressdevs < 1) {
ret = EXIT_FAILURE;
goto end;
}
- cleanup = ST_INPUT_DATA;
- if (comp_perf_allocate_memory(test_data) < 0) {
+ test_data->cleanup = ST_COMPDEV;
+ if (comp_perf_dump_input_data(test_data) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (prepare_bufs(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ test_data->cleanup = ST_INPUT_DATA;
- if (test_data->level.inc != 0)
- level = test_data->level.min;
+ if (test_data->level_lst.inc != 0)
+ test_data->level = test_data->level_lst.min;
else
- level = test_data->level.list[0];
+ test_data->level = test_data->level_lst.list[0];
printf("App uses socket: %u\n", rte_socket_id());
- printf("Driver uses socket: %u\n",
- rte_compressdev_socket_id(test_data->cdev_id));
printf("Burst size = %u\n", test_data->burst_sz);
printf("File size = %zu\n", test_data->input_data_sz);
- printf("%6s%12s%17s%19s%21s%15s%21s%23s%16s\n",
- "Level", "Comp size", "Comp ratio [%]",
- "Comp [Cycles/it]", "Comp [Cycles/Byte]", "Comp [Gbps]",
- "Decomp [Cycles/it]", "Decomp [Cycles/Byte]", "Decomp [Gbps]");
+ test_data->cleanup = ST_DURING_TEST;
+ total_nb_qps = nb_compressdevs * test_data->nb_qps;
- cleanup = ST_DURING_TEST;
- while (level <= test_data->level.max) {
+ i = 0;
+ uint8_t qp_id = 0, cdev_index = 0;
- /*
- * Run a first iteration, to verify compression and
- * get the compression ratio for the level
- */
- if (cperf_verification(test_data, level) != EXIT_SUCCESS)
- break;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
- /*
- * Run benchmarking test
- */
- if (cperf_benchmark(test_data, level) != EXIT_SUCCESS)
+ if (i == total_nb_qps)
break;
- printf("%6u%12zu%17.2f%19"PRIu64"%21.2f"
- "%15.2f%21"PRIu64"%23.2f%16.2f\n",
- level, test_data->comp_data_sz, test_data->ratio,
- test_data->comp_tsc_duration[level],
- test_data->comp_tsc_byte, test_data->comp_gbps,
- test_data->decomp_tsc_duration[level],
- test_data->decomp_tsc_byte, test_data->decomp_gbps);
+ cdev_id = enabled_cdevs[cdev_index];
+ ctx[i] = cperf_testmap[test_data->test].constructor(
+ cdev_id, qp_id,
+ test_data);
+ if (ctx[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Test run constructor failed\n");
+ goto end;
+ }
+ qp_id = (qp_id + 1) % test_data->nb_qps;
+ if (qp_id == 0)
+ cdev_index++;
+ i++;
+ }
+
+ while (test_data->level <= test_data->level_lst.max) {
+
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
- if (test_data->level.inc != 0)
- level += test_data->level.inc;
+ rte_eal_remote_launch(
+ cperf_testmap[test_data->test].runner,
+ ctx[i], lcore_id);
+ i++;
+ }
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+ ret |= rte_eal_wait_lcore(lcore_id);
+ i++;
+ }
+
+ if (ret != EXIT_SUCCESS)
+ break;
+
+ if (test_data->level_lst.inc != 0)
+ test_data->level += test_data->level_lst.inc;
else {
- if (++level_idx == test_data->level.count)
+ if (++level_idx == test_data->level_lst.count)
break;
- level = test_data->level.list[level_idx];
+ test_data->level = test_data->level_lst.list[level_idx];
}
}
end:
- switch (cleanup) {
+ switch (test_data->cleanup) {
case ST_DURING_TEST:
- case ST_PREPARE_BUF:
- free_bufs(test_data);
- /* fallthrough */
- case ST_MEMORY_ALLOC:
- rte_free(test_data->decomp_bufs);
- rte_free(test_data->comp_bufs);
- rte_free(test_data->decompressed_data);
- rte_free(test_data->compressed_data);
- rte_mempool_free(test_data->op_pool);
- rte_mempool_free(test_data->decomp_buf_pool);
- rte_mempool_free(test_data->comp_buf_pool);
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (i == total_nb_qps)
+ break;
+
+ if (ctx[i] && cperf_testmap[test_data->test].destructor)
+ cperf_testmap[test_data->test].destructor(
+ ctx[i]);
+ i++;
+ }
/* fallthrough */
case ST_INPUT_DATA:
rte_free(test_data->input_data);
/* fallthrough */
case ST_COMPDEV:
- if (test_data->cdev_id != -1)
- rte_compressdev_stop(test_data->cdev_id);
+ for (i = 0; i < nb_compressdevs &&
+ i < RTE_COMPRESS_MAX_DEVS; i++)
+ rte_compressdev_stop(enabled_cdevs[i]);
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
@@ -616,3 +446,65 @@ main(int argc, char **argv)
}
return ret;
}
+
+__rte_weak void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Benchmark test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_benchmark_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+__rte_weak void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Verify test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_verify_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_verify_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+
+__rte_weak void *
+cperf_pmd_cyclecount_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Pmd_cyclecount test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_pmd_cyclecount_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_pmd_cyclecount_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index ec73e5e..00413c6 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,6 +4,5 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
- 'comp_perf_test_verify.c',
- 'comp_perf_test_benchmark.c')
+ 'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 2/7] app/test-compress-perf: add ptest command line option
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
@ 2019-06-26 16:30 ` Tomasz Jozwiak
2019-06-26 17:13 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
` (5 subsequent siblings)
7 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-26 16:30 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds --ptest option to make possible a choose
of test case from command line.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/comp_perf_options_parse.c | 36 ++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index bc4b98a..07672b2 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -15,6 +15,7 @@
#include "comp_perf_options.h"
+#define CPERF_PTEST_TYPE ("ptest")
#define CPERF_DRIVER_NAME ("driver-name")
#define CPERF_TEST_FILE ("input-file")
#define CPERF_SEG_SIZE ("seg-sz")
@@ -37,6 +38,7 @@ static void
usage(char *progname)
{
printf("%s [EAL options] --\n"
+ " --ptest benchmark / verify :"
" --driver-name NAME: compress driver to use\n"
" --input-file NAME: file to compress and decompress\n"
" --extended-input-sz N: extend file data up to this size (default: no extension)\n"
@@ -76,6 +78,37 @@ get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
}
static int
+parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
+{
+ struct name_id_map cperftest_namemap[] = {
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
+ CPERF_TEST_TYPE_BENCHMARK
+ },
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
+ CPERF_TEST_TYPE_VERIFY
+ },
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_PMDCC],
+ CPERF_TEST_TYPE_PMDCC
+ }
+ };
+
+ int id = get_str_key_id_mapping(
+ (struct name_id_map *)cperftest_namemap,
+ RTE_DIM(cperftest_namemap), arg);
+ if (id < 0) {
+ RTE_LOG(ERR, USER1, "failed to parse test type");
+ return -1;
+ }
+
+ test_data->test = (enum cperf_perf_test_type)id;
+
+ return 0;
+}
+
+static int
parse_uint32_t(uint32_t *value, const char *arg)
{
char *end = NULL;
@@ -499,6 +532,8 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
+
+ { CPERF_PTEST_TYPE, required_argument, 0, 0 },
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -517,6 +552,7 @@ static int
comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
{
struct long_opt_parser parsermap[] = {
+ { CPERF_PTEST_TYPE, parse_cperf_test_type },
{ CPERF_DRIVER_NAME, parse_driver_name },
{ CPERF_TEST_FILE, parse_test_file },
{ CPERF_SEG_SIZE, parse_seg_sz },
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 3/7] app/test-compress-perf: add verification test case
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
@ 2019-06-26 16:30 ` Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
` (4 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-26 16:30 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a verification part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_verify.c | 122 ++++++++++++++++++-------
app/test-compress-perf/comp_perf_test_verify.h | 24 ++++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 112 insertions(+), 37 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index de74129..f54d9a4 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,6 +12,7 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
+SRCS-y += comp_perf_test_verify.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 28a0fe8..c2aab70 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -8,14 +8,48 @@
#include <rte_compressdev.h>
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_common.h"
+
+void
+cperf_verify_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)->mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_verify_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);
+
+ if (ctx != NULL) {
+ ctx->mem.dev_id = dev_id;
+ ctx->mem.qp_id = qp_id;
+ ctx->options = options;
+
+ if (!comp_perf_allocate_memory(ctx->options, &ctx->mem) &&
+ !prepare_bufs(ctx->options, &ctx->mem))
+ return ctx;
+ }
+
+ cperf_verify_test_destructor(ctx);
+ return NULL;
+}
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type,
- uint8_t *output_data_ptr,
- size_t *output_data_sz)
+main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->options;
+ uint8_t *output_data_ptr;
+ size_t *output_data_sz;
+ struct cperf_mem_resources *mem = &ctx->mem;
+
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -33,7 +67,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -42,7 +76,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -50,14 +84,16 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ output_data_ptr = ctx->mem.compressed_data;
+ output_data_sz = &ctx->comp_data_sz;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -69,8 +105,10 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ output_data_ptr = ctx->mem.decompressed_data;
+ output_data_sz = &ctx->decomp_data_sz;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -85,8 +123,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
num_iter = 1;
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +151,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +187,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +204,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -220,15 +260,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -291,7 +333,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
@@ -300,45 +342,45 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (output_data_sz)
*output_data_sz = output_size;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
-
-
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level)
+cperf_verify_test_runner(void *test_ctx)
{
+ struct cperf_verify_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->options;
int ret = EXIT_SUCCESS;
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+ uint32_t lcore = rte_lcore_id();
+
+ ctx->mem.lcore_id = lcore;
test_data->ratio = 0;
- if (main_loop(test_data, level, RTE_COMP_COMPRESS,
- test_data->compressed_data,
- &test_data->comp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS,
- test_data->decompressed_data,
- &test_data->decomp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (test_data->decomp_data_sz != test_data->input_data_sz) {
+ if (ctx->decomp_data_sz != test_data->input_data_sz) {
RTE_LOG(ERR, USER1,
"Decompressed data length not equal to input data length\n");
RTE_LOG(ERR, USER1,
"Decompressed size = %zu, expected = %zu\n",
- test_data->decomp_data_sz, test_data->input_data_sz);
+ ctx->decomp_data_sz, test_data->input_data_sz);
ret = EXIT_FAILURE;
goto end;
} else {
- if (memcmp(test_data->decompressed_data,
+ if (memcmp(ctx->mem.decompressed_data,
test_data->input_data,
test_data->input_data_sz) != 0) {
RTE_LOG(ERR, USER1,
@@ -348,9 +390,19 @@ cperf_verification(struct comp_test_data *test_data, uint8_t level)
}
}
- test_data->ratio = (double) test_data->comp_data_sz /
+ ctx->ratio = (double) ctx->comp_data_sz /
test_data->input_data_sz * 100;
+ if (!ctx->silent) {
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]");
+ }
+ printf("%12u%6u%12zu%17.2f\n",
+ ctx->mem.lcore_id,
+ test_data->level, ctx->comp_data_sz, ctx->ratio);
+ }
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.h b/app/test-compress-perf/comp_perf_test_verify.h
index 67c6b49..ae8b742 100644
--- a/app/test-compress-perf/comp_perf_test_verify.h
+++ b/app/test-compress-perf/comp_perf_test_verify.h
@@ -1,13 +1,33 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018-2019 Intel Corporation
*/
#ifndef _COMP_PERF_TEST_VERIFY_
#define _COMP_PERF_TEST_VERIFY_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+
+struct cperf_verify_ctx {
+ struct cperf_mem_resources mem;
+ struct comp_test_data *options;
+
+ int silent;
+ size_t comp_data_sz;
+ size_t decomp_data_sz;
+ double ratio;
+};
+
+void
+cperf_verify_test_destructor(void *arg);
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level);
+cperf_verify_test_runner(void *test_ctx);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index d142b91..eba2795 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,6 +8,7 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index 00413c6..c6246e5 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,5 +4,6 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
+ 'comp_perf_test_verify.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 4/7] app/test-compress-perf: add benchmark test case
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (2 preceding siblings ...)
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
@ 2019-06-26 16:30 ` Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
` (3 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-26 16:30 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a benchmark part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 139 ++++++++++++++++------
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 129 insertions(+), 38 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index f54d9a4..d1a6820 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -13,6 +13,7 @@ CFLAGS += -O3
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
SRCS-y += comp_perf_test_verify.c
+SRCS-y += comp_perf_test_benchmark.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 5752906..5f27bae 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -10,11 +10,45 @@
#include "comp_perf_test_benchmark.h"
+void
+cperf_benchmark_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(
+ &((struct cperf_benchmark_ctx *)arg)->ver.mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_benchmark_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_benchmark_ctx), 0);
+
+ if (ctx != NULL) {
+ ctx->ver.mem.dev_id = dev_id;
+ ctx->ver.mem.qp_id = qp_id;
+ ctx->ver.options = options;
+ ctx->ver.silent = 1; /* ver. part will be silent */
+
+ if (!comp_perf_allocate_memory(ctx->ver.options, &ctx->ver.mem)
+ && !prepare_bufs(ctx->ver.options, &ctx->ver.mem))
+ return ctx;
+ }
+
+ cperf_benchmark_test_destructor(ctx);
+ return NULL;
+}
+
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type)
+main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->ver.options;
+ struct cperf_mem_resources *mem = &ctx->ver.mem;
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -31,7 +65,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -40,7 +74,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -48,14 +82,14 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -67,8 +101,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -82,13 +116,13 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
uint64_t tsc_start, tsc_end, tsc_duration;
- tsc_start = tsc_end = tsc_duration = 0;
- tsc_start = rte_rdtsc();
num_iter = test_data->num_iter;
+ tsc_start = tsc_end = tsc_duration = 0;
+ tsc_start = rte_rdtsc_precise();
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +147,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +183,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +200,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -177,7 +213,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -198,15 +234,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -226,7 +264,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -247,65 +285,92 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
}
- tsc_end = rte_rdtsc();
+ tsc_end = rte_rdtsc_precise();
tsc_duration = tsc_end - tsc_start;
if (type == RTE_COMP_COMPRESS)
- test_data->comp_tsc_duration[level] =
+ ctx->comp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
else
- test_data->decomp_tsc_duration[level] =
+ ctx->decomp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level)
+cperf_benchmark_test_runner(void *test_ctx)
{
+ struct cperf_benchmark_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->ver.options;
+ uint32_t lcore = rte_lcore_id();
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+
+ ctx->ver.mem.lcore_id = lcore;
int i, ret = EXIT_SUCCESS;
/*
+ * First the verification part is needed
+ */
+ if (cperf_verify_test_runner(&ctx->ver)) {
+ ret = EXIT_FAILURE;
+ goto end;
+ }
+
+ /*
* Run the tests twice, discarding the first performance
* results, before the cache is warmed up
*/
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_COMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
- test_data->comp_tsc_byte =
- (double)(test_data->comp_tsc_duration[level]) /
+ ctx->comp_tsc_byte =
+ (double)(ctx->comp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->decomp_tsc_byte =
- (double)(test_data->decomp_tsc_duration[level]) /
+ ctx->decomp_tsc_byte =
+ (double)(ctx->decomp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->comp_gbps = rte_get_tsc_hz() / test_data->comp_tsc_byte * 8 /
+ ctx->comp_gbps = rte_get_tsc_hz() / ctx->comp_tsc_byte * 8 /
+ 1000000000;
+
+ ctx->decomp_gbps = rte_get_tsc_hz() / ctx->decomp_tsc_byte * 8 /
1000000000;
- test_data->decomp_gbps = rte_get_tsc_hz() / test_data->decomp_tsc_byte
- * 8 / 1000000000;
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s%15s%16s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]",
+ "Comp [Gbps]", "Decomp [Gbps]");
+ }
+
+ printf("%12u%6u%12zu%17.2f%15.2f%16.2f\n",
+ ctx->ver.mem.lcore_id,
+ test_data->level, ctx->ver.comp_data_sz, ctx->ver.ratio,
+ ctx->comp_gbps,
+ ctx->decomp_gbps);
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.h b/app/test-compress-perf/comp_perf_test_benchmark.h
index b193445..d9b2694 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.h
+++ b/app/test-compress-perf/comp_perf_test_benchmark.h
@@ -5,9 +5,32 @@
#ifndef _COMP_PERF_TEST_BENCHMARK_
#define _COMP_PERF_TEST_BENCHMARK_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+#include "comp_perf_test_verify.h"
+
+struct cperf_benchmark_ctx {
+ struct cperf_verify_ctx ver;
+
+ /* Store TSC duration for all levels (including level 0) */
+ uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ double comp_gbps;
+ double decomp_gbps;
+ double comp_tsc_byte;
+ double decomp_tsc_byte;
+};
+
+void
+cperf_benchmark_test_destructor(void *arg);
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level);
+cperf_benchmark_test_runner(void *test_ctx);
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index eba2795..1044532 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -9,6 +9,7 @@
#include "comp_perf_options.h"
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index c6246e5..1136f04 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -5,5 +5,6 @@ allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
'comp_perf_test_verify.c',
+ 'comp_perf_test_benchmark.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 5/7] doc: update dpdk-test-compress-perf description
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (3 preceding siblings ...)
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
@ 2019-06-26 16:30 ` Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
` (2 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-26 16:30 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch updates a dpdk-test-compress-perf documentation.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
doc/guides/tools/comp_perf.rst | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/doc/guides/tools/comp_perf.rst b/doc/guides/tools/comp_perf.rst
index 52869c1..71eef18 100644
--- a/doc/guides/tools/comp_perf.rst
+++ b/doc/guides/tools/comp_perf.rst
@@ -6,7 +6,9 @@ dpdk-test-compress-perf Tool
The ``dpdk-test-compress-perf`` tool is a Data Plane Development Kit (DPDK)
utility that allows measuring performance parameters of PMDs available in the
-compress tree. The tool reads the data from a file (--input-file),
+compress tree. User can use multiple cores to run tests on but only
+one type of compression PMD can be measured during single application
+execution. The tool reads the data from a file (--input-file),
dumps all the file into a buffer and fills out the data of input mbufs,
which are passed to compress device with compression operations.
Then, the output buffers are fed into the decompression stage, and the resulting
@@ -26,9 +28,35 @@ Limitations
* Stateful operation is not supported in this version.
+EAL Options
+~~~~~~~~~~~
+
+The following are the EAL command-line options that can be used in conjunction
+with the ``dpdk-test-compress-perf`` application.
+See the DPDK Getting Started Guides for more information on these options.
+
+* ``-c <COREMASK>`` or ``-l <CORELIST>``
+
+ Set the hexadecimal bitmask of the cores to run on. The corelist is a
+ list cores to use.
+
+.. Note::
+
+ One lcore is needed for process admin, tests are run on all other cores.
+ To run tests on two lcores, three lcores must be passed to the tool.
+
+* ``-w <PCI>``
+
+ Add a PCI device in white list.
+
+* ``--vdev <driver><id>``
+
+ Add a virtual device.
+
+Appication Options
+~~~~~~~~~~~~~~~~~~
-Command line options
---------------------
+ ``--ptest [benchmark/verify]``: set test type (default: benchmark)
``--driver-name NAME``: compress driver to use
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 6/7] app/test-compress-perf: add force process termination
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (4 preceding siblings ...)
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
@ 2019-06-26 16:30 ` Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
7 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-26 16:30 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a possibility to force controlled process termination
as a result of two signals: SIGTERM and SIGINT
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/comp_perf_options.h | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 13 ++++++++++++
app/test-compress-perf/comp_perf_test_verify.c | 14 ++++++++++++
app/test-compress-perf/main.c | 26 +++++++++++++++++++++--
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 79e63d5..534212d 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -68,6 +68,7 @@ struct comp_test_data {
double ratio;
enum cleanup_st cleanup;
+ int perf_comp_force_stop;
};
int
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 5f27bae..9effccc 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -183,6 +183,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -241,6 +244,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -305,6 +311,13 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
return res;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index c2aab70..b2cd7a0 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -187,6 +187,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -267,6 +270,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -345,6 +351,14 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
+
return res;
}
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 1044532..77b279b 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -2,6 +2,10 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include <rte_malloc.h>
#include <rte_eal.h>
#include <rte_log.h>
@@ -42,6 +46,8 @@ static const struct cperf_test cperf_testmap[] = {
}
};
+static struct comp_test_data *test_data;
+
static int
comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
@@ -283,12 +289,24 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
+static void
+comp_perf_cleanup_on_signal(int signalNumber __rte_unused)
+{
+ test_data->perf_comp_force_stop = 1;
+}
+
+static void
+comp_perf_register_cleanup_on_signal(void)
+{
+ signal(SIGTERM, comp_perf_cleanup_on_signal);
+ signal(SIGINT, comp_perf_cleanup_on_signal);
+}
+
int
main(int argc, char **argv)
{
uint8_t level_idx = 0;
int ret, i;
- struct comp_test_data *test_data;
void *ctx[RTE_MAX_LCORE] = {};
uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
int nb_compressdevs = 0;
@@ -310,6 +328,8 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d\n",
rte_socket_id());
+ comp_perf_register_cleanup_on_signal();
+
ret = EXIT_SUCCESS;
test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
@@ -430,8 +450,10 @@ main(int argc, char **argv)
/* fallthrough */
case ST_COMPDEV:
for (i = 0; i < nb_compressdevs &&
- i < RTE_COMPRESS_MAX_DEVS; i++)
+ i < RTE_COMPRESS_MAX_DEVS; i++) {
rte_compressdev_stop(enabled_cdevs[i]);
+ rte_compressdev_close(enabled_cdevs[i]);
+ }
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 7/7] doc: update release notes for 19.08
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (5 preceding siblings ...)
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
@ 2019-06-26 16:30 ` Tomasz Jozwiak
2019-06-26 21:26 ` Thomas Monjalon
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
7 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-26 16:30 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Added release note entry for test-compress-perf application
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
doc/guides/rel_notes/release_19_08.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/doc/guides/rel_notes/release_19_08.rst b/doc/guides/rel_notes/release_19_08.rst
index 7c0435a..2b2e029 100644
--- a/doc/guides/rel_notes/release_19_08.rst
+++ b/doc/guides/rel_notes/release_19_08.rst
@@ -99,6 +99,9 @@ New Features
Updated ``librte_telemetry`` to fetch the global metrics from the
``librte_metrics`` library.
+* **Updated test-compress-perf tool application.**
+
+ Added multiple cores feature to compression perf tool application.
Removed Items
-------------
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v3 2/7] app/test-compress-perf: add ptest command line option
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
@ 2019-06-26 17:13 ` Shally Verma
2019-06-26 17:34 ` Tomasz Jozwiak
0 siblings, 1 reply; 87+ messages in thread
From: Shally Verma @ 2019-06-26 17:13 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, fiona.trahe, arturx.trybula
> -----Original Message-----
> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
> Sent: Wednesday, June 26, 2019 10:00 PM
> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm@gmail.com; Shally
> Verma <shallyv@marvell.com>; arturx.trybula@intel.com
> Subject: [EXT] [PATCH v3 2/7] app/test-compress-perf: add ptest command
> line option
>
> External Email
>
> ----------------------------------------------------------------------
> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
>
> This patch adds --ptest option to make possible a choose of test case from
> command line.
>
> Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> ---
> app/test-compress-perf/comp_perf_options_parse.c | 36
> ++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-
> compress-perf/comp_perf_options_parse.c
> index bc4b98a..07672b2 100644
> --- a/app/test-compress-perf/comp_perf_options_parse.c
> +++ b/app/test-compress-perf/comp_perf_options_parse.c
> @@ -15,6 +15,7 @@
>
> #include "comp_perf_options.h"
>
> +#define CPERF_PTEST_TYPE ("ptest")
> #define CPERF_DRIVER_NAME ("driver-name")
> #define CPERF_TEST_FILE ("input-file")
> #define CPERF_SEG_SIZE ("seg-sz")
> @@ -37,6 +38,7 @@ static void
> usage(char *progname)
> {
> printf("%s [EAL options] --\n"
> + " --ptest benchmark / verify :"
> " --driver-name NAME: compress driver to use\n"
> " --input-file NAME: file to compress and decompress\n"
> " --extended-input-sz N: extend file data up to this size
> (default: no extension)\n"
> @@ -76,6 +78,37 @@ get_str_key_id_mapping(struct name_id_map *map,
> unsigned int map_len, }
>
> static int
> +parse_cperf_test_type(struct comp_test_data *test_data, const char
> +*arg) {
> + struct name_id_map cperftest_namemap[] = {
> + {
> +
> cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
> + CPERF_TEST_TYPE_BENCHMARK
> + },
> + {
> + cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
> + CPERF_TEST_TYPE_VERIFY
> + },
> + {
> + cperf_test_type_strs[CPERF_TEST_TYPE_PMDCC],
> + CPERF_TEST_TYPE_PMDCC
What is PMDCC here? What kind of test type?
> + }
> + };
> +
> + int id = get_str_key_id_mapping(
> + (struct name_id_map *)cperftest_namemap,
> + RTE_DIM(cperftest_namemap), arg);
> + if (id < 0) {
> + RTE_LOG(ERR, USER1, "failed to parse test type");
> + return -1;
> + }
> +
> + test_data->test = (enum cperf_perf_test_type)id;
> +
> + return 0;
> +}
> +
> +static int
> parse_uint32_t(uint32_t *value, const char *arg) {
> char *end = NULL;
> @@ -499,6 +532,8 @@ struct long_opt_parser { };
>
> static struct option lgopts[] = {
> +
> + { CPERF_PTEST_TYPE, required_argument, 0, 0 },
> { CPERF_DRIVER_NAME, required_argument, 0, 0 },
> { CPERF_TEST_FILE, required_argument, 0, 0 },
> { CPERF_SEG_SIZE, required_argument, 0, 0 }, @@ -517,6 +552,7 @@
> static int comp_perf_opts_parse_long(int opt_idx, struct comp_test_data
> *test_data) {
> struct long_opt_parser parsermap[] = {
> + { CPERF_PTEST_TYPE, parse_cperf_test_type },
> { CPERF_DRIVER_NAME, parse_driver_name },
> { CPERF_TEST_FILE, parse_test_file },
> { CPERF_SEG_SIZE, parse_seg_sz },
> --
> 2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v3 2/7] app/test-compress-perf: add ptest command line option
2019-06-26 17:13 ` [dpdk-dev] [EXT] " Shally Verma
@ 2019-06-26 17:34 ` Tomasz Jozwiak
2019-06-27 4:41 ` Shally Verma
0 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-26 17:34 UTC (permalink / raw)
To: Shally Verma, dev, fiona.trahe, arturx.trybula
Hi Shally,
>> -----Original Message-----
>> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
>> Sent: Wednesday, June 26, 2019 10:00 PM
>> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm@gmail.com; Shally
>> Verma <shallyv@marvell.com>; arturx.trybula@intel.com
>> Subject: [EXT] [PATCH v3 2/7] app/test-compress-perf: add ptest command
>> line option
>>
>> External Email
>>
>> ----------------------------------------------------------------------
>> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
>>
>> This patch adds --ptest option to make possible a choose of test case from
>> command line.
>>
>> Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
>> ---
>> app/test-compress-perf/comp_perf_options_parse.c | 36
>> ++++++++++++++++++++++++
>> 1 file changed, 36 insertions(+)
>>
>> diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-
>> compress-perf/comp_perf_options_parse.c
>> index bc4b98a..07672b2 100644
>> --- a/app/test-compress-perf/comp_perf_options_parse.c
>> +++ b/app/test-compress-perf/comp_perf_options_parse.c
>> @@ -15,6 +15,7 @@
>>
>> #include "comp_perf_options.h"
>>
>> +#define CPERF_PTEST_TYPE ("ptest")
>> #define CPERF_DRIVER_NAME ("driver-name")
>> #define CPERF_TEST_FILE ("input-file")
>> #define CPERF_SEG_SIZE ("seg-sz")
>> @@ -37,6 +38,7 @@ static void
>> usage(char *progname)
>> {
>> printf("%s [EAL options] --\n"
>> + " --ptest benchmark / verify :"
>> " --driver-name NAME: compress driver to use\n"
>> " --input-file NAME: file to compress and decompress\n"
>> " --extended-input-sz N: extend file data up to this size
>> (default: no extension)\n"
>> @@ -76,6 +78,37 @@ get_str_key_id_mapping(struct name_id_map *map,
>> unsigned int map_len, }
>>
>> static int
>> +parse_cperf_test_type(struct comp_test_data *test_data, const char
>> +*arg) {
>> + struct name_id_map cperftest_namemap[] = {
>> + {
>> +
>> cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
>> + CPERF_TEST_TYPE_BENCHMARK
>> + },
>> + {
>> + cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
>> + CPERF_TEST_TYPE_VERIFY
>> + },
>> + {
>> + cperf_test_type_strs[CPERF_TEST_TYPE_PMDCC],
>> + CPERF_TEST_TYPE_PMDCC
> What is PMDCC here? What kind of test type?
[Tomek] This's for 'pmd_cyclecount_test'. Actually compression_perf tool
doesn't support that test, but we added a sort of 'template' for that,
cause there's a plan to add
this test in the future.
Thx
--
Tomek
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v3 7/7] doc: update release notes for 19.08
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
@ 2019-06-26 21:26 ` Thomas Monjalon
2019-06-27 21:25 ` Tomasz Jozwiak
0 siblings, 1 reply; 87+ messages in thread
From: Thomas Monjalon @ 2019-06-26 21:26 UTC (permalink / raw)
To: Tomasz Jozwiak; +Cc: dev, fiona.trahe, shallyv, arturx.trybula
26/06/2019 18:30, Tomasz Jozwiak:
> --- a/doc/guides/rel_notes/release_19_08.rst
> +++ b/doc/guides/rel_notes/release_19_08.rst
> +* **Updated test-compress-perf tool application.**
> +
> + Added multiple cores feature to compression perf tool application.
This should be in the patch adding this feature.
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v3 2/7] app/test-compress-perf: add ptest command line option
2019-06-26 17:34 ` Tomasz Jozwiak
@ 2019-06-27 4:41 ` Shally Verma
2019-06-27 21:27 ` Tomasz Jozwiak
0 siblings, 1 reply; 87+ messages in thread
From: Shally Verma @ 2019-06-27 4:41 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, fiona.trahe, arturx.trybula
> -----Original Message-----
> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
> Sent: Wednesday, June 26, 2019 11:05 PM
> To: Shally Verma <shallyv@marvell.com>; dev@dpdk.org;
> fiona.trahe@intel.com; arturx.trybula@intel.com
> Subject: Re: [EXT] [PATCH v3 2/7] app/test-compress-perf: add ptest
> command line option
>
> Hi Shally,
>
>
> >> -----Original Message-----
> >> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
> >> Sent: Wednesday, June 26, 2019 10:00 PM
> >> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm@gmail.com;
> Shally
> >> Verma <shallyv@marvell.com>; arturx.trybula@intel.com
> >> Subject: [EXT] [PATCH v3 2/7] app/test-compress-perf: add ptest
> >> command line option
> >>
> >> External Email
> >>
> >> ---------------------------------------------------------------------
> >> -
> >> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> >>
> >> This patch adds --ptest option to make possible a choose of test case
> >> from command line.
> >>
> >> Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> >> ---
> >> app/test-compress-perf/comp_perf_options_parse.c | 36
> >> ++++++++++++++++++++++++
> >> 1 file changed, 36 insertions(+)
> >>
> >> diff --git a/app/test-compress-perf/comp_perf_options_parse.c
> >> b/app/test- compress-perf/comp_perf_options_parse.c
> >> index bc4b98a..07672b2 100644
> >> --- a/app/test-compress-perf/comp_perf_options_parse.c
> >> +++ b/app/test-compress-perf/comp_perf_options_parse.c
> >> @@ -15,6 +15,7 @@
> >>
> >> #include "comp_perf_options.h"
> >>
> >> +#define CPERF_PTEST_TYPE ("ptest")
> >> #define CPERF_DRIVER_NAME ("driver-name")
> >> #define CPERF_TEST_FILE ("input-file")
> >> #define CPERF_SEG_SIZE ("seg-sz")
> >> @@ -37,6 +38,7 @@ static void
> >> usage(char *progname)
> >> {
> >> printf("%s [EAL options] --\n"
> >> + " --ptest benchmark / verify :"
> >> " --driver-name NAME: compress driver to use\n"
> >> " --input-file NAME: file to compress and decompress\n"
> >> " --extended-input-sz N: extend file data up to this size
> >> (default: no extension)\n"
> >> @@ -76,6 +78,37 @@ get_str_key_id_mapping(struct name_id_map
> *map,
> >> unsigned int map_len, }
> >>
> >> static int
> >> +parse_cperf_test_type(struct comp_test_data *test_data, const char
> >> +*arg) {
> >> + struct name_id_map cperftest_namemap[] = {
> >> + {
> >> +
> >> cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
> >> + CPERF_TEST_TYPE_BENCHMARK
> >> + },
> >> + {
> >> + cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
> >> + CPERF_TEST_TYPE_VERIFY
> >> + },
> >> + {
> >> + cperf_test_type_strs[CPERF_TEST_TYPE_PMDCC],
> >> + CPERF_TEST_TYPE_PMDCC
> > What is PMDCC here? What kind of test type?
>
> [Tomek] This's for 'pmd_cyclecount_test'. Actually compression_perf tool
>
> doesn't support that test, but we added a sort of 'template' for that, cause
> there's a plan to add
>
> this test in the future.
Isn’t it better we add this .. when we actually add feature?
>
>
> Thx
>
> --
>
> Tomek
>
>
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v3 7/7] doc: update release notes for 19.08
2019-06-26 21:26 ` Thomas Monjalon
@ 2019-06-27 21:25 ` Tomasz Jozwiak
0 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-27 21:25 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, fiona.trahe, shallyv, arturx.trybula
Hi Thomas,
W dniu 26.06.2019 o 23:26, Thomas Monjalon pisze:
> 26/06/2019 18:30, Tomasz Jozwiak:
>> --- a/doc/guides/rel_notes/release_19_08.rst
>> +++ b/doc/guides/rel_notes/release_19_08.rst
>> +* **Updated test-compress-perf tool application.**
>> +
>> + Added multiple cores feature to compression perf tool application.
> This should be in the patch adding this feature.
[Tomek] Ok, we'll move this to that patch.
Thx, Tomek
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v3 2/7] app/test-compress-perf: add ptest command line option
2019-06-27 4:41 ` Shally Verma
@ 2019-06-27 21:27 ` Tomasz Jozwiak
0 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-27 21:27 UTC (permalink / raw)
To: Shally Verma, dev, fiona.trahe, arturx.trybula
Hi Shally,
>
>> -----Original Message-----
>> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
>> Sent: Wednesday, June 26, 2019 11:05 PM
>> To: Shally Verma <shallyv@marvell.com>; dev@dpdk.org;
>> fiona.trahe@intel.com; arturx.trybula@intel.com
>> Subject: Re: [EXT] [PATCH v3 2/7] app/test-compress-perf: add ptest
>> command line option
>>
>> Hi Shally,
>>
>>
>>>> -----Original Message-----
>>>> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
>>>> Sent: Wednesday, June 26, 2019 10:00 PM
>>>> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm@gmail.com;
>> Shally
>>>> Verma <shallyv@marvell.com>; arturx.trybula@intel.com
>>>> Subject: [EXT] [PATCH v3 2/7] app/test-compress-perf: add ptest
>>>> command line option
>>>>
>>>> External Email
>>>>
>>>> ---------------------------------------------------------------------
>>>> -
>>>> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
>>>>
>>>> This patch adds --ptest option to make possible a choose of test case
>>>> from command line.
>>>>
>>>> Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
>>>> ---
>>>> app/test-compress-perf/comp_perf_options_parse.c | 36
>>>> ++++++++++++++++++++++++
>>>> 1 file changed, 36 insertions(+)
>>>>
>>>> diff --git a/app/test-compress-perf/comp_perf_options_parse.c
>>>> b/app/test- compress-perf/comp_perf_options_parse.c
>>>> index bc4b98a..07672b2 100644
>>>> --- a/app/test-compress-perf/comp_perf_options_parse.c
>>>> +++ b/app/test-compress-perf/comp_perf_options_parse.c
>>>> @@ -15,6 +15,7 @@
>>>>
>>>> #include "comp_perf_options.h"
>>>>
>>>> +#define CPERF_PTEST_TYPE ("ptest")
>>>> #define CPERF_DRIVER_NAME ("driver-name")
>>>> #define CPERF_TEST_FILE ("input-file")
>>>> #define CPERF_SEG_SIZE ("seg-sz")
>>>> @@ -37,6 +38,7 @@ static void
>>>> usage(char *progname)
>>>> {
>>>> printf("%s [EAL options] --\n"
>>>> + " --ptest benchmark / verify :"
>>>> " --driver-name NAME: compress driver to use\n"
>>>> " --input-file NAME: file to compress and decompress\n"
>>>> " --extended-input-sz N: extend file data up to this size
>>>> (default: no extension)\n"
>>>> @@ -76,6 +78,37 @@ get_str_key_id_mapping(struct name_id_map
>> *map,
>>>> unsigned int map_len, }
>>>>
>>>> static int
>>>> +parse_cperf_test_type(struct comp_test_data *test_data, const char
>>>> +*arg) {
>>>> + struct name_id_map cperftest_namemap[] = {
>>>> + {
>>>> +
>>>> cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
>>>> + CPERF_TEST_TYPE_BENCHMARK
>>>> + },
>>>> + {
>>>> + cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
>>>> + CPERF_TEST_TYPE_VERIFY
>>>> + },
>>>> + {
>>>> + cperf_test_type_strs[CPERF_TEST_TYPE_PMDCC],
>>>> + CPERF_TEST_TYPE_PMDCC
>>> What is PMDCC here? What kind of test type?
>> [Tomek] This's for 'pmd_cyclecount_test'. Actually compression_perf tool
>>
>> doesn't support that test, but we added a sort of 'template' for that, cause
>> there's a plan to add
>>
>> this test in the future.
> Isn’t it better we add this .. when we actually add feature?
[Tomek] True , I'll remove this in V4.
Thx, Tomek
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (6 preceding siblings ...)
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
@ 2019-06-27 22:25 ` Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
` (6 more replies)
7 siblings, 7 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-27 22:25 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
This patchset adds multiple cores feature to compression perf tool.
All structures have been aligned and are consistent
with crypto perf tool. All test cases have constructor, runner
and destructor and can use more cores and compression devices at
the same time.
v2 changes:
- fixed checkpatch warning
- fixed max_nb_queue_pairs detection. Based on compression API
if max_nb_queue_pairs = 0 that means there is no limit in
maximum number of queue pairs
- fixed qp setup on the last device
v3 changes:
- merged with commit 767350e7ede791932cc050bf2a192f6527b70c15
app/compress-perf: add prints for socket id
- fixed wrong compression/decompression throughput calculation
v4 changes:
- moved release notes update to patch 1
- removed pmd cyclecount template
Tomasz Jozwiak (6):
app/test-compress-perf: add weak functions for multi-cores test
app/test-compress-perf: add ptest command line option
app/test-compress-perf: add verification test case
app/test-compress-perf: add benchmark test case
doc: update dpdk-test-compress-perf description
app/test-compress-perf: add force process termination
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf.h | 50 ++
app/test-compress-perf/comp_perf_options.h | 45 +-
app/test-compress-perf/comp_perf_options_parse.c | 54 +-
app/test-compress-perf/comp_perf_test_benchmark.c | 152 ++++--
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +-
app/test-compress-perf/comp_perf_test_common.c | 285 ++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/comp_perf_test_verify.c | 136 +++--
app/test-compress-perf/comp_perf_test_verify.h | 24 +-
app/test-compress-perf/main.c | 606 +++++++++-------------
app/test-compress-perf/meson.build | 3 +-
doc/guides/rel_notes/release_19_08.rst | 3 +
doc/guides/tools/comp_perf.rst | 34 +-
14 files changed, 992 insertions(+), 467 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 1/6] app/test-compress-perf: add weak functions for multi-cores test
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
@ 2019-06-27 22:25 ` Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 2/6] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
` (5 subsequent siblings)
6 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-27 22:25 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a template functions for multi-cores performance
version of compress-perf-tool and updates release notes for 19.08
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 3 +-
app/test-compress-perf/comp_perf.h | 50 ++
app/test-compress-perf/comp_perf_options.h | 44 +-
app/test-compress-perf/comp_perf_options_parse.c | 24 +-
app/test-compress-perf/comp_perf_test_common.c | 285 +++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/main.c | 600 +++++++++--------------
app/test-compress-perf/meson.build | 3 +-
doc/guides/rel_notes/release_19_08.rst | 3 +
9 files changed, 651 insertions(+), 402 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index d20e17e..de74129 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,7 +12,6 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
-SRCS-y += comp_perf_test_verify.c
-SRCS-y += comp_perf_test_benchmark.c
+SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf.h b/app/test-compress-perf/comp_perf.h
new file mode 100644
index 0000000..57289b0
--- /dev/null
+++ b/app/test-compress-perf/comp_perf.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_
+#define _COMP_PERF_
+
+#include <rte_mempool.h>
+
+struct comp_test_data;
+
+typedef void *(*cperf_constructor_t)(
+ uint8_t dev_id,
+ uint16_t qp_id,
+ struct comp_test_data *options);
+
+typedef int (*cperf_runner_t)(void *test_ctx);
+typedef void (*cperf_destructor_t)(void *test_ctx);
+
+struct cperf_test {
+ cperf_constructor_t constructor;
+ cperf_runner_t runner;
+ cperf_destructor_t destructor;
+};
+
+/* Needed for weak functions*/
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_benchmark_test_destructor(void *arg __rte_unused);
+
+int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_verify_test_destructor(void *arg __rte_unused);
+
+int
+cperf_verify_test_runner(void *test_ctx __rte_unused);
+
+#endif /* _COMP_PERF_ */
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index f87751d..0aa29a5 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -13,6 +13,23 @@
#define MAX_MBUF_DATA_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM)
#define MAX_SEG_SIZE ((int)(MAX_MBUF_DATA_SIZE / EXPANSE_RATIO))
+extern const char *cperf_test_type_strs[];
+
+/* Cleanup state machine */
+enum cleanup_st {
+ ST_CLEAR = 0,
+ ST_TEST_DATA,
+ ST_COMPDEV,
+ ST_INPUT_DATA,
+ ST_MEMORY_ALLOC,
+ ST_DURING_TEST
+};
+
+enum cperf_perf_test_type {
+ CPERF_TEST_TYPE_BENCHMARK,
+ CPERF_TEST_TYPE_VERIFY
+};
+
enum comp_operation {
COMPRESS_ONLY,
DECOMPRESS_ONLY,
@@ -30,37 +47,26 @@ struct range_list {
struct comp_test_data {
char driver_name[64];
char input_file[64];
- struct rte_mbuf **comp_bufs;
- struct rte_mbuf **decomp_bufs;
- uint32_t total_bufs;
+ enum cperf_perf_test_type test;
+
uint8_t *input_data;
size_t input_data_sz;
- uint8_t *compressed_data;
- uint8_t *decompressed_data;
- struct rte_mempool *comp_buf_pool;
- struct rte_mempool *decomp_buf_pool;
- struct rte_mempool *op_pool;
- int8_t cdev_id;
+ uint16_t nb_qps;
uint16_t seg_sz;
uint16_t out_seg_sz;
uint16_t burst_sz;
uint32_t pool_sz;
uint32_t num_iter;
uint16_t max_sgl_segs;
+
enum rte_comp_huffman huffman_enc;
enum comp_operation test_op;
int window_sz;
- struct range_list level;
- /* Store TSC duration for all levels (including level 0) */
- uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- size_t comp_data_sz;
- size_t decomp_data_sz;
+ struct range_list level_lst;
+ uint8_t level;
+
double ratio;
- double comp_gbps;
- double decomp_gbps;
- double comp_tsc_byte;
- double decomp_tsc_byte;
+ enum cleanup_st cleanup;
};
int
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 2fb6fb4..bc4b98a 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -466,19 +466,20 @@ parse_level(struct comp_test_data *test_data, const char *arg)
* Try parsing the argument as a range, if it fails,
* arse it as a list
*/
- if (parse_range(arg, &test_data->level.min, &test_data->level.max,
- &test_data->level.inc) < 0) {
- ret = parse_list(arg, test_data->level.list,
- &test_data->level.min,
- &test_data->level.max);
+ if (parse_range(arg, &test_data->level_lst.min,
+ &test_data->level_lst.max,
+ &test_data->level_lst.inc) < 0) {
+ ret = parse_list(arg, test_data->level_lst.list,
+ &test_data->level_lst.min,
+ &test_data->level_lst.max);
if (ret < 0) {
RTE_LOG(ERR, USER1,
"Failed to parse compression level/s\n");
return -1;
}
- test_data->level.count = ret;
+ test_data->level_lst.count = ret;
- if (test_data->level.max > RTE_COMP_LEVEL_MAX) {
+ if (test_data->level_lst.max > RTE_COMP_LEVEL_MAX) {
RTE_LOG(ERR, USER1, "Level cannot be higher than %u\n",
RTE_COMP_LEVEL_MAX);
return -1;
@@ -498,7 +499,6 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
-
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -572,7 +572,6 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv)
void
comp_perf_options_default(struct comp_test_data *test_data)
{
- test_data->cdev_id = -1;
test_data->seg_sz = 2048;
test_data->burst_sz = 32;
test_data->pool_sz = 8192;
@@ -581,9 +580,10 @@ comp_perf_options_default(struct comp_test_data *test_data)
test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
test_data->test_op = COMPRESS_DECOMPRESS;
test_data->window_sz = -1;
- test_data->level.min = 1;
- test_data->level.max = 9;
- test_data->level.inc = 1;
+ test_data->level_lst.min = 1;
+ test_data->level_lst.max = 9;
+ test_data->level_lst.inc = 1;
+ test_data->test = CPERF_TEST_TYPE_BENCHMARK;
}
int
diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
new file mode 100644
index 0000000..1d2b25e
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -0,0 +1,285 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_malloc.h>
+#include <rte_eal.h>
+#include <rte_log.h>
+#include <rte_compressdev.h>
+
+#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
+
+#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range)
+{
+ unsigned int next_size;
+
+ /* Check lower/upper bounds */
+ if (size < range->min)
+ return -1;
+
+ if (size > range->max)
+ return -1;
+
+ /* If range is actually only one value, size is correct */
+ if (range->increment == 0)
+ return 0;
+
+ /* Check if value is one of the supported sizes */
+ for (next_size = range->min; next_size <= range->max;
+ next_size += range->increment)
+ if (size == next_size)
+ return 0;
+
+ return -1;
+}
+
+static uint32_t
+find_buf_size(uint32_t input_size)
+{
+ uint32_t i;
+
+ /* From performance point of view the buffer size should be a
+ * power of 2 but also should be enough to store incompressible data
+ */
+
+ /* We're looking for nearest power of 2 buffer size, which is greather
+ * than input_size
+ */
+ uint32_t size =
+ !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
+
+ for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
+ ;
+
+ return i > ((UINT16_MAX + 1) >> 1)
+ ? (uint32_t)((float)input_size * EXPANSE_RATIO)
+ : i;
+}
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem)
+{
+ uint32_t i;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ rte_pktmbuf_free(mem->comp_bufs[i]);
+ rte_pktmbuf_free(mem->decomp_bufs[i]);
+ }
+
+ rte_free(mem->decomp_bufs);
+ rte_free(mem->comp_bufs);
+ rte_free(mem->decompressed_data);
+ rte_free(mem->compressed_data);
+ rte_mempool_free(mem->op_pool);
+ rte_mempool_free(mem->decomp_buf_pool);
+ rte_mempool_free(mem->comp_buf_pool);
+}
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem)
+{
+ test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
+ /* Number of segments for input and output
+ * (compression and decompression)
+ */
+ uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
+ test_data->seg_sz);
+ char pool_name[32] = "";
+
+ snprintf(pool_name, sizeof(pool_name), "comp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->comp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0,
+ test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->comp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ snprintf(pool_name, sizeof(pool_name), "decomp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->decomp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->decomp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ mem->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+
+ snprintf(pool_name, sizeof(pool_name), "op_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->op_pool = rte_comp_op_pool_create(pool_name,
+ mem->total_bufs,
+ 0, 0, rte_socket_id());
+ if (mem->op_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
+ return -1;
+ }
+
+ /*
+ * Compressed data might be a bit larger than input data,
+ * if data cannot be compressed
+ */
+ mem->compressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz * EXPANSE_RATIO
+ + MIN_COMPRESSED_BUF_SIZE, 0,
+ rte_socket_id());
+ if (mem->compressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->decompressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz, 0,
+ rte_socket_id());
+ if (mem->decompressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->comp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->comp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+
+ mem->decomp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->decomp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+ return 0;
+}
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
+{
+ uint32_t remaining_data = test_data->input_data_sz;
+ uint8_t *input_data_ptr = test_data->input_data;
+ size_t data_sz;
+ uint8_t *data_addr;
+ uint32_t i, j;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ /* Allocate data in input mbuf and copy data from input file */
+ mem->decomp_bufs[i] =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+ if (mem->decomp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->decomp_bufs[i], data_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ /* Already one segment in the mbuf */
+ uint16_t segs_per_mbuf = 1;
+
+ /* Chain mbufs if needed for input mbufs */
+ while (segs_per_mbuf < test_data->max_sgl_segs
+ && remaining_data > 0) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ data_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ if (rte_pktmbuf_chain(mem->decomp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ segs_per_mbuf++;
+ }
+
+ /* Allocate data in output mbuf */
+ mem->comp_bufs[i] =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+ if (mem->comp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->comp_bufs[i],
+ test_data->out_seg_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ /* Chain mbufs if needed for output mbufs */
+ for (j = 1; j < segs_per_mbuf; j++) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ test_data->out_seg_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ if (rte_pktmbuf_chain(mem->comp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test-compress-perf/comp_perf_test_common.h
new file mode 100644
index 0000000..9c11e3a
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_TEST_COMMON_H_
+#define _COMP_PERF_TEST_COMMON_H_
+
+#include <stdint.h>
+
+#include <rte_mempool.h>
+
+struct cperf_mem_resources {
+ uint8_t dev_id;
+ uint16_t qp_id;
+ uint8_t lcore_id;
+ uint32_t total_bufs;
+ uint8_t *compressed_data;
+ uint8_t *decompressed_data;
+
+ struct rte_mbuf **comp_bufs;
+ struct rte_mbuf **decomp_bufs;
+
+ struct rte_mempool *comp_buf_pool;
+ struct rte_mempool *decomp_buf_pool;
+ struct rte_mempool *op_pool;
+};
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range);
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem);
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem);
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem);
+
+#endif /* _COMP_PERF_TEST_COMMON_H_ */
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 7b9ee74..309dc98 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,56 +8,38 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
-#include "comp_perf_test_verify.h"
-#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
#define NUM_MAX_XFORMS 16
#define NUM_MAX_INFLIGHT_OPS 512
-#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
-
-/* Cleanup state machine */
-static enum cleanup_st {
- ST_CLEAR = 0,
- ST_TEST_DATA,
- ST_COMPDEV,
- ST_INPUT_DATA,
- ST_MEMORY_ALLOC,
- ST_PREPARE_BUF,
- ST_DURING_TEST
-} cleanup = ST_CLEAR;
-
-static int
-param_range_check(uint16_t size, const struct rte_param_log2_range *range)
-{
- unsigned int next_size;
-
- /* Check lower/upper bounds */
- if (size < range->min)
- return -1;
-
- if (size > range->max)
- return -1;
-
- /* If range is actually only one value, size is correct */
- if (range->increment == 0)
- return 0;
-
- /* Check if value is one of the supported sizes */
- for (next_size = range->min; next_size <= range->max;
- next_size += range->increment)
- if (size == next_size)
- return 0;
-
- return -1;
-}
+__extension__
+const char *cperf_test_type_strs[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = "benchmark",
+ [CPERF_TEST_TYPE_VERIFY] = "verify"
+};
+
+__extension__
+static const struct cperf_test cperf_testmap[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = {
+ cperf_benchmark_test_constructor,
+ cperf_benchmark_test_runner,
+ cperf_benchmark_test_destructor
+ },
+ [CPERF_TEST_TYPE_VERIFY] = {
+ cperf_verify_test_constructor,
+ cperf_verify_test_runner,
+ cperf_verify_test_destructor
+ }
+};
static int
-comp_perf_check_capabilities(struct comp_test_data *test_data)
+comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
const struct rte_compressdev_capabilities *cap;
- cap = rte_compressdev_capability_get(test_data->cdev_id,
+ cap = rte_compressdev_capability_get(cdev_id,
RTE_COMP_ALGO_DEFLATE);
if (cap == NULL) {
@@ -105,7 +87,7 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
}
/* Level 0 support */
- if (test_data->level.min == 0 &&
+ if (test_data->level_lst.min == 0 &&
(comp_flags & RTE_COMP_FF_NONCOMPRESSED_BLOCKS) == 0) {
RTE_LOG(ERR, USER1, "Compress device does not support "
"level 0 (no compression)\n");
@@ -115,110 +97,108 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
return 0;
}
-static uint32_t
-find_buf_size(uint32_t input_size)
+static int
+comp_perf_initialize_compressdev(struct comp_test_data *test_data,
+ uint8_t *enabled_cdevs)
{
- uint32_t i;
+ uint8_t enabled_cdev_count, nb_lcores, cdev_id;
+ unsigned int i, j;
+ int ret;
- /* From performance point of view the buffer size should be a
- * power of 2 but also should be enough to store incompressible data
- */
+ enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
+ enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
+ if (enabled_cdev_count == 0) {
+ RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
+ test_data->driver_name);
+ return -EINVAL;
+ }
- /* We're looking for nearest power of 2 buffer size, which is greather
- * than input_size
+ nb_lcores = rte_lcore_count() - 1;
+ /*
+ * Use fewer devices,
+ * if there are more available than cores.
*/
- uint32_t size =
- !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
-
- for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
- ;
-
- return i > ((UINT16_MAX + 1) >> 1)
- ? (uint32_t)((float)input_size * EXPANSE_RATIO)
- : i;
-}
-
-static int
-comp_perf_allocate_memory(struct comp_test_data *test_data)
-{
+ if (enabled_cdev_count > nb_lcores) {
+ enabled_cdev_count = nb_lcores;
+ RTE_LOG(INFO, USER1,
+ " There's more available devices than cores!"
+ " The number of devices has been aligned to %d cores\n",
+ nb_lcores);
+ }
- test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
- /* Number of segments for input and output
- * (compression and decompression)
+ /*
+ * Calculate number of needed queue pairs, based on the amount
+ * of available number of logical cores and compression devices.
+ * For instance, if there are 4 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device.
+ * One queue pair per one core.
+ * if e.g.: there're 3 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device but one queue pair
+ * will left unused in the last one device
*/
- uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
- test_data->seg_sz);
- test_data->comp_buf_pool = rte_pktmbuf_pool_create("comp_buf_pool",
- total_segs,
- 0, 0,
- test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->comp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ test_data->nb_qps = (nb_lcores % enabled_cdev_count) ?
+ (nb_lcores / enabled_cdev_count) + 1 :
+ nb_lcores / enabled_cdev_count;
- cleanup = ST_MEMORY_ALLOC;
- test_data->decomp_buf_pool = rte_pktmbuf_pool_create("decomp_buf_pool",
- total_segs,
- 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->decomp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ for (i = 0; i < enabled_cdev_count &&
+ i < RTE_COMPRESS_MAX_DEVS; i++,
+ nb_lcores -= test_data->nb_qps) {
+ cdev_id = enabled_cdevs[i];
- test_data->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+ struct rte_compressdev_info cdev_info;
+ uint8_t socket_id = rte_compressdev_socket_id(cdev_id);
- test_data->op_pool = rte_comp_op_pool_create("op_pool",
- test_data->total_bufs,
- 0, 0, rte_socket_id());
- if (test_data->op_pool == NULL) {
- RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
- return -1;
- }
+ rte_compressdev_info_get(cdev_id, &cdev_info);
+ if (cdev_info.max_nb_queue_pairs &&
+ test_data->nb_qps > cdev_info.max_nb_queue_pairs) {
+ RTE_LOG(ERR, USER1,
+ "Number of needed queue pairs is higher "
+ "than the maximum number of queue pairs "
+ "per device.\n");
+ RTE_LOG(ERR, USER1,
+ "Lower the number of cores or increase "
+ "the number of crypto devices\n");
+ return -EINVAL;
+ }
- /*
- * Compressed data might be a bit larger than input data,
- * if data cannot be compressed
- */
- test_data->compressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz * EXPANSE_RATIO
- + MIN_COMPRESSED_BUF_SIZE, 0,
- rte_socket_id());
- if (test_data->compressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ if (comp_perf_check_capabilities(test_data, cdev_id) < 0)
+ return -EINVAL;
+
+ /* Configure compressdev */
+ struct rte_compressdev_config config = {
+ .socket_id = socket_id,
+ .nb_queue_pairs = nb_lcores > test_data->nb_qps
+ ? test_data->nb_qps : nb_lcores,
+ .max_nb_priv_xforms = NUM_MAX_XFORMS,
+ .max_nb_streams = 0
+ };
+
+ if (rte_compressdev_configure(cdev_id, &config) < 0) {
+ RTE_LOG(ERR, USER1, "Device configuration failed\n");
+ return -EINVAL;
+ }
- test_data->decompressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz, 0,
- rte_socket_id());
- if (test_data->decompressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ for (j = 0; j < test_data->nb_qps; j++) {
+ ret = rte_compressdev_queue_pair_setup(cdev_id, j,
+ NUM_MAX_INFLIGHT_OPS, socket_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to setup queue pair %u on compressdev %u",
+ j, cdev_id);
+ return -EINVAL;
+ }
+ }
- test_data->comp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->comp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
- " could not be allocated\n");
- return -1;
+ ret = rte_compressdev_start(cdev_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to start device %u: error %d\n",
+ cdev_id, ret);
+ return -EPERM;
+ }
}
- test_data->decomp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->decomp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
- " could not be allocated\n");
- return -1;
- }
- return 0;
+ return enabled_cdev_count;
}
static int
@@ -295,187 +275,18 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
-static int
-comp_perf_initialize_compressdev(struct comp_test_data *test_data)
-{
- uint8_t enabled_cdev_count;
- uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
-
- enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
- enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
- if (enabled_cdev_count == 0) {
- RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
- test_data->driver_name);
- return -EINVAL;
- }
-
- if (enabled_cdev_count > 1)
- RTE_LOG(INFO, USER1,
- "Only the first compress device will be used\n");
-
- test_data->cdev_id = enabled_cdevs[0];
-
- if (comp_perf_check_capabilities(test_data) < 0)
- return -1;
-
- /* Configure compressdev (one device, one queue pair) */
- struct rte_compressdev_config config = {
- .socket_id = rte_socket_id(),
- .nb_queue_pairs = 1,
- .max_nb_priv_xforms = NUM_MAX_XFORMS,
- .max_nb_streams = 0
- };
-
- if (rte_compressdev_configure(test_data->cdev_id, &config) < 0) {
- RTE_LOG(ERR, USER1, "Device configuration failed\n");
- return -1;
- }
-
- if (rte_compressdev_queue_pair_setup(test_data->cdev_id, 0,
- NUM_MAX_INFLIGHT_OPS, rte_socket_id()) < 0) {
- RTE_LOG(ERR, USER1, "Queue pair setup failed\n");
- return -1;
- }
-
- if (rte_compressdev_start(test_data->cdev_id) < 0) {
- RTE_LOG(ERR, USER1, "Device could not be started\n");
- return -1;
- }
-
- return 0;
-}
-
-static int
-prepare_bufs(struct comp_test_data *test_data)
-{
- uint32_t remaining_data = test_data->input_data_sz;
- uint8_t *input_data_ptr = test_data->input_data;
- size_t data_sz;
- uint8_t *data_addr;
- uint32_t i, j;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- /* Allocate data in input mbuf and copy data from input file */
- test_data->decomp_bufs[i] =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
- if (test_data->decomp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
-
- cleanup = ST_PREPARE_BUF;
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->decomp_bufs[i], data_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
- rte_memcpy(data_addr, input_data_ptr, data_sz);
-
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- /* Already one segment in the mbuf */
- uint16_t segs_per_mbuf = 1;
-
- /* Chain mbufs if needed for input mbufs */
- while (segs_per_mbuf < test_data->max_sgl_segs
- && remaining_data > 0) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- data_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- rte_memcpy(data_addr, input_data_ptr, data_sz);
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- if (rte_pktmbuf_chain(test_data->decomp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- segs_per_mbuf++;
- }
-
- /* Allocate data in output mbuf */
- test_data->comp_bufs[i] =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
- if (test_data->comp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->comp_bufs[i],
- test_data->out_seg_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- /* Chain mbufs if needed for output mbufs */
- for (j = 1; j < segs_per_mbuf; j++) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- test_data->out_seg_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- if (rte_pktmbuf_chain(test_data->comp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- }
- }
-
- return 0;
-}
-
-static void
-free_bufs(struct comp_test_data *test_data)
-{
- uint32_t i;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- rte_pktmbuf_free(test_data->comp_bufs[i]);
- rte_pktmbuf_free(test_data->decomp_bufs[i]);
- }
-}
-
-
-
int
main(int argc, char **argv)
{
- uint8_t level, level_idx = 0;
+ uint8_t level_idx = 0;
int ret, i;
struct comp_test_data *test_data;
+ void *ctx[RTE_MAX_LCORE] = {};
+ uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
+ int nb_compressdevs = 0;
+ uint16_t total_nb_qps = 0;
+ uint8_t cdev_id;
+ uint32_t lcore_id;
/* Initialise DPDK EAL */
ret = rte_eal_init(argc, argv);
@@ -492,7 +303,7 @@ main(int argc, char **argv)
rte_socket_id());
ret = EXIT_SUCCESS;
- cleanup = ST_TEST_DATA;
+ test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
if (comp_perf_options_parse(test_data, argc, argv) < 0) {
@@ -507,99 +318,112 @@ main(int argc, char **argv)
goto end;
}
- if (comp_perf_initialize_compressdev(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ nb_compressdevs =
+ comp_perf_initialize_compressdev(test_data, enabled_cdevs);
- cleanup = ST_COMPDEV;
- if (comp_perf_dump_input_data(test_data) < 0) {
+ if (nb_compressdevs < 1) {
ret = EXIT_FAILURE;
goto end;
}
- cleanup = ST_INPUT_DATA;
- if (comp_perf_allocate_memory(test_data) < 0) {
+ test_data->cleanup = ST_COMPDEV;
+ if (comp_perf_dump_input_data(test_data) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (prepare_bufs(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ test_data->cleanup = ST_INPUT_DATA;
- if (test_data->level.inc != 0)
- level = test_data->level.min;
+ if (test_data->level_lst.inc != 0)
+ test_data->level = test_data->level_lst.min;
else
- level = test_data->level.list[0];
+ test_data->level = test_data->level_lst.list[0];
printf("App uses socket: %u\n", rte_socket_id());
- printf("Driver uses socket: %u\n",
- rte_compressdev_socket_id(test_data->cdev_id));
printf("Burst size = %u\n", test_data->burst_sz);
printf("File size = %zu\n", test_data->input_data_sz);
- printf("%6s%12s%17s%19s%21s%15s%21s%23s%16s\n",
- "Level", "Comp size", "Comp ratio [%]",
- "Comp [Cycles/it]", "Comp [Cycles/Byte]", "Comp [Gbps]",
- "Decomp [Cycles/it]", "Decomp [Cycles/Byte]", "Decomp [Gbps]");
+ test_data->cleanup = ST_DURING_TEST;
+ total_nb_qps = nb_compressdevs * test_data->nb_qps;
- cleanup = ST_DURING_TEST;
- while (level <= test_data->level.max) {
+ i = 0;
+ uint8_t qp_id = 0, cdev_index = 0;
- /*
- * Run a first iteration, to verify compression and
- * get the compression ratio for the level
- */
- if (cperf_verification(test_data, level) != EXIT_SUCCESS)
- break;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
- /*
- * Run benchmarking test
- */
- if (cperf_benchmark(test_data, level) != EXIT_SUCCESS)
+ if (i == total_nb_qps)
break;
- printf("%6u%12zu%17.2f%19"PRIu64"%21.2f"
- "%15.2f%21"PRIu64"%23.2f%16.2f\n",
- level, test_data->comp_data_sz, test_data->ratio,
- test_data->comp_tsc_duration[level],
- test_data->comp_tsc_byte, test_data->comp_gbps,
- test_data->decomp_tsc_duration[level],
- test_data->decomp_tsc_byte, test_data->decomp_gbps);
+ cdev_id = enabled_cdevs[cdev_index];
+ ctx[i] = cperf_testmap[test_data->test].constructor(
+ cdev_id, qp_id,
+ test_data);
+ if (ctx[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Test run constructor failed\n");
+ goto end;
+ }
+ qp_id = (qp_id + 1) % test_data->nb_qps;
+ if (qp_id == 0)
+ cdev_index++;
+ i++;
+ }
+
+ while (test_data->level <= test_data->level_lst.max) {
- if (test_data->level.inc != 0)
- level += test_data->level.inc;
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+
+ rte_eal_remote_launch(
+ cperf_testmap[test_data->test].runner,
+ ctx[i], lcore_id);
+ i++;
+ }
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+ ret |= rte_eal_wait_lcore(lcore_id);
+ i++;
+ }
+
+ if (ret != EXIT_SUCCESS)
+ break;
+
+ if (test_data->level_lst.inc != 0)
+ test_data->level += test_data->level_lst.inc;
else {
- if (++level_idx == test_data->level.count)
+ if (++level_idx == test_data->level_lst.count)
break;
- level = test_data->level.list[level_idx];
+ test_data->level = test_data->level_lst.list[level_idx];
}
}
end:
- switch (cleanup) {
+ switch (test_data->cleanup) {
case ST_DURING_TEST:
- case ST_PREPARE_BUF:
- free_bufs(test_data);
- /* fallthrough */
- case ST_MEMORY_ALLOC:
- rte_free(test_data->decomp_bufs);
- rte_free(test_data->comp_bufs);
- rte_free(test_data->decompressed_data);
- rte_free(test_data->compressed_data);
- rte_mempool_free(test_data->op_pool);
- rte_mempool_free(test_data->decomp_buf_pool);
- rte_mempool_free(test_data->comp_buf_pool);
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (i == total_nb_qps)
+ break;
+
+ if (ctx[i] && cperf_testmap[test_data->test].destructor)
+ cperf_testmap[test_data->test].destructor(
+ ctx[i]);
+ i++;
+ }
/* fallthrough */
case ST_INPUT_DATA:
rte_free(test_data->input_data);
/* fallthrough */
case ST_COMPDEV:
- if (test_data->cdev_id != -1)
- rte_compressdev_stop(test_data->cdev_id);
+ for (i = 0; i < nb_compressdevs &&
+ i < RTE_COMPRESS_MAX_DEVS; i++)
+ rte_compressdev_stop(enabled_cdevs[i]);
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
@@ -616,3 +440,45 @@ main(int argc, char **argv)
}
return ret;
}
+
+__rte_weak void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Benchmark test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_benchmark_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+__rte_weak void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Verify test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_verify_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_verify_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index ec73e5e..00413c6 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,6 +4,5 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
- 'comp_perf_test_verify.c',
- 'comp_perf_test_benchmark.c')
+ 'comp_perf_test_common.c')
deps = ['compressdev']
diff --git a/doc/guides/rel_notes/release_19_08.rst b/doc/guides/rel_notes/release_19_08.rst
index 7c0435a..2b2e029 100644
--- a/doc/guides/rel_notes/release_19_08.rst
+++ b/doc/guides/rel_notes/release_19_08.rst
@@ -99,6 +99,9 @@ New Features
Updated ``librte_telemetry`` to fetch the global metrics from the
``librte_metrics`` library.
+* **Updated test-compress-perf tool application.**
+
+ Added multiple cores feature to compression perf tool application.
Removed Items
-------------
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 2/6] app/test-compress-perf: add ptest command line option
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
@ 2019-06-27 22:25 ` Tomasz Jozwiak
2019-06-30 14:41 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 3/6] app/test-compress-perf: add verification test case Tomasz Jozwiak
` (4 subsequent siblings)
6 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-27 22:25 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds --ptest option to make possible a choose
of test case from command line.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/comp_perf_options_parse.c | 32 ++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index bc4b98a..7888ab6 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -15,6 +15,7 @@
#include "comp_perf_options.h"
+#define CPERF_PTEST_TYPE ("ptest")
#define CPERF_DRIVER_NAME ("driver-name")
#define CPERF_TEST_FILE ("input-file")
#define CPERF_SEG_SIZE ("seg-sz")
@@ -37,6 +38,7 @@ static void
usage(char *progname)
{
printf("%s [EAL options] --\n"
+ " --ptest benchmark / verify :"
" --driver-name NAME: compress driver to use\n"
" --input-file NAME: file to compress and decompress\n"
" --extended-input-sz N: extend file data up to this size (default: no extension)\n"
@@ -76,6 +78,33 @@ get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
}
static int
+parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
+{
+ struct name_id_map cperftest_namemap[] = {
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
+ CPERF_TEST_TYPE_BENCHMARK
+ },
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
+ CPERF_TEST_TYPE_VERIFY
+ }
+ };
+
+ int id = get_str_key_id_mapping(
+ (struct name_id_map *)cperftest_namemap,
+ RTE_DIM(cperftest_namemap), arg);
+ if (id < 0) {
+ RTE_LOG(ERR, USER1, "failed to parse test type");
+ return -1;
+ }
+
+ test_data->test = (enum cperf_perf_test_type)id;
+
+ return 0;
+}
+
+static int
parse_uint32_t(uint32_t *value, const char *arg)
{
char *end = NULL;
@@ -499,6 +528,8 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
+
+ { CPERF_PTEST_TYPE, required_argument, 0, 0 },
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -517,6 +548,7 @@ static int
comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
{
struct long_opt_parser parsermap[] = {
+ { CPERF_PTEST_TYPE, parse_cperf_test_type },
{ CPERF_DRIVER_NAME, parse_driver_name },
{ CPERF_TEST_FILE, parse_test_file },
{ CPERF_SEG_SIZE, parse_seg_sz },
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 3/6] app/test-compress-perf: add verification test case
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 2/6] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
@ 2019-06-27 22:25 ` Tomasz Jozwiak
2019-06-30 14:55 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 4/6] app/test-compress-perf: add benchmark " Tomasz Jozwiak
` (3 subsequent siblings)
6 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-27 22:25 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a verification part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_verify.c | 122 ++++++++++++++++++-------
app/test-compress-perf/comp_perf_test_verify.h | 24 ++++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 112 insertions(+), 37 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index de74129..f54d9a4 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,6 +12,7 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
+SRCS-y += comp_perf_test_verify.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 28a0fe8..c2aab70 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -8,14 +8,48 @@
#include <rte_compressdev.h>
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_common.h"
+
+void
+cperf_verify_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)->mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_verify_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);
+
+ if (ctx != NULL) {
+ ctx->mem.dev_id = dev_id;
+ ctx->mem.qp_id = qp_id;
+ ctx->options = options;
+
+ if (!comp_perf_allocate_memory(ctx->options, &ctx->mem) &&
+ !prepare_bufs(ctx->options, &ctx->mem))
+ return ctx;
+ }
+
+ cperf_verify_test_destructor(ctx);
+ return NULL;
+}
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type,
- uint8_t *output_data_ptr,
- size_t *output_data_sz)
+main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->options;
+ uint8_t *output_data_ptr;
+ size_t *output_data_sz;
+ struct cperf_mem_resources *mem = &ctx->mem;
+
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -33,7 +67,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -42,7 +76,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -50,14 +84,16 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ output_data_ptr = ctx->mem.compressed_data;
+ output_data_sz = &ctx->comp_data_sz;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -69,8 +105,10 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ output_data_ptr = ctx->mem.decompressed_data;
+ output_data_sz = &ctx->decomp_data_sz;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -85,8 +123,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
num_iter = 1;
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +151,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +187,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +204,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -220,15 +260,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -291,7 +333,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
@@ -300,45 +342,45 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (output_data_sz)
*output_data_sz = output_size;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
-
-
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level)
+cperf_verify_test_runner(void *test_ctx)
{
+ struct cperf_verify_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->options;
int ret = EXIT_SUCCESS;
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+ uint32_t lcore = rte_lcore_id();
+
+ ctx->mem.lcore_id = lcore;
test_data->ratio = 0;
- if (main_loop(test_data, level, RTE_COMP_COMPRESS,
- test_data->compressed_data,
- &test_data->comp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS,
- test_data->decompressed_data,
- &test_data->decomp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (test_data->decomp_data_sz != test_data->input_data_sz) {
+ if (ctx->decomp_data_sz != test_data->input_data_sz) {
RTE_LOG(ERR, USER1,
"Decompressed data length not equal to input data length\n");
RTE_LOG(ERR, USER1,
"Decompressed size = %zu, expected = %zu\n",
- test_data->decomp_data_sz, test_data->input_data_sz);
+ ctx->decomp_data_sz, test_data->input_data_sz);
ret = EXIT_FAILURE;
goto end;
} else {
- if (memcmp(test_data->decompressed_data,
+ if (memcmp(ctx->mem.decompressed_data,
test_data->input_data,
test_data->input_data_sz) != 0) {
RTE_LOG(ERR, USER1,
@@ -348,9 +390,19 @@ cperf_verification(struct comp_test_data *test_data, uint8_t level)
}
}
- test_data->ratio = (double) test_data->comp_data_sz /
+ ctx->ratio = (double) ctx->comp_data_sz /
test_data->input_data_sz * 100;
+ if (!ctx->silent) {
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]");
+ }
+ printf("%12u%6u%12zu%17.2f\n",
+ ctx->mem.lcore_id,
+ test_data->level, ctx->comp_data_sz, ctx->ratio);
+ }
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.h b/app/test-compress-perf/comp_perf_test_verify.h
index 67c6b49..ae8b742 100644
--- a/app/test-compress-perf/comp_perf_test_verify.h
+++ b/app/test-compress-perf/comp_perf_test_verify.h
@@ -1,13 +1,33 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018-2019 Intel Corporation
*/
#ifndef _COMP_PERF_TEST_VERIFY_
#define _COMP_PERF_TEST_VERIFY_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+
+struct cperf_verify_ctx {
+ struct cperf_mem_resources mem;
+ struct comp_test_data *options;
+
+ int silent;
+ size_t comp_data_sz;
+ size_t decomp_data_sz;
+ double ratio;
+};
+
+void
+cperf_verify_test_destructor(void *arg);
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level);
+cperf_verify_test_runner(void *test_ctx);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 309dc98..e54378a 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,6 +8,7 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index 00413c6..c6246e5 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,5 +4,6 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
+ 'comp_perf_test_verify.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 4/6] app/test-compress-perf: add benchmark test case
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (2 preceding siblings ...)
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 3/6] app/test-compress-perf: add verification test case Tomasz Jozwiak
@ 2019-06-27 22:25 ` Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 5/6] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
` (2 subsequent siblings)
6 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-27 22:25 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a benchmark part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 139 ++++++++++++++++------
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 129 insertions(+), 38 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index f54d9a4..d1a6820 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -13,6 +13,7 @@ CFLAGS += -O3
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
SRCS-y += comp_perf_test_verify.c
+SRCS-y += comp_perf_test_benchmark.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 5752906..5f27bae 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -10,11 +10,45 @@
#include "comp_perf_test_benchmark.h"
+void
+cperf_benchmark_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(
+ &((struct cperf_benchmark_ctx *)arg)->ver.mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_benchmark_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_benchmark_ctx), 0);
+
+ if (ctx != NULL) {
+ ctx->ver.mem.dev_id = dev_id;
+ ctx->ver.mem.qp_id = qp_id;
+ ctx->ver.options = options;
+ ctx->ver.silent = 1; /* ver. part will be silent */
+
+ if (!comp_perf_allocate_memory(ctx->ver.options, &ctx->ver.mem)
+ && !prepare_bufs(ctx->ver.options, &ctx->ver.mem))
+ return ctx;
+ }
+
+ cperf_benchmark_test_destructor(ctx);
+ return NULL;
+}
+
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type)
+main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->ver.options;
+ struct cperf_mem_resources *mem = &ctx->ver.mem;
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -31,7 +65,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -40,7 +74,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -48,14 +82,14 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -67,8 +101,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -82,13 +116,13 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
uint64_t tsc_start, tsc_end, tsc_duration;
- tsc_start = tsc_end = tsc_duration = 0;
- tsc_start = rte_rdtsc();
num_iter = test_data->num_iter;
+ tsc_start = tsc_end = tsc_duration = 0;
+ tsc_start = rte_rdtsc_precise();
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +147,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +183,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +200,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -177,7 +213,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -198,15 +234,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -226,7 +264,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -247,65 +285,92 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
}
- tsc_end = rte_rdtsc();
+ tsc_end = rte_rdtsc_precise();
tsc_duration = tsc_end - tsc_start;
if (type == RTE_COMP_COMPRESS)
- test_data->comp_tsc_duration[level] =
+ ctx->comp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
else
- test_data->decomp_tsc_duration[level] =
+ ctx->decomp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level)
+cperf_benchmark_test_runner(void *test_ctx)
{
+ struct cperf_benchmark_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->ver.options;
+ uint32_t lcore = rte_lcore_id();
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+
+ ctx->ver.mem.lcore_id = lcore;
int i, ret = EXIT_SUCCESS;
/*
+ * First the verification part is needed
+ */
+ if (cperf_verify_test_runner(&ctx->ver)) {
+ ret = EXIT_FAILURE;
+ goto end;
+ }
+
+ /*
* Run the tests twice, discarding the first performance
* results, before the cache is warmed up
*/
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_COMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
- test_data->comp_tsc_byte =
- (double)(test_data->comp_tsc_duration[level]) /
+ ctx->comp_tsc_byte =
+ (double)(ctx->comp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->decomp_tsc_byte =
- (double)(test_data->decomp_tsc_duration[level]) /
+ ctx->decomp_tsc_byte =
+ (double)(ctx->decomp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->comp_gbps = rte_get_tsc_hz() / test_data->comp_tsc_byte * 8 /
+ ctx->comp_gbps = rte_get_tsc_hz() / ctx->comp_tsc_byte * 8 /
+ 1000000000;
+
+ ctx->decomp_gbps = rte_get_tsc_hz() / ctx->decomp_tsc_byte * 8 /
1000000000;
- test_data->decomp_gbps = rte_get_tsc_hz() / test_data->decomp_tsc_byte
- * 8 / 1000000000;
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s%15s%16s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]",
+ "Comp [Gbps]", "Decomp [Gbps]");
+ }
+
+ printf("%12u%6u%12zu%17.2f%15.2f%16.2f\n",
+ ctx->ver.mem.lcore_id,
+ test_data->level, ctx->ver.comp_data_sz, ctx->ver.ratio,
+ ctx->comp_gbps,
+ ctx->decomp_gbps);
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.h b/app/test-compress-perf/comp_perf_test_benchmark.h
index b193445..d9b2694 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.h
+++ b/app/test-compress-perf/comp_perf_test_benchmark.h
@@ -5,9 +5,32 @@
#ifndef _COMP_PERF_TEST_BENCHMARK_
#define _COMP_PERF_TEST_BENCHMARK_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+#include "comp_perf_test_verify.h"
+
+struct cperf_benchmark_ctx {
+ struct cperf_verify_ctx ver;
+
+ /* Store TSC duration for all levels (including level 0) */
+ uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ double comp_gbps;
+ double decomp_gbps;
+ double comp_tsc_byte;
+ double decomp_tsc_byte;
+};
+
+void
+cperf_benchmark_test_destructor(void *arg);
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level);
+cperf_benchmark_test_runner(void *test_ctx);
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index e54378a..bc50e37 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -9,6 +9,7 @@
#include "comp_perf_options.h"
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index c6246e5..1136f04 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -5,5 +5,6 @@ allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
'comp_perf_test_verify.c',
+ 'comp_perf_test_benchmark.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 5/6] doc: update dpdk-test-compress-perf description
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (3 preceding siblings ...)
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 4/6] app/test-compress-perf: add benchmark " Tomasz Jozwiak
@ 2019-06-27 22:25 ` Tomasz Jozwiak
2019-06-30 14:56 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 6/6] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
6 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-27 22:25 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch updates a dpdk-test-compress-perf documentation.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
doc/guides/tools/comp_perf.rst | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/doc/guides/tools/comp_perf.rst b/doc/guides/tools/comp_perf.rst
index 52869c1..71eef18 100644
--- a/doc/guides/tools/comp_perf.rst
+++ b/doc/guides/tools/comp_perf.rst
@@ -6,7 +6,9 @@ dpdk-test-compress-perf Tool
The ``dpdk-test-compress-perf`` tool is a Data Plane Development Kit (DPDK)
utility that allows measuring performance parameters of PMDs available in the
-compress tree. The tool reads the data from a file (--input-file),
+compress tree. User can use multiple cores to run tests on but only
+one type of compression PMD can be measured during single application
+execution. The tool reads the data from a file (--input-file),
dumps all the file into a buffer and fills out the data of input mbufs,
which are passed to compress device with compression operations.
Then, the output buffers are fed into the decompression stage, and the resulting
@@ -26,9 +28,35 @@ Limitations
* Stateful operation is not supported in this version.
+EAL Options
+~~~~~~~~~~~
+
+The following are the EAL command-line options that can be used in conjunction
+with the ``dpdk-test-compress-perf`` application.
+See the DPDK Getting Started Guides for more information on these options.
+
+* ``-c <COREMASK>`` or ``-l <CORELIST>``
+
+ Set the hexadecimal bitmask of the cores to run on. The corelist is a
+ list cores to use.
+
+.. Note::
+
+ One lcore is needed for process admin, tests are run on all other cores.
+ To run tests on two lcores, three lcores must be passed to the tool.
+
+* ``-w <PCI>``
+
+ Add a PCI device in white list.
+
+* ``--vdev <driver><id>``
+
+ Add a virtual device.
+
+Appication Options
+~~~~~~~~~~~~~~~~~~
-Command line options
---------------------
+ ``--ptest [benchmark/verify]``: set test type (default: benchmark)
``--driver-name NAME``: compress driver to use
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 6/6] app/test-compress-perf: add force process termination
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (4 preceding siblings ...)
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 5/6] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
@ 2019-06-27 22:25 ` Tomasz Jozwiak
2019-06-30 15:00 ` [dpdk-dev] [EXT] " Shally Verma
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
6 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-27 22:25 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a possibility to force controlled process termination
as a result of two signals: SIGTERM and SIGINT
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/comp_perf_options.h | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 13 ++++++++++++
app/test-compress-perf/comp_perf_test_verify.c | 14 ++++++++++++
app/test-compress-perf/main.c | 26 +++++++++++++++++++++--
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0aa29a5..532fb96 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -67,6 +67,7 @@ struct comp_test_data {
double ratio;
enum cleanup_st cleanup;
+ int perf_comp_force_stop;
};
int
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 5f27bae..9effccc 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -183,6 +183,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -241,6 +244,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -305,6 +311,13 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
return res;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index c2aab70..b2cd7a0 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -187,6 +187,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -267,6 +270,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -345,6 +351,14 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
+
return res;
}
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index bc50e37..f31f663 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -2,6 +2,10 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include <rte_malloc.h>
#include <rte_eal.h>
#include <rte_log.h>
@@ -36,6 +40,8 @@ static const struct cperf_test cperf_testmap[] = {
}
};
+static struct comp_test_data *test_data;
+
static int
comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
@@ -277,12 +283,24 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
+static void
+comp_perf_cleanup_on_signal(int signalNumber __rte_unused)
+{
+ test_data->perf_comp_force_stop = 1;
+}
+
+static void
+comp_perf_register_cleanup_on_signal(void)
+{
+ signal(SIGTERM, comp_perf_cleanup_on_signal);
+ signal(SIGINT, comp_perf_cleanup_on_signal);
+}
+
int
main(int argc, char **argv)
{
uint8_t level_idx = 0;
int ret, i;
- struct comp_test_data *test_data;
void *ctx[RTE_MAX_LCORE] = {};
uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
int nb_compressdevs = 0;
@@ -304,6 +322,8 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d\n",
rte_socket_id());
+ comp_perf_register_cleanup_on_signal();
+
ret = EXIT_SUCCESS;
test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
@@ -424,8 +444,10 @@ main(int argc, char **argv)
/* fallthrough */
case ST_COMPDEV:
for (i = 0; i < nb_compressdevs &&
- i < RTE_COMPRESS_MAX_DEVS; i++)
+ i < RTE_COMPRESS_MAX_DEVS; i++) {
rte_compressdev_stop(enabled_cdevs[i]);
+ rte_compressdev_close(enabled_cdevs[i]);
+ }
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v4 2/6] app/test-compress-perf: add ptest command line option
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 2/6] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
@ 2019-06-30 14:41 ` Shally Verma
0 siblings, 0 replies; 87+ messages in thread
From: Shally Verma @ 2019-06-30 14:41 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, fiona.trahe, arturx.trybula
> -----Original Message-----
> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
> Sent: Friday, June 28, 2019 3:56 AM
> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm@gmail.com; Shally
> Verma <shallyv@marvell.com>; arturx.trybula@intel.com
> Subject: [EXT] [PATCH v4 2/6] app/test-compress-perf: add ptest command
> line option
>
> External Email
>
> ----------------------------------------------------------------------
> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
>
> This patch adds --ptest option to make possible a choose of test case from
> command line.
>
> Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
> Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> ---
Acked-by: Shally Verma <shallyv@marvell.com>
..
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v4 3/6] app/test-compress-perf: add verification test case
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 3/6] app/test-compress-perf: add verification test case Tomasz Jozwiak
@ 2019-06-30 14:55 ` Shally Verma
2019-06-30 21:02 ` Tomasz Jozwiak
0 siblings, 1 reply; 87+ messages in thread
From: Shally Verma @ 2019-06-30 14:55 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, fiona.trahe, arturx.trybula
> -----Original Message-----
> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
> Sent: Friday, June 28, 2019 3:56 AM
> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm@gmail.com; Shally
> Verma <shallyv@marvell.com>; arturx.trybula@intel.com
> Subject: [EXT] [PATCH v4 3/6] app/test-compress-perf: add verification test
> case
>
> External Email
>
> ----------------------------------------------------------------------
> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
...
> diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-
> compress-perf/comp_perf_test_verify.c
> index 28a0fe8..c2aab70 100644
> --- a/app/test-compress-perf/comp_perf_test_verify.c
> +++ b/app/test-compress-perf/comp_perf_test_verify.c
> @@ -8,14 +8,48 @@
> #include <rte_compressdev.h>
>
> #include "comp_perf_test_verify.h"
> +#include "comp_perf_test_common.h"
> +
> +void
> +cperf_verify_test_destructor(void *arg) {
> + if (arg) {
> + comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)-
> >mem);
> + rte_free(arg);
> + }
> +}
> +
> +void *
> +cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
> + struct comp_test_data *options)
> +{
> + struct cperf_verify_ctx *ctx = NULL;
> +
> + ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);
> +
Better just return from here
> + if (ctx != NULL) {
> + ctx->mem.dev_id = dev_id;
> + ctx->mem.qp_id = qp_id;
> + ctx->options = options;
> +
> + if (!comp_perf_allocate_memory(ctx->options, &ctx->mem)
> &&
> + !prepare_bufs(ctx->options, &ctx->mem))
> + return ctx;
What if condition fails on comp_per_allocate_memory(), then it will go to verify_test_destructor(), so comp_perf_free_memory() check if mem != NULL before calling actual free?
> + }
> +
> + cperf_verify_test_destructor(ctx);
> + return NULL;
> +}
>
> static int
> -main_loop(struct comp_test_data *test_data, uint8_t level,
> - enum rte_comp_xform_type type,
> - uint8_t *output_data_ptr,
> - size_t *output_data_sz)
> +main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
...
> --
> 2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v4 5/6] doc: update dpdk-test-compress-perf description
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 5/6] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
@ 2019-06-30 14:56 ` Shally Verma
0 siblings, 0 replies; 87+ messages in thread
From: Shally Verma @ 2019-06-30 14:56 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, fiona.trahe, arturx.trybula
> -----Original Message-----
> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
> Sent: Friday, June 28, 2019 3:56 AM
> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm@gmail.com; Shally
> Verma <shallyv@marvell.com>; arturx.trybula@intel.com
> Subject: [EXT] [PATCH v4 5/6] doc: update dpdk-test-compress-perf
> description
>
> External Email
>
> ----------------------------------------------------------------------
> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
>
> This patch updates a dpdk-test-compress-perf documentation.
>
> Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> ---
Acked-by: Shally Verma <shallyv@marvell.com>
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v4 6/6] app/test-compress-perf: add force process termination
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 6/6] app/test-compress-perf: add force process termination Tomasz Jozwiak
@ 2019-06-30 15:00 ` Shally Verma
0 siblings, 0 replies; 87+ messages in thread
From: Shally Verma @ 2019-06-30 15:00 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, fiona.trahe, arturx.trybula
> -----Original Message-----
> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
> Sent: Friday, June 28, 2019 3:56 AM
> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm@gmail.com; Shally
> Verma <shallyv@marvell.com>; arturx.trybula@intel.com
> Subject: [EXT] [PATCH v4 6/6] app/test-compress-perf: add force process
> termination
>
> External Email
>
> ----------------------------------------------------------------------
> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
>
> This patch adds a possibility to force controlled process termination as a
> result of two signals: SIGTERM and SIGINT
>
> Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> ---
Acked-by: Shally Verma <shallyv@marvell.com>
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v4 3/6] app/test-compress-perf: add verification test case
2019-06-30 14:55 ` [dpdk-dev] [EXT] " Shally Verma
@ 2019-06-30 21:02 ` Tomasz Jozwiak
2019-07-01 4:29 ` Shally Verma
0 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-06-30 21:02 UTC (permalink / raw)
To: Shally Verma, dev, fiona.trahe, arturx.trybula
Hi Shally,
Thx for the review.
My comments below:
>
>> -----Original Message-----
>> From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
>> Sent: Friday, June 28, 2019 3:56 AM
>> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm@gmail.com; Shally
>> Verma <shallyv@marvell.com>; arturx.trybula@intel.com
>> Subject: [EXT] [PATCH v4 3/6] app/test-compress-perf: add verification test
>> case
>>
>> External Email
>>
>> ----------------------------------------------------------------------
>> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> ...
>
>> diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-
>> compress-perf/comp_perf_test_verify.c
>> index 28a0fe8..c2aab70 100644
>> --- a/app/test-compress-perf/comp_perf_test_verify.c
>> +++ b/app/test-compress-perf/comp_perf_test_verify.c
>> @@ -8,14 +8,48 @@
>> #include <rte_compressdev.h>
>>
>> #include "comp_perf_test_verify.h"
>> +#include "comp_perf_test_common.h"
>> +
>> +void
>> +cperf_verify_test_destructor(void *arg) {
>> + if (arg) {
>> + comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)-
>>> mem);
>> + rte_free(arg);
>> + }
>> +}
>> +
>> +void *
>> +cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
>> + struct comp_test_data *options)
>> +{
>> + struct cperf_verify_ctx *ctx = NULL;
>> +
>> + ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);
>> +
> Better just return from here
[Tomek]. Yes you right. we wasn't able to allocate 'cperf_verify_ctx
struct',
so we don't need to call destructor here. I assume there's the same issue
in benchmark patch - will align both in V5. Thx.
>
>> + if (ctx != NULL) {
>> + ctx->mem.dev_id = dev_id;
>> + ctx->mem.qp_id = qp_id;
>> + ctx->options = options;
>> +
>> + if (!comp_perf_allocate_memory(ctx->options, &ctx->mem)
>> &&
>> + !prepare_bufs(ctx->options, &ctx->mem))
>> + return ctx;
> What if condition fails on comp_per_allocate_memory(), then it will go to verify_test_destructor(), so comp_perf_free_memory() check if mem != NULL before calling actual free?
[Tomek] I mean it's ok. Please take in to account that we was able to
allocate 'cperf_verify_ctx struct' - cause
ctx != NULL here. that means 'mem struct' inside 'cperf_verify_ctx
struct' exists for sure:
struct cperf_verify_ctx {
*struct cperf_mem_resources mem;*
struct comp_test_data *options;
int silent;
size_t comp_data_sz;
size_t decomp_data_sz;
double ratio;
};
and all fields inside 'struct cperf_mem_resources mem' are zeroed.
We don't need to check mem != NULL before free, because in this place
mem != NULL for sure. Also it's ok to call 'rte_free',
'rte_mempool_free' and 'rte_pktmbuf_free' with NULL ptr.
as a argument because the check is inside all of these functions.
Thx for the comments.
--
Tomek
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v4 3/6] app/test-compress-perf: add verification test case
2019-06-30 21:02 ` Tomasz Jozwiak
@ 2019-07-01 4:29 ` Shally Verma
0 siblings, 0 replies; 87+ messages in thread
From: Shally Verma @ 2019-07-01 4:29 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, fiona.trahe, arturx.trybula
From: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Sent: Monday, July 1, 2019 2:33 AM
To: Shally Verma <shallyv@marvell.com>; dev@dpdk.org; fiona.trahe@intel.com; arturx.trybula@intel.com
Subject: Re: [EXT] [PATCH v4 3/6] app/test-compress-perf: add verification test case
…
+ if (ctx != NULL) {
+ ctx->mem.dev_id = dev_id;
+ ctx->mem.qp_id = qp_id;
+ ctx->options = options;
+
+ if (!comp_perf_allocate_memory(ctx->options, &ctx->mem)
&&
+ !prepare_bufs(ctx->options, &ctx->mem))
+ return ctx;
What if condition fails on comp_per_allocate_memory(), then it will go to verify_test_destructor(), so comp_perf_free_memory() check if mem != NULL before calling actual free?
[Tomek] I mean it's ok. Please take in to account that we was able to allocate 'cperf_verify_ctx struct' - cause
ctx != NULL here. that means 'mem struct' inside 'cperf_verify_ctx struct' exists for sure:
struct cperf_verify_ctx {
struct cperf_mem_resources mem;
struct comp_test_data *options;
int silent;
size_t comp_data_sz;
size_t decomp_data_sz;
double ratio;
};
and all fields inside 'struct cperf_mem_resources mem' are zeroed.
We don't need to check mem != NULL before free, because in this place mem != NULL for sure. Also it's ok to call 'rte_free',
'rte_mempool_free' and 'rte_pktmbuf_free' with NULL ptr.
as a argument because the check is inside all of these functions.
[Shally] Okay.
Thx for the comments.
--
Tomek
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (5 preceding siblings ...)
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 6/6] app/test-compress-perf: add force process termination Tomasz Jozwiak
@ 2019-07-01 11:26 ` Tomasz Jozwiak
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
` (6 more replies)
6 siblings, 7 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-07-01 11:26 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
This patchset adds multiple cores feature to compression perf tool.
All structures have been aligned and are consistent
with crypto perf tool. All test cases have constructor, runner
and destructor and can use more cores and compression devices at
the same time.
v2 changes:
- fixed checkpatch warning
- fixed max_nb_queue_pairs detection. Based on compression API
if max_nb_queue_pairs = 0 that means there is no limit in
maximum number of queue pairs
- fixed qp setup on the last device
v3 changes:
- merged with commit 767350e7ede791932cc050bf2a192f6527b70c15
app/compress-perf: add prints for socket id
- fixed wrong compression/decompression throughput calculation
v4 changes:
- moved release notes update to patch 1
- removed pmd cyclecount template
v5 changes:
- changed ctx null ptr detection inside constructors
Tomasz Jozwiak (6):
app/test-compress-perf: add weak functions for multi-cores test
app/test-compress-perf: add ptest command line option
app/test-compress-perf: add verification test case
app/test-compress-perf: add benchmark test case
doc: update dpdk-test-compress-perf description
app/test-compress-perf: add force process termination
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf.h | 50 ++
app/test-compress-perf/comp_perf_options.h | 45 +-
app/test-compress-perf/comp_perf_options_parse.c | 54 +-
app/test-compress-perf/comp_perf_test_benchmark.c | 153 ++++--
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +-
app/test-compress-perf/comp_perf_test_common.c | 284 ++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/comp_perf_test_verify.c | 137 +++--
app/test-compress-perf/comp_perf_test_verify.h | 24 +-
app/test-compress-perf/main.c | 605 +++++++++-------------
app/test-compress-perf/meson.build | 3 +-
doc/guides/rel_notes/release_19_08.rst | 3 +
doc/guides/tools/comp_perf.rst | 34 +-
14 files changed, 992 insertions(+), 467 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 1/6] app/test-compress-perf: add weak functions for multi-cores test
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
@ 2019-07-01 11:26 ` Tomasz Jozwiak
2019-07-02 10:03 ` Trybula, ArturX
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 2/6] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
` (5 subsequent siblings)
6 siblings, 2 replies; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-07-01 11:26 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a template functions for multi-cores performance
version of compress-perf-tool and updates release notes for 19.08
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 3 +-
app/test-compress-perf/comp_perf.h | 50 ++
app/test-compress-perf/comp_perf_options.h | 44 +-
app/test-compress-perf/comp_perf_options_parse.c | 24 +-
app/test-compress-perf/comp_perf_test_common.c | 284 +++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/main.c | 599 +++++++++--------------
app/test-compress-perf/meson.build | 3 +-
doc/guides/rel_notes/release_19_08.rst | 3 +
9 files changed, 649 insertions(+), 402 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index d20e17e..de74129 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,7 +12,6 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
-SRCS-y += comp_perf_test_verify.c
-SRCS-y += comp_perf_test_benchmark.c
+SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf.h b/app/test-compress-perf/comp_perf.h
new file mode 100644
index 0000000..57289b0
--- /dev/null
+++ b/app/test-compress-perf/comp_perf.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_
+#define _COMP_PERF_
+
+#include <rte_mempool.h>
+
+struct comp_test_data;
+
+typedef void *(*cperf_constructor_t)(
+ uint8_t dev_id,
+ uint16_t qp_id,
+ struct comp_test_data *options);
+
+typedef int (*cperf_runner_t)(void *test_ctx);
+typedef void (*cperf_destructor_t)(void *test_ctx);
+
+struct cperf_test {
+ cperf_constructor_t constructor;
+ cperf_runner_t runner;
+ cperf_destructor_t destructor;
+};
+
+/* Needed for weak functions*/
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_benchmark_test_destructor(void *arg __rte_unused);
+
+int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_verify_test_destructor(void *arg __rte_unused);
+
+int
+cperf_verify_test_runner(void *test_ctx __rte_unused);
+
+#endif /* _COMP_PERF_ */
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index f87751d..0aa29a5 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -13,6 +13,23 @@
#define MAX_MBUF_DATA_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM)
#define MAX_SEG_SIZE ((int)(MAX_MBUF_DATA_SIZE / EXPANSE_RATIO))
+extern const char *cperf_test_type_strs[];
+
+/* Cleanup state machine */
+enum cleanup_st {
+ ST_CLEAR = 0,
+ ST_TEST_DATA,
+ ST_COMPDEV,
+ ST_INPUT_DATA,
+ ST_MEMORY_ALLOC,
+ ST_DURING_TEST
+};
+
+enum cperf_perf_test_type {
+ CPERF_TEST_TYPE_BENCHMARK,
+ CPERF_TEST_TYPE_VERIFY
+};
+
enum comp_operation {
COMPRESS_ONLY,
DECOMPRESS_ONLY,
@@ -30,37 +47,26 @@ struct range_list {
struct comp_test_data {
char driver_name[64];
char input_file[64];
- struct rte_mbuf **comp_bufs;
- struct rte_mbuf **decomp_bufs;
- uint32_t total_bufs;
+ enum cperf_perf_test_type test;
+
uint8_t *input_data;
size_t input_data_sz;
- uint8_t *compressed_data;
- uint8_t *decompressed_data;
- struct rte_mempool *comp_buf_pool;
- struct rte_mempool *decomp_buf_pool;
- struct rte_mempool *op_pool;
- int8_t cdev_id;
+ uint16_t nb_qps;
uint16_t seg_sz;
uint16_t out_seg_sz;
uint16_t burst_sz;
uint32_t pool_sz;
uint32_t num_iter;
uint16_t max_sgl_segs;
+
enum rte_comp_huffman huffman_enc;
enum comp_operation test_op;
int window_sz;
- struct range_list level;
- /* Store TSC duration for all levels (including level 0) */
- uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- size_t comp_data_sz;
- size_t decomp_data_sz;
+ struct range_list level_lst;
+ uint8_t level;
+
double ratio;
- double comp_gbps;
- double decomp_gbps;
- double comp_tsc_byte;
- double decomp_tsc_byte;
+ enum cleanup_st cleanup;
};
int
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 2fb6fb4..bc4b98a 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -466,19 +466,20 @@ parse_level(struct comp_test_data *test_data, const char *arg)
* Try parsing the argument as a range, if it fails,
* arse it as a list
*/
- if (parse_range(arg, &test_data->level.min, &test_data->level.max,
- &test_data->level.inc) < 0) {
- ret = parse_list(arg, test_data->level.list,
- &test_data->level.min,
- &test_data->level.max);
+ if (parse_range(arg, &test_data->level_lst.min,
+ &test_data->level_lst.max,
+ &test_data->level_lst.inc) < 0) {
+ ret = parse_list(arg, test_data->level_lst.list,
+ &test_data->level_lst.min,
+ &test_data->level_lst.max);
if (ret < 0) {
RTE_LOG(ERR, USER1,
"Failed to parse compression level/s\n");
return -1;
}
- test_data->level.count = ret;
+ test_data->level_lst.count = ret;
- if (test_data->level.max > RTE_COMP_LEVEL_MAX) {
+ if (test_data->level_lst.max > RTE_COMP_LEVEL_MAX) {
RTE_LOG(ERR, USER1, "Level cannot be higher than %u\n",
RTE_COMP_LEVEL_MAX);
return -1;
@@ -498,7 +499,6 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
-
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -572,7 +572,6 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv)
void
comp_perf_options_default(struct comp_test_data *test_data)
{
- test_data->cdev_id = -1;
test_data->seg_sz = 2048;
test_data->burst_sz = 32;
test_data->pool_sz = 8192;
@@ -581,9 +580,10 @@ comp_perf_options_default(struct comp_test_data *test_data)
test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
test_data->test_op = COMPRESS_DECOMPRESS;
test_data->window_sz = -1;
- test_data->level.min = 1;
- test_data->level.max = 9;
- test_data->level.inc = 1;
+ test_data->level_lst.min = 1;
+ test_data->level_lst.max = 9;
+ test_data->level_lst.inc = 1;
+ test_data->test = CPERF_TEST_TYPE_BENCHMARK;
}
int
diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
new file mode 100644
index 0000000..dc9d0b0
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -0,0 +1,284 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_malloc.h>
+#include <rte_eal.h>
+#include <rte_log.h>
+#include <rte_compressdev.h>
+
+#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
+
+#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range)
+{
+ unsigned int next_size;
+
+ /* Check lower/upper bounds */
+ if (size < range->min)
+ return -1;
+
+ if (size > range->max)
+ return -1;
+
+ /* If range is actually only one value, size is correct */
+ if (range->increment == 0)
+ return 0;
+
+ /* Check if value is one of the supported sizes */
+ for (next_size = range->min; next_size <= range->max;
+ next_size += range->increment)
+ if (size == next_size)
+ return 0;
+
+ return -1;
+}
+
+static uint32_t
+find_buf_size(uint32_t input_size)
+{
+ uint32_t i;
+
+ /* From performance point of view the buffer size should be a
+ * power of 2 but also should be enough to store incompressible data
+ */
+
+ /* We're looking for nearest power of 2 buffer size, which is greather
+ * than input_size
+ */
+ uint32_t size =
+ !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
+
+ for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
+ ;
+
+ return i > ((UINT16_MAX + 1) >> 1)
+ ? (uint32_t)((float)input_size * EXPANSE_RATIO)
+ : i;
+}
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem)
+{
+ uint32_t i;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ rte_pktmbuf_free(mem->comp_bufs[i]);
+ rte_pktmbuf_free(mem->decomp_bufs[i]);
+ }
+
+ rte_free(mem->decomp_bufs);
+ rte_free(mem->comp_bufs);
+ rte_free(mem->decompressed_data);
+ rte_free(mem->compressed_data);
+ rte_mempool_free(mem->op_pool);
+ rte_mempool_free(mem->decomp_buf_pool);
+ rte_mempool_free(mem->comp_buf_pool);
+}
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem)
+{
+ test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
+ /* Number of segments for input and output
+ * (compression and decompression)
+ */
+ uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
+ test_data->seg_sz);
+ char pool_name[32] = "";
+
+ snprintf(pool_name, sizeof(pool_name), "comp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->comp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0,
+ test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->comp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ snprintf(pool_name, sizeof(pool_name), "decomp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->decomp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->decomp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ mem->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+
+ snprintf(pool_name, sizeof(pool_name), "op_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->op_pool = rte_comp_op_pool_create(pool_name,
+ mem->total_bufs,
+ 0, 0, rte_socket_id());
+ if (mem->op_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
+ return -1;
+ }
+
+ /*
+ * Compressed data might be a bit larger than input data,
+ * if data cannot be compressed
+ */
+ mem->compressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz * EXPANSE_RATIO
+ + MIN_COMPRESSED_BUF_SIZE, 0,
+ rte_socket_id());
+ if (mem->compressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->decompressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz, 0,
+ rte_socket_id());
+ if (mem->decompressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->comp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->comp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+
+ mem->decomp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->decomp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+ return 0;
+}
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
+{
+ uint32_t remaining_data = test_data->input_data_sz;
+ uint8_t *input_data_ptr = test_data->input_data;
+ size_t data_sz;
+ uint8_t *data_addr;
+ uint32_t i, j;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ /* Allocate data in input mbuf and copy data from input file */
+ mem->decomp_bufs[i] =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+ if (mem->decomp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->decomp_bufs[i], data_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ /* Already one segment in the mbuf */
+ uint16_t segs_per_mbuf = 1;
+
+ /* Chain mbufs if needed for input mbufs */
+ while (segs_per_mbuf < test_data->max_sgl_segs
+ && remaining_data > 0) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ data_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ if (rte_pktmbuf_chain(mem->decomp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ segs_per_mbuf++;
+ }
+
+ /* Allocate data in output mbuf */
+ mem->comp_bufs[i] =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+ if (mem->comp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->comp_bufs[i],
+ test_data->out_seg_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ /* Chain mbufs if needed for output mbufs */
+ for (j = 1; j < segs_per_mbuf; j++) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ test_data->out_seg_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ if (rte_pktmbuf_chain(mem->comp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test-compress-perf/comp_perf_test_common.h
new file mode 100644
index 0000000..9c11e3a
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_TEST_COMMON_H_
+#define _COMP_PERF_TEST_COMMON_H_
+
+#include <stdint.h>
+
+#include <rte_mempool.h>
+
+struct cperf_mem_resources {
+ uint8_t dev_id;
+ uint16_t qp_id;
+ uint8_t lcore_id;
+ uint32_t total_bufs;
+ uint8_t *compressed_data;
+ uint8_t *decompressed_data;
+
+ struct rte_mbuf **comp_bufs;
+ struct rte_mbuf **decomp_bufs;
+
+ struct rte_mempool *comp_buf_pool;
+ struct rte_mempool *decomp_buf_pool;
+ struct rte_mempool *op_pool;
+};
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range);
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem);
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem);
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem);
+
+#endif /* _COMP_PERF_TEST_COMMON_H_ */
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 7b9ee74..3a3da4c 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,56 +8,38 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
-#include "comp_perf_test_verify.h"
-#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
#define NUM_MAX_XFORMS 16
#define NUM_MAX_INFLIGHT_OPS 512
-#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
-
-/* Cleanup state machine */
-static enum cleanup_st {
- ST_CLEAR = 0,
- ST_TEST_DATA,
- ST_COMPDEV,
- ST_INPUT_DATA,
- ST_MEMORY_ALLOC,
- ST_PREPARE_BUF,
- ST_DURING_TEST
-} cleanup = ST_CLEAR;
-
-static int
-param_range_check(uint16_t size, const struct rte_param_log2_range *range)
-{
- unsigned int next_size;
-
- /* Check lower/upper bounds */
- if (size < range->min)
- return -1;
-
- if (size > range->max)
- return -1;
-
- /* If range is actually only one value, size is correct */
- if (range->increment == 0)
- return 0;
-
- /* Check if value is one of the supported sizes */
- for (next_size = range->min; next_size <= range->max;
- next_size += range->increment)
- if (size == next_size)
- return 0;
-
- return -1;
-}
+__extension__
+const char *cperf_test_type_strs[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = "benchmark",
+ [CPERF_TEST_TYPE_VERIFY] = "verify"
+};
+
+__extension__
+static const struct cperf_test cperf_testmap[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = {
+ cperf_benchmark_test_constructor,
+ cperf_benchmark_test_runner,
+ cperf_benchmark_test_destructor
+ },
+ [CPERF_TEST_TYPE_VERIFY] = {
+ cperf_verify_test_constructor,
+ cperf_verify_test_runner,
+ cperf_verify_test_destructor
+ }
+};
static int
-comp_perf_check_capabilities(struct comp_test_data *test_data)
+comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
const struct rte_compressdev_capabilities *cap;
- cap = rte_compressdev_capability_get(test_data->cdev_id,
+ cap = rte_compressdev_capability_get(cdev_id,
RTE_COMP_ALGO_DEFLATE);
if (cap == NULL) {
@@ -105,7 +87,7 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
}
/* Level 0 support */
- if (test_data->level.min == 0 &&
+ if (test_data->level_lst.min == 0 &&
(comp_flags & RTE_COMP_FF_NONCOMPRESSED_BLOCKS) == 0) {
RTE_LOG(ERR, USER1, "Compress device does not support "
"level 0 (no compression)\n");
@@ -115,110 +97,108 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
return 0;
}
-static uint32_t
-find_buf_size(uint32_t input_size)
+static int
+comp_perf_initialize_compressdev(struct comp_test_data *test_data,
+ uint8_t *enabled_cdevs)
{
- uint32_t i;
+ uint8_t enabled_cdev_count, nb_lcores, cdev_id;
+ unsigned int i, j;
+ int ret;
- /* From performance point of view the buffer size should be a
- * power of 2 but also should be enough to store incompressible data
- */
+ enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
+ enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
+ if (enabled_cdev_count == 0) {
+ RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
+ test_data->driver_name);
+ return -EINVAL;
+ }
- /* We're looking for nearest power of 2 buffer size, which is greather
- * than input_size
+ nb_lcores = rte_lcore_count() - 1;
+ /*
+ * Use fewer devices,
+ * if there are more available than cores.
*/
- uint32_t size =
- !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
-
- for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
- ;
-
- return i > ((UINT16_MAX + 1) >> 1)
- ? (uint32_t)((float)input_size * EXPANSE_RATIO)
- : i;
-}
-
-static int
-comp_perf_allocate_memory(struct comp_test_data *test_data)
-{
+ if (enabled_cdev_count > nb_lcores) {
+ enabled_cdev_count = nb_lcores;
+ RTE_LOG(INFO, USER1,
+ " There's more available devices than cores!"
+ " The number of devices has been aligned to %d cores\n",
+ nb_lcores);
+ }
- test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
- /* Number of segments for input and output
- * (compression and decompression)
+ /*
+ * Calculate number of needed queue pairs, based on the amount
+ * of available number of logical cores and compression devices.
+ * For instance, if there are 4 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device.
+ * One queue pair per one core.
+ * if e.g.: there're 3 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device but one queue pair
+ * will left unused in the last one device
*/
- uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
- test_data->seg_sz);
- test_data->comp_buf_pool = rte_pktmbuf_pool_create("comp_buf_pool",
- total_segs,
- 0, 0,
- test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->comp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ test_data->nb_qps = (nb_lcores % enabled_cdev_count) ?
+ (nb_lcores / enabled_cdev_count) + 1 :
+ nb_lcores / enabled_cdev_count;
- cleanup = ST_MEMORY_ALLOC;
- test_data->decomp_buf_pool = rte_pktmbuf_pool_create("decomp_buf_pool",
- total_segs,
- 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->decomp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ for (i = 0; i < enabled_cdev_count &&
+ i < RTE_COMPRESS_MAX_DEVS; i++,
+ nb_lcores -= test_data->nb_qps) {
+ cdev_id = enabled_cdevs[i];
- test_data->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+ struct rte_compressdev_info cdev_info;
+ uint8_t socket_id = rte_compressdev_socket_id(cdev_id);
- test_data->op_pool = rte_comp_op_pool_create("op_pool",
- test_data->total_bufs,
- 0, 0, rte_socket_id());
- if (test_data->op_pool == NULL) {
- RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
- return -1;
- }
+ rte_compressdev_info_get(cdev_id, &cdev_info);
+ if (cdev_info.max_nb_queue_pairs &&
+ test_data->nb_qps > cdev_info.max_nb_queue_pairs) {
+ RTE_LOG(ERR, USER1,
+ "Number of needed queue pairs is higher "
+ "than the maximum number of queue pairs "
+ "per device.\n");
+ RTE_LOG(ERR, USER1,
+ "Lower the number of cores or increase "
+ "the number of crypto devices\n");
+ return -EINVAL;
+ }
- /*
- * Compressed data might be a bit larger than input data,
- * if data cannot be compressed
- */
- test_data->compressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz * EXPANSE_RATIO
- + MIN_COMPRESSED_BUF_SIZE, 0,
- rte_socket_id());
- if (test_data->compressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ if (comp_perf_check_capabilities(test_data, cdev_id) < 0)
+ return -EINVAL;
+
+ /* Configure compressdev */
+ struct rte_compressdev_config config = {
+ .socket_id = socket_id,
+ .nb_queue_pairs = nb_lcores > test_data->nb_qps
+ ? test_data->nb_qps : nb_lcores,
+ .max_nb_priv_xforms = NUM_MAX_XFORMS,
+ .max_nb_streams = 0
+ };
+
+ if (rte_compressdev_configure(cdev_id, &config) < 0) {
+ RTE_LOG(ERR, USER1, "Device configuration failed\n");
+ return -EINVAL;
+ }
- test_data->decompressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz, 0,
- rte_socket_id());
- if (test_data->decompressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ for (j = 0; j < test_data->nb_qps; j++) {
+ ret = rte_compressdev_queue_pair_setup(cdev_id, j,
+ NUM_MAX_INFLIGHT_OPS, socket_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to setup queue pair %u on compressdev %u",
+ j, cdev_id);
+ return -EINVAL;
+ }
+ }
- test_data->comp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->comp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
- " could not be allocated\n");
- return -1;
+ ret = rte_compressdev_start(cdev_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to start device %u: error %d\n",
+ cdev_id, ret);
+ return -EPERM;
+ }
}
- test_data->decomp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->decomp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
- " could not be allocated\n");
- return -1;
- }
- return 0;
+ return enabled_cdev_count;
}
static int
@@ -295,187 +275,18 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
-static int
-comp_perf_initialize_compressdev(struct comp_test_data *test_data)
-{
- uint8_t enabled_cdev_count;
- uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
-
- enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
- enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
- if (enabled_cdev_count == 0) {
- RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
- test_data->driver_name);
- return -EINVAL;
- }
-
- if (enabled_cdev_count > 1)
- RTE_LOG(INFO, USER1,
- "Only the first compress device will be used\n");
-
- test_data->cdev_id = enabled_cdevs[0];
-
- if (comp_perf_check_capabilities(test_data) < 0)
- return -1;
-
- /* Configure compressdev (one device, one queue pair) */
- struct rte_compressdev_config config = {
- .socket_id = rte_socket_id(),
- .nb_queue_pairs = 1,
- .max_nb_priv_xforms = NUM_MAX_XFORMS,
- .max_nb_streams = 0
- };
-
- if (rte_compressdev_configure(test_data->cdev_id, &config) < 0) {
- RTE_LOG(ERR, USER1, "Device configuration failed\n");
- return -1;
- }
-
- if (rte_compressdev_queue_pair_setup(test_data->cdev_id, 0,
- NUM_MAX_INFLIGHT_OPS, rte_socket_id()) < 0) {
- RTE_LOG(ERR, USER1, "Queue pair setup failed\n");
- return -1;
- }
-
- if (rte_compressdev_start(test_data->cdev_id) < 0) {
- RTE_LOG(ERR, USER1, "Device could not be started\n");
- return -1;
- }
-
- return 0;
-}
-
-static int
-prepare_bufs(struct comp_test_data *test_data)
-{
- uint32_t remaining_data = test_data->input_data_sz;
- uint8_t *input_data_ptr = test_data->input_data;
- size_t data_sz;
- uint8_t *data_addr;
- uint32_t i, j;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- /* Allocate data in input mbuf and copy data from input file */
- test_data->decomp_bufs[i] =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
- if (test_data->decomp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
-
- cleanup = ST_PREPARE_BUF;
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->decomp_bufs[i], data_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
- rte_memcpy(data_addr, input_data_ptr, data_sz);
-
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- /* Already one segment in the mbuf */
- uint16_t segs_per_mbuf = 1;
-
- /* Chain mbufs if needed for input mbufs */
- while (segs_per_mbuf < test_data->max_sgl_segs
- && remaining_data > 0) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- data_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- rte_memcpy(data_addr, input_data_ptr, data_sz);
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- if (rte_pktmbuf_chain(test_data->decomp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- segs_per_mbuf++;
- }
-
- /* Allocate data in output mbuf */
- test_data->comp_bufs[i] =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
- if (test_data->comp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->comp_bufs[i],
- test_data->out_seg_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- /* Chain mbufs if needed for output mbufs */
- for (j = 1; j < segs_per_mbuf; j++) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- test_data->out_seg_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- if (rte_pktmbuf_chain(test_data->comp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- }
- }
-
- return 0;
-}
-
-static void
-free_bufs(struct comp_test_data *test_data)
-{
- uint32_t i;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- rte_pktmbuf_free(test_data->comp_bufs[i]);
- rte_pktmbuf_free(test_data->decomp_bufs[i]);
- }
-}
-
-
-
int
main(int argc, char **argv)
{
- uint8_t level, level_idx = 0;
+ uint8_t level_idx = 0;
int ret, i;
struct comp_test_data *test_data;
+ void *ctx[RTE_MAX_LCORE] = {};
+ uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
+ int nb_compressdevs = 0;
+ uint16_t total_nb_qps = 0;
+ uint8_t cdev_id;
+ uint32_t lcore_id;
/* Initialise DPDK EAL */
ret = rte_eal_init(argc, argv);
@@ -492,7 +303,7 @@ main(int argc, char **argv)
rte_socket_id());
ret = EXIT_SUCCESS;
- cleanup = ST_TEST_DATA;
+ test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
if (comp_perf_options_parse(test_data, argc, argv) < 0) {
@@ -507,99 +318,112 @@ main(int argc, char **argv)
goto end;
}
- if (comp_perf_initialize_compressdev(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ nb_compressdevs =
+ comp_perf_initialize_compressdev(test_data, enabled_cdevs);
- cleanup = ST_COMPDEV;
- if (comp_perf_dump_input_data(test_data) < 0) {
+ if (nb_compressdevs < 1) {
ret = EXIT_FAILURE;
goto end;
}
- cleanup = ST_INPUT_DATA;
- if (comp_perf_allocate_memory(test_data) < 0) {
+ test_data->cleanup = ST_COMPDEV;
+ if (comp_perf_dump_input_data(test_data) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (prepare_bufs(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ test_data->cleanup = ST_INPUT_DATA;
- if (test_data->level.inc != 0)
- level = test_data->level.min;
+ if (test_data->level_lst.inc != 0)
+ test_data->level = test_data->level_lst.min;
else
- level = test_data->level.list[0];
+ test_data->level = test_data->level_lst.list[0];
printf("App uses socket: %u\n", rte_socket_id());
- printf("Driver uses socket: %u\n",
- rte_compressdev_socket_id(test_data->cdev_id));
printf("Burst size = %u\n", test_data->burst_sz);
printf("File size = %zu\n", test_data->input_data_sz);
- printf("%6s%12s%17s%19s%21s%15s%21s%23s%16s\n",
- "Level", "Comp size", "Comp ratio [%]",
- "Comp [Cycles/it]", "Comp [Cycles/Byte]", "Comp [Gbps]",
- "Decomp [Cycles/it]", "Decomp [Cycles/Byte]", "Decomp [Gbps]");
+ test_data->cleanup = ST_DURING_TEST;
+ total_nb_qps = nb_compressdevs * test_data->nb_qps;
- cleanup = ST_DURING_TEST;
- while (level <= test_data->level.max) {
+ i = 0;
+ uint8_t qp_id = 0, cdev_index = 0;
- /*
- * Run a first iteration, to verify compression and
- * get the compression ratio for the level
- */
- if (cperf_verification(test_data, level) != EXIT_SUCCESS)
- break;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
- /*
- * Run benchmarking test
- */
- if (cperf_benchmark(test_data, level) != EXIT_SUCCESS)
+ if (i == total_nb_qps)
break;
- printf("%6u%12zu%17.2f%19"PRIu64"%21.2f"
- "%15.2f%21"PRIu64"%23.2f%16.2f\n",
- level, test_data->comp_data_sz, test_data->ratio,
- test_data->comp_tsc_duration[level],
- test_data->comp_tsc_byte, test_data->comp_gbps,
- test_data->decomp_tsc_duration[level],
- test_data->decomp_tsc_byte, test_data->decomp_gbps);
+ cdev_id = enabled_cdevs[cdev_index];
+ ctx[i] = cperf_testmap[test_data->test].constructor(
+ cdev_id, qp_id,
+ test_data);
+ if (ctx[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Test run constructor failed\n");
+ goto end;
+ }
+ qp_id = (qp_id + 1) % test_data->nb_qps;
+ if (qp_id == 0)
+ cdev_index++;
+ i++;
+ }
+
+ while (test_data->level <= test_data->level_lst.max) {
- if (test_data->level.inc != 0)
- level += test_data->level.inc;
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+
+ rte_eal_remote_launch(
+ cperf_testmap[test_data->test].runner,
+ ctx[i], lcore_id);
+ i++;
+ }
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+ ret |= rte_eal_wait_lcore(lcore_id);
+ i++;
+ }
+
+ if (ret != EXIT_SUCCESS)
+ break;
+
+ if (test_data->level_lst.inc != 0)
+ test_data->level += test_data->level_lst.inc;
else {
- if (++level_idx == test_data->level.count)
+ if (++level_idx == test_data->level_lst.count)
break;
- level = test_data->level.list[level_idx];
+ test_data->level = test_data->level_lst.list[level_idx];
}
}
end:
- switch (cleanup) {
+ switch (test_data->cleanup) {
case ST_DURING_TEST:
- case ST_PREPARE_BUF:
- free_bufs(test_data);
- /* fallthrough */
- case ST_MEMORY_ALLOC:
- rte_free(test_data->decomp_bufs);
- rte_free(test_data->comp_bufs);
- rte_free(test_data->decompressed_data);
- rte_free(test_data->compressed_data);
- rte_mempool_free(test_data->op_pool);
- rte_mempool_free(test_data->decomp_buf_pool);
- rte_mempool_free(test_data->comp_buf_pool);
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (i == total_nb_qps)
+ break;
+
+ if (ctx[i] && cperf_testmap[test_data->test].destructor)
+ cperf_testmap[test_data->test].destructor(
+ ctx[i]);
+ i++;
+ }
/* fallthrough */
case ST_INPUT_DATA:
rte_free(test_data->input_data);
/* fallthrough */
case ST_COMPDEV:
- if (test_data->cdev_id != -1)
- rte_compressdev_stop(test_data->cdev_id);
+ for (i = 0; i < nb_compressdevs &&
+ i < RTE_COMPRESS_MAX_DEVS; i++)
+ rte_compressdev_stop(enabled_cdevs[i]);
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
@@ -616,3 +440,44 @@ main(int argc, char **argv)
}
return ret;
}
+
+__rte_weak void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Benchmark test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_benchmark_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+__rte_weak void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Verify test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_verify_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_verify_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index ec73e5e..00413c6 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,6 +4,5 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
- 'comp_perf_test_verify.c',
- 'comp_perf_test_benchmark.c')
+ 'comp_perf_test_common.c')
deps = ['compressdev']
diff --git a/doc/guides/rel_notes/release_19_08.rst b/doc/guides/rel_notes/release_19_08.rst
index 7c0435a..2b2e029 100644
--- a/doc/guides/rel_notes/release_19_08.rst
+++ b/doc/guides/rel_notes/release_19_08.rst
@@ -99,6 +99,9 @@ New Features
Updated ``librte_telemetry`` to fetch the global metrics from the
``librte_metrics`` library.
+* **Updated test-compress-perf tool application.**
+
+ Added multiple cores feature to compression perf tool application.
Removed Items
-------------
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 2/6] app/test-compress-perf: add ptest command line option
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
@ 2019-07-01 11:26 ` Tomasz Jozwiak
2019-07-02 10:05 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 3/6] app/test-compress-perf: add verification test case Tomasz Jozwiak
` (4 subsequent siblings)
6 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-07-01 11:26 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds --ptest option to make possible a choose
of test case from command line.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/comp_perf_options_parse.c | 32 ++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index bc4b98a..7888ab6 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -15,6 +15,7 @@
#include "comp_perf_options.h"
+#define CPERF_PTEST_TYPE ("ptest")
#define CPERF_DRIVER_NAME ("driver-name")
#define CPERF_TEST_FILE ("input-file")
#define CPERF_SEG_SIZE ("seg-sz")
@@ -37,6 +38,7 @@ static void
usage(char *progname)
{
printf("%s [EAL options] --\n"
+ " --ptest benchmark / verify :"
" --driver-name NAME: compress driver to use\n"
" --input-file NAME: file to compress and decompress\n"
" --extended-input-sz N: extend file data up to this size (default: no extension)\n"
@@ -76,6 +78,33 @@ get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
}
static int
+parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
+{
+ struct name_id_map cperftest_namemap[] = {
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
+ CPERF_TEST_TYPE_BENCHMARK
+ },
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
+ CPERF_TEST_TYPE_VERIFY
+ }
+ };
+
+ int id = get_str_key_id_mapping(
+ (struct name_id_map *)cperftest_namemap,
+ RTE_DIM(cperftest_namemap), arg);
+ if (id < 0) {
+ RTE_LOG(ERR, USER1, "failed to parse test type");
+ return -1;
+ }
+
+ test_data->test = (enum cperf_perf_test_type)id;
+
+ return 0;
+}
+
+static int
parse_uint32_t(uint32_t *value, const char *arg)
{
char *end = NULL;
@@ -499,6 +528,8 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
+
+ { CPERF_PTEST_TYPE, required_argument, 0, 0 },
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -517,6 +548,7 @@ static int
comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
{
struct long_opt_parser parsermap[] = {
+ { CPERF_PTEST_TYPE, parse_cperf_test_type },
{ CPERF_DRIVER_NAME, parse_driver_name },
{ CPERF_TEST_FILE, parse_test_file },
{ CPERF_SEG_SIZE, parse_seg_sz },
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 3/6] app/test-compress-perf: add verification test case
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 2/6] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
@ 2019-07-01 11:26 ` Tomasz Jozwiak
2019-07-02 10:02 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 4/6] app/test-compress-perf: add benchmark " Tomasz Jozwiak
` (3 subsequent siblings)
6 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-07-01 11:26 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a verification part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_verify.c | 123 ++++++++++++++++++-------
app/test-compress-perf/comp_perf_test_verify.h | 24 ++++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 113 insertions(+), 37 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index de74129..f54d9a4 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,6 +12,7 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
+SRCS-y += comp_perf_test_verify.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 28a0fe8..7be30ee 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -8,14 +8,49 @@
#include <rte_compressdev.h>
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_common.h"
+
+void
+cperf_verify_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)->mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_verify_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);
+
+ if (ctx == NULL)
+ return NULL;
+
+ ctx->mem.dev_id = dev_id;
+ ctx->mem.qp_id = qp_id;
+ ctx->options = options;
+
+ if (!comp_perf_allocate_memory(ctx->options, &ctx->mem) &&
+ !prepare_bufs(ctx->options, &ctx->mem))
+ return ctx;
+
+ cperf_verify_test_destructor(ctx);
+ return NULL;
+}
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type,
- uint8_t *output_data_ptr,
- size_t *output_data_sz)
+main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->options;
+ uint8_t *output_data_ptr;
+ size_t *output_data_sz;
+ struct cperf_mem_resources *mem = &ctx->mem;
+
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -33,7 +68,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -42,7 +77,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -50,14 +85,16 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ output_data_ptr = ctx->mem.compressed_data;
+ output_data_sz = &ctx->comp_data_sz;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -69,8 +106,10 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ output_data_ptr = ctx->mem.decompressed_data;
+ output_data_sz = &ctx->decomp_data_sz;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -85,8 +124,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
num_iter = 1;
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +152,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +188,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +205,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -220,15 +261,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -291,7 +334,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
@@ -300,45 +343,45 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (output_data_sz)
*output_data_sz = output_size;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
-
-
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level)
+cperf_verify_test_runner(void *test_ctx)
{
+ struct cperf_verify_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->options;
int ret = EXIT_SUCCESS;
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+ uint32_t lcore = rte_lcore_id();
+
+ ctx->mem.lcore_id = lcore;
test_data->ratio = 0;
- if (main_loop(test_data, level, RTE_COMP_COMPRESS,
- test_data->compressed_data,
- &test_data->comp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS,
- test_data->decompressed_data,
- &test_data->decomp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (test_data->decomp_data_sz != test_data->input_data_sz) {
+ if (ctx->decomp_data_sz != test_data->input_data_sz) {
RTE_LOG(ERR, USER1,
"Decompressed data length not equal to input data length\n");
RTE_LOG(ERR, USER1,
"Decompressed size = %zu, expected = %zu\n",
- test_data->decomp_data_sz, test_data->input_data_sz);
+ ctx->decomp_data_sz, test_data->input_data_sz);
ret = EXIT_FAILURE;
goto end;
} else {
- if (memcmp(test_data->decompressed_data,
+ if (memcmp(ctx->mem.decompressed_data,
test_data->input_data,
test_data->input_data_sz) != 0) {
RTE_LOG(ERR, USER1,
@@ -348,9 +391,19 @@ cperf_verification(struct comp_test_data *test_data, uint8_t level)
}
}
- test_data->ratio = (double) test_data->comp_data_sz /
+ ctx->ratio = (double) ctx->comp_data_sz /
test_data->input_data_sz * 100;
+ if (!ctx->silent) {
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]");
+ }
+ printf("%12u%6u%12zu%17.2f\n",
+ ctx->mem.lcore_id,
+ test_data->level, ctx->comp_data_sz, ctx->ratio);
+ }
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.h b/app/test-compress-perf/comp_perf_test_verify.h
index 67c6b49..ae8b742 100644
--- a/app/test-compress-perf/comp_perf_test_verify.h
+++ b/app/test-compress-perf/comp_perf_test_verify.h
@@ -1,13 +1,33 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018-2019 Intel Corporation
*/
#ifndef _COMP_PERF_TEST_VERIFY_
#define _COMP_PERF_TEST_VERIFY_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+
+struct cperf_verify_ctx {
+ struct cperf_mem_resources mem;
+ struct comp_test_data *options;
+
+ int silent;
+ size_t comp_data_sz;
+ size_t decomp_data_sz;
+ double ratio;
+};
+
+void
+cperf_verify_test_destructor(void *arg);
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level);
+cperf_verify_test_runner(void *test_ctx);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 3a3da4c..51ca9f5 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,6 +8,7 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index 00413c6..c6246e5 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,5 +4,6 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
+ 'comp_perf_test_verify.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 4/6] app/test-compress-perf: add benchmark test case
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (2 preceding siblings ...)
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 3/6] app/test-compress-perf: add verification test case Tomasz Jozwiak
@ 2019-07-01 11:26 ` Tomasz Jozwiak
2019-07-02 10:02 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 5/6] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
` (2 subsequent siblings)
6 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-07-01 11:26 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a benchmark part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 140 ++++++++++++++++------
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 130 insertions(+), 38 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index f54d9a4..d1a6820 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -13,6 +13,7 @@ CFLAGS += -O3
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
SRCS-y += comp_perf_test_verify.c
+SRCS-y += comp_perf_test_benchmark.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 5752906..e0f852b 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -10,11 +10,46 @@
#include "comp_perf_test_benchmark.h"
+void
+cperf_benchmark_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(
+ &((struct cperf_benchmark_ctx *)arg)->ver.mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_benchmark_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_benchmark_ctx), 0);
+
+ if (ctx == NULL)
+ return NULL;
+
+ ctx->ver.mem.dev_id = dev_id;
+ ctx->ver.mem.qp_id = qp_id;
+ ctx->ver.options = options;
+ ctx->ver.silent = 1; /* ver. part will be silent */
+
+ if (!comp_perf_allocate_memory(ctx->ver.options, &ctx->ver.mem)
+ && !prepare_bufs(ctx->ver.options, &ctx->ver.mem))
+ return ctx;
+
+ cperf_benchmark_test_destructor(ctx);
+ return NULL;
+}
+
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type)
+main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->ver.options;
+ struct cperf_mem_resources *mem = &ctx->ver.mem;
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -31,7 +66,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -40,7 +75,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -48,14 +83,14 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -67,8 +102,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -82,13 +117,13 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
uint64_t tsc_start, tsc_end, tsc_duration;
- tsc_start = tsc_end = tsc_duration = 0;
- tsc_start = rte_rdtsc();
num_iter = test_data->num_iter;
+ tsc_start = tsc_end = tsc_duration = 0;
+ tsc_start = rte_rdtsc_precise();
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +148,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +184,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +201,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -177,7 +214,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -198,15 +235,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -226,7 +265,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -247,65 +286,92 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
}
- tsc_end = rte_rdtsc();
+ tsc_end = rte_rdtsc_precise();
tsc_duration = tsc_end - tsc_start;
if (type == RTE_COMP_COMPRESS)
- test_data->comp_tsc_duration[level] =
+ ctx->comp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
else
- test_data->decomp_tsc_duration[level] =
+ ctx->decomp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level)
+cperf_benchmark_test_runner(void *test_ctx)
{
+ struct cperf_benchmark_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->ver.options;
+ uint32_t lcore = rte_lcore_id();
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+
+ ctx->ver.mem.lcore_id = lcore;
int i, ret = EXIT_SUCCESS;
/*
+ * First the verification part is needed
+ */
+ if (cperf_verify_test_runner(&ctx->ver)) {
+ ret = EXIT_FAILURE;
+ goto end;
+ }
+
+ /*
* Run the tests twice, discarding the first performance
* results, before the cache is warmed up
*/
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_COMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
- test_data->comp_tsc_byte =
- (double)(test_data->comp_tsc_duration[level]) /
+ ctx->comp_tsc_byte =
+ (double)(ctx->comp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->decomp_tsc_byte =
- (double)(test_data->decomp_tsc_duration[level]) /
+ ctx->decomp_tsc_byte =
+ (double)(ctx->decomp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->comp_gbps = rte_get_tsc_hz() / test_data->comp_tsc_byte * 8 /
+ ctx->comp_gbps = rte_get_tsc_hz() / ctx->comp_tsc_byte * 8 /
+ 1000000000;
+
+ ctx->decomp_gbps = rte_get_tsc_hz() / ctx->decomp_tsc_byte * 8 /
1000000000;
- test_data->decomp_gbps = rte_get_tsc_hz() / test_data->decomp_tsc_byte
- * 8 / 1000000000;
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s%15s%16s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]",
+ "Comp [Gbps]", "Decomp [Gbps]");
+ }
+
+ printf("%12u%6u%12zu%17.2f%15.2f%16.2f\n",
+ ctx->ver.mem.lcore_id,
+ test_data->level, ctx->ver.comp_data_sz, ctx->ver.ratio,
+ ctx->comp_gbps,
+ ctx->decomp_gbps);
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.h b/app/test-compress-perf/comp_perf_test_benchmark.h
index b193445..d9b2694 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.h
+++ b/app/test-compress-perf/comp_perf_test_benchmark.h
@@ -5,9 +5,32 @@
#ifndef _COMP_PERF_TEST_BENCHMARK_
#define _COMP_PERF_TEST_BENCHMARK_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+#include "comp_perf_test_verify.h"
+
+struct cperf_benchmark_ctx {
+ struct cperf_verify_ctx ver;
+
+ /* Store TSC duration for all levels (including level 0) */
+ uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ double comp_gbps;
+ double decomp_gbps;
+ double comp_tsc_byte;
+ double decomp_tsc_byte;
+};
+
+void
+cperf_benchmark_test_destructor(void *arg);
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level);
+cperf_benchmark_test_runner(void *test_ctx);
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 51ca9f5..dd6ef9a 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -9,6 +9,7 @@
#include "comp_perf_options.h"
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index c6246e5..1136f04 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -5,5 +5,6 @@ allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
'comp_perf_test_verify.c',
+ 'comp_perf_test_benchmark.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 5/6] doc: update dpdk-test-compress-perf description
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (3 preceding siblings ...)
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 4/6] app/test-compress-perf: add benchmark " Tomasz Jozwiak
@ 2019-07-01 11:26 ` Tomasz Jozwiak
2019-07-02 10:04 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 6/6] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-07-03 10:21 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Akhil Goyal
6 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-07-01 11:26 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch updates a dpdk-test-compress-perf documentation.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
doc/guides/tools/comp_perf.rst | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/doc/guides/tools/comp_perf.rst b/doc/guides/tools/comp_perf.rst
index 52869c1..71eef18 100644
--- a/doc/guides/tools/comp_perf.rst
+++ b/doc/guides/tools/comp_perf.rst
@@ -6,7 +6,9 @@ dpdk-test-compress-perf Tool
The ``dpdk-test-compress-perf`` tool is a Data Plane Development Kit (DPDK)
utility that allows measuring performance parameters of PMDs available in the
-compress tree. The tool reads the data from a file (--input-file),
+compress tree. User can use multiple cores to run tests on but only
+one type of compression PMD can be measured during single application
+execution. The tool reads the data from a file (--input-file),
dumps all the file into a buffer and fills out the data of input mbufs,
which are passed to compress device with compression operations.
Then, the output buffers are fed into the decompression stage, and the resulting
@@ -26,9 +28,35 @@ Limitations
* Stateful operation is not supported in this version.
+EAL Options
+~~~~~~~~~~~
+
+The following are the EAL command-line options that can be used in conjunction
+with the ``dpdk-test-compress-perf`` application.
+See the DPDK Getting Started Guides for more information on these options.
+
+* ``-c <COREMASK>`` or ``-l <CORELIST>``
+
+ Set the hexadecimal bitmask of the cores to run on. The corelist is a
+ list cores to use.
+
+.. Note::
+
+ One lcore is needed for process admin, tests are run on all other cores.
+ To run tests on two lcores, three lcores must be passed to the tool.
+
+* ``-w <PCI>``
+
+ Add a PCI device in white list.
+
+* ``--vdev <driver><id>``
+
+ Add a virtual device.
+
+Appication Options
+~~~~~~~~~~~~~~~~~~
-Command line options
---------------------
+ ``--ptest [benchmark/verify]``: set test type (default: benchmark)
``--driver-name NAME``: compress driver to use
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 6/6] app/test-compress-perf: add force process termination
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (4 preceding siblings ...)
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 5/6] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
@ 2019-07-01 11:26 ` Tomasz Jozwiak
2019-07-02 10:02 ` Trybula, ArturX
2019-07-03 10:21 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Akhil Goyal
6 siblings, 1 reply; 87+ messages in thread
From: Tomasz Jozwiak @ 2019-07-01 11:26 UTC (permalink / raw)
To: dev, fiona.trahe, tjozwiakgm, shallyv, arturx.trybula
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a possibility to force controlled process termination
as a result of two signals: SIGTERM and SIGINT
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
app/test-compress-perf/comp_perf_options.h | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 13 ++++++++++++
app/test-compress-perf/comp_perf_test_verify.c | 14 ++++++++++++
app/test-compress-perf/main.c | 26 +++++++++++++++++++++--
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0aa29a5..532fb96 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -67,6 +67,7 @@ struct comp_test_data {
double ratio;
enum cleanup_st cleanup;
+ int perf_comp_force_stop;
};
int
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index e0f852b..aa1f8ee 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -184,6 +184,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -242,6 +245,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -306,6 +312,13 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
return res;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 7be30ee..37ac38d 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -188,6 +188,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -268,6 +271,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -346,6 +352,14 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
+
return res;
}
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index dd6ef9a..e746e47 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -2,6 +2,10 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include <rte_malloc.h>
#include <rte_eal.h>
#include <rte_log.h>
@@ -36,6 +40,8 @@ static const struct cperf_test cperf_testmap[] = {
}
};
+static struct comp_test_data *test_data;
+
static int
comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
@@ -277,12 +283,24 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
+static void
+comp_perf_cleanup_on_signal(int signalNumber __rte_unused)
+{
+ test_data->perf_comp_force_stop = 1;
+}
+
+static void
+comp_perf_register_cleanup_on_signal(void)
+{
+ signal(SIGTERM, comp_perf_cleanup_on_signal);
+ signal(SIGINT, comp_perf_cleanup_on_signal);
+}
+
int
main(int argc, char **argv)
{
uint8_t level_idx = 0;
int ret, i;
- struct comp_test_data *test_data;
void *ctx[RTE_MAX_LCORE] = {};
uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
int nb_compressdevs = 0;
@@ -304,6 +322,8 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d\n",
rte_socket_id());
+ comp_perf_register_cleanup_on_signal();
+
ret = EXIT_SUCCESS;
test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
@@ -424,8 +444,10 @@ main(int argc, char **argv)
/* fallthrough */
case ST_COMPDEV:
for (i = 0; i < nb_compressdevs &&
- i < RTE_COMPRESS_MAX_DEVS; i++)
+ i < RTE_COMPRESS_MAX_DEVS; i++) {
rte_compressdev_stop(enabled_cdevs[i]);
+ rte_compressdev_close(enabled_cdevs[i]);
+ }
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
--
2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v5 6/6] app/test-compress-perf: add force process termination
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 6/6] app/test-compress-perf: add force process termination Tomasz Jozwiak
@ 2019-07-02 10:02 ` Trybula, ArturX
0 siblings, 0 replies; 87+ messages in thread
From: Trybula, ArturX @ 2019-07-02 10:02 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, Trahe, Fiona, shallyv
This patch adds a possibility to force controlled process termination as a result of two signals: SIGTERM and SIGINT
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula < arturx.trybula@intel.com>
---
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v5 4/6] app/test-compress-perf: add benchmark test case
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 4/6] app/test-compress-perf: add benchmark " Tomasz Jozwiak
@ 2019-07-02 10:02 ` Trybula, ArturX
0 siblings, 0 replies; 87+ messages in thread
From: Trybula, ArturX @ 2019-07-02 10:02 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, Trahe, Fiona, shallyv
This patch adds a benchmark part to
compression-perf-tool as a separate test case, which can be executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula < arturx.trybula@intel.com>
---
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v5 3/6] app/test-compress-perf: add verification test case
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 3/6] app/test-compress-perf: add verification test case Tomasz Jozwiak
@ 2019-07-02 10:02 ` Trybula, ArturX
0 siblings, 0 replies; 87+ messages in thread
From: Trybula, ArturX @ 2019-07-02 10:02 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, Trahe, Fiona, shallyv
This patch adds a verification part to
compression-perf-tool as a separate test case, which can be executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula < arturx.trybula@intel.com>
---
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v5 1/6] app/test-compress-perf: add weak functions for multi-cores test
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
@ 2019-07-02 10:03 ` Trybula, ArturX
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
1 sibling, 0 replies; 87+ messages in thread
From: Trybula, ArturX @ 2019-07-02 10:03 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, Trahe, Fiona, shallyv
This patch adds a template functions for multi-cores performance version of compress-perf-tool and updates release notes for 19.08
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula < arturx.trybula@intel.com>
---
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v5 5/6] doc: update dpdk-test-compress-perf description
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 5/6] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
@ 2019-07-02 10:04 ` Trybula, ArturX
0 siblings, 0 replies; 87+ messages in thread
From: Trybula, ArturX @ 2019-07-02 10:04 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, Trahe, Fiona, shallyv
This patch updates a dpdk-test-compress-perf documentation.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula < arturx.trybula@intel.com>
---
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v5 2/6] app/test-compress-perf: add ptest command line option
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 2/6] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
@ 2019-07-02 10:05 ` Trybula, ArturX
0 siblings, 0 replies; 87+ messages in thread
From: Trybula, ArturX @ 2019-07-02 10:05 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, Trahe, Fiona, shallyv
This patch adds --ptest option to make possible a choose of test case from command line.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula < arturx.trybula@intel.com>
---
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
` (5 preceding siblings ...)
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 6/6] app/test-compress-perf: add force process termination Tomasz Jozwiak
@ 2019-07-03 10:21 ` Akhil Goyal
2019-07-03 12:20 ` Tomasz Jóźwiak
6 siblings, 1 reply; 87+ messages in thread
From: Akhil Goyal @ 2019-07-03 10:21 UTC (permalink / raw)
To: Tomasz Jozwiak, dev, fiona.trahe, shallyv, arturx.trybula
Hi Tomasz,
This series need a rebase.
Thanks,
Akhil
>
> This patchset adds multiple cores feature to compression perf tool.
> All structures have been aligned and are consistent
> with crypto perf tool. All test cases have constructor, runner
> and destructor and can use more cores and compression devices at
> the same time.
>
> v2 changes:
>
> - fixed checkpatch warning
> - fixed max_nb_queue_pairs detection. Based on compression API
> if max_nb_queue_pairs = 0 that means there is no limit in
> maximum number of queue pairs
> - fixed qp setup on the last device
>
> v3 changes:
>
> - merged with commit 767350e7ede791932cc050bf2a192f6527b70c15
> app/compress-perf: add prints for socket id
>
> - fixed wrong compression/decompression throughput calculation
>
> v4 changes:
>
> - moved release notes update to patch 1
> - removed pmd cyclecount template
>
> v5 changes:
>
> - changed ctx null ptr detection inside constructors
>
> Tomasz Jozwiak (6):
> app/test-compress-perf: add weak functions for multi-cores test
> app/test-compress-perf: add ptest command line option
> app/test-compress-perf: add verification test case
> app/test-compress-perf: add benchmark test case
> doc: update dpdk-test-compress-perf description
> app/test-compress-perf: add force process termination
>
> app/test-compress-perf/Makefile | 1 +
> app/test-compress-perf/comp_perf.h | 50 ++
> app/test-compress-perf/comp_perf_options.h | 45 +-
> app/test-compress-perf/comp_perf_options_parse.c | 54 +-
> app/test-compress-perf/comp_perf_test_benchmark.c | 153 ++++--
> app/test-compress-perf/comp_perf_test_benchmark.h | 25 +-
> app/test-compress-perf/comp_perf_test_common.c | 284 ++++++++++
> app/test-compress-perf/comp_perf_test_common.h | 41 ++
> app/test-compress-perf/comp_perf_test_verify.c | 137 +++--
> app/test-compress-perf/comp_perf_test_verify.h | 24 +-
> app/test-compress-perf/main.c | 605 +++++++++-------------
> app/test-compress-perf/meson.build | 3 +-
> doc/guides/rel_notes/release_19_08.rst | 3 +
> doc/guides/tools/comp_perf.rst | 34 +-
> 14 files changed, 992 insertions(+), 467 deletions(-)
> create mode 100644 app/test-compress-perf/comp_perf.h
> create mode 100644 app/test-compress-perf/comp_perf_test_common.c
> create mode 100644 app/test-compress-perf/comp_perf_test_common.h
>
> --
> 2.7.4
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf
2019-07-03 10:21 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Akhil Goyal
@ 2019-07-03 12:20 ` Tomasz Jóźwiak
0 siblings, 0 replies; 87+ messages in thread
From: Tomasz Jóźwiak @ 2019-07-03 12:20 UTC (permalink / raw)
To: Akhil Goyal; +Cc: dev, Trahe, Fiona, shallyv, arturx.trybula
Hi Akhil,
Was rebased on Monday. Too dynamic head :) , will do Today and add you in
Cc.
Thx, Tomek
śr., 3.07.2019, 12:21 użytkownik Akhil Goyal <akhil.goyal@nxp.com> napisał:
> Hi Tomasz,
>
> This series need a rebase.
>
> Thanks,
> Akhil
>
> >
> > This patchset adds multiple cores feature to compression perf tool.
> > All structures have been aligned and are consistent
> > with crypto perf tool. All test cases have constructor, runner
> > and destructor and can use more cores and compression devices at
> > the same time.
> >
> > v2 changes:
> >
> > - fixed checkpatch warning
> > - fixed max_nb_queue_pairs detection. Based on compression API
> > if max_nb_queue_pairs = 0 that means there is no limit in
> > maximum number of queue pairs
> > - fixed qp setup on the last device
> >
> > v3 changes:
> >
> > - merged with commit 767350e7ede791932cc050bf2a192f6527b70c15
> > app/compress-perf: add prints for socket id
> >
> > - fixed wrong compression/decompression throughput calculation
> >
> > v4 changes:
> >
> > - moved release notes update to patch 1
> > - removed pmd cyclecount template
> >
> > v5 changes:
> >
> > - changed ctx null ptr detection inside constructors
> >
> > Tomasz Jozwiak (6):
> > app/test-compress-perf: add weak functions for multi-cores test
> > app/test-compress-perf: add ptest command line option
> > app/test-compress-perf: add verification test case
> > app/test-compress-perf: add benchmark test case
> > doc: update dpdk-test-compress-perf description
> > app/test-compress-perf: add force process termination
> >
> > app/test-compress-perf/Makefile | 1 +
> > app/test-compress-perf/comp_perf.h | 50 ++
> > app/test-compress-perf/comp_perf_options.h | 45 +-
> > app/test-compress-perf/comp_perf_options_parse.c | 54 +-
> > app/test-compress-perf/comp_perf_test_benchmark.c | 153 ++++--
> > app/test-compress-perf/comp_perf_test_benchmark.h | 25 +-
> > app/test-compress-perf/comp_perf_test_common.c | 284 ++++++++++
> > app/test-compress-perf/comp_perf_test_common.h | 41 ++
> > app/test-compress-perf/comp_perf_test_verify.c | 137 +++--
> > app/test-compress-perf/comp_perf_test_verify.h | 24 +-
> > app/test-compress-perf/main.c | 605
> +++++++++-------------
> > app/test-compress-perf/meson.build | 3 +-
> > doc/guides/rel_notes/release_19_08.rst | 3 +
> > doc/guides/tools/comp_perf.rst | 34 +-
> > 14 files changed, 992 insertions(+), 467 deletions(-)
> > create mode 100644 app/test-compress-perf/comp_perf.h
> > create mode 100644 app/test-compress-perf/comp_perf_test_common.c
> > create mode 100644 app/test-compress-perf/comp_perf_test_common.h
> >
> > --
> > 2.7.4
>
>
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-07-02 10:03 ` Trybula, ArturX
@ 2019-07-03 15:24 ` Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 1/6] app/test-compress-perf: add weak functions for multi-cores test Artur Trybula
` (13 more replies)
1 sibling, 14 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-03 15:24 UTC (permalink / raw)
To: dev, fiona.trahe, akhil.goyal, adamx.dybkowski, arturx.trybula,
tjozwiakgm
This patchset adds multiple cores feature to compression perf tool.
All structures have been aligned and are consistent with crypto perf tool.
All test cases have constructor, runner and destructor and can use more
cores and compression devices at the same time.
v2 changes:
- fixed checkpatch warning
- fixed max_nb_queue_pairs detection. Based on compression API
if max_nb_queue_pairs = 0 that means there is no limit in
maximum number of queue pairs
- fixed qp setup on the last device
v3 changes:
- merged with commit 2f6527b70c15
app/compress-perf: add prints for socket id
- fixed wrong compression/decompression throughput calculation
v4 changes:
- moved release notes update to patch 1
- removed pmd cyclecount template
v5 changes:
- changed ctx null ptr detection inside constructors
v6 changes:
- rebase to the recent master (before applying)
commit 82b9677cb23c
Tomasz Jozwiak (6):
app/test-compress-perf: add weak functions for multi-cores test
app/test-compress-perf: add ptest command line option
app/test-compress-perf: add verification test case
app/test-compress-perf: add benchmark test case
doc: update dpdk-test-compress-perf description
app/test-compress-perf: add force process termination
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf.h | 50 ++
app/test-compress-perf/comp_perf_options.h | 45 +-
.../comp_perf_options_parse.c | 54 +-
.../comp_perf_test_benchmark.c | 153 +++--
.../comp_perf_test_benchmark.h | 25 +-
.../comp_perf_test_common.c | 284 ++++++++
.../comp_perf_test_common.h | 41 ++
.../comp_perf_test_verify.c | 137 +++-
.../comp_perf_test_verify.h | 24 +-
app/test-compress-perf/main.c | 605 +++++++-----------
app/test-compress-perf/meson.build | 3 +-
doc/guides/rel_notes/release_19_08.rst | 4 +
doc/guides/tools/comp_perf.rst | 34 +-
14 files changed, 993 insertions(+), 467 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v6 1/6] app/test-compress-perf: add weak functions for multi-cores test
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
@ 2019-07-03 15:24 ` Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 2/6] app/test-compress-perf: add ptest command line option Artur Trybula
` (12 subsequent siblings)
13 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-03 15:24 UTC (permalink / raw)
To: dev, fiona.trahe, akhil.goyal, adamx.dybkowski, arturx.trybula,
tjozwiakgm
Cc: Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a template functions for multi-cores performance
version of compress-perf-tool and updates release notes for 19.08
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/Makefile | 3 +-
app/test-compress-perf/comp_perf.h | 50 ++
app/test-compress-perf/comp_perf_options.h | 44 +-
.../comp_perf_options_parse.c | 24 +-
.../comp_perf_test_common.c | 284 +++++++++
.../comp_perf_test_common.h | 41 ++
app/test-compress-perf/main.c | 599 +++++++-----------
app/test-compress-perf/meson.build | 3 +-
doc/guides/rel_notes/release_19_08.rst | 4 +
9 files changed, 650 insertions(+), 402 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index d20e17e47..de7412961 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,7 +12,6 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
-SRCS-y += comp_perf_test_verify.c
-SRCS-y += comp_perf_test_benchmark.c
+SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf.h b/app/test-compress-perf/comp_perf.h
new file mode 100644
index 000000000..57289b07a
--- /dev/null
+++ b/app/test-compress-perf/comp_perf.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_
+#define _COMP_PERF_
+
+#include <rte_mempool.h>
+
+struct comp_test_data;
+
+typedef void *(*cperf_constructor_t)(
+ uint8_t dev_id,
+ uint16_t qp_id,
+ struct comp_test_data *options);
+
+typedef int (*cperf_runner_t)(void *test_ctx);
+typedef void (*cperf_destructor_t)(void *test_ctx);
+
+struct cperf_test {
+ cperf_constructor_t constructor;
+ cperf_runner_t runner;
+ cperf_destructor_t destructor;
+};
+
+/* Needed for weak functions*/
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_benchmark_test_destructor(void *arg __rte_unused);
+
+int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_verify_test_destructor(void *arg __rte_unused);
+
+int
+cperf_verify_test_runner(void *test_ctx __rte_unused);
+
+#endif /* _COMP_PERF_ */
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index f87751d87..0aa29a599 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -13,6 +13,23 @@
#define MAX_MBUF_DATA_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM)
#define MAX_SEG_SIZE ((int)(MAX_MBUF_DATA_SIZE / EXPANSE_RATIO))
+extern const char *cperf_test_type_strs[];
+
+/* Cleanup state machine */
+enum cleanup_st {
+ ST_CLEAR = 0,
+ ST_TEST_DATA,
+ ST_COMPDEV,
+ ST_INPUT_DATA,
+ ST_MEMORY_ALLOC,
+ ST_DURING_TEST
+};
+
+enum cperf_perf_test_type {
+ CPERF_TEST_TYPE_BENCHMARK,
+ CPERF_TEST_TYPE_VERIFY
+};
+
enum comp_operation {
COMPRESS_ONLY,
DECOMPRESS_ONLY,
@@ -30,37 +47,26 @@ struct range_list {
struct comp_test_data {
char driver_name[64];
char input_file[64];
- struct rte_mbuf **comp_bufs;
- struct rte_mbuf **decomp_bufs;
- uint32_t total_bufs;
+ enum cperf_perf_test_type test;
+
uint8_t *input_data;
size_t input_data_sz;
- uint8_t *compressed_data;
- uint8_t *decompressed_data;
- struct rte_mempool *comp_buf_pool;
- struct rte_mempool *decomp_buf_pool;
- struct rte_mempool *op_pool;
- int8_t cdev_id;
+ uint16_t nb_qps;
uint16_t seg_sz;
uint16_t out_seg_sz;
uint16_t burst_sz;
uint32_t pool_sz;
uint32_t num_iter;
uint16_t max_sgl_segs;
+
enum rte_comp_huffman huffman_enc;
enum comp_operation test_op;
int window_sz;
- struct range_list level;
- /* Store TSC duration for all levels (including level 0) */
- uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- size_t comp_data_sz;
- size_t decomp_data_sz;
+ struct range_list level_lst;
+ uint8_t level;
+
double ratio;
- double comp_gbps;
- double decomp_gbps;
- double comp_tsc_byte;
- double decomp_tsc_byte;
+ enum cleanup_st cleanup;
};
int
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index a7a8c1f9e..74ea81d09 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -468,19 +468,20 @@ parse_level(struct comp_test_data *test_data, const char *arg)
* Try parsing the argument as a range, if it fails,
* arse it as a list
*/
- if (parse_range(arg, &test_data->level.min, &test_data->level.max,
- &test_data->level.inc) < 0) {
- ret = parse_list(arg, test_data->level.list,
- &test_data->level.min,
- &test_data->level.max);
+ if (parse_range(arg, &test_data->level_lst.min,
+ &test_data->level_lst.max,
+ &test_data->level_lst.inc) < 0) {
+ ret = parse_list(arg, test_data->level_lst.list,
+ &test_data->level_lst.min,
+ &test_data->level_lst.max);
if (ret < 0) {
RTE_LOG(ERR, USER1,
"Failed to parse compression level/s\n");
return -1;
}
- test_data->level.count = ret;
+ test_data->level_lst.count = ret;
- if (test_data->level.max > RTE_COMP_LEVEL_MAX) {
+ if (test_data->level_lst.max > RTE_COMP_LEVEL_MAX) {
RTE_LOG(ERR, USER1, "Level cannot be higher than %u\n",
RTE_COMP_LEVEL_MAX);
return -1;
@@ -500,7 +501,6 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
-
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -574,7 +574,6 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv)
void
comp_perf_options_default(struct comp_test_data *test_data)
{
- test_data->cdev_id = -1;
test_data->seg_sz = 2048;
test_data->burst_sz = 32;
test_data->pool_sz = 8192;
@@ -583,9 +582,10 @@ comp_perf_options_default(struct comp_test_data *test_data)
test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
test_data->test_op = COMPRESS_DECOMPRESS;
test_data->window_sz = -1;
- test_data->level.min = 1;
- test_data->level.max = 9;
- test_data->level.inc = 1;
+ test_data->level_lst.min = 1;
+ test_data->level_lst.max = 9;
+ test_data->level_lst.inc = 1;
+ test_data->test = CPERF_TEST_TYPE_BENCHMARK;
}
int
diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
new file mode 100644
index 000000000..dc9d0b0f4
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -0,0 +1,284 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_malloc.h>
+#include <rte_eal.h>
+#include <rte_log.h>
+#include <rte_compressdev.h>
+
+#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
+
+#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range)
+{
+ unsigned int next_size;
+
+ /* Check lower/upper bounds */
+ if (size < range->min)
+ return -1;
+
+ if (size > range->max)
+ return -1;
+
+ /* If range is actually only one value, size is correct */
+ if (range->increment == 0)
+ return 0;
+
+ /* Check if value is one of the supported sizes */
+ for (next_size = range->min; next_size <= range->max;
+ next_size += range->increment)
+ if (size == next_size)
+ return 0;
+
+ return -1;
+}
+
+static uint32_t
+find_buf_size(uint32_t input_size)
+{
+ uint32_t i;
+
+ /* From performance point of view the buffer size should be a
+ * power of 2 but also should be enough to store incompressible data
+ */
+
+ /* We're looking for nearest power of 2 buffer size, which is greather
+ * than input_size
+ */
+ uint32_t size =
+ !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
+
+ for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
+ ;
+
+ return i > ((UINT16_MAX + 1) >> 1)
+ ? (uint32_t)((float)input_size * EXPANSE_RATIO)
+ : i;
+}
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem)
+{
+ uint32_t i;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ rte_pktmbuf_free(mem->comp_bufs[i]);
+ rte_pktmbuf_free(mem->decomp_bufs[i]);
+ }
+
+ rte_free(mem->decomp_bufs);
+ rte_free(mem->comp_bufs);
+ rte_free(mem->decompressed_data);
+ rte_free(mem->compressed_data);
+ rte_mempool_free(mem->op_pool);
+ rte_mempool_free(mem->decomp_buf_pool);
+ rte_mempool_free(mem->comp_buf_pool);
+}
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem)
+{
+ test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
+ /* Number of segments for input and output
+ * (compression and decompression)
+ */
+ uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
+ test_data->seg_sz);
+ char pool_name[32] = "";
+
+ snprintf(pool_name, sizeof(pool_name), "comp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->comp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0,
+ test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->comp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ snprintf(pool_name, sizeof(pool_name), "decomp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->decomp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->decomp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ mem->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+
+ snprintf(pool_name, sizeof(pool_name), "op_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->op_pool = rte_comp_op_pool_create(pool_name,
+ mem->total_bufs,
+ 0, 0, rte_socket_id());
+ if (mem->op_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
+ return -1;
+ }
+
+ /*
+ * Compressed data might be a bit larger than input data,
+ * if data cannot be compressed
+ */
+ mem->compressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz * EXPANSE_RATIO
+ + MIN_COMPRESSED_BUF_SIZE, 0,
+ rte_socket_id());
+ if (mem->compressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->decompressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz, 0,
+ rte_socket_id());
+ if (mem->decompressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->comp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->comp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+
+ mem->decomp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->decomp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+ return 0;
+}
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
+{
+ uint32_t remaining_data = test_data->input_data_sz;
+ uint8_t *input_data_ptr = test_data->input_data;
+ size_t data_sz;
+ uint8_t *data_addr;
+ uint32_t i, j;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ /* Allocate data in input mbuf and copy data from input file */
+ mem->decomp_bufs[i] =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+ if (mem->decomp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->decomp_bufs[i], data_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ /* Already one segment in the mbuf */
+ uint16_t segs_per_mbuf = 1;
+
+ /* Chain mbufs if needed for input mbufs */
+ while (segs_per_mbuf < test_data->max_sgl_segs
+ && remaining_data > 0) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ data_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ if (rte_pktmbuf_chain(mem->decomp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ segs_per_mbuf++;
+ }
+
+ /* Allocate data in output mbuf */
+ mem->comp_bufs[i] =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+ if (mem->comp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->comp_bufs[i],
+ test_data->out_seg_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ /* Chain mbufs if needed for output mbufs */
+ for (j = 1; j < segs_per_mbuf; j++) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ test_data->out_seg_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ if (rte_pktmbuf_chain(mem->comp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test-compress-perf/comp_perf_test_common.h
new file mode 100644
index 000000000..9c11e3a00
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_TEST_COMMON_H_
+#define _COMP_PERF_TEST_COMMON_H_
+
+#include <stdint.h>
+
+#include <rte_mempool.h>
+
+struct cperf_mem_resources {
+ uint8_t dev_id;
+ uint16_t qp_id;
+ uint8_t lcore_id;
+ uint32_t total_bufs;
+ uint8_t *compressed_data;
+ uint8_t *decompressed_data;
+
+ struct rte_mbuf **comp_bufs;
+ struct rte_mbuf **decomp_bufs;
+
+ struct rte_mempool *comp_buf_pool;
+ struct rte_mempool *decomp_buf_pool;
+ struct rte_mempool *op_pool;
+};
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range);
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem);
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem);
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem);
+
+#endif /* _COMP_PERF_TEST_COMMON_H_ */
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 7b9ee7420..3a3da4c90 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,56 +8,38 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
-#include "comp_perf_test_verify.h"
-#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
#define NUM_MAX_XFORMS 16
#define NUM_MAX_INFLIGHT_OPS 512
-#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
-
-/* Cleanup state machine */
-static enum cleanup_st {
- ST_CLEAR = 0,
- ST_TEST_DATA,
- ST_COMPDEV,
- ST_INPUT_DATA,
- ST_MEMORY_ALLOC,
- ST_PREPARE_BUF,
- ST_DURING_TEST
-} cleanup = ST_CLEAR;
-
-static int
-param_range_check(uint16_t size, const struct rte_param_log2_range *range)
-{
- unsigned int next_size;
-
- /* Check lower/upper bounds */
- if (size < range->min)
- return -1;
-
- if (size > range->max)
- return -1;
-
- /* If range is actually only one value, size is correct */
- if (range->increment == 0)
- return 0;
-
- /* Check if value is one of the supported sizes */
- for (next_size = range->min; next_size <= range->max;
- next_size += range->increment)
- if (size == next_size)
- return 0;
-
- return -1;
-}
+__extension__
+const char *cperf_test_type_strs[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = "benchmark",
+ [CPERF_TEST_TYPE_VERIFY] = "verify"
+};
+
+__extension__
+static const struct cperf_test cperf_testmap[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = {
+ cperf_benchmark_test_constructor,
+ cperf_benchmark_test_runner,
+ cperf_benchmark_test_destructor
+ },
+ [CPERF_TEST_TYPE_VERIFY] = {
+ cperf_verify_test_constructor,
+ cperf_verify_test_runner,
+ cperf_verify_test_destructor
+ }
+};
static int
-comp_perf_check_capabilities(struct comp_test_data *test_data)
+comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
const struct rte_compressdev_capabilities *cap;
- cap = rte_compressdev_capability_get(test_data->cdev_id,
+ cap = rte_compressdev_capability_get(cdev_id,
RTE_COMP_ALGO_DEFLATE);
if (cap == NULL) {
@@ -105,7 +87,7 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
}
/* Level 0 support */
- if (test_data->level.min == 0 &&
+ if (test_data->level_lst.min == 0 &&
(comp_flags & RTE_COMP_FF_NONCOMPRESSED_BLOCKS) == 0) {
RTE_LOG(ERR, USER1, "Compress device does not support "
"level 0 (no compression)\n");
@@ -115,110 +97,108 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
return 0;
}
-static uint32_t
-find_buf_size(uint32_t input_size)
+static int
+comp_perf_initialize_compressdev(struct comp_test_data *test_data,
+ uint8_t *enabled_cdevs)
{
- uint32_t i;
+ uint8_t enabled_cdev_count, nb_lcores, cdev_id;
+ unsigned int i, j;
+ int ret;
- /* From performance point of view the buffer size should be a
- * power of 2 but also should be enough to store incompressible data
- */
+ enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
+ enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
+ if (enabled_cdev_count == 0) {
+ RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
+ test_data->driver_name);
+ return -EINVAL;
+ }
- /* We're looking for nearest power of 2 buffer size, which is greather
- * than input_size
+ nb_lcores = rte_lcore_count() - 1;
+ /*
+ * Use fewer devices,
+ * if there are more available than cores.
*/
- uint32_t size =
- !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
-
- for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
- ;
-
- return i > ((UINT16_MAX + 1) >> 1)
- ? (uint32_t)((float)input_size * EXPANSE_RATIO)
- : i;
-}
-
-static int
-comp_perf_allocate_memory(struct comp_test_data *test_data)
-{
+ if (enabled_cdev_count > nb_lcores) {
+ enabled_cdev_count = nb_lcores;
+ RTE_LOG(INFO, USER1,
+ " There's more available devices than cores!"
+ " The number of devices has been aligned to %d cores\n",
+ nb_lcores);
+ }
- test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
- /* Number of segments for input and output
- * (compression and decompression)
+ /*
+ * Calculate number of needed queue pairs, based on the amount
+ * of available number of logical cores and compression devices.
+ * For instance, if there are 4 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device.
+ * One queue pair per one core.
+ * if e.g.: there're 3 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device but one queue pair
+ * will left unused in the last one device
*/
- uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
- test_data->seg_sz);
- test_data->comp_buf_pool = rte_pktmbuf_pool_create("comp_buf_pool",
- total_segs,
- 0, 0,
- test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->comp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ test_data->nb_qps = (nb_lcores % enabled_cdev_count) ?
+ (nb_lcores / enabled_cdev_count) + 1 :
+ nb_lcores / enabled_cdev_count;
- cleanup = ST_MEMORY_ALLOC;
- test_data->decomp_buf_pool = rte_pktmbuf_pool_create("decomp_buf_pool",
- total_segs,
- 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->decomp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ for (i = 0; i < enabled_cdev_count &&
+ i < RTE_COMPRESS_MAX_DEVS; i++,
+ nb_lcores -= test_data->nb_qps) {
+ cdev_id = enabled_cdevs[i];
- test_data->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+ struct rte_compressdev_info cdev_info;
+ uint8_t socket_id = rte_compressdev_socket_id(cdev_id);
- test_data->op_pool = rte_comp_op_pool_create("op_pool",
- test_data->total_bufs,
- 0, 0, rte_socket_id());
- if (test_data->op_pool == NULL) {
- RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
- return -1;
- }
+ rte_compressdev_info_get(cdev_id, &cdev_info);
+ if (cdev_info.max_nb_queue_pairs &&
+ test_data->nb_qps > cdev_info.max_nb_queue_pairs) {
+ RTE_LOG(ERR, USER1,
+ "Number of needed queue pairs is higher "
+ "than the maximum number of queue pairs "
+ "per device.\n");
+ RTE_LOG(ERR, USER1,
+ "Lower the number of cores or increase "
+ "the number of crypto devices\n");
+ return -EINVAL;
+ }
- /*
- * Compressed data might be a bit larger than input data,
- * if data cannot be compressed
- */
- test_data->compressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz * EXPANSE_RATIO
- + MIN_COMPRESSED_BUF_SIZE, 0,
- rte_socket_id());
- if (test_data->compressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ if (comp_perf_check_capabilities(test_data, cdev_id) < 0)
+ return -EINVAL;
+
+ /* Configure compressdev */
+ struct rte_compressdev_config config = {
+ .socket_id = socket_id,
+ .nb_queue_pairs = nb_lcores > test_data->nb_qps
+ ? test_data->nb_qps : nb_lcores,
+ .max_nb_priv_xforms = NUM_MAX_XFORMS,
+ .max_nb_streams = 0
+ };
+
+ if (rte_compressdev_configure(cdev_id, &config) < 0) {
+ RTE_LOG(ERR, USER1, "Device configuration failed\n");
+ return -EINVAL;
+ }
- test_data->decompressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz, 0,
- rte_socket_id());
- if (test_data->decompressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ for (j = 0; j < test_data->nb_qps; j++) {
+ ret = rte_compressdev_queue_pair_setup(cdev_id, j,
+ NUM_MAX_INFLIGHT_OPS, socket_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to setup queue pair %u on compressdev %u",
+ j, cdev_id);
+ return -EINVAL;
+ }
+ }
- test_data->comp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->comp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
- " could not be allocated\n");
- return -1;
+ ret = rte_compressdev_start(cdev_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to start device %u: error %d\n",
+ cdev_id, ret);
+ return -EPERM;
+ }
}
- test_data->decomp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->decomp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
- " could not be allocated\n");
- return -1;
- }
- return 0;
+ return enabled_cdev_count;
}
static int
@@ -295,187 +275,18 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
-static int
-comp_perf_initialize_compressdev(struct comp_test_data *test_data)
-{
- uint8_t enabled_cdev_count;
- uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
-
- enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
- enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
- if (enabled_cdev_count == 0) {
- RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
- test_data->driver_name);
- return -EINVAL;
- }
-
- if (enabled_cdev_count > 1)
- RTE_LOG(INFO, USER1,
- "Only the first compress device will be used\n");
-
- test_data->cdev_id = enabled_cdevs[0];
-
- if (comp_perf_check_capabilities(test_data) < 0)
- return -1;
-
- /* Configure compressdev (one device, one queue pair) */
- struct rte_compressdev_config config = {
- .socket_id = rte_socket_id(),
- .nb_queue_pairs = 1,
- .max_nb_priv_xforms = NUM_MAX_XFORMS,
- .max_nb_streams = 0
- };
-
- if (rte_compressdev_configure(test_data->cdev_id, &config) < 0) {
- RTE_LOG(ERR, USER1, "Device configuration failed\n");
- return -1;
- }
-
- if (rte_compressdev_queue_pair_setup(test_data->cdev_id, 0,
- NUM_MAX_INFLIGHT_OPS, rte_socket_id()) < 0) {
- RTE_LOG(ERR, USER1, "Queue pair setup failed\n");
- return -1;
- }
-
- if (rte_compressdev_start(test_data->cdev_id) < 0) {
- RTE_LOG(ERR, USER1, "Device could not be started\n");
- return -1;
- }
-
- return 0;
-}
-
-static int
-prepare_bufs(struct comp_test_data *test_data)
-{
- uint32_t remaining_data = test_data->input_data_sz;
- uint8_t *input_data_ptr = test_data->input_data;
- size_t data_sz;
- uint8_t *data_addr;
- uint32_t i, j;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- /* Allocate data in input mbuf and copy data from input file */
- test_data->decomp_bufs[i] =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
- if (test_data->decomp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
-
- cleanup = ST_PREPARE_BUF;
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->decomp_bufs[i], data_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
- rte_memcpy(data_addr, input_data_ptr, data_sz);
-
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- /* Already one segment in the mbuf */
- uint16_t segs_per_mbuf = 1;
-
- /* Chain mbufs if needed for input mbufs */
- while (segs_per_mbuf < test_data->max_sgl_segs
- && remaining_data > 0) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- data_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- rte_memcpy(data_addr, input_data_ptr, data_sz);
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- if (rte_pktmbuf_chain(test_data->decomp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- segs_per_mbuf++;
- }
-
- /* Allocate data in output mbuf */
- test_data->comp_bufs[i] =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
- if (test_data->comp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->comp_bufs[i],
- test_data->out_seg_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- /* Chain mbufs if needed for output mbufs */
- for (j = 1; j < segs_per_mbuf; j++) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- test_data->out_seg_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- if (rte_pktmbuf_chain(test_data->comp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- }
- }
-
- return 0;
-}
-
-static void
-free_bufs(struct comp_test_data *test_data)
-{
- uint32_t i;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- rte_pktmbuf_free(test_data->comp_bufs[i]);
- rte_pktmbuf_free(test_data->decomp_bufs[i]);
- }
-}
-
-
-
int
main(int argc, char **argv)
{
- uint8_t level, level_idx = 0;
+ uint8_t level_idx = 0;
int ret, i;
struct comp_test_data *test_data;
+ void *ctx[RTE_MAX_LCORE] = {};
+ uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
+ int nb_compressdevs = 0;
+ uint16_t total_nb_qps = 0;
+ uint8_t cdev_id;
+ uint32_t lcore_id;
/* Initialise DPDK EAL */
ret = rte_eal_init(argc, argv);
@@ -492,7 +303,7 @@ main(int argc, char **argv)
rte_socket_id());
ret = EXIT_SUCCESS;
- cleanup = ST_TEST_DATA;
+ test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
if (comp_perf_options_parse(test_data, argc, argv) < 0) {
@@ -507,99 +318,112 @@ main(int argc, char **argv)
goto end;
}
- if (comp_perf_initialize_compressdev(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ nb_compressdevs =
+ comp_perf_initialize_compressdev(test_data, enabled_cdevs);
- cleanup = ST_COMPDEV;
- if (comp_perf_dump_input_data(test_data) < 0) {
+ if (nb_compressdevs < 1) {
ret = EXIT_FAILURE;
goto end;
}
- cleanup = ST_INPUT_DATA;
- if (comp_perf_allocate_memory(test_data) < 0) {
+ test_data->cleanup = ST_COMPDEV;
+ if (comp_perf_dump_input_data(test_data) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (prepare_bufs(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ test_data->cleanup = ST_INPUT_DATA;
- if (test_data->level.inc != 0)
- level = test_data->level.min;
+ if (test_data->level_lst.inc != 0)
+ test_data->level = test_data->level_lst.min;
else
- level = test_data->level.list[0];
+ test_data->level = test_data->level_lst.list[0];
printf("App uses socket: %u\n", rte_socket_id());
- printf("Driver uses socket: %u\n",
- rte_compressdev_socket_id(test_data->cdev_id));
printf("Burst size = %u\n", test_data->burst_sz);
printf("File size = %zu\n", test_data->input_data_sz);
- printf("%6s%12s%17s%19s%21s%15s%21s%23s%16s\n",
- "Level", "Comp size", "Comp ratio [%]",
- "Comp [Cycles/it]", "Comp [Cycles/Byte]", "Comp [Gbps]",
- "Decomp [Cycles/it]", "Decomp [Cycles/Byte]", "Decomp [Gbps]");
+ test_data->cleanup = ST_DURING_TEST;
+ total_nb_qps = nb_compressdevs * test_data->nb_qps;
- cleanup = ST_DURING_TEST;
- while (level <= test_data->level.max) {
+ i = 0;
+ uint8_t qp_id = 0, cdev_index = 0;
- /*
- * Run a first iteration, to verify compression and
- * get the compression ratio for the level
- */
- if (cperf_verification(test_data, level) != EXIT_SUCCESS)
- break;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
- /*
- * Run benchmarking test
- */
- if (cperf_benchmark(test_data, level) != EXIT_SUCCESS)
+ if (i == total_nb_qps)
break;
- printf("%6u%12zu%17.2f%19"PRIu64"%21.2f"
- "%15.2f%21"PRIu64"%23.2f%16.2f\n",
- level, test_data->comp_data_sz, test_data->ratio,
- test_data->comp_tsc_duration[level],
- test_data->comp_tsc_byte, test_data->comp_gbps,
- test_data->decomp_tsc_duration[level],
- test_data->decomp_tsc_byte, test_data->decomp_gbps);
+ cdev_id = enabled_cdevs[cdev_index];
+ ctx[i] = cperf_testmap[test_data->test].constructor(
+ cdev_id, qp_id,
+ test_data);
+ if (ctx[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Test run constructor failed\n");
+ goto end;
+ }
+ qp_id = (qp_id + 1) % test_data->nb_qps;
+ if (qp_id == 0)
+ cdev_index++;
+ i++;
+ }
+
+ while (test_data->level <= test_data->level_lst.max) {
- if (test_data->level.inc != 0)
- level += test_data->level.inc;
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+
+ rte_eal_remote_launch(
+ cperf_testmap[test_data->test].runner,
+ ctx[i], lcore_id);
+ i++;
+ }
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+ ret |= rte_eal_wait_lcore(lcore_id);
+ i++;
+ }
+
+ if (ret != EXIT_SUCCESS)
+ break;
+
+ if (test_data->level_lst.inc != 0)
+ test_data->level += test_data->level_lst.inc;
else {
- if (++level_idx == test_data->level.count)
+ if (++level_idx == test_data->level_lst.count)
break;
- level = test_data->level.list[level_idx];
+ test_data->level = test_data->level_lst.list[level_idx];
}
}
end:
- switch (cleanup) {
+ switch (test_data->cleanup) {
case ST_DURING_TEST:
- case ST_PREPARE_BUF:
- free_bufs(test_data);
- /* fallthrough */
- case ST_MEMORY_ALLOC:
- rte_free(test_data->decomp_bufs);
- rte_free(test_data->comp_bufs);
- rte_free(test_data->decompressed_data);
- rte_free(test_data->compressed_data);
- rte_mempool_free(test_data->op_pool);
- rte_mempool_free(test_data->decomp_buf_pool);
- rte_mempool_free(test_data->comp_buf_pool);
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (i == total_nb_qps)
+ break;
+
+ if (ctx[i] && cperf_testmap[test_data->test].destructor)
+ cperf_testmap[test_data->test].destructor(
+ ctx[i]);
+ i++;
+ }
/* fallthrough */
case ST_INPUT_DATA:
rte_free(test_data->input_data);
/* fallthrough */
case ST_COMPDEV:
- if (test_data->cdev_id != -1)
- rte_compressdev_stop(test_data->cdev_id);
+ for (i = 0; i < nb_compressdevs &&
+ i < RTE_COMPRESS_MAX_DEVS; i++)
+ rte_compressdev_stop(enabled_cdevs[i]);
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
@@ -616,3 +440,44 @@ main(int argc, char **argv)
}
return ret;
}
+
+__rte_weak void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Benchmark test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_benchmark_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+__rte_weak void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Verify test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_verify_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_verify_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index ec73e5e02..00413c6d0 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,6 +4,5 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
- 'comp_perf_test_verify.c',
- 'comp_perf_test_benchmark.c')
+ 'comp_perf_test_common.c')
deps = ['compressdev']
diff --git a/doc/guides/rel_notes/release_19_08.rst b/doc/guides/rel_notes/release_19_08.rst
index 644a74be8..3f779f336 100644
--- a/doc/guides/rel_notes/release_19_08.rst
+++ b/doc/guides/rel_notes/release_19_08.rst
@@ -126,6 +126,10 @@ New Features
Added telemetry mode to l3fwd-power application to report
application level busyness, empty and full polls of rte_eth_rx_burst().
+* **Updated test-compress-perf tool application.**
+
+ Added multiple cores feature to compression perf tool application.
+
Removed Items
-------------
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v6 2/6] app/test-compress-perf: add ptest command line option
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 1/6] app/test-compress-perf: add weak functions for multi-cores test Artur Trybula
@ 2019-07-03 15:24 ` Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 3/6] app/test-compress-perf: add verification test case Artur Trybula
` (11 subsequent siblings)
13 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-03 15:24 UTC (permalink / raw)
To: dev, fiona.trahe, akhil.goyal, adamx.dybkowski, arturx.trybula,
tjozwiakgm
Cc: Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds --ptest option to make possible a choose
of test case from command line.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
.../comp_perf_options_parse.c | 32 +++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 74ea81d09..3d820197a 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -15,6 +15,7 @@
#include "comp_perf_options.h"
+#define CPERF_PTEST_TYPE ("ptest")
#define CPERF_DRIVER_NAME ("driver-name")
#define CPERF_TEST_FILE ("input-file")
#define CPERF_SEG_SIZE ("seg-sz")
@@ -37,6 +38,7 @@ static void
usage(char *progname)
{
printf("%s [EAL options] --\n"
+ " --ptest benchmark / verify :"
" --driver-name NAME: compress driver to use\n"
" --input-file NAME: file to compress and decompress\n"
" --extended-input-sz N: extend file data up to this size (default: no extension)\n"
@@ -75,6 +77,33 @@ get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
return -1;
}
+static int
+parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
+{
+ struct name_id_map cperftest_namemap[] = {
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
+ CPERF_TEST_TYPE_BENCHMARK
+ },
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
+ CPERF_TEST_TYPE_VERIFY
+ }
+ };
+
+ int id = get_str_key_id_mapping(
+ (struct name_id_map *)cperftest_namemap,
+ RTE_DIM(cperftest_namemap), arg);
+ if (id < 0) {
+ RTE_LOG(ERR, USER1, "failed to parse test type");
+ return -1;
+ }
+
+ test_data->test = (enum cperf_perf_test_type)id;
+
+ return 0;
+}
+
static int
parse_uint32_t(uint32_t *value, const char *arg)
{
@@ -501,6 +530,8 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
+
+ { CPERF_PTEST_TYPE, required_argument, 0, 0 },
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -519,6 +550,7 @@ static int
comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
{
struct long_opt_parser parsermap[] = {
+ { CPERF_PTEST_TYPE, parse_cperf_test_type },
{ CPERF_DRIVER_NAME, parse_driver_name },
{ CPERF_TEST_FILE, parse_test_file },
{ CPERF_SEG_SIZE, parse_seg_sz },
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v6 3/6] app/test-compress-perf: add verification test case
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 1/6] app/test-compress-perf: add weak functions for multi-cores test Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 2/6] app/test-compress-perf: add ptest command line option Artur Trybula
@ 2019-07-03 15:24 ` Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 4/6] app/test-compress-perf: add benchmark " Artur Trybula
` (10 subsequent siblings)
13 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-03 15:24 UTC (permalink / raw)
To: dev, fiona.trahe, akhil.goyal, adamx.dybkowski, arturx.trybula,
tjozwiakgm
Cc: Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a verification part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/Makefile | 1 +
.../comp_perf_test_verify.c | 123 +++++++++++++-----
.../comp_perf_test_verify.h | 24 +++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 113 insertions(+), 37 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index de7412961..f54d9a4dd 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,6 +12,7 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
+SRCS-y += comp_perf_test_verify.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 28a0fe873..7be30ee13 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -8,14 +8,49 @@
#include <rte_compressdev.h>
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_common.h"
+
+void
+cperf_verify_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)->mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_verify_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);
+
+ if (ctx == NULL)
+ return NULL;
+
+ ctx->mem.dev_id = dev_id;
+ ctx->mem.qp_id = qp_id;
+ ctx->options = options;
+
+ if (!comp_perf_allocate_memory(ctx->options, &ctx->mem) &&
+ !prepare_bufs(ctx->options, &ctx->mem))
+ return ctx;
+
+ cperf_verify_test_destructor(ctx);
+ return NULL;
+}
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type,
- uint8_t *output_data_ptr,
- size_t *output_data_sz)
+main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->options;
+ uint8_t *output_data_ptr;
+ size_t *output_data_sz;
+ struct cperf_mem_resources *mem = &ctx->mem;
+
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -33,7 +68,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -42,7 +77,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -50,14 +85,16 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ output_data_ptr = ctx->mem.compressed_data;
+ output_data_sz = &ctx->comp_data_sz;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -69,8 +106,10 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ output_data_ptr = ctx->mem.decompressed_data;
+ output_data_sz = &ctx->decomp_data_sz;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -85,8 +124,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
num_iter = 1;
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +152,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +188,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +205,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -220,15 +261,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -291,7 +334,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
@@ -300,45 +343,45 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (output_data_sz)
*output_data_sz = output_size;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
-
-
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level)
+cperf_verify_test_runner(void *test_ctx)
{
+ struct cperf_verify_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->options;
int ret = EXIT_SUCCESS;
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+ uint32_t lcore = rte_lcore_id();
+
+ ctx->mem.lcore_id = lcore;
test_data->ratio = 0;
- if (main_loop(test_data, level, RTE_COMP_COMPRESS,
- test_data->compressed_data,
- &test_data->comp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS,
- test_data->decompressed_data,
- &test_data->decomp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (test_data->decomp_data_sz != test_data->input_data_sz) {
+ if (ctx->decomp_data_sz != test_data->input_data_sz) {
RTE_LOG(ERR, USER1,
"Decompressed data length not equal to input data length\n");
RTE_LOG(ERR, USER1,
"Decompressed size = %zu, expected = %zu\n",
- test_data->decomp_data_sz, test_data->input_data_sz);
+ ctx->decomp_data_sz, test_data->input_data_sz);
ret = EXIT_FAILURE;
goto end;
} else {
- if (memcmp(test_data->decompressed_data,
+ if (memcmp(ctx->mem.decompressed_data,
test_data->input_data,
test_data->input_data_sz) != 0) {
RTE_LOG(ERR, USER1,
@@ -348,9 +391,19 @@ cperf_verification(struct comp_test_data *test_data, uint8_t level)
}
}
- test_data->ratio = (double) test_data->comp_data_sz /
+ ctx->ratio = (double) ctx->comp_data_sz /
test_data->input_data_sz * 100;
+ if (!ctx->silent) {
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]");
+ }
+ printf("%12u%6u%12zu%17.2f\n",
+ ctx->mem.lcore_id,
+ test_data->level, ctx->comp_data_sz, ctx->ratio);
+ }
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.h b/app/test-compress-perf/comp_perf_test_verify.h
index 67c6b4980..ae8b7429c 100644
--- a/app/test-compress-perf/comp_perf_test_verify.h
+++ b/app/test-compress-perf/comp_perf_test_verify.h
@@ -1,13 +1,33 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018-2019 Intel Corporation
*/
#ifndef _COMP_PERF_TEST_VERIFY_
#define _COMP_PERF_TEST_VERIFY_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+
+struct cperf_verify_ctx {
+ struct cperf_mem_resources mem;
+ struct comp_test_data *options;
+
+ int silent;
+ size_t comp_data_sz;
+ size_t decomp_data_sz;
+ double ratio;
+};
+
+void
+cperf_verify_test_destructor(void *arg);
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level);
+cperf_verify_test_runner(void *test_ctx);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 3a3da4c90..51ca9f5b7 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,6 +8,7 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index 00413c6d0..c6246e503 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,5 +4,6 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
+ 'comp_perf_test_verify.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v6 4/6] app/test-compress-perf: add benchmark test case
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
` (2 preceding siblings ...)
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 3/6] app/test-compress-perf: add verification test case Artur Trybula
@ 2019-07-03 15:24 ` Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 5/6] doc: update dpdk-test-compress-perf description Artur Trybula
` (9 subsequent siblings)
13 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-03 15:24 UTC (permalink / raw)
To: dev, fiona.trahe, akhil.goyal, adamx.dybkowski, arturx.trybula,
tjozwiakgm
Cc: Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a benchmark part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/Makefile | 1 +
.../comp_perf_test_benchmark.c | 140 +++++++++++++-----
.../comp_perf_test_benchmark.h | 25 +++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 130 insertions(+), 38 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index f54d9a4dd..d1a6820e6 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -13,6 +13,7 @@ CFLAGS += -O3
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
SRCS-y += comp_perf_test_verify.c
+SRCS-y += comp_perf_test_benchmark.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 5752906b3..e0f852bf0 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -10,11 +10,46 @@
#include "comp_perf_test_benchmark.h"
+void
+cperf_benchmark_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(
+ &((struct cperf_benchmark_ctx *)arg)->ver.mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_benchmark_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_benchmark_ctx), 0);
+
+ if (ctx == NULL)
+ return NULL;
+
+ ctx->ver.mem.dev_id = dev_id;
+ ctx->ver.mem.qp_id = qp_id;
+ ctx->ver.options = options;
+ ctx->ver.silent = 1; /* ver. part will be silent */
+
+ if (!comp_perf_allocate_memory(ctx->ver.options, &ctx->ver.mem)
+ && !prepare_bufs(ctx->ver.options, &ctx->ver.mem))
+ return ctx;
+
+ cperf_benchmark_test_destructor(ctx);
+ return NULL;
+}
+
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type)
+main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->ver.options;
+ struct cperf_mem_resources *mem = &ctx->ver.mem;
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -31,7 +66,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -40,7 +75,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -48,14 +83,14 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -67,8 +102,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -82,13 +117,13 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
uint64_t tsc_start, tsc_end, tsc_duration;
- tsc_start = tsc_end = tsc_duration = 0;
- tsc_start = rte_rdtsc();
num_iter = test_data->num_iter;
+ tsc_start = tsc_end = tsc_duration = 0;
+ tsc_start = rte_rdtsc_precise();
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +148,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +184,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +201,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -177,7 +214,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -198,15 +235,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -226,7 +265,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -247,65 +286,92 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
}
- tsc_end = rte_rdtsc();
+ tsc_end = rte_rdtsc_precise();
tsc_duration = tsc_end - tsc_start;
if (type == RTE_COMP_COMPRESS)
- test_data->comp_tsc_duration[level] =
+ ctx->comp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
else
- test_data->decomp_tsc_duration[level] =
+ ctx->decomp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level)
+cperf_benchmark_test_runner(void *test_ctx)
{
+ struct cperf_benchmark_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->ver.options;
+ uint32_t lcore = rte_lcore_id();
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+
+ ctx->ver.mem.lcore_id = lcore;
int i, ret = EXIT_SUCCESS;
+ /*
+ * First the verification part is needed
+ */
+ if (cperf_verify_test_runner(&ctx->ver)) {
+ ret = EXIT_FAILURE;
+ goto end;
+ }
+
/*
* Run the tests twice, discarding the first performance
* results, before the cache is warmed up
*/
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_COMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
- test_data->comp_tsc_byte =
- (double)(test_data->comp_tsc_duration[level]) /
+ ctx->comp_tsc_byte =
+ (double)(ctx->comp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->decomp_tsc_byte =
- (double)(test_data->decomp_tsc_duration[level]) /
+ ctx->decomp_tsc_byte =
+ (double)(ctx->decomp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->comp_gbps = rte_get_tsc_hz() / test_data->comp_tsc_byte * 8 /
+ ctx->comp_gbps = rte_get_tsc_hz() / ctx->comp_tsc_byte * 8 /
+ 1000000000;
+
+ ctx->decomp_gbps = rte_get_tsc_hz() / ctx->decomp_tsc_byte * 8 /
1000000000;
- test_data->decomp_gbps = rte_get_tsc_hz() / test_data->decomp_tsc_byte
- * 8 / 1000000000;
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s%15s%16s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]",
+ "Comp [Gbps]", "Decomp [Gbps]");
+ }
+
+ printf("%12u%6u%12zu%17.2f%15.2f%16.2f\n",
+ ctx->ver.mem.lcore_id,
+ test_data->level, ctx->ver.comp_data_sz, ctx->ver.ratio,
+ ctx->comp_gbps,
+ ctx->decomp_gbps);
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.h b/app/test-compress-perf/comp_perf_test_benchmark.h
index b193445a3..d9b2694b8 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.h
+++ b/app/test-compress-perf/comp_perf_test_benchmark.h
@@ -5,9 +5,32 @@
#ifndef _COMP_PERF_TEST_BENCHMARK_
#define _COMP_PERF_TEST_BENCHMARK_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+#include "comp_perf_test_verify.h"
+
+struct cperf_benchmark_ctx {
+ struct cperf_verify_ctx ver;
+
+ /* Store TSC duration for all levels (including level 0) */
+ uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ double comp_gbps;
+ double decomp_gbps;
+ double comp_tsc_byte;
+ double decomp_tsc_byte;
+};
+
+void
+cperf_benchmark_test_destructor(void *arg);
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level);
+cperf_benchmark_test_runner(void *test_ctx);
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 51ca9f5b7..dd6ef9a6d 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -9,6 +9,7 @@
#include "comp_perf_options.h"
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index c6246e503..1136f04bc 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -5,5 +5,6 @@ allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
'comp_perf_test_verify.c',
+ 'comp_perf_test_benchmark.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v6 5/6] doc: update dpdk-test-compress-perf description
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
` (3 preceding siblings ...)
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 4/6] app/test-compress-perf: add benchmark " Artur Trybula
@ 2019-07-03 15:24 ` Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 6/6] app/test-compress-perf: add force process termination Artur Trybula
` (8 subsequent siblings)
13 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-03 15:24 UTC (permalink / raw)
To: dev, fiona.trahe, akhil.goyal, adamx.dybkowski, arturx.trybula,
tjozwiakgm
Cc: Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch updates a dpdk-test-compress-perf documentation.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
doc/guides/tools/comp_perf.rst | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/doc/guides/tools/comp_perf.rst b/doc/guides/tools/comp_perf.rst
index 52869c18c..71eef1821 100644
--- a/doc/guides/tools/comp_perf.rst
+++ b/doc/guides/tools/comp_perf.rst
@@ -6,7 +6,9 @@ dpdk-test-compress-perf Tool
The ``dpdk-test-compress-perf`` tool is a Data Plane Development Kit (DPDK)
utility that allows measuring performance parameters of PMDs available in the
-compress tree. The tool reads the data from a file (--input-file),
+compress tree. User can use multiple cores to run tests on but only
+one type of compression PMD can be measured during single application
+execution. The tool reads the data from a file (--input-file),
dumps all the file into a buffer and fills out the data of input mbufs,
which are passed to compress device with compression operations.
Then, the output buffers are fed into the decompression stage, and the resulting
@@ -26,9 +28,35 @@ Limitations
* Stateful operation is not supported in this version.
+EAL Options
+~~~~~~~~~~~
+
+The following are the EAL command-line options that can be used in conjunction
+with the ``dpdk-test-compress-perf`` application.
+See the DPDK Getting Started Guides for more information on these options.
+
+* ``-c <COREMASK>`` or ``-l <CORELIST>``
+
+ Set the hexadecimal bitmask of the cores to run on. The corelist is a
+ list cores to use.
+
+.. Note::
+
+ One lcore is needed for process admin, tests are run on all other cores.
+ To run tests on two lcores, three lcores must be passed to the tool.
+
+* ``-w <PCI>``
+
+ Add a PCI device in white list.
+
+* ``--vdev <driver><id>``
+
+ Add a virtual device.
+
+Appication Options
+~~~~~~~~~~~~~~~~~~
-Command line options
---------------------
+ ``--ptest [benchmark/verify]``: set test type (default: benchmark)
``--driver-name NAME``: compress driver to use
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v6 6/6] app/test-compress-perf: add force process termination
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
` (4 preceding siblings ...)
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 5/6] doc: update dpdk-test-compress-perf description Artur Trybula
@ 2019-07-03 15:24 ` Artur Trybula
2019-07-05 9:50 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Shally Verma
` (7 subsequent siblings)
13 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-03 15:24 UTC (permalink / raw)
To: dev, fiona.trahe, akhil.goyal, adamx.dybkowski, arturx.trybula,
tjozwiakgm
Cc: Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a possibility to force controlled process termination
as a result of two signals: SIGTERM and SIGINT
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/comp_perf_options.h | 1 +
.../comp_perf_test_benchmark.c | 13 ++++++++++
.../comp_perf_test_verify.c | 14 ++++++++++
app/test-compress-perf/main.c | 26 +++++++++++++++++--
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0aa29a599..532fb964e 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -67,6 +67,7 @@ struct comp_test_data {
double ratio;
enum cleanup_st cleanup;
+ int perf_comp_force_stop;
};
int
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index e0f852bf0..aa1f8eea2 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -184,6 +184,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -242,6 +245,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -306,6 +312,13 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
return res;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 7be30ee13..37ac38da6 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -188,6 +188,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -268,6 +271,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -346,6 +352,14 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
+
return res;
}
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index dd6ef9a6d..e746e4708 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -2,6 +2,10 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include <rte_malloc.h>
#include <rte_eal.h>
#include <rte_log.h>
@@ -36,6 +40,8 @@ static const struct cperf_test cperf_testmap[] = {
}
};
+static struct comp_test_data *test_data;
+
static int
comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
@@ -277,12 +283,24 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
+static void
+comp_perf_cleanup_on_signal(int signalNumber __rte_unused)
+{
+ test_data->perf_comp_force_stop = 1;
+}
+
+static void
+comp_perf_register_cleanup_on_signal(void)
+{
+ signal(SIGTERM, comp_perf_cleanup_on_signal);
+ signal(SIGINT, comp_perf_cleanup_on_signal);
+}
+
int
main(int argc, char **argv)
{
uint8_t level_idx = 0;
int ret, i;
- struct comp_test_data *test_data;
void *ctx[RTE_MAX_LCORE] = {};
uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
int nb_compressdevs = 0;
@@ -304,6 +322,8 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d\n",
rte_socket_id());
+ comp_perf_register_cleanup_on_signal();
+
ret = EXIT_SUCCESS;
test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
@@ -424,8 +444,10 @@ main(int argc, char **argv)
/* fallthrough */
case ST_COMPDEV:
for (i = 0; i < nb_compressdevs &&
- i < RTE_COMPRESS_MAX_DEVS; i++)
+ i < RTE_COMPRESS_MAX_DEVS; i++) {
rte_compressdev_stop(enabled_cdevs[i]);
+ rte_compressdev_close(enabled_cdevs[i]);
+ }
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
` (5 preceding siblings ...)
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 6/6] app/test-compress-perf: add force process termination Artur Trybula
@ 2019-07-05 9:50 ` Shally Verma
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 " Fiona Trahe
` (6 subsequent siblings)
13 siblings, 0 replies; 87+ messages in thread
From: Shally Verma @ 2019-07-05 9:50 UTC (permalink / raw)
To: Artur Trybula, dev, fiona.trahe, akhil.goyal, adamx.dybkowski,
tjozwiakgm
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Artur Trybula
> Sent: Wednesday, July 3, 2019 8:54 PM
> To: dev@dpdk.org; fiona.trahe@intel.com; akhil.goyal@nxp.com;
> adamx.dybkowski@intel.com; arturx.trybula@intel.com;
> tjozwiakgm@gmail.com
> Subject: [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-
> compress-perf
>
> This patchset adds multiple cores feature to compression perf tool.
> All structures have been aligned and are consistent with crypto perf tool.
> All test cases have constructor, runner and destructor and can use more
> cores and compression devices at the same time.
>
> v2 changes:
>
> - fixed checkpatch warning
> - fixed max_nb_queue_pairs detection. Based on compression API
> if max_nb_queue_pairs = 0 that means there is no limit in
> maximum number of queue pairs
> - fixed qp setup on the last device
>
> v3 changes:
>
> - merged with commit 2f6527b70c15
> app/compress-perf: add prints for socket id
>
> - fixed wrong compression/decompression throughput calculation
>
> v4 changes:
>
> - moved release notes update to patch 1
> - removed pmd cyclecount template
>
> v5 changes:
>
> - changed ctx null ptr detection inside constructors
>
> v6 changes:
>
> - rebase to the recent master (before applying)
> commit 82b9677cb23c
>
> Tomasz Jozwiak (6):
> app/test-compress-perf: add weak functions for multi-cores test
> app/test-compress-perf: add ptest command line option
> app/test-compress-perf: add verification test case
> app/test-compress-perf: add benchmark test case
> doc: update dpdk-test-compress-perf description
> app/test-compress-perf: add force process termination
>
> app/test-compress-perf/Makefile | 1 +
> app/test-compress-perf/comp_perf.h | 50 ++
> app/test-compress-perf/comp_perf_options.h | 45 +-
> .../comp_perf_options_parse.c | 54 +-
> .../comp_perf_test_benchmark.c | 153 +++--
> .../comp_perf_test_benchmark.h | 25 +-
> .../comp_perf_test_common.c | 284 ++++++++
> .../comp_perf_test_common.h | 41 ++
> .../comp_perf_test_verify.c | 137 +++-
> .../comp_perf_test_verify.h | 24 +-
> app/test-compress-perf/main.c | 605 +++++++-----------
> app/test-compress-perf/meson.build | 3 +-
> doc/guides/rel_notes/release_19_08.rst | 4 +
> doc/guides/tools/comp_perf.rst | 34 +-
> 14 files changed, 993 insertions(+), 467 deletions(-) create mode 100644
> app/test-compress-perf/comp_perf.h
> create mode 100644 app/test-compress-perf/comp_perf_test_common.c
> create mode 100644 app/test-compress-perf/comp_perf_test_common.h
>
> --
It will be nice if we could have version history in descending order. Other than that
Series Acked-by: Shally Verma <shallyv@marvell.com>
> 2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v7 0/6] add multiple cores feature to test-compress-perf
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
` (6 preceding siblings ...)
2019-07-05 9:50 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Shally Verma
@ 2019-07-05 11:15 ` Fiona Trahe
2019-07-06 9:36 ` [dpdk-dev] [EXT] " Shally Verma
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 1/6] app/test-compress-perf: add weak functions for multi-cores test Fiona Trahe
` (5 subsequent siblings)
13 siblings, 1 reply; 87+ messages in thread
From: Fiona Trahe @ 2019-07-05 11:15 UTC (permalink / raw)
To: dev; +Cc: akhil.goyal, shallyv, arturx.trybula, tjozwiakgm, fiona.trahe
This patchset adds multiple cores feature to compression perf tool.
All structures have been aligned and are consistent with crypto perf tool.
All test cases have constructor, runner and destructor and can use more
cores and compression devices at the same time.
v7 changes:
- rebase as patch failed to apply due to release note clash
- moved release note change to patch 4 as more appropriate
v6 changes:
- rebase to the recent master (before applying)
commit 82b9677cb23c
v5 changes:
- changed ctx null ptr detection inside constructors
v4 changes:
- moved release notes update to patch 1
- removed pmd cyclecount template
v3 changes:
- merged with commit 2f6527b70c15
app/compress-perf: add prints for socket id
- fixed wrong compression/decompression throughput calculation
v2 changes:
- fixed max_nb_queue_pairs detection. Based on compression API
if max_nb_queue_pairs = 0 that means there is no limit in
maximum number of queue pairs
- fixed qp setup on the last device
Tomasz Jozwiak (6):
app/test-compress-perf: add weak functions for multi-cores test
app/test-compress-perf: add ptest command line option
app/test-compress-perf: add verification test case
app/test-compress-perf: add benchmark test case
doc: update dpdk-test-compress-perf description
app/test-compress-perf: add force process termination
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf.h | 50 ++
app/test-compress-perf/comp_perf_options.h | 45 +-
app/test-compress-perf/comp_perf_options_parse.c | 54 +-
app/test-compress-perf/comp_perf_test_benchmark.c | 153 ++++--
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +-
app/test-compress-perf/comp_perf_test_common.c | 284 ++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/comp_perf_test_verify.c | 137 +++--
app/test-compress-perf/comp_perf_test_verify.h | 24 +-
app/test-compress-perf/main.c | 605 +++++++++-------------
app/test-compress-perf/meson.build | 3 +-
doc/guides/rel_notes/release_19_08.rst | 4 +
doc/guides/tools/comp_perf.rst | 34 +-
14 files changed, 993 insertions(+), 467 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
--
2.13.6
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v7 1/6] app/test-compress-perf: add weak functions for multi-cores test
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
` (7 preceding siblings ...)
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 " Fiona Trahe
@ 2019-07-05 11:15 ` Fiona Trahe
2019-07-06 9:31 ` [dpdk-dev] [EXT] " Shally Verma
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 2/6] app/test-compress-perf: add ptest command line option Fiona Trahe
` (4 subsequent siblings)
13 siblings, 2 replies; 87+ messages in thread
From: Fiona Trahe @ 2019-07-05 11:15 UTC (permalink / raw)
To: dev
Cc: akhil.goyal, shallyv, arturx.trybula, tjozwiakgm, fiona.trahe,
Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds template functions for multi-cores performance
version of compress-perf-tool
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/Makefile | 3 +-
app/test-compress-perf/comp_perf.h | 50 ++
app/test-compress-perf/comp_perf_options.h | 44 +-
app/test-compress-perf/comp_perf_options_parse.c | 24 +-
app/test-compress-perf/comp_perf_test_common.c | 284 +++++++++++
app/test-compress-perf/comp_perf_test_common.h | 41 ++
app/test-compress-perf/main.c | 599 +++++++++--------------
app/test-compress-perf/meson.build | 3 +-
8 files changed, 646 insertions(+), 402 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index d20e17e47..de7412961 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,7 +12,6 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
-SRCS-y += comp_perf_test_verify.c
-SRCS-y += comp_perf_test_benchmark.c
+SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf.h b/app/test-compress-perf/comp_perf.h
new file mode 100644
index 000000000..57289b07a
--- /dev/null
+++ b/app/test-compress-perf/comp_perf.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_
+#define _COMP_PERF_
+
+#include <rte_mempool.h>
+
+struct comp_test_data;
+
+typedef void *(*cperf_constructor_t)(
+ uint8_t dev_id,
+ uint16_t qp_id,
+ struct comp_test_data *options);
+
+typedef int (*cperf_runner_t)(void *test_ctx);
+typedef void (*cperf_destructor_t)(void *test_ctx);
+
+struct cperf_test {
+ cperf_constructor_t constructor;
+ cperf_runner_t runner;
+ cperf_destructor_t destructor;
+};
+
+/* Needed for weak functions*/
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_benchmark_test_destructor(void *arg __rte_unused);
+
+int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_verify_test_destructor(void *arg __rte_unused);
+
+int
+cperf_verify_test_runner(void *test_ctx __rte_unused);
+
+#endif /* _COMP_PERF_ */
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index f87751d87..0aa29a599 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -13,6 +13,23 @@
#define MAX_MBUF_DATA_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM)
#define MAX_SEG_SIZE ((int)(MAX_MBUF_DATA_SIZE / EXPANSE_RATIO))
+extern const char *cperf_test_type_strs[];
+
+/* Cleanup state machine */
+enum cleanup_st {
+ ST_CLEAR = 0,
+ ST_TEST_DATA,
+ ST_COMPDEV,
+ ST_INPUT_DATA,
+ ST_MEMORY_ALLOC,
+ ST_DURING_TEST
+};
+
+enum cperf_perf_test_type {
+ CPERF_TEST_TYPE_BENCHMARK,
+ CPERF_TEST_TYPE_VERIFY
+};
+
enum comp_operation {
COMPRESS_ONLY,
DECOMPRESS_ONLY,
@@ -30,37 +47,26 @@ struct range_list {
struct comp_test_data {
char driver_name[64];
char input_file[64];
- struct rte_mbuf **comp_bufs;
- struct rte_mbuf **decomp_bufs;
- uint32_t total_bufs;
+ enum cperf_perf_test_type test;
+
uint8_t *input_data;
size_t input_data_sz;
- uint8_t *compressed_data;
- uint8_t *decompressed_data;
- struct rte_mempool *comp_buf_pool;
- struct rte_mempool *decomp_buf_pool;
- struct rte_mempool *op_pool;
- int8_t cdev_id;
+ uint16_t nb_qps;
uint16_t seg_sz;
uint16_t out_seg_sz;
uint16_t burst_sz;
uint32_t pool_sz;
uint32_t num_iter;
uint16_t max_sgl_segs;
+
enum rte_comp_huffman huffman_enc;
enum comp_operation test_op;
int window_sz;
- struct range_list level;
- /* Store TSC duration for all levels (including level 0) */
- uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- size_t comp_data_sz;
- size_t decomp_data_sz;
+ struct range_list level_lst;
+ uint8_t level;
+
double ratio;
- double comp_gbps;
- double decomp_gbps;
- double comp_tsc_byte;
- double decomp_tsc_byte;
+ enum cleanup_st cleanup;
};
int
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index a7a8c1f9e..74ea81d09 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -468,19 +468,20 @@ parse_level(struct comp_test_data *test_data, const char *arg)
* Try parsing the argument as a range, if it fails,
* arse it as a list
*/
- if (parse_range(arg, &test_data->level.min, &test_data->level.max,
- &test_data->level.inc) < 0) {
- ret = parse_list(arg, test_data->level.list,
- &test_data->level.min,
- &test_data->level.max);
+ if (parse_range(arg, &test_data->level_lst.min,
+ &test_data->level_lst.max,
+ &test_data->level_lst.inc) < 0) {
+ ret = parse_list(arg, test_data->level_lst.list,
+ &test_data->level_lst.min,
+ &test_data->level_lst.max);
if (ret < 0) {
RTE_LOG(ERR, USER1,
"Failed to parse compression level/s\n");
return -1;
}
- test_data->level.count = ret;
+ test_data->level_lst.count = ret;
- if (test_data->level.max > RTE_COMP_LEVEL_MAX) {
+ if (test_data->level_lst.max > RTE_COMP_LEVEL_MAX) {
RTE_LOG(ERR, USER1, "Level cannot be higher than %u\n",
RTE_COMP_LEVEL_MAX);
return -1;
@@ -500,7 +501,6 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
-
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -574,7 +574,6 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv)
void
comp_perf_options_default(struct comp_test_data *test_data)
{
- test_data->cdev_id = -1;
test_data->seg_sz = 2048;
test_data->burst_sz = 32;
test_data->pool_sz = 8192;
@@ -583,9 +582,10 @@ comp_perf_options_default(struct comp_test_data *test_data)
test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
test_data->test_op = COMPRESS_DECOMPRESS;
test_data->window_sz = -1;
- test_data->level.min = 1;
- test_data->level.max = 9;
- test_data->level.inc = 1;
+ test_data->level_lst.min = 1;
+ test_data->level_lst.max = 9;
+ test_data->level_lst.inc = 1;
+ test_data->test = CPERF_TEST_TYPE_BENCHMARK;
}
int
diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
new file mode 100644
index 000000000..dc9d0b0f4
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -0,0 +1,284 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_malloc.h>
+#include <rte_eal.h>
+#include <rte_log.h>
+#include <rte_compressdev.h>
+
+#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
+
+#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range)
+{
+ unsigned int next_size;
+
+ /* Check lower/upper bounds */
+ if (size < range->min)
+ return -1;
+
+ if (size > range->max)
+ return -1;
+
+ /* If range is actually only one value, size is correct */
+ if (range->increment == 0)
+ return 0;
+
+ /* Check if value is one of the supported sizes */
+ for (next_size = range->min; next_size <= range->max;
+ next_size += range->increment)
+ if (size == next_size)
+ return 0;
+
+ return -1;
+}
+
+static uint32_t
+find_buf_size(uint32_t input_size)
+{
+ uint32_t i;
+
+ /* From performance point of view the buffer size should be a
+ * power of 2 but also should be enough to store incompressible data
+ */
+
+ /* We're looking for nearest power of 2 buffer size, which is greather
+ * than input_size
+ */
+ uint32_t size =
+ !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
+
+ for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
+ ;
+
+ return i > ((UINT16_MAX + 1) >> 1)
+ ? (uint32_t)((float)input_size * EXPANSE_RATIO)
+ : i;
+}
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem)
+{
+ uint32_t i;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ rte_pktmbuf_free(mem->comp_bufs[i]);
+ rte_pktmbuf_free(mem->decomp_bufs[i]);
+ }
+
+ rte_free(mem->decomp_bufs);
+ rte_free(mem->comp_bufs);
+ rte_free(mem->decompressed_data);
+ rte_free(mem->compressed_data);
+ rte_mempool_free(mem->op_pool);
+ rte_mempool_free(mem->decomp_buf_pool);
+ rte_mempool_free(mem->comp_buf_pool);
+}
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem)
+{
+ test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
+ /* Number of segments for input and output
+ * (compression and decompression)
+ */
+ uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
+ test_data->seg_sz);
+ char pool_name[32] = "";
+
+ snprintf(pool_name, sizeof(pool_name), "comp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->comp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0,
+ test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->comp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ snprintf(pool_name, sizeof(pool_name), "decomp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->decomp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->decomp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ mem->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+
+ snprintf(pool_name, sizeof(pool_name), "op_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->op_pool = rte_comp_op_pool_create(pool_name,
+ mem->total_bufs,
+ 0, 0, rte_socket_id());
+ if (mem->op_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
+ return -1;
+ }
+
+ /*
+ * Compressed data might be a bit larger than input data,
+ * if data cannot be compressed
+ */
+ mem->compressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz * EXPANSE_RATIO
+ + MIN_COMPRESSED_BUF_SIZE, 0,
+ rte_socket_id());
+ if (mem->compressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->decompressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz, 0,
+ rte_socket_id());
+ if (mem->decompressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->comp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->comp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+
+ mem->decomp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->decomp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+ return 0;
+}
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
+{
+ uint32_t remaining_data = test_data->input_data_sz;
+ uint8_t *input_data_ptr = test_data->input_data;
+ size_t data_sz;
+ uint8_t *data_addr;
+ uint32_t i, j;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ /* Allocate data in input mbuf and copy data from input file */
+ mem->decomp_bufs[i] =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+ if (mem->decomp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->decomp_bufs[i], data_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ /* Already one segment in the mbuf */
+ uint16_t segs_per_mbuf = 1;
+
+ /* Chain mbufs if needed for input mbufs */
+ while (segs_per_mbuf < test_data->max_sgl_segs
+ && remaining_data > 0) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ data_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ if (rte_pktmbuf_chain(mem->decomp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ segs_per_mbuf++;
+ }
+
+ /* Allocate data in output mbuf */
+ mem->comp_bufs[i] =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+ if (mem->comp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->comp_bufs[i],
+ test_data->out_seg_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ /* Chain mbufs if needed for output mbufs */
+ for (j = 1; j < segs_per_mbuf; j++) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ test_data->out_seg_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ if (rte_pktmbuf_chain(mem->comp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test-compress-perf/comp_perf_test_common.h
new file mode 100644
index 000000000..9c11e3a00
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_TEST_COMMON_H_
+#define _COMP_PERF_TEST_COMMON_H_
+
+#include <stdint.h>
+
+#include <rte_mempool.h>
+
+struct cperf_mem_resources {
+ uint8_t dev_id;
+ uint16_t qp_id;
+ uint8_t lcore_id;
+ uint32_t total_bufs;
+ uint8_t *compressed_data;
+ uint8_t *decompressed_data;
+
+ struct rte_mbuf **comp_bufs;
+ struct rte_mbuf **decomp_bufs;
+
+ struct rte_mempool *comp_buf_pool;
+ struct rte_mempool *decomp_buf_pool;
+ struct rte_mempool *op_pool;
+};
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range);
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem);
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem);
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem);
+
+#endif /* _COMP_PERF_TEST_COMMON_H_ */
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 7b9ee7420..3a3da4c90 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,56 +8,38 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
-#include "comp_perf_test_verify.h"
-#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
#define NUM_MAX_XFORMS 16
#define NUM_MAX_INFLIGHT_OPS 512
-#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
-
-/* Cleanup state machine */
-static enum cleanup_st {
- ST_CLEAR = 0,
- ST_TEST_DATA,
- ST_COMPDEV,
- ST_INPUT_DATA,
- ST_MEMORY_ALLOC,
- ST_PREPARE_BUF,
- ST_DURING_TEST
-} cleanup = ST_CLEAR;
-
-static int
-param_range_check(uint16_t size, const struct rte_param_log2_range *range)
-{
- unsigned int next_size;
-
- /* Check lower/upper bounds */
- if (size < range->min)
- return -1;
-
- if (size > range->max)
- return -1;
-
- /* If range is actually only one value, size is correct */
- if (range->increment == 0)
- return 0;
-
- /* Check if value is one of the supported sizes */
- for (next_size = range->min; next_size <= range->max;
- next_size += range->increment)
- if (size == next_size)
- return 0;
-
- return -1;
-}
+__extension__
+const char *cperf_test_type_strs[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = "benchmark",
+ [CPERF_TEST_TYPE_VERIFY] = "verify"
+};
+
+__extension__
+static const struct cperf_test cperf_testmap[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = {
+ cperf_benchmark_test_constructor,
+ cperf_benchmark_test_runner,
+ cperf_benchmark_test_destructor
+ },
+ [CPERF_TEST_TYPE_VERIFY] = {
+ cperf_verify_test_constructor,
+ cperf_verify_test_runner,
+ cperf_verify_test_destructor
+ }
+};
static int
-comp_perf_check_capabilities(struct comp_test_data *test_data)
+comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
const struct rte_compressdev_capabilities *cap;
- cap = rte_compressdev_capability_get(test_data->cdev_id,
+ cap = rte_compressdev_capability_get(cdev_id,
RTE_COMP_ALGO_DEFLATE);
if (cap == NULL) {
@@ -105,7 +87,7 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
}
/* Level 0 support */
- if (test_data->level.min == 0 &&
+ if (test_data->level_lst.min == 0 &&
(comp_flags & RTE_COMP_FF_NONCOMPRESSED_BLOCKS) == 0) {
RTE_LOG(ERR, USER1, "Compress device does not support "
"level 0 (no compression)\n");
@@ -115,110 +97,108 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
return 0;
}
-static uint32_t
-find_buf_size(uint32_t input_size)
+static int
+comp_perf_initialize_compressdev(struct comp_test_data *test_data,
+ uint8_t *enabled_cdevs)
{
- uint32_t i;
+ uint8_t enabled_cdev_count, nb_lcores, cdev_id;
+ unsigned int i, j;
+ int ret;
- /* From performance point of view the buffer size should be a
- * power of 2 but also should be enough to store incompressible data
- */
+ enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
+ enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
+ if (enabled_cdev_count == 0) {
+ RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
+ test_data->driver_name);
+ return -EINVAL;
+ }
- /* We're looking for nearest power of 2 buffer size, which is greather
- * than input_size
+ nb_lcores = rte_lcore_count() - 1;
+ /*
+ * Use fewer devices,
+ * if there are more available than cores.
*/
- uint32_t size =
- !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
-
- for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
- ;
-
- return i > ((UINT16_MAX + 1) >> 1)
- ? (uint32_t)((float)input_size * EXPANSE_RATIO)
- : i;
-}
-
-static int
-comp_perf_allocate_memory(struct comp_test_data *test_data)
-{
+ if (enabled_cdev_count > nb_lcores) {
+ enabled_cdev_count = nb_lcores;
+ RTE_LOG(INFO, USER1,
+ " There's more available devices than cores!"
+ " The number of devices has been aligned to %d cores\n",
+ nb_lcores);
+ }
- test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
- /* Number of segments for input and output
- * (compression and decompression)
+ /*
+ * Calculate number of needed queue pairs, based on the amount
+ * of available number of logical cores and compression devices.
+ * For instance, if there are 4 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device.
+ * One queue pair per one core.
+ * if e.g.: there're 3 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device but one queue pair
+ * will left unused in the last one device
*/
- uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
- test_data->seg_sz);
- test_data->comp_buf_pool = rte_pktmbuf_pool_create("comp_buf_pool",
- total_segs,
- 0, 0,
- test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->comp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ test_data->nb_qps = (nb_lcores % enabled_cdev_count) ?
+ (nb_lcores / enabled_cdev_count) + 1 :
+ nb_lcores / enabled_cdev_count;
- cleanup = ST_MEMORY_ALLOC;
- test_data->decomp_buf_pool = rte_pktmbuf_pool_create("decomp_buf_pool",
- total_segs,
- 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->decomp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ for (i = 0; i < enabled_cdev_count &&
+ i < RTE_COMPRESS_MAX_DEVS; i++,
+ nb_lcores -= test_data->nb_qps) {
+ cdev_id = enabled_cdevs[i];
- test_data->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+ struct rte_compressdev_info cdev_info;
+ uint8_t socket_id = rte_compressdev_socket_id(cdev_id);
- test_data->op_pool = rte_comp_op_pool_create("op_pool",
- test_data->total_bufs,
- 0, 0, rte_socket_id());
- if (test_data->op_pool == NULL) {
- RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
- return -1;
- }
+ rte_compressdev_info_get(cdev_id, &cdev_info);
+ if (cdev_info.max_nb_queue_pairs &&
+ test_data->nb_qps > cdev_info.max_nb_queue_pairs) {
+ RTE_LOG(ERR, USER1,
+ "Number of needed queue pairs is higher "
+ "than the maximum number of queue pairs "
+ "per device.\n");
+ RTE_LOG(ERR, USER1,
+ "Lower the number of cores or increase "
+ "the number of crypto devices\n");
+ return -EINVAL;
+ }
- /*
- * Compressed data might be a bit larger than input data,
- * if data cannot be compressed
- */
- test_data->compressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz * EXPANSE_RATIO
- + MIN_COMPRESSED_BUF_SIZE, 0,
- rte_socket_id());
- if (test_data->compressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ if (comp_perf_check_capabilities(test_data, cdev_id) < 0)
+ return -EINVAL;
+
+ /* Configure compressdev */
+ struct rte_compressdev_config config = {
+ .socket_id = socket_id,
+ .nb_queue_pairs = nb_lcores > test_data->nb_qps
+ ? test_data->nb_qps : nb_lcores,
+ .max_nb_priv_xforms = NUM_MAX_XFORMS,
+ .max_nb_streams = 0
+ };
+
+ if (rte_compressdev_configure(cdev_id, &config) < 0) {
+ RTE_LOG(ERR, USER1, "Device configuration failed\n");
+ return -EINVAL;
+ }
- test_data->decompressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz, 0,
- rte_socket_id());
- if (test_data->decompressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ for (j = 0; j < test_data->nb_qps; j++) {
+ ret = rte_compressdev_queue_pair_setup(cdev_id, j,
+ NUM_MAX_INFLIGHT_OPS, socket_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to setup queue pair %u on compressdev %u",
+ j, cdev_id);
+ return -EINVAL;
+ }
+ }
- test_data->comp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->comp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
- " could not be allocated\n");
- return -1;
+ ret = rte_compressdev_start(cdev_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to start device %u: error %d\n",
+ cdev_id, ret);
+ return -EPERM;
+ }
}
- test_data->decomp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->decomp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
- " could not be allocated\n");
- return -1;
- }
- return 0;
+ return enabled_cdev_count;
}
static int
@@ -295,187 +275,18 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
-static int
-comp_perf_initialize_compressdev(struct comp_test_data *test_data)
-{
- uint8_t enabled_cdev_count;
- uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
-
- enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
- enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
- if (enabled_cdev_count == 0) {
- RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
- test_data->driver_name);
- return -EINVAL;
- }
-
- if (enabled_cdev_count > 1)
- RTE_LOG(INFO, USER1,
- "Only the first compress device will be used\n");
-
- test_data->cdev_id = enabled_cdevs[0];
-
- if (comp_perf_check_capabilities(test_data) < 0)
- return -1;
-
- /* Configure compressdev (one device, one queue pair) */
- struct rte_compressdev_config config = {
- .socket_id = rte_socket_id(),
- .nb_queue_pairs = 1,
- .max_nb_priv_xforms = NUM_MAX_XFORMS,
- .max_nb_streams = 0
- };
-
- if (rte_compressdev_configure(test_data->cdev_id, &config) < 0) {
- RTE_LOG(ERR, USER1, "Device configuration failed\n");
- return -1;
- }
-
- if (rte_compressdev_queue_pair_setup(test_data->cdev_id, 0,
- NUM_MAX_INFLIGHT_OPS, rte_socket_id()) < 0) {
- RTE_LOG(ERR, USER1, "Queue pair setup failed\n");
- return -1;
- }
-
- if (rte_compressdev_start(test_data->cdev_id) < 0) {
- RTE_LOG(ERR, USER1, "Device could not be started\n");
- return -1;
- }
-
- return 0;
-}
-
-static int
-prepare_bufs(struct comp_test_data *test_data)
-{
- uint32_t remaining_data = test_data->input_data_sz;
- uint8_t *input_data_ptr = test_data->input_data;
- size_t data_sz;
- uint8_t *data_addr;
- uint32_t i, j;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- /* Allocate data in input mbuf and copy data from input file */
- test_data->decomp_bufs[i] =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
- if (test_data->decomp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
-
- cleanup = ST_PREPARE_BUF;
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->decomp_bufs[i], data_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
- rte_memcpy(data_addr, input_data_ptr, data_sz);
-
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- /* Already one segment in the mbuf */
- uint16_t segs_per_mbuf = 1;
-
- /* Chain mbufs if needed for input mbufs */
- while (segs_per_mbuf < test_data->max_sgl_segs
- && remaining_data > 0) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- data_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- rte_memcpy(data_addr, input_data_ptr, data_sz);
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- if (rte_pktmbuf_chain(test_data->decomp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- segs_per_mbuf++;
- }
-
- /* Allocate data in output mbuf */
- test_data->comp_bufs[i] =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
- if (test_data->comp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->comp_bufs[i],
- test_data->out_seg_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- /* Chain mbufs if needed for output mbufs */
- for (j = 1; j < segs_per_mbuf; j++) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- test_data->out_seg_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- if (rte_pktmbuf_chain(test_data->comp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- }
- }
-
- return 0;
-}
-
-static void
-free_bufs(struct comp_test_data *test_data)
-{
- uint32_t i;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- rte_pktmbuf_free(test_data->comp_bufs[i]);
- rte_pktmbuf_free(test_data->decomp_bufs[i]);
- }
-}
-
-
-
int
main(int argc, char **argv)
{
- uint8_t level, level_idx = 0;
+ uint8_t level_idx = 0;
int ret, i;
struct comp_test_data *test_data;
+ void *ctx[RTE_MAX_LCORE] = {};
+ uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
+ int nb_compressdevs = 0;
+ uint16_t total_nb_qps = 0;
+ uint8_t cdev_id;
+ uint32_t lcore_id;
/* Initialise DPDK EAL */
ret = rte_eal_init(argc, argv);
@@ -492,7 +303,7 @@ main(int argc, char **argv)
rte_socket_id());
ret = EXIT_SUCCESS;
- cleanup = ST_TEST_DATA;
+ test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
if (comp_perf_options_parse(test_data, argc, argv) < 0) {
@@ -507,99 +318,112 @@ main(int argc, char **argv)
goto end;
}
- if (comp_perf_initialize_compressdev(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ nb_compressdevs =
+ comp_perf_initialize_compressdev(test_data, enabled_cdevs);
- cleanup = ST_COMPDEV;
- if (comp_perf_dump_input_data(test_data) < 0) {
+ if (nb_compressdevs < 1) {
ret = EXIT_FAILURE;
goto end;
}
- cleanup = ST_INPUT_DATA;
- if (comp_perf_allocate_memory(test_data) < 0) {
+ test_data->cleanup = ST_COMPDEV;
+ if (comp_perf_dump_input_data(test_data) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (prepare_bufs(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ test_data->cleanup = ST_INPUT_DATA;
- if (test_data->level.inc != 0)
- level = test_data->level.min;
+ if (test_data->level_lst.inc != 0)
+ test_data->level = test_data->level_lst.min;
else
- level = test_data->level.list[0];
+ test_data->level = test_data->level_lst.list[0];
printf("App uses socket: %u\n", rte_socket_id());
- printf("Driver uses socket: %u\n",
- rte_compressdev_socket_id(test_data->cdev_id));
printf("Burst size = %u\n", test_data->burst_sz);
printf("File size = %zu\n", test_data->input_data_sz);
- printf("%6s%12s%17s%19s%21s%15s%21s%23s%16s\n",
- "Level", "Comp size", "Comp ratio [%]",
- "Comp [Cycles/it]", "Comp [Cycles/Byte]", "Comp [Gbps]",
- "Decomp [Cycles/it]", "Decomp [Cycles/Byte]", "Decomp [Gbps]");
+ test_data->cleanup = ST_DURING_TEST;
+ total_nb_qps = nb_compressdevs * test_data->nb_qps;
- cleanup = ST_DURING_TEST;
- while (level <= test_data->level.max) {
+ i = 0;
+ uint8_t qp_id = 0, cdev_index = 0;
- /*
- * Run a first iteration, to verify compression and
- * get the compression ratio for the level
- */
- if (cperf_verification(test_data, level) != EXIT_SUCCESS)
- break;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
- /*
- * Run benchmarking test
- */
- if (cperf_benchmark(test_data, level) != EXIT_SUCCESS)
+ if (i == total_nb_qps)
break;
- printf("%6u%12zu%17.2f%19"PRIu64"%21.2f"
- "%15.2f%21"PRIu64"%23.2f%16.2f\n",
- level, test_data->comp_data_sz, test_data->ratio,
- test_data->comp_tsc_duration[level],
- test_data->comp_tsc_byte, test_data->comp_gbps,
- test_data->decomp_tsc_duration[level],
- test_data->decomp_tsc_byte, test_data->decomp_gbps);
+ cdev_id = enabled_cdevs[cdev_index];
+ ctx[i] = cperf_testmap[test_data->test].constructor(
+ cdev_id, qp_id,
+ test_data);
+ if (ctx[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Test run constructor failed\n");
+ goto end;
+ }
+ qp_id = (qp_id + 1) % test_data->nb_qps;
+ if (qp_id == 0)
+ cdev_index++;
+ i++;
+ }
+
+ while (test_data->level <= test_data->level_lst.max) {
- if (test_data->level.inc != 0)
- level += test_data->level.inc;
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+
+ rte_eal_remote_launch(
+ cperf_testmap[test_data->test].runner,
+ ctx[i], lcore_id);
+ i++;
+ }
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+ ret |= rte_eal_wait_lcore(lcore_id);
+ i++;
+ }
+
+ if (ret != EXIT_SUCCESS)
+ break;
+
+ if (test_data->level_lst.inc != 0)
+ test_data->level += test_data->level_lst.inc;
else {
- if (++level_idx == test_data->level.count)
+ if (++level_idx == test_data->level_lst.count)
break;
- level = test_data->level.list[level_idx];
+ test_data->level = test_data->level_lst.list[level_idx];
}
}
end:
- switch (cleanup) {
+ switch (test_data->cleanup) {
case ST_DURING_TEST:
- case ST_PREPARE_BUF:
- free_bufs(test_data);
- /* fallthrough */
- case ST_MEMORY_ALLOC:
- rte_free(test_data->decomp_bufs);
- rte_free(test_data->comp_bufs);
- rte_free(test_data->decompressed_data);
- rte_free(test_data->compressed_data);
- rte_mempool_free(test_data->op_pool);
- rte_mempool_free(test_data->decomp_buf_pool);
- rte_mempool_free(test_data->comp_buf_pool);
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (i == total_nb_qps)
+ break;
+
+ if (ctx[i] && cperf_testmap[test_data->test].destructor)
+ cperf_testmap[test_data->test].destructor(
+ ctx[i]);
+ i++;
+ }
/* fallthrough */
case ST_INPUT_DATA:
rte_free(test_data->input_data);
/* fallthrough */
case ST_COMPDEV:
- if (test_data->cdev_id != -1)
- rte_compressdev_stop(test_data->cdev_id);
+ for (i = 0; i < nb_compressdevs &&
+ i < RTE_COMPRESS_MAX_DEVS; i++)
+ rte_compressdev_stop(enabled_cdevs[i]);
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
@@ -616,3 +440,44 @@ main(int argc, char **argv)
}
return ret;
}
+
+__rte_weak void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Benchmark test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_benchmark_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+__rte_weak void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Verify test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_verify_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_verify_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index ec73e5e02..00413c6d0 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,6 +4,5 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
- 'comp_perf_test_verify.c',
- 'comp_perf_test_benchmark.c')
+ 'comp_perf_test_common.c')
deps = ['compressdev']
--
2.13.6
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v7 2/6] app/test-compress-perf: add ptest command line option
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
` (8 preceding siblings ...)
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 1/6] app/test-compress-perf: add weak functions for multi-cores test Fiona Trahe
@ 2019-07-05 11:15 ` Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 3/6] app/test-compress-perf: add verification test case Fiona Trahe
` (3 subsequent siblings)
13 siblings, 0 replies; 87+ messages in thread
From: Fiona Trahe @ 2019-07-05 11:15 UTC (permalink / raw)
To: dev
Cc: akhil.goyal, shallyv, arturx.trybula, tjozwiakgm, fiona.trahe,
Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds --ptest option to make possible to choose
test case from command line.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/comp_perf_options_parse.c | 32 ++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 74ea81d09..3d820197a 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -15,6 +15,7 @@
#include "comp_perf_options.h"
+#define CPERF_PTEST_TYPE ("ptest")
#define CPERF_DRIVER_NAME ("driver-name")
#define CPERF_TEST_FILE ("input-file")
#define CPERF_SEG_SIZE ("seg-sz")
@@ -37,6 +38,7 @@ static void
usage(char *progname)
{
printf("%s [EAL options] --\n"
+ " --ptest benchmark / verify :"
" --driver-name NAME: compress driver to use\n"
" --input-file NAME: file to compress and decompress\n"
" --extended-input-sz N: extend file data up to this size (default: no extension)\n"
@@ -76,6 +78,33 @@ get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
}
static int
+parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
+{
+ struct name_id_map cperftest_namemap[] = {
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
+ CPERF_TEST_TYPE_BENCHMARK
+ },
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
+ CPERF_TEST_TYPE_VERIFY
+ }
+ };
+
+ int id = get_str_key_id_mapping(
+ (struct name_id_map *)cperftest_namemap,
+ RTE_DIM(cperftest_namemap), arg);
+ if (id < 0) {
+ RTE_LOG(ERR, USER1, "failed to parse test type");
+ return -1;
+ }
+
+ test_data->test = (enum cperf_perf_test_type)id;
+
+ return 0;
+}
+
+static int
parse_uint32_t(uint32_t *value, const char *arg)
{
char *end = NULL;
@@ -501,6 +530,8 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
+
+ { CPERF_PTEST_TYPE, required_argument, 0, 0 },
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -519,6 +550,7 @@ static int
comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
{
struct long_opt_parser parsermap[] = {
+ { CPERF_PTEST_TYPE, parse_cperf_test_type },
{ CPERF_DRIVER_NAME, parse_driver_name },
{ CPERF_TEST_FILE, parse_test_file },
{ CPERF_SEG_SIZE, parse_seg_sz },
--
2.13.6
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v7 3/6] app/test-compress-perf: add verification test case
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
` (9 preceding siblings ...)
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 2/6] app/test-compress-perf: add ptest command line option Fiona Trahe
@ 2019-07-05 11:15 ` Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 4/6] app/test-compress-perf: add benchmark " Fiona Trahe
` (2 subsequent siblings)
13 siblings, 0 replies; 87+ messages in thread
From: Fiona Trahe @ 2019-07-05 11:15 UTC (permalink / raw)
To: dev
Cc: akhil.goyal, shallyv, arturx.trybula, tjozwiakgm, fiona.trahe,
Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a verification part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_verify.c | 123 ++++++++++++++++++-------
app/test-compress-perf/comp_perf_test_verify.h | 24 ++++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 113 insertions(+), 37 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index de7412961..f54d9a4dd 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,6 +12,7 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
+SRCS-y += comp_perf_test_verify.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 28a0fe873..7be30ee13 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -8,14 +8,49 @@
#include <rte_compressdev.h>
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_common.h"
+
+void
+cperf_verify_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)->mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_verify_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);
+
+ if (ctx == NULL)
+ return NULL;
+
+ ctx->mem.dev_id = dev_id;
+ ctx->mem.qp_id = qp_id;
+ ctx->options = options;
+
+ if (!comp_perf_allocate_memory(ctx->options, &ctx->mem) &&
+ !prepare_bufs(ctx->options, &ctx->mem))
+ return ctx;
+
+ cperf_verify_test_destructor(ctx);
+ return NULL;
+}
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type,
- uint8_t *output_data_ptr,
- size_t *output_data_sz)
+main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->options;
+ uint8_t *output_data_ptr;
+ size_t *output_data_sz;
+ struct cperf_mem_resources *mem = &ctx->mem;
+
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -33,7 +68,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -42,7 +77,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -50,14 +85,16 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ output_data_ptr = ctx->mem.compressed_data;
+ output_data_sz = &ctx->comp_data_sz;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -69,8 +106,10 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ output_data_ptr = ctx->mem.decompressed_data;
+ output_data_sz = &ctx->decomp_data_sz;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -85,8 +124,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
num_iter = 1;
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +152,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +188,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +205,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -220,15 +261,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -291,7 +334,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
@@ -300,45 +343,45 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (output_data_sz)
*output_data_sz = output_size;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
-
-
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level)
+cperf_verify_test_runner(void *test_ctx)
{
+ struct cperf_verify_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->options;
int ret = EXIT_SUCCESS;
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+ uint32_t lcore = rte_lcore_id();
+
+ ctx->mem.lcore_id = lcore;
test_data->ratio = 0;
- if (main_loop(test_data, level, RTE_COMP_COMPRESS,
- test_data->compressed_data,
- &test_data->comp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS,
- test_data->decompressed_data,
- &test_data->decomp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (test_data->decomp_data_sz != test_data->input_data_sz) {
+ if (ctx->decomp_data_sz != test_data->input_data_sz) {
RTE_LOG(ERR, USER1,
"Decompressed data length not equal to input data length\n");
RTE_LOG(ERR, USER1,
"Decompressed size = %zu, expected = %zu\n",
- test_data->decomp_data_sz, test_data->input_data_sz);
+ ctx->decomp_data_sz, test_data->input_data_sz);
ret = EXIT_FAILURE;
goto end;
} else {
- if (memcmp(test_data->decompressed_data,
+ if (memcmp(ctx->mem.decompressed_data,
test_data->input_data,
test_data->input_data_sz) != 0) {
RTE_LOG(ERR, USER1,
@@ -348,9 +391,19 @@ cperf_verification(struct comp_test_data *test_data, uint8_t level)
}
}
- test_data->ratio = (double) test_data->comp_data_sz /
+ ctx->ratio = (double) ctx->comp_data_sz /
test_data->input_data_sz * 100;
+ if (!ctx->silent) {
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]");
+ }
+ printf("%12u%6u%12zu%17.2f\n",
+ ctx->mem.lcore_id,
+ test_data->level, ctx->comp_data_sz, ctx->ratio);
+ }
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.h b/app/test-compress-perf/comp_perf_test_verify.h
index 67c6b4980..ae8b7429c 100644
--- a/app/test-compress-perf/comp_perf_test_verify.h
+++ b/app/test-compress-perf/comp_perf_test_verify.h
@@ -1,13 +1,33 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018-2019 Intel Corporation
*/
#ifndef _COMP_PERF_TEST_VERIFY_
#define _COMP_PERF_TEST_VERIFY_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+
+struct cperf_verify_ctx {
+ struct cperf_mem_resources mem;
+ struct comp_test_data *options;
+
+ int silent;
+ size_t comp_data_sz;
+ size_t decomp_data_sz;
+ double ratio;
+};
+
+void
+cperf_verify_test_destructor(void *arg);
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level);
+cperf_verify_test_runner(void *test_ctx);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 3a3da4c90..51ca9f5b7 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,6 +8,7 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index 00413c6d0..c6246e503 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,5 +4,6 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
+ 'comp_perf_test_verify.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.13.6
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v7 4/6] app/test-compress-perf: add benchmark test case
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
` (10 preceding siblings ...)
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 3/6] app/test-compress-perf: add verification test case Fiona Trahe
@ 2019-07-05 11:15 ` Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 5/6] doc: update dpdk-test-compress-perf description Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 6/6] app/test-compress-perf: add force process termination Fiona Trahe
13 siblings, 0 replies; 87+ messages in thread
From: Fiona Trahe @ 2019-07-05 11:15 UTC (permalink / raw)
To: dev
Cc: akhil.goyal, shallyv, arturx.trybula, tjozwiakgm, fiona.trahe,
Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a benchmark part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Also updates release notes.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 140 ++++++++++++++++------
app/test-compress-perf/comp_perf_test_benchmark.h | 25 +++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
doc/guides/rel_notes/release_19_08.rst | 4 +
6 files changed, 134 insertions(+), 38 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index f54d9a4dd..d1a6820e6 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -13,6 +13,7 @@ CFLAGS += -O3
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
SRCS-y += comp_perf_test_verify.c
+SRCS-y += comp_perf_test_benchmark.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 5752906b3..e0f852bf0 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -10,11 +10,46 @@
#include "comp_perf_test_benchmark.h"
+void
+cperf_benchmark_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(
+ &((struct cperf_benchmark_ctx *)arg)->ver.mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_benchmark_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_benchmark_ctx), 0);
+
+ if (ctx == NULL)
+ return NULL;
+
+ ctx->ver.mem.dev_id = dev_id;
+ ctx->ver.mem.qp_id = qp_id;
+ ctx->ver.options = options;
+ ctx->ver.silent = 1; /* ver. part will be silent */
+
+ if (!comp_perf_allocate_memory(ctx->ver.options, &ctx->ver.mem)
+ && !prepare_bufs(ctx->ver.options, &ctx->ver.mem))
+ return ctx;
+
+ cperf_benchmark_test_destructor(ctx);
+ return NULL;
+}
+
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type)
+main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->ver.options;
+ struct cperf_mem_resources *mem = &ctx->ver.mem;
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -31,7 +66,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -40,7 +75,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -48,14 +83,14 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -67,8 +102,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -82,13 +117,13 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
uint64_t tsc_start, tsc_end, tsc_duration;
- tsc_start = tsc_end = tsc_duration = 0;
- tsc_start = rte_rdtsc();
num_iter = test_data->num_iter;
+ tsc_start = tsc_end = tsc_duration = 0;
+ tsc_start = rte_rdtsc_precise();
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +148,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +184,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +201,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -177,7 +214,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -198,15 +235,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -226,7 +265,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -247,65 +286,92 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
}
- tsc_end = rte_rdtsc();
+ tsc_end = rte_rdtsc_precise();
tsc_duration = tsc_end - tsc_start;
if (type == RTE_COMP_COMPRESS)
- test_data->comp_tsc_duration[level] =
+ ctx->comp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
else
- test_data->decomp_tsc_duration[level] =
+ ctx->decomp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level)
+cperf_benchmark_test_runner(void *test_ctx)
{
+ struct cperf_benchmark_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->ver.options;
+ uint32_t lcore = rte_lcore_id();
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+
+ ctx->ver.mem.lcore_id = lcore;
int i, ret = EXIT_SUCCESS;
/*
+ * First the verification part is needed
+ */
+ if (cperf_verify_test_runner(&ctx->ver)) {
+ ret = EXIT_FAILURE;
+ goto end;
+ }
+
+ /*
* Run the tests twice, discarding the first performance
* results, before the cache is warmed up
*/
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_COMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
- test_data->comp_tsc_byte =
- (double)(test_data->comp_tsc_duration[level]) /
+ ctx->comp_tsc_byte =
+ (double)(ctx->comp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->decomp_tsc_byte =
- (double)(test_data->decomp_tsc_duration[level]) /
+ ctx->decomp_tsc_byte =
+ (double)(ctx->decomp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->comp_gbps = rte_get_tsc_hz() / test_data->comp_tsc_byte * 8 /
+ ctx->comp_gbps = rte_get_tsc_hz() / ctx->comp_tsc_byte * 8 /
+ 1000000000;
+
+ ctx->decomp_gbps = rte_get_tsc_hz() / ctx->decomp_tsc_byte * 8 /
1000000000;
- test_data->decomp_gbps = rte_get_tsc_hz() / test_data->decomp_tsc_byte
- * 8 / 1000000000;
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s%15s%16s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]",
+ "Comp [Gbps]", "Decomp [Gbps]");
+ }
+
+ printf("%12u%6u%12zu%17.2f%15.2f%16.2f\n",
+ ctx->ver.mem.lcore_id,
+ test_data->level, ctx->ver.comp_data_sz, ctx->ver.ratio,
+ ctx->comp_gbps,
+ ctx->decomp_gbps);
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.h b/app/test-compress-perf/comp_perf_test_benchmark.h
index b193445a3..d9b2694b8 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.h
+++ b/app/test-compress-perf/comp_perf_test_benchmark.h
@@ -5,9 +5,32 @@
#ifndef _COMP_PERF_TEST_BENCHMARK_
#define _COMP_PERF_TEST_BENCHMARK_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+#include "comp_perf_test_verify.h"
+
+struct cperf_benchmark_ctx {
+ struct cperf_verify_ctx ver;
+
+ /* Store TSC duration for all levels (including level 0) */
+ uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ double comp_gbps;
+ double decomp_gbps;
+ double comp_tsc_byte;
+ double decomp_tsc_byte;
+};
+
+void
+cperf_benchmark_test_destructor(void *arg);
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level);
+cperf_benchmark_test_runner(void *test_ctx);
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 51ca9f5b7..dd6ef9a6d 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -9,6 +9,7 @@
#include "comp_perf_options.h"
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index c6246e503..1136f04bc 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -5,5 +5,6 @@ allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
'comp_perf_test_verify.c',
+ 'comp_perf_test_benchmark.c',
'comp_perf_test_common.c')
deps = ['compressdev']
diff --git a/doc/guides/rel_notes/release_19_08.rst b/doc/guides/rel_notes/release_19_08.rst
index dffad8236..5f2a0d57d 100644
--- a/doc/guides/rel_notes/release_19_08.rst
+++ b/doc/guides/rel_notes/release_19_08.rst
@@ -158,6 +158,10 @@ New Features
SDK libraries.
* Added support for 5GNR encode/decode operations.
+* **Updated test-compress-perf tool application.**
+
+ Added multiple cores feature to compression perf tool application.
+
Removed Items
-------------
--
2.13.6
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v7 5/6] doc: update dpdk-test-compress-perf description
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
` (11 preceding siblings ...)
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 4/6] app/test-compress-perf: add benchmark " Fiona Trahe
@ 2019-07-05 11:15 ` Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 6/6] app/test-compress-perf: add force process termination Fiona Trahe
13 siblings, 0 replies; 87+ messages in thread
From: Fiona Trahe @ 2019-07-05 11:15 UTC (permalink / raw)
To: dev
Cc: akhil.goyal, shallyv, arturx.trybula, tjozwiakgm, fiona.trahe,
Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch updates dpdk-test-compress-perf documentation.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
doc/guides/tools/comp_perf.rst | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/doc/guides/tools/comp_perf.rst b/doc/guides/tools/comp_perf.rst
index 52869c18c..71eef1821 100644
--- a/doc/guides/tools/comp_perf.rst
+++ b/doc/guides/tools/comp_perf.rst
@@ -6,7 +6,9 @@ dpdk-test-compress-perf Tool
The ``dpdk-test-compress-perf`` tool is a Data Plane Development Kit (DPDK)
utility that allows measuring performance parameters of PMDs available in the
-compress tree. The tool reads the data from a file (--input-file),
+compress tree. User can use multiple cores to run tests on but only
+one type of compression PMD can be measured during single application
+execution. The tool reads the data from a file (--input-file),
dumps all the file into a buffer and fills out the data of input mbufs,
which are passed to compress device with compression operations.
Then, the output buffers are fed into the decompression stage, and the resulting
@@ -26,9 +28,35 @@ Limitations
* Stateful operation is not supported in this version.
+EAL Options
+~~~~~~~~~~~
+
+The following are the EAL command-line options that can be used in conjunction
+with the ``dpdk-test-compress-perf`` application.
+See the DPDK Getting Started Guides for more information on these options.
+
+* ``-c <COREMASK>`` or ``-l <CORELIST>``
+
+ Set the hexadecimal bitmask of the cores to run on. The corelist is a
+ list cores to use.
+
+.. Note::
+
+ One lcore is needed for process admin, tests are run on all other cores.
+ To run tests on two lcores, three lcores must be passed to the tool.
+
+* ``-w <PCI>``
+
+ Add a PCI device in white list.
+
+* ``--vdev <driver><id>``
+
+ Add a virtual device.
+
+Appication Options
+~~~~~~~~~~~~~~~~~~
-Command line options
---------------------
+ ``--ptest [benchmark/verify]``: set test type (default: benchmark)
``--driver-name NAME``: compress driver to use
--
2.13.6
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v7 6/6] app/test-compress-perf: add force process termination
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
` (12 preceding siblings ...)
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 5/6] doc: update dpdk-test-compress-perf description Fiona Trahe
@ 2019-07-05 11:15 ` Fiona Trahe
13 siblings, 0 replies; 87+ messages in thread
From: Fiona Trahe @ 2019-07-05 11:15 UTC (permalink / raw)
To: dev
Cc: akhil.goyal, shallyv, arturx.trybula, tjozwiakgm, fiona.trahe,
Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a possibility to force controlled process termination
as a result of two signals: SIGTERM and SIGINT
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/comp_perf_options.h | 1 +
app/test-compress-perf/comp_perf_test_benchmark.c | 13 ++++++++++++
app/test-compress-perf/comp_perf_test_verify.c | 14 ++++++++++++
app/test-compress-perf/main.c | 26 +++++++++++++++++++++--
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0aa29a599..532fb964e 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -67,6 +67,7 @@ struct comp_test_data {
double ratio;
enum cleanup_st cleanup;
+ int perf_comp_force_stop;
};
int
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index e0f852bf0..aa1f8eea2 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -184,6 +184,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -242,6 +245,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -306,6 +312,13 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
return res;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 7be30ee13..37ac38da6 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -188,6 +188,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -268,6 +271,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -346,6 +352,14 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
+
return res;
}
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index dd6ef9a6d..e746e4708 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -2,6 +2,10 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include <rte_malloc.h>
#include <rte_eal.h>
#include <rte_log.h>
@@ -36,6 +40,8 @@ static const struct cperf_test cperf_testmap[] = {
}
};
+static struct comp_test_data *test_data;
+
static int
comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
@@ -277,12 +283,24 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
+static void
+comp_perf_cleanup_on_signal(int signalNumber __rte_unused)
+{
+ test_data->perf_comp_force_stop = 1;
+}
+
+static void
+comp_perf_register_cleanup_on_signal(void)
+{
+ signal(SIGTERM, comp_perf_cleanup_on_signal);
+ signal(SIGINT, comp_perf_cleanup_on_signal);
+}
+
int
main(int argc, char **argv)
{
uint8_t level_idx = 0;
int ret, i;
- struct comp_test_data *test_data;
void *ctx[RTE_MAX_LCORE] = {};
uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
int nb_compressdevs = 0;
@@ -304,6 +322,8 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d\n",
rte_socket_id());
+ comp_perf_register_cleanup_on_signal();
+
ret = EXIT_SUCCESS;
test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
@@ -424,8 +444,10 @@ main(int argc, char **argv)
/* fallthrough */
case ST_COMPDEV:
for (i = 0; i < nb_compressdevs &&
- i < RTE_COMPRESS_MAX_DEVS; i++)
+ i < RTE_COMPRESS_MAX_DEVS; i++) {
rte_compressdev_stop(enabled_cdevs[i]);
+ rte_compressdev_close(enabled_cdevs[i]);
+ }
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
--
2.13.6
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v7 1/6] app/test-compress-perf: add weak functions for multi-cores test
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 1/6] app/test-compress-perf: add weak functions for multi-cores test Fiona Trahe
@ 2019-07-06 9:31 ` Shally Verma
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
1 sibling, 0 replies; 87+ messages in thread
From: Shally Verma @ 2019-07-06 9:31 UTC (permalink / raw)
To: Fiona Trahe, dev; +Cc: akhil.goyal, arturx.trybula, tjozwiakgm, Tomasz Jozwiak
> -----Original Message-----
> From: Fiona Trahe <fiona.trahe@intel.com>
> Sent: Friday, July 5, 2019 4:46 PM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Shally Verma <shallyv@marvell.com>;
> arturx.trybula@intel.com; tjozwiakgm@gmail.com; fiona.trahe@intel.com;
> Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> Subject: [EXT] [PATCH v7 1/6] app/test-compress-perf: add weak functions
> for multi-cores test
>
> External Email
>
> ----------------------------------------------------------------------
...
....
> +enum cperf_perf_test_type {
I think I had feedback here on enum name: it can be just cperf_test_type
> + CPERF_TEST_TYPE_BENCHMARK,
> + CPERF_TEST_TYPE_VERIFY
> +};
> +
...
> struct comp_test_data {
> char driver_name[64];
> char input_file[64];
Rather than using magic number better use MACRO NAME? also where is limitation mentioned on name sizes?
> - struct rte_mbuf **comp_bufs;
> - struct rte_mbuf **decomp_bufs;
> - uint32_t total_bufs;
> + enum cperf_perf_test_type test;
> +
> uint8_t *input_data;
> size_t input_data_sz;
> - uint8_t *compressed_data;
> - uint8_t *decompressed_data;
> - struct rte_mempool *comp_buf_pool;
> - struct rte_mempool *decomp_buf_pool;
> - struct rte_mempool *op_pool;
> - int8_t cdev_id;
> + uint16_t nb_qps;
> uint16_t seg_sz;
> uint16_t out_seg_sz;
> uint16_t burst_sz;
> uint32_t pool_sz;
> uint32_t num_iter;
> uint16_t max_sgl_segs;
> +
> enum rte_comp_huffman huffman_enc;
> enum comp_operation test_op;
> int window_sz;
> - struct range_list level;
> - /* Store TSC duration for all levels (including level 0) */
> - uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
> - uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
> - size_t comp_data_sz;
> - size_t decomp_data_sz;
> + struct range_list level_lst;
> + uint8_t level;
> +
> double ratio;
> - double comp_gbps;
> - double decomp_gbps;
> - double comp_tsc_byte;
> - double decomp_tsc_byte;
> + enum cleanup_st cleanup;
> };
>
> int
> diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-
> compress-perf/comp_perf_options_parse.c
> index a7a8c1f9e..74ea81d09 100644
> --- a/app/test-compress-perf/comp_perf_options_parse.c
> +++ b/app/test-compress-perf/comp_perf_options_parse.c
...
> @@ -500,7 +501,6 @@ struct long_opt_parser { };
>
> static struct option lgopts[] = {
> -
...
> - test_data->level.min = 1;
> - test_data->level.max = 9;
> - test_data->level.inc = 1;
> + test_data->level_lst.min = 1;
> + test_data->level_lst.max = 9;
> + test_data->level_lst.inc = 1;
Replace by Macro?
> + test_data->test = CPERF_TEST_TYPE_BENCHMARK;
> }
>
> int
> diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-
> compress-perf/comp_perf_test_common.c
> new file mode 100644
> index 000000000..dc9d0b0f4
> --- /dev/null
> +++ b/app/test-compress-perf/comp_perf_test_common.c
> @@ -0,0 +1,284 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2019 Intel Corporation
> + */
> +
> +#include <rte_malloc.h>
> +#include <rte_eal.h>
> +#include <rte_log.h>
> +#include <rte_compressdev.h>
> +
> +#include "comp_perf_options.h"
> +#include "comp_perf_test_verify.h"
> +#include "comp_perf_test_benchmark.h"
> +#include "comp_perf.h"
Should this is before comp_perf_xx files to maintain alphabetical order?
> +#include "comp_perf_test_common.h"
> +
...
> +
> +static uint32_t
> +find_buf_size(uint32_t input_size)
> +{
> + uint32_t i;
> +
> + /* From performance point of view the buffer size should be a
> + * power of 2 but also should be enough to store incompressible data
> + */
> +
> + /* We're looking for nearest power of 2 buffer size, which is greather
Typo: greater
> + * than input_size
> + */
> + uint32_t size =
> + !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size <<
> 1);
> +
> + for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
> + ;
> +
> + return i > ((UINT16_MAX + 1) >> 1)
> + ? (uint32_t)((float)input_size * EXPANSE_RATIO)
> + : i;
> +}
> +
...
> --
> 2.13.6
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v7 0/6] add multiple cores feature to test-compress-perf
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 " Fiona Trahe
@ 2019-07-06 9:36 ` Shally Verma
0 siblings, 0 replies; 87+ messages in thread
From: Shally Verma @ 2019-07-06 9:36 UTC (permalink / raw)
To: Fiona Trahe, dev; +Cc: akhil.goyal, arturx.trybula, tjozwiakgm
> -----Original Message-----
> From: Fiona Trahe <fiona.trahe@intel.com>
> Sent: Friday, July 5, 2019 4:46 PM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Shally Verma <shallyv@marvell.com>;
> arturx.trybula@intel.com; tjozwiakgm@gmail.com; fiona.trahe@intel.com
> Subject: [EXT] [PATCH v7 0/6] add multiple cores feature to test-compress-
> perf
>
> External Email
>
> ----------------------------------------------------------------------
> This patchset adds multiple cores feature to compression perf tool.
> All structures have been aligned and are consistent with crypto perf tool.
> All test cases have constructor, runner and destructor and can use more
> cores and compression devices at the same time.
>
> v7 changes:
> - rebase as patch failed to apply due to release note clash
> - moved release note change to patch 4 as more appropriate
>
> v6 changes:
> - rebase to the recent master (before applying)
> commit 82b9677cb23c
>
> v5 changes:
> - changed ctx null ptr detection inside constructors
>
> v4 changes:
> - moved release notes update to patch 1
> - removed pmd cyclecount template
>
> v3 changes:
> - merged with commit 2f6527b70c15
> app/compress-perf: add prints for socket id
> - fixed wrong compression/decompression throughput calculation
>
> v2 changes:
> - fixed max_nb_queue_pairs detection. Based on compression API
> if max_nb_queue_pairs = 0 that means there is no limit in
> maximum number of queue pairs
> - fixed qp setup on the last device
>
>
> Tomasz Jozwiak (6):
> app/test-compress-perf: add weak functions for multi-cores test
> app/test-compress-perf: add ptest command line option
> app/test-compress-perf: add verification test case
> app/test-compress-perf: add benchmark test case
> doc: update dpdk-test-compress-perf description
> app/test-compress-perf: add force process termination
>
> app/test-compress-perf/Makefile | 1 +
> app/test-compress-perf/comp_perf.h | 50 ++
> app/test-compress-perf/comp_perf_options.h | 45 +-
> app/test-compress-perf/comp_perf_options_parse.c | 54 +- app/test-
> compress-perf/comp_perf_test_benchmark.c | 153 ++++-- app/test-
> compress-perf/comp_perf_test_benchmark.h | 25 +-
> app/test-compress-perf/comp_perf_test_common.c | 284 ++++++++++
> app/test-compress-perf/comp_perf_test_common.h | 41 ++
> app/test-compress-perf/comp_perf_test_verify.c | 137 +++--
> app/test-compress-perf/comp_perf_test_verify.h | 24 +-
> app/test-compress-perf/main.c | 605 +++++++++-------------
> app/test-compress-perf/meson.build | 3 +-
> doc/guides/rel_notes/release_19_08.rst | 4 +
> doc/guides/tools/comp_perf.rst | 34 +-
> 14 files changed, 993 insertions(+), 467 deletions(-) create mode 100644
> app/test-compress-perf/comp_perf.h
> create mode 100644 app/test-compress-perf/comp_perf_test_common.c
> create mode 100644 app/test-compress-perf/comp_perf_test_common.h
>
> --
Other than few minor comments on another patch which can be addressed in next series,
Series acked-by: Shally Verma <shallyv@marvell.com>
> 2.13.6
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 1/6] app/test-compress-perf: add weak functions for multi-cores test Fiona Trahe
2019-07-06 9:31 ` [dpdk-dev] [EXT] " Shally Verma
@ 2019-07-08 18:16 ` Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 1/7] app/test-compress-perf: add weak functions for multi-cores test Artur Trybula
` (7 more replies)
1 sibling, 8 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-08 18:16 UTC (permalink / raw)
To: dev, fiona.trahe, shallyv, adamx.dybkowski, arturx.trybula, akhil.goyal
This patchset adds multiple cores feature to compression perf tool.
All structures have been aligned and are consistent with crypto perf tool.
All test cases have constructor, runner and destructor and can use more
cores and compression devices at the same time.
v8 changes:
- some minor fixes (e.g. 'magic numbers', spelling mistake,
enum naming)
v7 changes:
- rebase as patch failed to apply due to release note clash
- moved release note change to patch 4 as more appropriate
v6 changes:
- rebase to the recent master (before applying)
commit 82b9677cb23c
v5 changes:
- changed ctx null ptr detection inside constructors
v4 changes:
- moved release notes update to patch 1
- removed pmd cyclecount template
v3 changes:
- merged with commit 2f6527b70c15
app/compress-perf: add prints for socket id
- fixed wrong compression/decompression throughput calculation
v2 changes:
- fixed max_nb_queue_pairs detection. Based on compression API
if max_nb_queue_pairs = 0 that means there is no limit in
maximum number of queue pairs
- fixed qp setup on the last device
Artur Trybula (1):
app/test-compress-perf: 'magic numbers' removed
Tomasz Jozwiak (6):
app/test-compress-perf: add weak functions for multi-cores test
app/test-compress-perf: add ptest command line option
app/test-compress-perf: add verification test case
app/test-compress-perf: add benchmark test case
doc: update dpdk-test-compress-perf description
app/test-compress-perf: add force process termination
app/test-compress-perf/Makefile | 1 +
app/test-compress-perf/comp_perf.h | 50 ++
app/test-compress-perf/comp_perf_options.h | 51 +-
.../comp_perf_options_parse.c | 54 +-
.../comp_perf_test_benchmark.c | 153 +++--
.../comp_perf_test_benchmark.h | 25 +-
.../comp_perf_test_common.c | 285 +++++++++
.../comp_perf_test_common.h | 41 ++
.../comp_perf_test_verify.c | 137 +++-
.../comp_perf_test_verify.h | 24 +-
app/test-compress-perf/main.c | 605 +++++++-----------
app/test-compress-perf/meson.build | 3 +-
doc/guides/rel_notes/release_19_08.rst | 27 +
doc/guides/tools/comp_perf.rst | 34 +-
14 files changed, 1019 insertions(+), 471 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
Series acked-by: Shally Verma <shallyv@marvell.com>
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v8 1/7] app/test-compress-perf: add weak functions for multi-cores test
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
@ 2019-07-08 18:16 ` Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 2/7] app/test-compress-perf: add ptest command line option Artur Trybula
` (6 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-08 18:16 UTC (permalink / raw)
To: dev, fiona.trahe, shallyv, adamx.dybkowski, arturx.trybula, akhil.goyal
Cc: Tomasz Jozwiak, Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds template functions for multi-cores performance
version of compress-perf-tool
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/Makefile | 3 +-
app/test-compress-perf/comp_perf.h | 50 ++
app/test-compress-perf/comp_perf_options.h | 44 +-
.../comp_perf_options_parse.c | 24 +-
.../comp_perf_test_common.c | 284 +++++++++
.../comp_perf_test_common.h | 41 ++
app/test-compress-perf/main.c | 599 +++++++-----------
app/test-compress-perf/meson.build | 3 +-
8 files changed, 646 insertions(+), 402 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf.h
create mode 100644 app/test-compress-perf/comp_perf_test_common.c
create mode 100644 app/test-compress-perf/comp_perf_test_common.h
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index d20e17e47..de7412961 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,7 +12,6 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
-SRCS-y += comp_perf_test_verify.c
-SRCS-y += comp_perf_test_benchmark.c
+SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf.h b/app/test-compress-perf/comp_perf.h
new file mode 100644
index 000000000..57289b07a
--- /dev/null
+++ b/app/test-compress-perf/comp_perf.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_
+#define _COMP_PERF_
+
+#include <rte_mempool.h>
+
+struct comp_test_data;
+
+typedef void *(*cperf_constructor_t)(
+ uint8_t dev_id,
+ uint16_t qp_id,
+ struct comp_test_data *options);
+
+typedef int (*cperf_runner_t)(void *test_ctx);
+typedef void (*cperf_destructor_t)(void *test_ctx);
+
+struct cperf_test {
+ cperf_constructor_t constructor;
+ cperf_runner_t runner;
+ cperf_destructor_t destructor;
+};
+
+/* Needed for weak functions*/
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_benchmark_test_destructor(void *arg __rte_unused);
+
+int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused);
+
+void
+cperf_verify_test_destructor(void *arg __rte_unused);
+
+int
+cperf_verify_test_runner(void *test_ctx __rte_unused);
+
+#endif /* _COMP_PERF_ */
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index f87751d87..0aa29a599 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -13,6 +13,23 @@
#define MAX_MBUF_DATA_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM)
#define MAX_SEG_SIZE ((int)(MAX_MBUF_DATA_SIZE / EXPANSE_RATIO))
+extern const char *cperf_test_type_strs[];
+
+/* Cleanup state machine */
+enum cleanup_st {
+ ST_CLEAR = 0,
+ ST_TEST_DATA,
+ ST_COMPDEV,
+ ST_INPUT_DATA,
+ ST_MEMORY_ALLOC,
+ ST_DURING_TEST
+};
+
+enum cperf_perf_test_type {
+ CPERF_TEST_TYPE_BENCHMARK,
+ CPERF_TEST_TYPE_VERIFY
+};
+
enum comp_operation {
COMPRESS_ONLY,
DECOMPRESS_ONLY,
@@ -30,37 +47,26 @@ struct range_list {
struct comp_test_data {
char driver_name[64];
char input_file[64];
- struct rte_mbuf **comp_bufs;
- struct rte_mbuf **decomp_bufs;
- uint32_t total_bufs;
+ enum cperf_perf_test_type test;
+
uint8_t *input_data;
size_t input_data_sz;
- uint8_t *compressed_data;
- uint8_t *decompressed_data;
- struct rte_mempool *comp_buf_pool;
- struct rte_mempool *decomp_buf_pool;
- struct rte_mempool *op_pool;
- int8_t cdev_id;
+ uint16_t nb_qps;
uint16_t seg_sz;
uint16_t out_seg_sz;
uint16_t burst_sz;
uint32_t pool_sz;
uint32_t num_iter;
uint16_t max_sgl_segs;
+
enum rte_comp_huffman huffman_enc;
enum comp_operation test_op;
int window_sz;
- struct range_list level;
- /* Store TSC duration for all levels (including level 0) */
- uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
- size_t comp_data_sz;
- size_t decomp_data_sz;
+ struct range_list level_lst;
+ uint8_t level;
+
double ratio;
- double comp_gbps;
- double decomp_gbps;
- double comp_tsc_byte;
- double decomp_tsc_byte;
+ enum cleanup_st cleanup;
};
int
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index a7a8c1f9e..74ea81d09 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -468,19 +468,20 @@ parse_level(struct comp_test_data *test_data, const char *arg)
* Try parsing the argument as a range, if it fails,
* arse it as a list
*/
- if (parse_range(arg, &test_data->level.min, &test_data->level.max,
- &test_data->level.inc) < 0) {
- ret = parse_list(arg, test_data->level.list,
- &test_data->level.min,
- &test_data->level.max);
+ if (parse_range(arg, &test_data->level_lst.min,
+ &test_data->level_lst.max,
+ &test_data->level_lst.inc) < 0) {
+ ret = parse_list(arg, test_data->level_lst.list,
+ &test_data->level_lst.min,
+ &test_data->level_lst.max);
if (ret < 0) {
RTE_LOG(ERR, USER1,
"Failed to parse compression level/s\n");
return -1;
}
- test_data->level.count = ret;
+ test_data->level_lst.count = ret;
- if (test_data->level.max > RTE_COMP_LEVEL_MAX) {
+ if (test_data->level_lst.max > RTE_COMP_LEVEL_MAX) {
RTE_LOG(ERR, USER1, "Level cannot be higher than %u\n",
RTE_COMP_LEVEL_MAX);
return -1;
@@ -500,7 +501,6 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
-
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -574,7 +574,6 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv)
void
comp_perf_options_default(struct comp_test_data *test_data)
{
- test_data->cdev_id = -1;
test_data->seg_sz = 2048;
test_data->burst_sz = 32;
test_data->pool_sz = 8192;
@@ -583,9 +582,10 @@ comp_perf_options_default(struct comp_test_data *test_data)
test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
test_data->test_op = COMPRESS_DECOMPRESS;
test_data->window_sz = -1;
- test_data->level.min = 1;
- test_data->level.max = 9;
- test_data->level.inc = 1;
+ test_data->level_lst.min = 1;
+ test_data->level_lst.max = 9;
+ test_data->level_lst.inc = 1;
+ test_data->test = CPERF_TEST_TYPE_BENCHMARK;
}
int
diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
new file mode 100644
index 000000000..dc9d0b0f4
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -0,0 +1,284 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_malloc.h>
+#include <rte_eal.h>
+#include <rte_log.h>
+#include <rte_compressdev.h>
+
+#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
+
+#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range)
+{
+ unsigned int next_size;
+
+ /* Check lower/upper bounds */
+ if (size < range->min)
+ return -1;
+
+ if (size > range->max)
+ return -1;
+
+ /* If range is actually only one value, size is correct */
+ if (range->increment == 0)
+ return 0;
+
+ /* Check if value is one of the supported sizes */
+ for (next_size = range->min; next_size <= range->max;
+ next_size += range->increment)
+ if (size == next_size)
+ return 0;
+
+ return -1;
+}
+
+static uint32_t
+find_buf_size(uint32_t input_size)
+{
+ uint32_t i;
+
+ /* From performance point of view the buffer size should be a
+ * power of 2 but also should be enough to store incompressible data
+ */
+
+ /* We're looking for nearest power of 2 buffer size, which is greather
+ * than input_size
+ */
+ uint32_t size =
+ !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
+
+ for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
+ ;
+
+ return i > ((UINT16_MAX + 1) >> 1)
+ ? (uint32_t)((float)input_size * EXPANSE_RATIO)
+ : i;
+}
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem)
+{
+ uint32_t i;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ rte_pktmbuf_free(mem->comp_bufs[i]);
+ rte_pktmbuf_free(mem->decomp_bufs[i]);
+ }
+
+ rte_free(mem->decomp_bufs);
+ rte_free(mem->comp_bufs);
+ rte_free(mem->decompressed_data);
+ rte_free(mem->compressed_data);
+ rte_mempool_free(mem->op_pool);
+ rte_mempool_free(mem->decomp_buf_pool);
+ rte_mempool_free(mem->comp_buf_pool);
+}
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem)
+{
+ test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
+ /* Number of segments for input and output
+ * (compression and decompression)
+ */
+ uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
+ test_data->seg_sz);
+ char pool_name[32] = "";
+
+ snprintf(pool_name, sizeof(pool_name), "comp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->comp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0,
+ test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->comp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ snprintf(pool_name, sizeof(pool_name), "decomp_buf_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->decomp_buf_pool = rte_pktmbuf_pool_create(pool_name,
+ total_segs,
+ 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
+ rte_socket_id());
+ if (mem->decomp_buf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
+ return -1;
+ }
+
+ mem->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+
+ snprintf(pool_name, sizeof(pool_name), "op_pool_%u_qp_%u",
+ mem->dev_id, mem->qp_id);
+ mem->op_pool = rte_comp_op_pool_create(pool_name,
+ mem->total_bufs,
+ 0, 0, rte_socket_id());
+ if (mem->op_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
+ return -1;
+ }
+
+ /*
+ * Compressed data might be a bit larger than input data,
+ * if data cannot be compressed
+ */
+ mem->compressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz * EXPANSE_RATIO
+ + MIN_COMPRESSED_BUF_SIZE, 0,
+ rte_socket_id());
+ if (mem->compressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->decompressed_data = rte_zmalloc_socket(NULL,
+ test_data->input_data_sz, 0,
+ rte_socket_id());
+ if (mem->decompressed_data == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
+ "file could not be allocated\n");
+ return -1;
+ }
+
+ mem->comp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->comp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+
+ mem->decomp_bufs = rte_zmalloc_socket(NULL,
+ mem->total_bufs * sizeof(struct rte_mbuf *),
+ 0, rte_socket_id());
+ if (mem->decomp_bufs == NULL) {
+ RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
+ " could not be allocated\n");
+ return -1;
+ }
+ return 0;
+}
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
+{
+ uint32_t remaining_data = test_data->input_data_sz;
+ uint8_t *input_data_ptr = test_data->input_data;
+ size_t data_sz;
+ uint8_t *data_addr;
+ uint32_t i, j;
+
+ for (i = 0; i < mem->total_bufs; i++) {
+ /* Allocate data in input mbuf and copy data from input file */
+ mem->decomp_bufs[i] =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+ if (mem->decomp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->decomp_bufs[i], data_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ /* Already one segment in the mbuf */
+ uint16_t segs_per_mbuf = 1;
+
+ /* Chain mbufs if needed for input mbufs */
+ while (segs_per_mbuf < test_data->max_sgl_segs
+ && remaining_data > 0) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->decomp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ data_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ rte_memcpy(data_addr, input_data_ptr, data_sz);
+ input_data_ptr += data_sz;
+ remaining_data -= data_sz;
+
+ if (rte_pktmbuf_chain(mem->decomp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ segs_per_mbuf++;
+ }
+
+ /* Allocate data in output mbuf */
+ mem->comp_bufs[i] =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+ if (mem->comp_bufs[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
+ return -1;
+ }
+ data_addr = (uint8_t *) rte_pktmbuf_append(
+ mem->comp_bufs[i],
+ test_data->out_seg_sz);
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ /* Chain mbufs if needed for output mbufs */
+ for (j = 1; j < segs_per_mbuf; j++) {
+ struct rte_mbuf *next_seg =
+ rte_pktmbuf_alloc(mem->comp_buf_pool);
+
+ if (next_seg == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Could not allocate mbuf\n");
+ return -1;
+ }
+
+ data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
+ test_data->out_seg_sz);
+
+ if (data_addr == NULL) {
+ RTE_LOG(ERR, USER1, "Could not append data\n");
+ return -1;
+ }
+
+ if (rte_pktmbuf_chain(mem->comp_bufs[i],
+ next_seg) < 0) {
+ RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test-compress-perf/comp_perf_test_common.h
new file mode 100644
index 000000000..9c11e3a00
--- /dev/null
+++ b/app/test-compress-perf/comp_perf_test_common.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _COMP_PERF_TEST_COMMON_H_
+#define _COMP_PERF_TEST_COMMON_H_
+
+#include <stdint.h>
+
+#include <rte_mempool.h>
+
+struct cperf_mem_resources {
+ uint8_t dev_id;
+ uint16_t qp_id;
+ uint8_t lcore_id;
+ uint32_t total_bufs;
+ uint8_t *compressed_data;
+ uint8_t *decompressed_data;
+
+ struct rte_mbuf **comp_bufs;
+ struct rte_mbuf **decomp_bufs;
+
+ struct rte_mempool *comp_buf_pool;
+ struct rte_mempool *decomp_buf_pool;
+ struct rte_mempool *op_pool;
+};
+
+int
+param_range_check(uint16_t size, const struct rte_param_log2_range *range);
+
+void
+comp_perf_free_memory(struct cperf_mem_resources *mem);
+
+int
+comp_perf_allocate_memory(struct comp_test_data *test_data,
+ struct cperf_mem_resources *mem);
+
+int
+prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem);
+
+#endif /* _COMP_PERF_TEST_COMMON_H_ */
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 7b9ee7420..3a3da4c90 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,56 +8,38 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
-#include "comp_perf_test_verify.h"
-#include "comp_perf_test_benchmark.h"
+#include "comp_perf.h"
+#include "comp_perf_test_common.h"
#define NUM_MAX_XFORMS 16
#define NUM_MAX_INFLIGHT_OPS 512
-#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
-
-/* Cleanup state machine */
-static enum cleanup_st {
- ST_CLEAR = 0,
- ST_TEST_DATA,
- ST_COMPDEV,
- ST_INPUT_DATA,
- ST_MEMORY_ALLOC,
- ST_PREPARE_BUF,
- ST_DURING_TEST
-} cleanup = ST_CLEAR;
-
-static int
-param_range_check(uint16_t size, const struct rte_param_log2_range *range)
-{
- unsigned int next_size;
-
- /* Check lower/upper bounds */
- if (size < range->min)
- return -1;
-
- if (size > range->max)
- return -1;
-
- /* If range is actually only one value, size is correct */
- if (range->increment == 0)
- return 0;
-
- /* Check if value is one of the supported sizes */
- for (next_size = range->min; next_size <= range->max;
- next_size += range->increment)
- if (size == next_size)
- return 0;
-
- return -1;
-}
+__extension__
+const char *cperf_test_type_strs[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = "benchmark",
+ [CPERF_TEST_TYPE_VERIFY] = "verify"
+};
+
+__extension__
+static const struct cperf_test cperf_testmap[] = {
+ [CPERF_TEST_TYPE_BENCHMARK] = {
+ cperf_benchmark_test_constructor,
+ cperf_benchmark_test_runner,
+ cperf_benchmark_test_destructor
+ },
+ [CPERF_TEST_TYPE_VERIFY] = {
+ cperf_verify_test_constructor,
+ cperf_verify_test_runner,
+ cperf_verify_test_destructor
+ }
+};
static int
-comp_perf_check_capabilities(struct comp_test_data *test_data)
+comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
const struct rte_compressdev_capabilities *cap;
- cap = rte_compressdev_capability_get(test_data->cdev_id,
+ cap = rte_compressdev_capability_get(cdev_id,
RTE_COMP_ALGO_DEFLATE);
if (cap == NULL) {
@@ -105,7 +87,7 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
}
/* Level 0 support */
- if (test_data->level.min == 0 &&
+ if (test_data->level_lst.min == 0 &&
(comp_flags & RTE_COMP_FF_NONCOMPRESSED_BLOCKS) == 0) {
RTE_LOG(ERR, USER1, "Compress device does not support "
"level 0 (no compression)\n");
@@ -115,110 +97,108 @@ comp_perf_check_capabilities(struct comp_test_data *test_data)
return 0;
}
-static uint32_t
-find_buf_size(uint32_t input_size)
+static int
+comp_perf_initialize_compressdev(struct comp_test_data *test_data,
+ uint8_t *enabled_cdevs)
{
- uint32_t i;
+ uint8_t enabled_cdev_count, nb_lcores, cdev_id;
+ unsigned int i, j;
+ int ret;
- /* From performance point of view the buffer size should be a
- * power of 2 but also should be enough to store incompressible data
- */
+ enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
+ enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
+ if (enabled_cdev_count == 0) {
+ RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
+ test_data->driver_name);
+ return -EINVAL;
+ }
- /* We're looking for nearest power of 2 buffer size, which is greather
- * than input_size
+ nb_lcores = rte_lcore_count() - 1;
+ /*
+ * Use fewer devices,
+ * if there are more available than cores.
*/
- uint32_t size =
- !input_size ? MIN_COMPRESSED_BUF_SIZE : (input_size << 1);
-
- for (i = UINT16_MAX + 1; !(i & size); i >>= 1)
- ;
-
- return i > ((UINT16_MAX + 1) >> 1)
- ? (uint32_t)((float)input_size * EXPANSE_RATIO)
- : i;
-}
-
-static int
-comp_perf_allocate_memory(struct comp_test_data *test_data)
-{
+ if (enabled_cdev_count > nb_lcores) {
+ enabled_cdev_count = nb_lcores;
+ RTE_LOG(INFO, USER1,
+ " There's more available devices than cores!"
+ " The number of devices has been aligned to %d cores\n",
+ nb_lcores);
+ }
- test_data->out_seg_sz = find_buf_size(test_data->seg_sz);
- /* Number of segments for input and output
- * (compression and decompression)
+ /*
+ * Calculate number of needed queue pairs, based on the amount
+ * of available number of logical cores and compression devices.
+ * For instance, if there are 4 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device.
+ * One queue pair per one core.
+ * if e.g.: there're 3 cores and 2 compression devices,
+ * 2 queue pairs will be set up per device but one queue pair
+ * will left unused in the last one device
*/
- uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
- test_data->seg_sz);
- test_data->comp_buf_pool = rte_pktmbuf_pool_create("comp_buf_pool",
- total_segs,
- 0, 0,
- test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->comp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ test_data->nb_qps = (nb_lcores % enabled_cdev_count) ?
+ (nb_lcores / enabled_cdev_count) + 1 :
+ nb_lcores / enabled_cdev_count;
- cleanup = ST_MEMORY_ALLOC;
- test_data->decomp_buf_pool = rte_pktmbuf_pool_create("decomp_buf_pool",
- total_segs,
- 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
- rte_socket_id());
- if (test_data->decomp_buf_pool == NULL) {
- RTE_LOG(ERR, USER1, "Mbuf mempool could not be created\n");
- return -1;
- }
+ for (i = 0; i < enabled_cdev_count &&
+ i < RTE_COMPRESS_MAX_DEVS; i++,
+ nb_lcores -= test_data->nb_qps) {
+ cdev_id = enabled_cdevs[i];
- test_data->total_bufs = DIV_CEIL(total_segs, test_data->max_sgl_segs);
+ struct rte_compressdev_info cdev_info;
+ uint8_t socket_id = rte_compressdev_socket_id(cdev_id);
- test_data->op_pool = rte_comp_op_pool_create("op_pool",
- test_data->total_bufs,
- 0, 0, rte_socket_id());
- if (test_data->op_pool == NULL) {
- RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
- return -1;
- }
+ rte_compressdev_info_get(cdev_id, &cdev_info);
+ if (cdev_info.max_nb_queue_pairs &&
+ test_data->nb_qps > cdev_info.max_nb_queue_pairs) {
+ RTE_LOG(ERR, USER1,
+ "Number of needed queue pairs is higher "
+ "than the maximum number of queue pairs "
+ "per device.\n");
+ RTE_LOG(ERR, USER1,
+ "Lower the number of cores or increase "
+ "the number of crypto devices\n");
+ return -EINVAL;
+ }
- /*
- * Compressed data might be a bit larger than input data,
- * if data cannot be compressed
- */
- test_data->compressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz * EXPANSE_RATIO
- + MIN_COMPRESSED_BUF_SIZE, 0,
- rte_socket_id());
- if (test_data->compressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ if (comp_perf_check_capabilities(test_data, cdev_id) < 0)
+ return -EINVAL;
+
+ /* Configure compressdev */
+ struct rte_compressdev_config config = {
+ .socket_id = socket_id,
+ .nb_queue_pairs = nb_lcores > test_data->nb_qps
+ ? test_data->nb_qps : nb_lcores,
+ .max_nb_priv_xforms = NUM_MAX_XFORMS,
+ .max_nb_streams = 0
+ };
+
+ if (rte_compressdev_configure(cdev_id, &config) < 0) {
+ RTE_LOG(ERR, USER1, "Device configuration failed\n");
+ return -EINVAL;
+ }
- test_data->decompressed_data = rte_zmalloc_socket(NULL,
- test_data->input_data_sz, 0,
- rte_socket_id());
- if (test_data->decompressed_data == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the data from the input "
- "file could not be allocated\n");
- return -1;
- }
+ for (j = 0; j < test_data->nb_qps; j++) {
+ ret = rte_compressdev_queue_pair_setup(cdev_id, j,
+ NUM_MAX_INFLIGHT_OPS, socket_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to setup queue pair %u on compressdev %u",
+ j, cdev_id);
+ return -EINVAL;
+ }
+ }
- test_data->comp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->comp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the compression mbufs"
- " could not be allocated\n");
- return -1;
+ ret = rte_compressdev_start(cdev_id);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Failed to start device %u: error %d\n",
+ cdev_id, ret);
+ return -EPERM;
+ }
}
- test_data->decomp_bufs = rte_zmalloc_socket(NULL,
- test_data->total_bufs * sizeof(struct rte_mbuf *),
- 0, rte_socket_id());
- if (test_data->decomp_bufs == NULL) {
- RTE_LOG(ERR, USER1, "Memory to hold the decompression mbufs"
- " could not be allocated\n");
- return -1;
- }
- return 0;
+ return enabled_cdev_count;
}
static int
@@ -295,187 +275,18 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
-static int
-comp_perf_initialize_compressdev(struct comp_test_data *test_data)
-{
- uint8_t enabled_cdev_count;
- uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
-
- enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
- enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
- if (enabled_cdev_count == 0) {
- RTE_LOG(ERR, USER1, "No compress devices type %s available\n",
- test_data->driver_name);
- return -EINVAL;
- }
-
- if (enabled_cdev_count > 1)
- RTE_LOG(INFO, USER1,
- "Only the first compress device will be used\n");
-
- test_data->cdev_id = enabled_cdevs[0];
-
- if (comp_perf_check_capabilities(test_data) < 0)
- return -1;
-
- /* Configure compressdev (one device, one queue pair) */
- struct rte_compressdev_config config = {
- .socket_id = rte_socket_id(),
- .nb_queue_pairs = 1,
- .max_nb_priv_xforms = NUM_MAX_XFORMS,
- .max_nb_streams = 0
- };
-
- if (rte_compressdev_configure(test_data->cdev_id, &config) < 0) {
- RTE_LOG(ERR, USER1, "Device configuration failed\n");
- return -1;
- }
-
- if (rte_compressdev_queue_pair_setup(test_data->cdev_id, 0,
- NUM_MAX_INFLIGHT_OPS, rte_socket_id()) < 0) {
- RTE_LOG(ERR, USER1, "Queue pair setup failed\n");
- return -1;
- }
-
- if (rte_compressdev_start(test_data->cdev_id) < 0) {
- RTE_LOG(ERR, USER1, "Device could not be started\n");
- return -1;
- }
-
- return 0;
-}
-
-static int
-prepare_bufs(struct comp_test_data *test_data)
-{
- uint32_t remaining_data = test_data->input_data_sz;
- uint8_t *input_data_ptr = test_data->input_data;
- size_t data_sz;
- uint8_t *data_addr;
- uint32_t i, j;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- /* Allocate data in input mbuf and copy data from input file */
- test_data->decomp_bufs[i] =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
- if (test_data->decomp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
-
- cleanup = ST_PREPARE_BUF;
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->decomp_bufs[i], data_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
- rte_memcpy(data_addr, input_data_ptr, data_sz);
-
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- /* Already one segment in the mbuf */
- uint16_t segs_per_mbuf = 1;
-
- /* Chain mbufs if needed for input mbufs */
- while (segs_per_mbuf < test_data->max_sgl_segs
- && remaining_data > 0) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->decomp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- data_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- rte_memcpy(data_addr, input_data_ptr, data_sz);
- input_data_ptr += data_sz;
- remaining_data -= data_sz;
-
- if (rte_pktmbuf_chain(test_data->decomp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- segs_per_mbuf++;
- }
-
- /* Allocate data in output mbuf */
- test_data->comp_bufs[i] =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
- if (test_data->comp_bufs[i] == NULL) {
- RTE_LOG(ERR, USER1, "Could not allocate mbuf\n");
- return -1;
- }
- data_addr = (uint8_t *) rte_pktmbuf_append(
- test_data->comp_bufs[i],
- test_data->out_seg_sz);
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- /* Chain mbufs if needed for output mbufs */
- for (j = 1; j < segs_per_mbuf; j++) {
- struct rte_mbuf *next_seg =
- rte_pktmbuf_alloc(test_data->comp_buf_pool);
-
- if (next_seg == NULL) {
- RTE_LOG(ERR, USER1,
- "Could not allocate mbuf\n");
- return -1;
- }
-
- data_addr = (uint8_t *)rte_pktmbuf_append(next_seg,
- test_data->out_seg_sz);
-
- if (data_addr == NULL) {
- RTE_LOG(ERR, USER1, "Could not append data\n");
- return -1;
- }
-
- if (rte_pktmbuf_chain(test_data->comp_bufs[i],
- next_seg) < 0) {
- RTE_LOG(ERR, USER1, "Could not chain mbufs\n");
- return -1;
- }
- }
- }
-
- return 0;
-}
-
-static void
-free_bufs(struct comp_test_data *test_data)
-{
- uint32_t i;
-
- for (i = 0; i < test_data->total_bufs; i++) {
- rte_pktmbuf_free(test_data->comp_bufs[i]);
- rte_pktmbuf_free(test_data->decomp_bufs[i]);
- }
-}
-
-
-
int
main(int argc, char **argv)
{
- uint8_t level, level_idx = 0;
+ uint8_t level_idx = 0;
int ret, i;
struct comp_test_data *test_data;
+ void *ctx[RTE_MAX_LCORE] = {};
+ uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
+ int nb_compressdevs = 0;
+ uint16_t total_nb_qps = 0;
+ uint8_t cdev_id;
+ uint32_t lcore_id;
/* Initialise DPDK EAL */
ret = rte_eal_init(argc, argv);
@@ -492,7 +303,7 @@ main(int argc, char **argv)
rte_socket_id());
ret = EXIT_SUCCESS;
- cleanup = ST_TEST_DATA;
+ test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
if (comp_perf_options_parse(test_data, argc, argv) < 0) {
@@ -507,99 +318,112 @@ main(int argc, char **argv)
goto end;
}
- if (comp_perf_initialize_compressdev(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ nb_compressdevs =
+ comp_perf_initialize_compressdev(test_data, enabled_cdevs);
- cleanup = ST_COMPDEV;
- if (comp_perf_dump_input_data(test_data) < 0) {
+ if (nb_compressdevs < 1) {
ret = EXIT_FAILURE;
goto end;
}
- cleanup = ST_INPUT_DATA;
- if (comp_perf_allocate_memory(test_data) < 0) {
+ test_data->cleanup = ST_COMPDEV;
+ if (comp_perf_dump_input_data(test_data) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (prepare_bufs(test_data) < 0) {
- ret = EXIT_FAILURE;
- goto end;
- }
+ test_data->cleanup = ST_INPUT_DATA;
- if (test_data->level.inc != 0)
- level = test_data->level.min;
+ if (test_data->level_lst.inc != 0)
+ test_data->level = test_data->level_lst.min;
else
- level = test_data->level.list[0];
+ test_data->level = test_data->level_lst.list[0];
printf("App uses socket: %u\n", rte_socket_id());
- printf("Driver uses socket: %u\n",
- rte_compressdev_socket_id(test_data->cdev_id));
printf("Burst size = %u\n", test_data->burst_sz);
printf("File size = %zu\n", test_data->input_data_sz);
- printf("%6s%12s%17s%19s%21s%15s%21s%23s%16s\n",
- "Level", "Comp size", "Comp ratio [%]",
- "Comp [Cycles/it]", "Comp [Cycles/Byte]", "Comp [Gbps]",
- "Decomp [Cycles/it]", "Decomp [Cycles/Byte]", "Decomp [Gbps]");
+ test_data->cleanup = ST_DURING_TEST;
+ total_nb_qps = nb_compressdevs * test_data->nb_qps;
- cleanup = ST_DURING_TEST;
- while (level <= test_data->level.max) {
+ i = 0;
+ uint8_t qp_id = 0, cdev_index = 0;
- /*
- * Run a first iteration, to verify compression and
- * get the compression ratio for the level
- */
- if (cperf_verification(test_data, level) != EXIT_SUCCESS)
- break;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
- /*
- * Run benchmarking test
- */
- if (cperf_benchmark(test_data, level) != EXIT_SUCCESS)
+ if (i == total_nb_qps)
break;
- printf("%6u%12zu%17.2f%19"PRIu64"%21.2f"
- "%15.2f%21"PRIu64"%23.2f%16.2f\n",
- level, test_data->comp_data_sz, test_data->ratio,
- test_data->comp_tsc_duration[level],
- test_data->comp_tsc_byte, test_data->comp_gbps,
- test_data->decomp_tsc_duration[level],
- test_data->decomp_tsc_byte, test_data->decomp_gbps);
+ cdev_id = enabled_cdevs[cdev_index];
+ ctx[i] = cperf_testmap[test_data->test].constructor(
+ cdev_id, qp_id,
+ test_data);
+ if (ctx[i] == NULL) {
+ RTE_LOG(ERR, USER1, "Test run constructor failed\n");
+ goto end;
+ }
+ qp_id = (qp_id + 1) % test_data->nb_qps;
+ if (qp_id == 0)
+ cdev_index++;
+ i++;
+ }
+
+ while (test_data->level <= test_data->level_lst.max) {
- if (test_data->level.inc != 0)
- level += test_data->level.inc;
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+
+ rte_eal_remote_launch(
+ cperf_testmap[test_data->test].runner,
+ ctx[i], lcore_id);
+ i++;
+ }
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+ if (i == total_nb_qps)
+ break;
+ ret |= rte_eal_wait_lcore(lcore_id);
+ i++;
+ }
+
+ if (ret != EXIT_SUCCESS)
+ break;
+
+ if (test_data->level_lst.inc != 0)
+ test_data->level += test_data->level_lst.inc;
else {
- if (++level_idx == test_data->level.count)
+ if (++level_idx == test_data->level_lst.count)
break;
- level = test_data->level.list[level_idx];
+ test_data->level = test_data->level_lst.list[level_idx];
}
}
end:
- switch (cleanup) {
+ switch (test_data->cleanup) {
case ST_DURING_TEST:
- case ST_PREPARE_BUF:
- free_bufs(test_data);
- /* fallthrough */
- case ST_MEMORY_ALLOC:
- rte_free(test_data->decomp_bufs);
- rte_free(test_data->comp_bufs);
- rte_free(test_data->decompressed_data);
- rte_free(test_data->compressed_data);
- rte_mempool_free(test_data->op_pool);
- rte_mempool_free(test_data->decomp_buf_pool);
- rte_mempool_free(test_data->comp_buf_pool);
+ i = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (i == total_nb_qps)
+ break;
+
+ if (ctx[i] && cperf_testmap[test_data->test].destructor)
+ cperf_testmap[test_data->test].destructor(
+ ctx[i]);
+ i++;
+ }
/* fallthrough */
case ST_INPUT_DATA:
rte_free(test_data->input_data);
/* fallthrough */
case ST_COMPDEV:
- if (test_data->cdev_id != -1)
- rte_compressdev_stop(test_data->cdev_id);
+ for (i = 0; i < nb_compressdevs &&
+ i < RTE_COMPRESS_MAX_DEVS; i++)
+ rte_compressdev_stop(enabled_cdevs[i]);
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
@@ -616,3 +440,44 @@ main(int argc, char **argv)
}
return ret;
}
+
+__rte_weak void *
+cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Benchmark test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_benchmark_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_benchmark_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
+__rte_weak void *
+cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
+ uint16_t qp_id __rte_unused,
+ struct comp_test_data *options __rte_unused)
+{
+ RTE_LOG(INFO, USER1, "Verify test is not supported yet\n");
+ return NULL;
+}
+
+__rte_weak void
+cperf_verify_test_destructor(void *arg __rte_unused)
+{
+
+}
+
+__rte_weak int
+cperf_verify_test_runner(void *test_ctx __rte_unused)
+{
+ return 0;
+}
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index ec73e5e02..00413c6d0 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,6 +4,5 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
- 'comp_perf_test_verify.c',
- 'comp_perf_test_benchmark.c')
+ 'comp_perf_test_common.c')
deps = ['compressdev']
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v8 2/7] app/test-compress-perf: add ptest command line option
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 1/7] app/test-compress-perf: add weak functions for multi-cores test Artur Trybula
@ 2019-07-08 18:16 ` Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 3/7] app/test-compress-perf: add verification test case Artur Trybula
` (5 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-08 18:16 UTC (permalink / raw)
To: dev, fiona.trahe, shallyv, adamx.dybkowski, arturx.trybula, akhil.goyal
Cc: Tomasz Jozwiak, Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds --ptest option to make possible to choose
test case from command line.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
.../comp_perf_options_parse.c | 32 +++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 74ea81d09..3d820197a 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -15,6 +15,7 @@
#include "comp_perf_options.h"
+#define CPERF_PTEST_TYPE ("ptest")
#define CPERF_DRIVER_NAME ("driver-name")
#define CPERF_TEST_FILE ("input-file")
#define CPERF_SEG_SIZE ("seg-sz")
@@ -37,6 +38,7 @@ static void
usage(char *progname)
{
printf("%s [EAL options] --\n"
+ " --ptest benchmark / verify :"
" --driver-name NAME: compress driver to use\n"
" --input-file NAME: file to compress and decompress\n"
" --extended-input-sz N: extend file data up to this size (default: no extension)\n"
@@ -75,6 +77,33 @@ get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
return -1;
}
+static int
+parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
+{
+ struct name_id_map cperftest_namemap[] = {
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
+ CPERF_TEST_TYPE_BENCHMARK
+ },
+ {
+ cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
+ CPERF_TEST_TYPE_VERIFY
+ }
+ };
+
+ int id = get_str_key_id_mapping(
+ (struct name_id_map *)cperftest_namemap,
+ RTE_DIM(cperftest_namemap), arg);
+ if (id < 0) {
+ RTE_LOG(ERR, USER1, "failed to parse test type");
+ return -1;
+ }
+
+ test_data->test = (enum cperf_perf_test_type)id;
+
+ return 0;
+}
+
static int
parse_uint32_t(uint32_t *value, const char *arg)
{
@@ -501,6 +530,8 @@ struct long_opt_parser {
};
static struct option lgopts[] = {
+
+ { CPERF_PTEST_TYPE, required_argument, 0, 0 },
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -519,6 +550,7 @@ static int
comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
{
struct long_opt_parser parsermap[] = {
+ { CPERF_PTEST_TYPE, parse_cperf_test_type },
{ CPERF_DRIVER_NAME, parse_driver_name },
{ CPERF_TEST_FILE, parse_test_file },
{ CPERF_SEG_SIZE, parse_seg_sz },
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v8 3/7] app/test-compress-perf: add verification test case
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 1/7] app/test-compress-perf: add weak functions for multi-cores test Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 2/7] app/test-compress-perf: add ptest command line option Artur Trybula
@ 2019-07-08 18:16 ` Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 4/7] app/test-compress-perf: add benchmark " Artur Trybula
` (4 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-08 18:16 UTC (permalink / raw)
To: dev, fiona.trahe, shallyv, adamx.dybkowski, arturx.trybula, akhil.goyal
Cc: Tomasz Jozwiak, Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a verification part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/Makefile | 1 +
.../comp_perf_test_verify.c | 123 +++++++++++++-----
.../comp_perf_test_verify.h | 24 +++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
5 files changed, 113 insertions(+), 37 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index de7412961..f54d9a4dd 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -12,6 +12,7 @@ CFLAGS += -O3
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
+SRCS-y += comp_perf_test_verify.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 28a0fe873..7be30ee13 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -8,14 +8,49 @@
#include <rte_compressdev.h>
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_common.h"
+
+void
+cperf_verify_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)->mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_verify_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);
+
+ if (ctx == NULL)
+ return NULL;
+
+ ctx->mem.dev_id = dev_id;
+ ctx->mem.qp_id = qp_id;
+ ctx->options = options;
+
+ if (!comp_perf_allocate_memory(ctx->options, &ctx->mem) &&
+ !prepare_bufs(ctx->options, &ctx->mem))
+ return ctx;
+
+ cperf_verify_test_destructor(ctx);
+ return NULL;
+}
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type,
- uint8_t *output_data_ptr,
- size_t *output_data_sz)
+main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->options;
+ uint8_t *output_data_ptr;
+ size_t *output_data_sz;
+ struct cperf_mem_resources *mem = &ctx->mem;
+
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -33,7 +68,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -42,7 +77,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -50,14 +85,16 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ output_data_ptr = ctx->mem.compressed_data;
+ output_data_sz = &ctx->comp_data_sz;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -69,8 +106,10 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ output_data_ptr = ctx->mem.decompressed_data;
+ output_data_sz = &ctx->decomp_data_sz;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -85,8 +124,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
num_iter = 1;
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +152,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +188,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +205,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -220,15 +261,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -291,7 +334,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
@@ -300,45 +343,45 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (output_data_sz)
*output_data_sz = output_size;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
-
-
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level)
+cperf_verify_test_runner(void *test_ctx)
{
+ struct cperf_verify_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->options;
int ret = EXIT_SUCCESS;
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+ uint32_t lcore = rte_lcore_id();
+
+ ctx->mem.lcore_id = lcore;
test_data->ratio = 0;
- if (main_loop(test_data, level, RTE_COMP_COMPRESS,
- test_data->compressed_data,
- &test_data->comp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS,
- test_data->decompressed_data,
- &test_data->decomp_data_sz) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
- if (test_data->decomp_data_sz != test_data->input_data_sz) {
+ if (ctx->decomp_data_sz != test_data->input_data_sz) {
RTE_LOG(ERR, USER1,
"Decompressed data length not equal to input data length\n");
RTE_LOG(ERR, USER1,
"Decompressed size = %zu, expected = %zu\n",
- test_data->decomp_data_sz, test_data->input_data_sz);
+ ctx->decomp_data_sz, test_data->input_data_sz);
ret = EXIT_FAILURE;
goto end;
} else {
- if (memcmp(test_data->decompressed_data,
+ if (memcmp(ctx->mem.decompressed_data,
test_data->input_data,
test_data->input_data_sz) != 0) {
RTE_LOG(ERR, USER1,
@@ -348,9 +391,19 @@ cperf_verification(struct comp_test_data *test_data, uint8_t level)
}
}
- test_data->ratio = (double) test_data->comp_data_sz /
+ ctx->ratio = (double) ctx->comp_data_sz /
test_data->input_data_sz * 100;
+ if (!ctx->silent) {
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]");
+ }
+ printf("%12u%6u%12zu%17.2f\n",
+ ctx->mem.lcore_id,
+ test_data->level, ctx->comp_data_sz, ctx->ratio);
+ }
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.h b/app/test-compress-perf/comp_perf_test_verify.h
index 67c6b4980..ae8b7429c 100644
--- a/app/test-compress-perf/comp_perf_test_verify.h
+++ b/app/test-compress-perf/comp_perf_test_verify.h
@@ -1,13 +1,33 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018-2019 Intel Corporation
*/
#ifndef _COMP_PERF_TEST_VERIFY_
#define _COMP_PERF_TEST_VERIFY_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+
+struct cperf_verify_ctx {
+ struct cperf_mem_resources mem;
+ struct comp_test_data *options;
+
+ int silent;
+ size_t comp_data_sz;
+ size_t decomp_data_sz;
+ double ratio;
+};
+
+void
+cperf_verify_test_destructor(void *arg);
int
-cperf_verification(struct comp_test_data *test_data, uint8_t level);
+cperf_verify_test_runner(void *test_ctx);
+
+void *
+cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 3a3da4c90..51ca9f5b7 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -8,6 +8,7 @@
#include <rte_compressdev.h>
#include "comp_perf_options.h"
+#include "comp_perf_test_verify.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index 00413c6d0..c6246e503 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -4,5 +4,6 @@
allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
+ 'comp_perf_test_verify.c',
'comp_perf_test_common.c')
deps = ['compressdev']
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v8 4/7] app/test-compress-perf: add benchmark test case
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
` (2 preceding siblings ...)
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 3/7] app/test-compress-perf: add verification test case Artur Trybula
@ 2019-07-08 18:16 ` Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 5/7] doc: update dpdk-test-compress-perf description Artur Trybula
` (3 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-08 18:16 UTC (permalink / raw)
To: dev, fiona.trahe, shallyv, adamx.dybkowski, arturx.trybula, akhil.goyal
Cc: Tomasz Jozwiak, Tomasz Jozwiak
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 13608 bytes --]
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a benchmark part to
compression-perf-tool as a separate test case, which can be
executed multi-threaded.
Also updates release notes.
Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/Makefile | 1 +
.../comp_perf_test_benchmark.c | 140 +++++++++++++-----
.../comp_perf_test_benchmark.h | 25 +++-
app/test-compress-perf/main.c | 1 +
app/test-compress-perf/meson.build | 1 +
doc/guides/rel_notes/release_19_08.rst | 27 ++++
6 files changed, 157 insertions(+), 38 deletions(-)
diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile
index f54d9a4dd..d1a6820e6 100644
--- a/app/test-compress-perf/Makefile
+++ b/app/test-compress-perf/Makefile
@@ -13,6 +13,7 @@ CFLAGS += -O3
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
SRCS-y += comp_perf_test_verify.c
+SRCS-y += comp_perf_test_benchmark.c
SRCS-y += comp_perf_test_common.c
include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index 5752906b3..e0f852bf0 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -10,11 +10,46 @@
#include "comp_perf_test_benchmark.h"
+void
+cperf_benchmark_test_destructor(void *arg)
+{
+ if (arg) {
+ comp_perf_free_memory(
+ &((struct cperf_benchmark_ctx *)arg)->ver.mem);
+ rte_free(arg);
+ }
+}
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options)
+{
+ struct cperf_benchmark_ctx *ctx = NULL;
+
+ ctx = rte_malloc(NULL, sizeof(struct cperf_benchmark_ctx), 0);
+
+ if (ctx == NULL)
+ return NULL;
+
+ ctx->ver.mem.dev_id = dev_id;
+ ctx->ver.mem.qp_id = qp_id;
+ ctx->ver.options = options;
+ ctx->ver.silent = 1; /* ver. part will be silent */
+
+ if (!comp_perf_allocate_memory(ctx->ver.options, &ctx->ver.mem)
+ && !prepare_bufs(ctx->ver.options, &ctx->ver.mem))
+ return ctx;
+
+ cperf_benchmark_test_destructor(ctx);
+ return NULL;
+}
+
static int
-main_loop(struct comp_test_data *test_data, uint8_t level,
- enum rte_comp_xform_type type)
+main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
{
- uint8_t dev_id = test_data->cdev_id;
+ struct comp_test_data *test_data = ctx->ver.options;
+ struct cperf_mem_resources *mem = &ctx->ver.mem;
+ uint8_t dev_id = mem->dev_id;
uint32_t i, iter, num_iter;
struct rte_comp_op **ops, **deq_ops;
void *priv_xform = NULL;
@@ -31,7 +66,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
ops = rte_zmalloc_socket(NULL,
- 2 * test_data->total_bufs * sizeof(struct rte_comp_op *),
+ 2 * mem->total_bufs * sizeof(struct rte_comp_op *),
0, rte_socket_id());
if (ops == NULL) {
@@ -40,7 +75,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
return -1;
}
- deq_ops = &ops[test_data->total_bufs];
+ deq_ops = &ops[mem->total_bufs];
if (type == RTE_COMP_COMPRESS) {
xform = (struct rte_comp_xform) {
@@ -48,14 +83,14 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.compress = {
.algo = RTE_COMP_ALGO_DEFLATE,
.deflate.huffman = test_data->huffman_enc,
- .level = level,
+ .level = test_data->level,
.window_size = test_data->window_sz,
.chksum = RTE_COMP_CHECKSUM_NONE,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->decomp_bufs;
- output_bufs = test_data->comp_bufs;
+ input_bufs = mem->decomp_bufs;
+ output_bufs = mem->comp_bufs;
out_seg_sz = test_data->out_seg_sz;
} else {
xform = (struct rte_comp_xform) {
@@ -67,8 +102,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
.hash_algo = RTE_COMP_HASH_ALGO_NONE
}
};
- input_bufs = test_data->comp_bufs;
- output_bufs = test_data->decomp_bufs;
+ input_bufs = mem->comp_bufs;
+ output_bufs = mem->decomp_bufs;
out_seg_sz = test_data->seg_sz;
}
@@ -82,13 +117,13 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
uint64_t tsc_start, tsc_end, tsc_duration;
- tsc_start = tsc_end = tsc_duration = 0;
- tsc_start = rte_rdtsc();
num_iter = test_data->num_iter;
+ tsc_start = tsc_end = tsc_duration = 0;
+ tsc_start = rte_rdtsc_precise();
for (iter = 0; iter < num_iter; iter++) {
- uint32_t total_ops = test_data->total_bufs;
- uint32_t remaining_ops = test_data->total_bufs;
+ uint32_t total_ops = mem->total_bufs;
+ uint32_t remaining_ops = mem->total_bufs;
uint32_t total_deq_ops = 0;
uint32_t total_enq_ops = 0;
uint16_t ops_unused = 0;
@@ -113,7 +148,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
/* Allocate compression operations */
if (ops_needed && !rte_comp_op_bulk_alloc(
- test_data->op_pool,
+ mem->op_pool,
&ops[ops_unused],
ops_needed)) {
RTE_LOG(ERR, USER1,
@@ -149,7 +184,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
ops[op_id]->private_xform = priv_xform;
}
- num_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,
+ num_enq = rte_compressdev_enqueue_burst(dev_id,
+ mem->qp_id, ops,
num_ops);
if (num_enq == 0) {
struct rte_compressdev_stats stats;
@@ -165,7 +201,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
remaining_ops -= num_enq;
total_enq_ops += num_enq;
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops += num_deq;
@@ -177,7 +214,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -198,15 +235,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
- num_deq = rte_compressdev_dequeue_burst(dev_id, 0,
- deq_ops, test_data->burst_sz);
+ num_deq = rte_compressdev_dequeue_burst(dev_id,
+ mem->qp_id,
+ deq_ops,
+ test_data->burst_sz);
if (num_deq == 0) {
struct rte_compressdev_stats stats;
@@ -226,7 +265,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
if (op->status !=
RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
- "Some operations were not successful\n");
+ "Some operations were not successful\n");
goto end;
}
@@ -247,65 +286,92 @@ main_loop(struct comp_test_data *test_data, uint8_t level,
}
}
}
- rte_mempool_put_bulk(test_data->op_pool,
+ rte_mempool_put_bulk(mem->op_pool,
(void **)deq_ops, num_deq);
allocated -= num_deq;
}
}
- tsc_end = rte_rdtsc();
+ tsc_end = rte_rdtsc_precise();
tsc_duration = tsc_end - tsc_start;
if (type == RTE_COMP_COMPRESS)
- test_data->comp_tsc_duration[level] =
+ ctx->comp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
else
- test_data->decomp_tsc_duration[level] =
+ ctx->decomp_tsc_duration[test_data->level] =
tsc_duration / num_iter;
end:
- rte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);
+ rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
return res;
}
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level)
+cperf_benchmark_test_runner(void *test_ctx)
{
+ struct cperf_benchmark_ctx *ctx = test_ctx;
+ struct comp_test_data *test_data = ctx->ver.options;
+ uint32_t lcore = rte_lcore_id();
+ static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+
+ ctx->ver.mem.lcore_id = lcore;
int i, ret = EXIT_SUCCESS;
+ /*
+ * First the verification part is needed
+ */
+ if (cperf_verify_test_runner(&ctx->ver)) {
+ ret = EXIT_FAILURE;
+ goto end;
+ }
+
/*
* Run the tests twice, discarding the first performance
* results, before the cache is warmed up
*/
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_COMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
for (i = 0; i < 2; i++) {
- if (main_loop(test_data, level, RTE_COMP_DECOMPRESS) < 0) {
+ if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {
ret = EXIT_FAILURE;
goto end;
}
}
- test_data->comp_tsc_byte =
- (double)(test_data->comp_tsc_duration[level]) /
+ ctx->comp_tsc_byte =
+ (double)(ctx->comp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->decomp_tsc_byte =
- (double)(test_data->decomp_tsc_duration[level]) /
+ ctx->decomp_tsc_byte =
+ (double)(ctx->decomp_tsc_duration[test_data->level]) /
test_data->input_data_sz;
- test_data->comp_gbps = rte_get_tsc_hz() / test_data->comp_tsc_byte * 8 /
+ ctx->comp_gbps = rte_get_tsc_hz() / ctx->comp_tsc_byte * 8 /
+ 1000000000;
+
+ ctx->decomp_gbps = rte_get_tsc_hz() / ctx->decomp_tsc_byte * 8 /
1000000000;
- test_data->decomp_gbps = rte_get_tsc_hz() / test_data->decomp_tsc_byte
- * 8 / 1000000000;
+ if (rte_atomic16_test_and_set(&display_once)) {
+ printf("%12s%6s%12s%17s%15s%16s\n",
+ "lcore id", "Level", "Comp size", "Comp ratio [%]",
+ "Comp [Gbps]", "Decomp [Gbps]");
+ }
+
+ printf("%12u%6u%12zu%17.2f%15.2f%16.2f\n",
+ ctx->ver.mem.lcore_id,
+ test_data->level, ctx->ver.comp_data_sz, ctx->ver.ratio,
+ ctx->comp_gbps,
+ ctx->decomp_gbps);
+
end:
return ret;
}
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.h b/app/test-compress-perf/comp_perf_test_benchmark.h
index b193445a3..d9b2694b8 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.h
+++ b/app/test-compress-perf/comp_perf_test_benchmark.h
@@ -5,9 +5,32 @@
#ifndef _COMP_PERF_TEST_BENCHMARK_
#define _COMP_PERF_TEST_BENCHMARK_
+#include <stdint.h>
+
#include "comp_perf_options.h"
+#include "comp_perf_test_common.h"
+#include "comp_perf_test_verify.h"
+
+struct cperf_benchmark_ctx {
+ struct cperf_verify_ctx ver;
+
+ /* Store TSC duration for all levels (including level 0) */
+ uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
+ double comp_gbps;
+ double decomp_gbps;
+ double comp_tsc_byte;
+ double decomp_tsc_byte;
+};
+
+void
+cperf_benchmark_test_destructor(void *arg);
int
-cperf_benchmark(struct comp_test_data *test_data, uint8_t level);
+cperf_benchmark_test_runner(void *test_ctx);
+
+void *
+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,
+ struct comp_test_data *options);
#endif
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 51ca9f5b7..dd6ef9a6d 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -9,6 +9,7 @@
#include "comp_perf_options.h"
#include "comp_perf_test_verify.h"
+#include "comp_perf_test_benchmark.h"
#include "comp_perf.h"
#include "comp_perf_test_common.h"
diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build
index c6246e503..1136f04bc 100644
--- a/app/test-compress-perf/meson.build
+++ b/app/test-compress-perf/meson.build
@@ -5,5 +5,6 @@ allow_experimental_apis = true
sources = files('comp_perf_options_parse.c',
'main.c',
'comp_perf_test_verify.c',
+ 'comp_perf_test_benchmark.c',
'comp_perf_test_common.c')
deps = ['compressdev']
diff --git a/doc/guides/rel_notes/release_19_08.rst b/doc/guides/rel_notes/release_19_08.rst
index 8480112b9..ed7f6e250 100644
--- a/doc/guides/rel_notes/release_19_08.rst
+++ b/doc/guides/rel_notes/release_19_08.rst
@@ -190,6 +190,29 @@ New Features
Added telemetry mode to l3fwd-power application to report
application level busyness, empty and full polls of rte_eth_rx_burst().
+* **Updated the QuickAssist Technology (QAT) symmetric crypto PMD.**
+
+ Added support for digest-encrypted cases where digest is appended
+ to the data.
+
+* **Added a FPGA_LTE_FEC bbdev PMD.**
+
+ Added the new ``fpga_lte_fec`` bbdev driver for the Intel® FPGA PAC
+ (Programmable Acceleration Card) N3000. See the
+ :doc:`../bbdevs/fpga_lte_fec` BBDEV guide for more details on this new driver.
+
+* **Updated TURBO_SW bbdev PMD.**
+
+ Updated the ``turbo_sw`` bbdev driver with changes including:
+
+ * Added option to build the driver with or without dependency of external
+ SDK libraries.
+ * Added support for 5GNR encode/decode operations.
+
+* **Updated test-compress-perf tool application.**
+
+ Added multiple cores feature to compression perf tool application.
+
Removed Items
-------------
@@ -259,6 +282,10 @@ API Changes
offload flag from the library. The application must set this flag if it is
supported by the platform and application wishes to use it.
+* cryptodev: the ``uint8_t *data`` member of ``key`` structure in the xforms
+ structure (``rte_crypto_cipher_xform``, ``rte_crypto_auth_xform``, and
+ ``rte_crypto_aead_xform``) have been changed to ``const uint8_t *data``.
+
ABI Changes
-----------
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v8 5/7] doc: update dpdk-test-compress-perf description
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
` (3 preceding siblings ...)
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 4/7] app/test-compress-perf: add benchmark " Artur Trybula
@ 2019-07-08 18:16 ` Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 6/7] app/test-compress-perf: add force process termination Artur Trybula
` (2 subsequent siblings)
7 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-08 18:16 UTC (permalink / raw)
To: dev, fiona.trahe, shallyv, adamx.dybkowski, arturx.trybula, akhil.goyal
Cc: Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch updates dpdk-test-compress-perf documentation.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
doc/guides/tools/comp_perf.rst | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/doc/guides/tools/comp_perf.rst b/doc/guides/tools/comp_perf.rst
index 52869c18c..71eef1821 100644
--- a/doc/guides/tools/comp_perf.rst
+++ b/doc/guides/tools/comp_perf.rst
@@ -6,7 +6,9 @@ dpdk-test-compress-perf Tool
The ``dpdk-test-compress-perf`` tool is a Data Plane Development Kit (DPDK)
utility that allows measuring performance parameters of PMDs available in the
-compress tree. The tool reads the data from a file (--input-file),
+compress tree. User can use multiple cores to run tests on but only
+one type of compression PMD can be measured during single application
+execution. The tool reads the data from a file (--input-file),
dumps all the file into a buffer and fills out the data of input mbufs,
which are passed to compress device with compression operations.
Then, the output buffers are fed into the decompression stage, and the resulting
@@ -26,9 +28,35 @@ Limitations
* Stateful operation is not supported in this version.
+EAL Options
+~~~~~~~~~~~
+
+The following are the EAL command-line options that can be used in conjunction
+with the ``dpdk-test-compress-perf`` application.
+See the DPDK Getting Started Guides for more information on these options.
+
+* ``-c <COREMASK>`` or ``-l <CORELIST>``
+
+ Set the hexadecimal bitmask of the cores to run on. The corelist is a
+ list cores to use.
+
+.. Note::
+
+ One lcore is needed for process admin, tests are run on all other cores.
+ To run tests on two lcores, three lcores must be passed to the tool.
+
+* ``-w <PCI>``
+
+ Add a PCI device in white list.
+
+* ``--vdev <driver><id>``
+
+ Add a virtual device.
+
+Appication Options
+~~~~~~~~~~~~~~~~~~
-Command line options
---------------------
+ ``--ptest [benchmark/verify]``: set test type (default: benchmark)
``--driver-name NAME``: compress driver to use
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v8 6/7] app/test-compress-perf: add force process termination
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
` (4 preceding siblings ...)
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 5/7] doc: update dpdk-test-compress-perf description Artur Trybula
@ 2019-07-08 18:16 ` Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 7/7] app/test-compress-perf: 'magic numbers' removed Artur Trybula
2019-07-15 13:12 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Akhil Goyal
7 siblings, 0 replies; 87+ messages in thread
From: Artur Trybula @ 2019-07-08 18:16 UTC (permalink / raw)
To: dev, fiona.trahe, shallyv, adamx.dybkowski, arturx.trybula, akhil.goyal
Cc: Tomasz Jozwiak
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a possibility to force controlled process termination
as a result of two signals: SIGTERM and SIGINT
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/comp_perf_options.h | 1 +
.../comp_perf_test_benchmark.c | 13 ++++++++++
.../comp_perf_test_verify.c | 14 ++++++++++
app/test-compress-perf/main.c | 26 +++++++++++++++++--
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0aa29a599..532fb964e 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -67,6 +67,7 @@ struct comp_test_data {
double ratio;
enum cleanup_st cleanup;
+ int perf_comp_force_stop;
};
int
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index e0f852bf0..aa1f8eea2 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -184,6 +184,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -242,6 +245,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -306,6 +312,13 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
return res;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 7be30ee13..37ac38da6 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -188,6 +188,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -268,6 +271,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -346,6 +352,14 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
+
return res;
}
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index dd6ef9a6d..e746e4708 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -2,6 +2,10 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include <rte_malloc.h>
#include <rte_eal.h>
#include <rte_log.h>
@@ -36,6 +40,8 @@ static const struct cperf_test cperf_testmap[] = {
}
};
+static struct comp_test_data *test_data;
+
static int
comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
@@ -277,12 +283,24 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
+static void
+comp_perf_cleanup_on_signal(int signalNumber __rte_unused)
+{
+ test_data->perf_comp_force_stop = 1;
+}
+
+static void
+comp_perf_register_cleanup_on_signal(void)
+{
+ signal(SIGTERM, comp_perf_cleanup_on_signal);
+ signal(SIGINT, comp_perf_cleanup_on_signal);
+}
+
int
main(int argc, char **argv)
{
uint8_t level_idx = 0;
int ret, i;
- struct comp_test_data *test_data;
void *ctx[RTE_MAX_LCORE] = {};
uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
int nb_compressdevs = 0;
@@ -304,6 +322,8 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d\n",
rte_socket_id());
+ comp_perf_register_cleanup_on_signal();
+
ret = EXIT_SUCCESS;
test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
@@ -424,8 +444,10 @@ main(int argc, char **argv)
/* fallthrough */
case ST_COMPDEV:
for (i = 0; i < nb_compressdevs &&
- i < RTE_COMPRESS_MAX_DEVS; i++)
+ i < RTE_COMPRESS_MAX_DEVS; i++) {
rte_compressdev_stop(enabled_cdevs[i]);
+ rte_compressdev_close(enabled_cdevs[i]);
+ }
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v8 7/7] app/test-compress-perf: 'magic numbers' removed
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
` (5 preceding siblings ...)
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 6/7] app/test-compress-perf: add force process termination Artur Trybula
@ 2019-07-08 18:16 ` Artur Trybula
2019-07-15 10:03 ` Trahe, Fiona
2019-07-15 13:12 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Akhil Goyal
7 siblings, 1 reply; 87+ messages in thread
From: Artur Trybula @ 2019-07-08 18:16 UTC (permalink / raw)
To: dev, fiona.trahe, shallyv, adamx.dybkowski, arturx.trybula, akhil.goyal
This patch fixes some minor problems like 'magic numbers',
spelling mistakes, enumes naming.
Signed-off-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/comp_perf_options.h | 10 ++++------
app/test-compress-perf/comp_perf_options_parse.c | 6 +++---
app/test-compress-perf/comp_perf_test_common.c | 7 ++++---
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 532fb964e..5a32ed3a6 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -5,8 +5,6 @@
#ifndef _COMP_PERF_OPS_
#define _COMP_PERF_OPS_
-#define MAX_DRIVER_NAME 64
-#define MAX_INPUT_FILE_NAME 64
#define MAX_LIST 32
#define MIN_COMPRESSED_BUF_SIZE 8
#define EXPANSE_RATIO 1.05
@@ -25,7 +23,7 @@ enum cleanup_st {
ST_DURING_TEST
};
-enum cperf_perf_test_type {
+enum cperf_test_type {
CPERF_TEST_TYPE_BENCHMARK,
CPERF_TEST_TYPE_VERIFY
};
@@ -45,9 +43,9 @@ struct range_list {
};
struct comp_test_data {
- char driver_name[64];
- char input_file[64];
- enum cperf_perf_test_type test;
+ char driver_name[RTE_DEV_NAME_MAX_LEN];
+ char input_file[PATH_MAX];
+ enum cperf_test_type test;
uint8_t *input_data;
size_t input_data_sz;
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 3d820197a..01e19eafb 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -99,7 +99,7 @@ parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
return -1;
}
- test_data->test = (enum cperf_perf_test_type)id;
+ test_data->test = (enum cperf_test_type)id;
return 0;
}
@@ -614,8 +614,8 @@ comp_perf_options_default(struct comp_test_data *test_data)
test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
test_data->test_op = COMPRESS_DECOMPRESS;
test_data->window_sz = -1;
- test_data->level_lst.min = 1;
- test_data->level_lst.max = 9;
+ test_data->level_lst.min = RTE_COMP_LEVEL_MIN;
+ test_data->level_lst.max = RTE_COMP_LEVEL_MAX;
test_data->level_lst.inc = 1;
test_data->test = CPERF_TEST_TYPE_BENCHMARK;
}
diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
index dc9d0b0f4..472c76686 100644
--- a/app/test-compress-perf/comp_perf_test_common.c
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -7,11 +7,12 @@
#include <rte_log.h>
#include <rte_compressdev.h>
+#include "comp_perf.h"
#include "comp_perf_options.h"
-#include "comp_perf_test_verify.h"
#include "comp_perf_test_benchmark.h"
-#include "comp_perf.h"
#include "comp_perf_test_common.h"
+#include "comp_perf_test_verify.h"
+
#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
@@ -49,7 +50,7 @@ find_buf_size(uint32_t input_size)
* power of 2 but also should be enough to store incompressible data
*/
- /* We're looking for nearest power of 2 buffer size, which is greather
+ /* We're looking for nearest power of 2 buffer size, which is greater
* than input_size
*/
uint32_t size =
--
2.17.1
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v8 7/7] app/test-compress-perf: 'magic numbers' removed
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 7/7] app/test-compress-perf: 'magic numbers' removed Artur Trybula
@ 2019-07-15 10:03 ` Trahe, Fiona
0 siblings, 0 replies; 87+ messages in thread
From: Trahe, Fiona @ 2019-07-15 10:03 UTC (permalink / raw)
To: Trybula, ArturX, dev, shallyv, Dybkowski, AdamX, akhil.goyal
> -----Original Message-----
> From: Trybula, ArturX
> Sent: Monday, July 8, 2019 7:16 PM
> To: dev@dpdk.org; Trahe, Fiona <fiona.trahe@intel.com>; shallyv@marvell.com; Dybkowski, AdamX
> <adamx.dybkowski@intel.com>; Trybula, ArturX <arturx.trybula@intel.com>; akhil.goyal@nxp.com
> Subject: [PATCH v8 7/7] app/test-compress-perf: 'magic numbers' removed
>
> This patch fixes some minor problems like 'magic numbers',
> spelling mistakes, enumes naming.
>
> Signed-off-by: Artur Trybula <arturx.trybula@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
` (6 preceding siblings ...)
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 7/7] app/test-compress-perf: 'magic numbers' removed Artur Trybula
@ 2019-07-15 13:12 ` Akhil Goyal
7 siblings, 0 replies; 87+ messages in thread
From: Akhil Goyal @ 2019-07-15 13:12 UTC (permalink / raw)
To: Artur Trybula, dev, fiona.trahe, shallyv, adamx.dybkowski
>
> This patchset adds multiple cores feature to compression perf tool.
> All structures have been aligned and are consistent with crypto perf tool.
> All test cases have constructor, runner and destructor and can use more
> cores and compression devices at the same time.
>
> v8 changes:
> - some minor fixes (e.g. 'magic numbers', spelling mistake,
> enum naming)
>
> v7 changes:
> - rebase as patch failed to apply due to release note clash
> - moved release note change to patch 4 as more appropriate
>
> v6 changes:
> - rebase to the recent master (before applying)
> commit 82b9677cb23c
>
> v5 changes:
> - changed ctx null ptr detection inside constructors
>
> v4 changes:
> - moved release notes update to patch 1
> - removed pmd cyclecount template
>
> v3 changes:
> - merged with commit 2f6527b70c15
> app/compress-perf: add prints for socket id
> - fixed wrong compression/decompression throughput calculation
>
> v2 changes:
> - fixed max_nb_queue_pairs detection. Based on compression API
> if max_nb_queue_pairs = 0 that means there is no limit in
> maximum number of queue pairs
> - fixed qp setup on the last device
>
>
> Artur Trybula (1):
> app/test-compress-perf: 'magic numbers' removed
>
> Tomasz Jozwiak (6):
> app/test-compress-perf: add weak functions for multi-cores test
> app/test-compress-perf: add ptest command line option
> app/test-compress-perf: add verification test case
> app/test-compress-perf: add benchmark test case
> doc: update dpdk-test-compress-perf description
> app/test-compress-perf: add force process termination
>
> app/test-compress-perf/Makefile | 1 +
> app/test-compress-perf/comp_perf.h | 50 ++
> app/test-compress-perf/comp_perf_options.h | 51 +-
> .../comp_perf_options_parse.c | 54 +-
> .../comp_perf_test_benchmark.c | 153 +++--
> .../comp_perf_test_benchmark.h | 25 +-
> .../comp_perf_test_common.c | 285 +++++++++
> .../comp_perf_test_common.h | 41 ++
> .../comp_perf_test_verify.c | 137 +++-
> .../comp_perf_test_verify.h | 24 +-
> app/test-compress-perf/main.c | 605 +++++++-----------
> app/test-compress-perf/meson.build | 3 +-
> doc/guides/rel_notes/release_19_08.rst | 27 +
> doc/guides/tools/comp_perf.rst | 34 +-
> 14 files changed, 1019 insertions(+), 471 deletions(-)
> create mode 100644 app/test-compress-perf/comp_perf.h
> create mode 100644 app/test-compress-perf/comp_perf_test_common.c
> create mode 100644 app/test-compress-perf/comp_perf_test_common.h
>
> Series acked-by: Shally Verma <shallyv@marvell.com>
> --
> 2.17.1
Applied to dpdk-next-crypto
^ permalink raw reply [flat|nested] 87+ messages in thread
end of thread, other threads:[~2019-07-15 13:12 UTC | newest]
Thread overview: 87+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-30 8:06 [dpdk-dev] [PATCH v1 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
2019-06-03 13:35 ` [dpdk-dev] [EXT] " Shally Verma
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
2019-06-26 17:13 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-26 17:34 ` Tomasz Jozwiak
2019-06-27 4:41 ` Shally Verma
2019-06-27 21:27 ` Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
2019-06-26 21:26 ` Thomas Monjalon
2019-06-27 21:25 ` Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 2/6] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
2019-06-30 14:41 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 3/6] app/test-compress-perf: add verification test case Tomasz Jozwiak
2019-06-30 14:55 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-30 21:02 ` Tomasz Jozwiak
2019-07-01 4:29 ` Shally Verma
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 4/6] app/test-compress-perf: add benchmark " Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 5/6] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
2019-06-30 14:56 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 6/6] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-06-30 15:00 ` [dpdk-dev] [EXT] " Shally Verma
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-07-02 10:03 ` Trybula, ArturX
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 1/6] app/test-compress-perf: add weak functions for multi-cores test Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 2/6] app/test-compress-perf: add ptest command line option Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 3/6] app/test-compress-perf: add verification test case Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 4/6] app/test-compress-perf: add benchmark " Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 5/6] doc: update dpdk-test-compress-perf description Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 6/6] app/test-compress-perf: add force process termination Artur Trybula
2019-07-05 9:50 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Shally Verma
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 " Fiona Trahe
2019-07-06 9:36 ` [dpdk-dev] [EXT] " Shally Verma
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 1/6] app/test-compress-perf: add weak functions for multi-cores test Fiona Trahe
2019-07-06 9:31 ` [dpdk-dev] [EXT] " Shally Verma
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 1/7] app/test-compress-perf: add weak functions for multi-cores test Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 2/7] app/test-compress-perf: add ptest command line option Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 3/7] app/test-compress-perf: add verification test case Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 4/7] app/test-compress-perf: add benchmark " Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 5/7] doc: update dpdk-test-compress-perf description Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 6/7] app/test-compress-perf: add force process termination Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 7/7] app/test-compress-perf: 'magic numbers' removed Artur Trybula
2019-07-15 10:03 ` Trahe, Fiona
2019-07-15 13:12 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Akhil Goyal
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 2/6] app/test-compress-perf: add ptest command line option Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 3/6] app/test-compress-perf: add verification test case Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 4/6] app/test-compress-perf: add benchmark " Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 5/6] doc: update dpdk-test-compress-perf description Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 6/6] app/test-compress-perf: add force process termination Fiona Trahe
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 2/6] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
2019-07-02 10:05 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 3/6] app/test-compress-perf: add verification test case Tomasz Jozwiak
2019-07-02 10:02 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 4/6] app/test-compress-perf: add benchmark " Tomasz Jozwiak
2019-07-02 10:02 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 5/6] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
2019-07-02 10:04 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 6/6] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-07-02 10:02 ` Trybula, ArturX
2019-07-03 10:21 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Akhil Goyal
2019-07-03 12:20 ` Tomasz Jóźwiak
[not found] ` <1560031175-13787-1-git-send-email-tjozwiakgm@gmail.com>
2019-06-09 4:53 ` [dpdk-dev] [EXT] [PATCH v2 0/7] " Shally Verma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).