bus/vmbus: add support allow/block scan mode

Message ID SY6P282MB41027A086B7300F0CD5A6D7BA5A79@SY6P282MB4102.AUSP282.PROD.OUTLOOK.COM (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series bus/vmbus: add support allow/block scan mode |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Xiaoming Jiang June 9, 2022, 8:46 a.m. UTC
  bus/vmbus: add support allow/block scan mode

Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com>
---
 drivers/bus/vmbus/vmbus_common.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
  

Comments

Stephen Hemminger July 6, 2023, 10:52 p.m. UTC | #1
On Thu,  9 Jun 2022 08:46:18 +0000
Xiaoming Jiang <jiangxiaoming@outlook.com> wrote:

> bus/vmbus: add support allow/block scan mode
> 
> Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com>

Looks fine to me. Any comments from Long Li?
  
Long Li July 6, 2023, 11:49 p.m. UTC | #2
> Subject: Re: [PATCH] bus/vmbus: add support allow/block scan mode
> 
> On Thu,  9 Jun 2022 08:46:18 +0000
> Xiaoming Jiang <jiangxiaoming@outlook.com> wrote:
> 
> > bus/vmbus: add support allow/block scan mode
> >
> > Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com>
> 
> Looks fine to me. Any comments from Long Li?

Xiaoming, I have trouble applying the patch to the current vmbus code. Can you rebase the patch to the current next-net?

The patch looks good.

Thanks,
Long
  
Long Li July 7, 2023, 1:32 a.m. UTC | #3
> Subject: RE: [PATCH] bus/vmbus: add support allow/block scan mode
> 
> > Subject: Re: [PATCH] bus/vmbus: add support allow/block scan mode
> >
> > On Thu,  9 Jun 2022 08:46:18 +0000
> > Xiaoming Jiang <jiangxiaoming@outlook.com> wrote:
> >
> > > bus/vmbus: add support allow/block scan mode
> > >
> > > Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com>
> >
> > Looks fine to me. Any comments from Long Li?
> 
> Xiaoming, I have trouble applying the patch to the current vmbus code. Can
> you rebase the patch to the current next-net?
> 

The patch can be merged.

Acked-by: Long Li <longli@microsoft.com>
  
lihuisong (C) July 7, 2023, 1:37 a.m. UTC | #4
在 2023/7/7 9:32, Long Li 写道:
>> Subject: RE: [PATCH] bus/vmbus: add support allow/block scan mode
>>
>>> Subject: Re: [PATCH] bus/vmbus: add support allow/block scan mode
>>>
>>> On Thu,  9 Jun 2022 08:46:18 +0000
>>> Xiaoming Jiang <jiangxiaoming@outlook.com> wrote:
>>>
>>>> bus/vmbus: add support allow/block scan mode
>>>>
>>>> Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com>
>>> Looks fine to me. Any comments from Long Li?
>> Xiaoming, I have trouble applying the patch to the current vmbus code. Can
>> you rebase the patch to the current next-net?
>>
> The patch can be merged.
>
> Acked-by: Long Li <longli@microsoft.com>
> .
lgtm
Acked-by: Huisong Li <lihuisong@huawei.com>
  
David Marchand Oct. 12, 2023, 11:39 a.m. UTC | #5
On Thu, Jun 9, 2022 at 10:46 AM Xiaoming Jiang
<jiangxiaoming@outlook.com> wrote:
>
> bus/vmbus: add support allow/block scan mode
>
> Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com>

Acked-by: Long Li <longli@microsoft.com>
Acked-by: Huisong Li <lihuisong@huawei.com>

Applied, thanks Xiaoming.
  

Patch

diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 367727367e..ba84e6237a 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -102,7 +102,12 @@  vmbus_probe_one_driver(struct rte_vmbus_driver *dr,
 	VMBUS_LOG(INFO, "VMBUS device %s on NUMA socket %i",
 		  guid, dev->device.numa_node);
 
-	/* TODO add block/allow logic */
+	/* no initialization when marked as blocked, return without error */
+	if (dev->device.devargs != NULL &&
+		dev->device.devargs->policy == RTE_DEV_BLOCKED) {
+		VMBUS_LOG(INFO, "  Device is blocked, not initializing\n");
+		return 1;
+	}
 
 	/* map resources for device */
 	ret = rte_vmbus_map_device(dev);
@@ -163,6 +168,25 @@  vmbus_probe_all_drivers(struct rte_vmbus_device *dev)
 	return 1;
 }
 
+static bool
+rte_vmbus_ignore_device(struct rte_vmbus_device *dev)
+{
+	struct rte_devargs *devargs = vmbus_devargs_lookup(dev);
+
+	switch (rte_vmbus_bus.bus.conf.scan_mode) {
+	case RTE_BUS_SCAN_ALLOWLIST:
+		if (devargs && devargs->policy == RTE_DEV_ALLOWED)
+			return false;
+		break;
+	case RTE_BUS_SCAN_UNDEFINED:
+	case RTE_BUS_SCAN_BLOCKLIST:
+		if (devargs == NULL || devargs->policy != RTE_DEV_BLOCKED)
+			return false;
+		break;
+	}
+	return true;
+}
+
 /*
  * Scan the vmbus, and call the devinit() function for
  * all registered drivers that have a matching entry in its id_table
@@ -180,7 +204,9 @@  rte_vmbus_probe(void)
 
 		rte_uuid_unparse(dev->device_id, ubuf, sizeof(ubuf));
 
-		/* TODO: add allowlist/blocklist */
+		if (rte_vmbus_ignore_device(dev)) {
+			continue;
+		}
 
 		if (vmbus_probe_all_drivers(dev) < 0) {
 			VMBUS_LOG(NOTICE,