From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <honest.jiang@foxmail.com>
Cc: <dev@dpdk.org>, <liuyonglong@huawei.com>, <vattunuru@marvell.com>
Subject: [PATCH v4 07/14] app/dma-perf: remove invalid or redundant field
Date: Mon, 20 Oct 2025 12:10:58 +0800 [thread overview]
Message-ID: <20251020041105.1590-8-fengchengwen@huawei.com> (raw)
In-Reply-To: <20251020041105.1590-1-fengchengwen@huawei.com>
Remove invalid or redundant fields to make code more clean.
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Vamsi Attunuru <vattunuru@marvell.com>
---
app/test-dma-perf/benchmark.c | 19 +++++++++----------
app/test-dma-perf/main.c | 21 +++++----------------
app/test-dma-perf/main.h | 12 ++++++------
3 files changed, 20 insertions(+), 32 deletions(-)
diff --git a/app/test-dma-perf/benchmark.c b/app/test-dma-perf/benchmark.c
index a3e530a665..c0a6e3d4d7 100644
--- a/app/test-dma-perf/benchmark.c
+++ b/app/test-dma-perf/benchmark.c
@@ -104,7 +104,7 @@ output_result(struct test_configure *cfg, struct lcore_params *para,
uint32_t lcore_id = para->lcore_id;
char *dma_name = para->dma_name;
- if (cfg->is_dma) {
+ if (cfg->test_type == TEST_TYPE_DMA_MEM_COPY) {
printf("lcore %u, DMA %s, DMA Ring Size: %u, Kick Batch Size: %u", lcore_id,
dma_name, ring_size, kick_batch);
if (cfg->is_sg)
@@ -119,7 +119,7 @@ output_result(struct test_configure *cfg, struct lcore_params *para,
ave_cycle, buf_size, nr_buf, memory, rte_get_timer_hz()/1000000000.0);
printf("Average Bandwidth: %.3lf Gbps, MOps: %.3lf\n", bandwidth, mops);
- if (cfg->is_dma)
+ if (cfg->test_type == TEST_TYPE_DMA_MEM_COPY)
output_csv(CSV_LINE_DMA_FMT,
scenario_id, lcore_id, dma_name, ring_size, kick_batch, buf_size,
nr_buf, memory, ave_cycle, bandwidth, mops);
@@ -502,14 +502,14 @@ dummy_free_ext_buf(void *addr, void *opaque)
}
static int
-setup_memory_env(struct test_configure *cfg, struct rte_mbuf ***srcs, struct rte_mbuf ***dsts,
+setup_memory_env(struct test_configure *cfg, uint32_t nr_buf,
+ struct rte_mbuf ***srcs, struct rte_mbuf ***dsts,
struct rte_dma_sge **src_sges, struct rte_dma_sge **dst_sges,
struct rte_dma_op ***dma_ops)
{
unsigned int cur_buf_size = cfg->buf_size.cur;
unsigned int buf_size = cur_buf_size + RTE_PKTMBUF_HEADROOM;
bool is_src_numa_incorrect, is_dst_numa_incorrect;
- uint32_t nr_buf = cfg->nr_buf;
unsigned int nr_sockets;
uintptr_t ops;
uint32_t i;
@@ -674,7 +674,7 @@ get_work_function(struct test_configure *cfg)
{
lcore_function_t *fn;
- if (cfg->is_dma) {
+ if (cfg->test_type == TEST_TYPE_DMA_MEM_COPY) {
if (!cfg->is_sg)
fn = do_dma_plain_mem_copy;
else {
@@ -794,12 +794,11 @@ mem_copy_benchmark(struct test_configure *cfg)
int ret = 0;
nr_buf = align_buffer_count(cfg, &nr_sgsrc, &nr_sgdst);
- cfg->nr_buf = nr_buf;
- if (setup_memory_env(cfg, &srcs, &dsts, &src_sges, &dst_sges, &dma_ops) < 0)
+ if (setup_memory_env(cfg, nr_buf, &srcs, &dsts, &src_sges, &dst_sges, &dma_ops) < 0)
goto out;
- if (cfg->is_dma)
+ if (cfg->test_type == TEST_TYPE_DMA_MEM_COPY)
if (config_dmadevs(cfg) < 0)
goto out;
@@ -822,7 +821,7 @@ mem_copy_benchmark(struct test_configure *cfg)
printf("lcore parameters malloc failure for lcore %d\n", lcore_id);
break;
}
- if (cfg->is_dma) {
+ if (cfg->test_type == TEST_TYPE_DMA_MEM_COPY) {
lcores[i]->dma_name = lcore_dma_map->dma_names;
lcores[i]->dev_id = lcore_dma_map->dma_id;
lcores[i]->kick_batch = kick_batch;
@@ -1040,7 +1039,7 @@ mem_copy_benchmark(struct test_configure *cfg)
lcores[i] = NULL;
}
- if (cfg->is_dma) {
+ if (cfg->test_type == TEST_TYPE_DMA_MEM_COPY) {
for (i = 0; i < nb_workers; i++) {
lcore_dma_map = &cfg->dma_config[i].lcore_dma_map;
printf("Stopping dmadev %d\n", lcore_dma_map->dma_id);
diff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c
index 7615c62951..9816b3ae06 100644
--- a/app/test-dma-perf/main.c
+++ b/app/test-dma-perf/main.c
@@ -29,12 +29,6 @@
#define MAX_PARAMS_PER_ENTRY 4
-enum {
- TEST_TYPE_NONE = 0,
- TEST_TYPE_DMA_MEM_COPY,
- TEST_TYPE_CPU_MEM_COPY
-};
-
#define MAX_TEST_CASES 16
static struct test_configure test_cases[MAX_TEST_CASES];
@@ -90,7 +84,8 @@ output_env_info(void)
static void
output_header(uint32_t case_id, struct test_configure *case_cfg)
{
- output_csv(CSV_HDR_FMT, case_id, case_cfg->test_type_str);
+ static const char * const type_str[] = { "NONE", DMA_MEM_COPY, CPU_MEM_COPY };
+ output_csv(CSV_HDR_FMT, case_id, type_str[case_cfg->test_type]);
}
static int
@@ -104,7 +99,7 @@ run_test_case(struct test_configure *case_cfg)
ret = mem_copy_benchmark(case_cfg);
break;
default:
- printf("Unknown test type. %s\n", case_cfg->test_type_str);
+ printf("Unknown test type\n");
break;
}
@@ -338,7 +333,6 @@ load_configs(const char *path)
const char *skip;
struct rte_kvargs *kvlist;
int args_nr, nb_vp;
- bool is_dma;
printf("config file parsing...\n");
cfgfile = rte_cfgfile_load(path, 0);
@@ -376,19 +370,15 @@ load_configs(const char *path)
if (strcmp(case_type, DMA_MEM_COPY) == 0) {
test_case->test_type = TEST_TYPE_DMA_MEM_COPY;
- test_case->test_type_str = DMA_MEM_COPY;
- is_dma = true;
} else if (strcmp(case_type, CPU_MEM_COPY) == 0) {
test_case->test_type = TEST_TYPE_CPU_MEM_COPY;
- test_case->test_type_str = CPU_MEM_COPY;
- is_dma = false;
} else {
printf("Error: Wrong test case type %s in case%d.\n", case_type, i + 1);
test_case->is_valid = false;
continue;
}
- if (is_dma) {
+ if (test_case->test_type == TEST_TYPE_DMA_MEM_COPY) {
use_dma_ops =
rte_cfgfile_get_entry(cfgfile, section_name, "use_enq_deq_ops");
if (use_dma_ops != NULL && (atoi(use_dma_ops) == 1))
@@ -397,7 +387,6 @@ load_configs(const char *path)
test_case->use_ops = false;
}
- test_case->is_dma = is_dma;
test_case->src_numa_node = (int)atoi(rte_cfgfile_get_entry(cfgfile,
section_name, "src_numa_node"));
test_case->dst_numa_node = (int)atoi(rte_cfgfile_get_entry(cfgfile,
@@ -421,7 +410,7 @@ load_configs(const char *path)
} else if (args_nr == 4)
nb_vp++;
- if (is_dma) {
+ if (test_case->test_type == TEST_TYPE_DMA_MEM_COPY) {
ring_size_str = rte_cfgfile_get_entry(cfgfile, section_name,
"dma_ring_size");
args_nr = parse_entry(ring_size_str, &test_case->ring_size);
diff --git a/app/test-dma-perf/main.h b/app/test-dma-perf/main.h
index 11a07e57e7..25f32b72f7 100644
--- a/app/test-dma-perf/main.h
+++ b/app/test-dma-perf/main.h
@@ -12,7 +12,11 @@
#define MAX_WORKER_NB 128
-#define MAX_DMA_NB 128
+enum {
+ TEST_TYPE_NONE = 0,
+ TEST_TYPE_DMA_MEM_COPY,
+ TEST_TYPE_CPU_MEM_COPY
+};
typedef enum {
OP_NONE = 0,
@@ -49,12 +53,8 @@ struct test_configure {
bool is_valid;
bool is_skip;
uint8_t test_type;
- const char *test_type_str;
uint16_t src_numa_node;
uint16_t dst_numa_node;
- uint16_t opcode;
- bool is_dma;
- bool is_sg;
bool use_ops;
struct lcore_dma_config dma_config[MAX_WORKER_NB];
struct test_configure_entry mem_size;
@@ -64,7 +64,7 @@ struct test_configure {
uint16_t num_worker;
uint8_t nb_src_sges;
uint8_t nb_dst_sges;
- uint32_t nr_buf;
+ bool is_sg;
uint8_t scenario_id;
};
--
2.17.1
next prev parent reply other threads:[~2025-10-20 4:11 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 10:54 [PATCH 0/9] bugfix and refactor of dma-perf Chengwen Feng
2025-08-11 10:54 ` [PATCH 1/9] app/dma-perf: fix use-after-free Chengwen Feng
2025-08-11 10:54 ` [PATCH 2/9] app/dma-perf: add global section for config file Chengwen Feng
2025-08-11 10:54 ` [PATCH 3/9] app/dma-perf: use argparse lib to parse argument Chengwen Feng
2025-08-11 10:54 ` [PATCH 4/9] app/dma-perf: refactor output csv Chengwen Feng
2025-08-11 10:54 ` [PATCH 5/9] app/dma-perf: support list DMA devices Chengwen Feng
2025-08-11 10:54 ` [PATCH 6/9] app/dma-perf: add more global config Chengwen Feng
2025-08-11 10:54 ` [PATCH 7/9] app/dma-perf: remove invalid or redundant field Chengwen Feng
2025-08-11 10:54 ` [PATCH 8/9] app/dma-perf: refactor load config function Chengwen Feng
2025-08-11 10:54 ` [PATCH 9/9] app/dma-perf: refactor benchmark function Chengwen Feng
2025-08-12 2:06 ` [PATCH 00/10] bugfix and refactor of dma-perf Chengwen Feng
2025-08-12 2:06 ` [PATCH 01/10] app/dma-perf: fix use-after-free Chengwen Feng
2025-08-12 2:07 ` [PATCH 02/10] app/dma-perf: add global section for config file Chengwen Feng
2025-08-12 2:07 ` [PATCH 03/10] app/dma-perf: use argparse lib to parse argument Chengwen Feng
2025-08-12 2:07 ` [PATCH 04/10] app/dma-perf: refactor output csv Chengwen Feng
2025-08-12 2:07 ` [PATCH 05/10] app/dma-perf: support list DMA devices Chengwen Feng
2025-08-12 2:07 ` [PATCH 06/10] app/dma-perf: add more global config Chengwen Feng
2025-08-12 2:07 ` [PATCH 07/10] app/dma-perf: remove invalid or redundant field Chengwen Feng
2025-08-12 2:07 ` [PATCH 08/10] app/dma-perf: refactor load config function Chengwen Feng
2025-08-12 2:07 ` [PATCH 09/10] app/dma-perf: refactor benchmark function Chengwen Feng
2025-08-12 2:07 ` [PATCH 10/10] app/dma-perf: support specific error info Chengwen Feng
2025-09-11 14:53 ` [EXTERNAL] [PATCH 00/10] bugfix and refactor of dma-perf Vamsi Krishna Attunuru
2025-09-17 3:33 ` [PATCH v2 " Chengwen Feng
2025-09-17 3:33 ` [PATCH v2 01/10] app/dma-perf: fix use-after-free Chengwen Feng
2025-09-17 3:33 ` [PATCH v2 02/10] app/dma-perf: add global section for config file Chengwen Feng
2025-09-17 3:33 ` [PATCH v2 03/10] app/dma-perf: use argparse lib to parse argument Chengwen Feng
2025-09-17 3:33 ` [PATCH v2 04/10] app/dma-perf: refactor output csv Chengwen Feng
2025-09-17 3:33 ` [PATCH v2 05/10] app/dma-perf: support list DMA devices Chengwen Feng
2025-09-17 3:33 ` [PATCH v2 06/10] app/dma-perf: add more global config Chengwen Feng
2025-09-17 3:33 ` [PATCH v2 07/10] app/dma-perf: remove invalid or redundant field Chengwen Feng
2025-09-17 3:33 ` [PATCH v2 08/10] app/dma-perf: refactor load config function Chengwen Feng
2025-09-17 3:33 ` [PATCH v2 09/10] app/dma-perf: refactor benchmark function Chengwen Feng
2025-09-17 3:33 ` [PATCH v2 10/10] app/dma-perf: support specific error info Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 00/13] bugfix and refactor of dma-perf Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 01/13] app/dma-perf: fix use-after-free Chengwen Feng
2025-10-13 7:55 ` Bruce Richardson
2025-10-13 8:15 ` fengchengwen
2025-10-13 3:02 ` [PATCH v3 02/13] app/dma-perf: add global section for config file Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 03/13] app/dma-perf: use argparse lib to parse argument Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 04/13] app/dma-perf: refactor output csv Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 05/13] app/dma-perf: support list DMA devices Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 06/13] app/dma-perf: add more global config Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 07/13] app/dma-perf: remove invalid or redundant field Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 08/13] app/dma-perf: refactor load config function Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 09/13] app/dma-perf: refactor benchmark function Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 10/13] app/dma-perf: support specific error info Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 11/13] app/dma-perf: fix segment fault with large size Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 12/13] app/dma-perf: fix on-flight DMA when verify data Chengwen Feng
2025-10-13 3:02 ` [PATCH v3 13/13] app/dma-perf: fix wrong stage to stop dmadev Chengwen Feng
2025-10-20 4:10 ` [PATCH v4 00/14] bugfix and refactor of dma-perf Chengwen Feng
2025-10-20 4:10 ` [PATCH v4 01/14] app/dma-perf: fix use-after-free Chengwen Feng
2025-10-20 4:10 ` [PATCH v4 02/14] app/dma-perf: add global section for config file Chengwen Feng
2025-10-20 4:10 ` [PATCH v4 03/14] app/dma-perf: use argparse lib to parse argument Chengwen Feng
2025-10-20 4:10 ` [PATCH v4 04/14] app/dma-perf: refactor output csv Chengwen Feng
2025-10-20 4:10 ` [PATCH v4 05/14] app/dma-perf: support list DMA devices Chengwen Feng
2025-10-20 4:10 ` [PATCH v4 06/14] app/dma-perf: add more global config Chengwen Feng
2025-10-20 4:10 ` Chengwen Feng [this message]
2025-10-20 4:10 ` [PATCH v4 08/14] app/dma-perf: refactor load config function Chengwen Feng
2025-10-20 4:11 ` [PATCH v4 09/14] app/dma-perf: refactor benchmark function Chengwen Feng
2025-10-20 4:11 ` [PATCH v4 10/14] app/dma-perf: support specific error info Chengwen Feng
2025-10-20 4:11 ` [PATCH v4 11/14] app/dma-perf: fix segment fault with large size Chengwen Feng
2025-10-20 4:11 ` [PATCH v4 12/14] app/dma-perf: fix on-flight DMA when verify data Chengwen Feng
2025-10-20 4:11 ` [PATCH v4 13/14] app/dma-perf: fix wrong stage to stop dmadev Chengwen Feng
2025-10-20 4:11 ` [PATCH v4 14/14] app/dma-perf: refactor benchmark function Chengwen Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251020041105.1590-8-fengchengwen@huawei.com \
--to=fengchengwen@huawei.com \
--cc=dev@dpdk.org \
--cc=honest.jiang@foxmail.com \
--cc=liuyonglong@huawei.com \
--cc=thomas@monjalon.net \
--cc=vattunuru@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).