DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] test: fix option block
@ 2024-03-14  9:46 Mingjin Ye
  2024-03-15  6:49 ` Jiale, SongX
  0 siblings, 1 reply; 2+ messages in thread
From: Mingjin Ye @ 2024-03-14  9:46 UTC (permalink / raw)
  To: dev; +Cc: Mingjin Ye, stable

The options allow (-a) and block (-b) cannot be used at the same time.
Therefore, allow (-a) will not be added when block (-b) is present.

Fixes: b3ce7891ad38 ("test: fix probing in secondary process")
Cc: stable@dpdk.org

Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
---
 app/test/process.h | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/app/test/process.h b/app/test/process.h
index 9fb2bf481c..388c7975cd 100644
--- a/app/test/process.h
+++ b/app/test/process.h
@@ -44,7 +44,7 @@ add_parameter_allow(char **argv, int max_capacity)
 	int count = 0;
 
 	RTE_EAL_DEVARGS_FOREACH(NULL, devargs) {
-		if (strlen(devargs->name) == 0)
+		if (strlen(devargs->name) == 0 || devargs->type != RTE_DEVTYPE_ALLOWED)
 			continue;
 
 		if (devargs->data == NULL || strlen(devargs->data) == 0) {
@@ -74,7 +74,7 @@ process_dup(const char *const argv[], int numargs, const char *env_value)
 {
 	int num = 0;
 	char **argv_cpy;
-	int allow_num;
+	int allow_num, block_num;
 	int argv_num;
 	int i, status;
 	char path[32];
@@ -89,7 +89,18 @@ process_dup(const char *const argv[], int numargs, const char *env_value)
 	if (pid < 0)
 		return -1;
 	else if (pid == 0) {
-		allow_num = rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
+		allow_num = 0;
+		block_num = 0;
+
+		/* If block (-b) is present, allow (-a) is not added. */
+		for (i = 0; i < numargs; i++) {
+			if (strcmp(argv[i], "-b") == 0 ||
+			    strcmp(argv[i], "-block") == 0)
+				block_num++;
+		}
+		if (!block_num)
+			allow_num = rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
+
 		argv_num = numargs + allow_num + 1;
 		argv_cpy = calloc(argv_num, sizeof(char *));
 		if (!argv_cpy)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH] test: fix option block
  2024-03-14  9:46 [PATCH] test: fix option block Mingjin Ye
@ 2024-03-15  6:49 ` Jiale, SongX
  0 siblings, 0 replies; 2+ messages in thread
From: Jiale, SongX @ 2024-03-15  6:49 UTC (permalink / raw)
  To: Ye, MingjinX, dev; +Cc: Ye, MingjinX, stable

> -----Original Message-----
> From: Mingjin Ye <mingjinx.ye@intel.com>
> Sent: Thursday, March 14, 2024 5:46 PM
> To: dev@dpdk.org
> Cc: Ye, MingjinX <mingjinx.ye@intel.com>; stable@dpdk.org
> Subject: [PATCH] test: fix option block
> 
> The options allow (-a) and block (-b) cannot be used at the same time.
> Therefore, allow (-a) will not be added when block (-b) is present.
> 
> Fixes: b3ce7891ad38 ("test: fix probing in secondary process")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> ---

Tested-by: Jiale Song <songx.jiale@intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-15  6:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14  9:46 [PATCH] test: fix option block Mingjin Ye
2024-03-15  6:49 ` Jiale, SongX

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).