[PATCH] eal: allow both allow and block options coexistence

Marvin Liu yong.liu at intel.com
Fri May 19 04:29:46 CEST 2023


Since all buses share the same eal allow and block options. There's a
need to allow both allow and block options coexist. At the same time,
this wouldn't be a problem if both allow and block options were present
on the same bus. The scan mode of a bus will be set when met the first
type option.

eg: --allow 0000:05:00.0 --block wq0.0
    only pci device 0000:05:00.0 will be scanned
    all devices except wq0.0 on dsa bus will be scanned
eg: --allow 0000:05:00.0 --block 0000:05:00.1
    block option will be ingored
eg: --block 0000:05:00.1 --allow 0000:05:00.0
    allow option will be ignored

Signed-off-by: Marvin Liu <yong.liu at intel.com>
---
 .mailmap                            |  2 +-
 lib/eal/common/eal_common_options.c | 14 --------------
 2 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/.mailmap b/.mailmap
index 0443e461a9..d256696485 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1548,7 +1548,7 @@ Yogesh Jangra <yogesh.jangra at intel.com>
 Yogev Chaimovich <yogev at cgstowernetworks.com>
 Yongjie Gu <yongjiex.gu at intel.com>
 Yongji Xie <xieyongji at baidu.com>
-Yong Liu <yong.liu at intel.com>
+Marvin Liu <yong.liu at intel.com>
 Yongping Zhang <yongping.zhang at broadcom.com>
 Yongseok Koh <yskoh at mellanox.com>
 Yong Wang <wang.yong19 at zte.com.cn> <yongwang at vmware.com>
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index 0305933698..0d8f9c5a38 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -1623,24 +1623,15 @@ int
 eal_parse_common_option(int opt, const char *optarg,
 			struct internal_config *conf)
 {
-	static int b_used;
-	static int a_used;
-
 	switch (opt) {
 	case 'b':
-		if (a_used)
-			goto ba_conflict;
 		if (eal_option_device_add(RTE_DEVTYPE_BLOCKED, optarg) < 0)
 			return -1;
-		b_used = 1;
 		break;
 
 	case 'a':
-		if (b_used)
-			goto ba_conflict;
 		if (eal_option_device_add(RTE_DEVTYPE_ALLOWED, optarg) < 0)
 			return -1;
-		a_used = 1;
 		break;
 	/* coremask */
 	case 'c': {
@@ -1929,11 +1920,6 @@ eal_parse_common_option(int opt, const char *optarg,
 	}
 
 	return 0;
-
-ba_conflict:
-	RTE_LOG(ERR, EAL,
-		"Options allow (-a) and block (-b) can't be used at the same time\n");
-	return -1;
 }
 
 static void
-- 
2.24.0.rc1



More information about the dev mailing list