[v3,3/3] app/dma-perf: fix infinite loop

Message ID 20250402122454.2148612-4-huangdengdui@huawei.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series fix the problem of dma-perf infinite loop |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS

Commit Message

Dengdui Huang April 2, 2025, 12:24 p.m. UTC
When a core that is not used by the rte is specified in the config
for testing, the problem of infinite loop occurs. This patch fix it
by adding a check for lcore_id.

Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
 app/test-dma-perf/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Patch

diff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c
index 0586b3e1d0..1365456dd1 100644
--- a/app/test-dma-perf/main.c
+++ b/app/test-dma-perf/main.c
@@ -523,7 +523,7 @@  main(int argc, char *argv[])
 {
 	int ret;
 	uint16_t case_nb;
-	uint32_t i, nb_lcores;
+	uint32_t i, j, nb_lcores, lcore;
 	pid_t cpid, wpid;
 	int wstatus;
 	char args[MAX_EAL_PARAM_NB][MAX_EAL_PARAM_LEN];
@@ -603,6 +603,12 @@  main(int argc, char *argv[])
 			if (nb_lcores < 2)
 				rte_exit(EXIT_FAILURE,
 					"There should be at least 2 worker lcores.\n");
+			for (j = 0; j < test_cases[i].num_worker; j++) {
+				lcore = test_cases[i].dma_config[j].lcore_dma_map.lcore;
+				if (!rte_lcore_has_role(lcore, ROLE_RTE))
+					rte_exit(EXIT_FAILURE,
+						 "Worker lcore %u not enabled in EAL\n", lcore);
+			}
 
 			fd = fopen(rst_path_ptr, "a");
 			if (!fd) {