Skip to contentSkip to conversation

eal: allow both allow and block options coexistence

PATCH In review Marvin Liu 2 participants 2 messages Jul 7, 2023

lore
Share & tools
lore

Marvin Liu

author
#0 lore raw

PATCH 1/1 eal: allow both allow and block options coexistence

Currently, all buses use the same eal allow and block options. Need to allow both allow and block options for different buses to coexist. It wouldn't be a problem for pci bus if both allow and block options were present. When the first option occurs, the scan mode for pci bus is set.

For example:
--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
--allow 0000:05:00.0 --block 0000:05:00.1
block option will be ignored
--block 0000:05:00.1 --allow 0000:05:00.0
allow option will be ignored

---
 .mailmap                            |  2 +-
 lib/eal/common/eal_common_options.c | 14 --------------
 2 files changed, 1 insertion(+), 15 deletions(-)
.mailmap +1 -1
index 0443e461a9..d256696485 100644
@@ -1548,7 +1548,7 @@ Yogesh Jangra <[email protected]>
 Yogev Chaimovich <[email protected]>
 Yongjie Gu <[email protected]>
 Yongji Xie <[email protected]>
-Yong Liu <[email protected]>
+Marvin Liu <[email protected]>
 Yongping Zhang <[email protected]>
 Yongseok Koh <[email protected]>
 Yong Wang <[email protected]> <[email protected]>
lib/eal/common/eal_common_options.c +0 -14
index 0305933698..0d8f9c5a38 100644
@@ -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
Signature · 1 line
2.24.0.rc1
#1 lore raw

07/07/2023 07:07, Marvin Liu:

Quoted 6 lines

Currently, all buses use the same eal allow and block options. Need to allow both allow and block options for different buses to coexist. It wouldn't be a problem for pci bus if both allow and block options were present. When the first option occurs, the scan mode for pci bus is set.

Quoted 8 lines

For example:
--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
--allow 0000:05:00.0 --block 0000:05:00.1
block option will be ignored
--block 0000:05:00.1 --allow 0000:05:00.0
allow option will be ignored

It is wrong to ignore a user parameter silently.

Also, it would be clearer to use the new devargs syntax with bus=pci,addr=0000:05:00.0