DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] bus/vmbus: add support allow/block scan mode
@ 2022-06-09  8:28 Xiaoming Jiang
  0 siblings, 0 replies; 10+ messages in thread
From: Xiaoming Jiang @ 2022-06-09  8:28 UTC (permalink / raw)
  To: dev; +Cc: Xiaoming Jiang, Stephen Hemminger, Long Li

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

diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 367727367e..0ee851b811 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(const 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,
-- 
2.32.0


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

* Re: [PATCH] bus/vmbus: add support allow/block scan mode
  2022-06-09  8:46 Xiaoming Jiang
  2023-07-06 22:52 ` Stephen Hemminger
@ 2023-10-12 11:39 ` David Marchand
  1 sibling, 0 replies; 10+ messages in thread
From: David Marchand @ 2023-10-12 11:39 UTC (permalink / raw)
  To: Xiaoming Jiang; +Cc: dev, Stephen Hemminger, Long Li, lihuisong

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.


-- 
David Marchand


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

* Re: [PATCH] bus/vmbus: add support allow/block scan mode
  2023-07-07  1:32     ` Long Li
@ 2023-07-07  1:37       ` lihuisong (C)
  0 siblings, 0 replies; 10+ messages in thread
From: lihuisong (C) @ 2023-07-07  1:37 UTC (permalink / raw)
  To: Long Li, Stephen Hemminger, Xiaoming Jiang; +Cc: dev, Stephen Hemminger


在 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>

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

* RE: [PATCH] bus/vmbus: add support allow/block scan mode
  2023-07-06 23:49   ` Long Li
@ 2023-07-07  1:32     ` Long Li
  2023-07-07  1:37       ` lihuisong (C)
  0 siblings, 1 reply; 10+ messages in thread
From: Long Li @ 2023-07-07  1:32 UTC (permalink / raw)
  To: Stephen Hemminger, Xiaoming Jiang; +Cc: dev, Stephen Hemminger

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

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

* RE: [PATCH] bus/vmbus: add support allow/block scan mode
  2023-07-06 22:52 ` Stephen Hemminger
@ 2023-07-06 23:49   ` Long Li
  2023-07-07  1:32     ` Long Li
  0 siblings, 1 reply; 10+ messages in thread
From: Long Li @ 2023-07-06 23:49 UTC (permalink / raw)
  To: Stephen Hemminger, Xiaoming Jiang; +Cc: dev, Stephen Hemminger

> 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

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

* Re: [PATCH] bus/vmbus: add support allow/block scan mode
  2022-06-09  8:46 Xiaoming Jiang
@ 2023-07-06 22:52 ` Stephen Hemminger
  2023-07-06 23:49   ` Long Li
  2023-10-12 11:39 ` David Marchand
  1 sibling, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2023-07-06 22:52 UTC (permalink / raw)
  To: Xiaoming Jiang; +Cc: dev, Stephen Hemminger, Long Li

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?

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

* Re: [PATCH] bus/vmbus: add support allow/block scan mode
  2022-06-09  7:55 Xiaoming Jiang
@ 2023-07-04  0:12 ` Stephen Hemminger
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2023-07-04  0:12 UTC (permalink / raw)
  To: Xiaoming Jiang; +Cc: dev, Stephen Hemminger, Long Li

On Thu,  9 Jun 2022 07:55:13 +0000
Xiaoming Jiang <jiangxiaoming@outlook.com> wrote:

> Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com>
> ---
>  drivers/bus/vmbus/vmbus_common.c | 30 ++++++++++++++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
> index 367727367e..c583c3df8b 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) {
> +		RTE_LOG(INFO, EAL, "  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(const 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;
> +		}
Nit: You don't need the brackets here.


Looks ok to me, need ack from Long Li on this one.

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

* [PATCH] bus/vmbus: add support allow/block scan mode
@ 2022-06-09  8:46 Xiaoming Jiang
  2023-07-06 22:52 ` Stephen Hemminger
  2023-10-12 11:39 ` David Marchand
  0 siblings, 2 replies; 10+ messages in thread
From: Xiaoming Jiang @ 2022-06-09  8:46 UTC (permalink / raw)
  To: dev; +Cc: Xiaoming Jiang, Stephen Hemminger, Long Li

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

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,
-- 
2.32.0


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

* [PATCH] bus/vmbus: add support allow/block scan mode
@ 2022-06-09  8:01 Xiaoming Jiang
  0 siblings, 0 replies; 10+ messages in thread
From: Xiaoming Jiang @ 2022-06-09  8:01 UTC (permalink / raw)
  To: dev; +Cc: Xiaoming Jiang, Stephen Hemminger, Long Li

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

diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 367727367e..c583c3df8b 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) {
+		RTE_LOG(INFO, EAL, "  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(const 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,
-- 
2.32.0


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

* [PATCH] bus/vmbus: add support allow/block scan mode
@ 2022-06-09  7:55 Xiaoming Jiang
  2023-07-04  0:12 ` Stephen Hemminger
  0 siblings, 1 reply; 10+ messages in thread
From: Xiaoming Jiang @ 2022-06-09  7:55 UTC (permalink / raw)
  To: dev; +Cc: Xiaoming Jiang, Stephen Hemminger, Long Li

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

diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 367727367e..c583c3df8b 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) {
+		RTE_LOG(INFO, EAL, "  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(const 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,
-- 
2.32.0


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

end of thread, other threads:[~2023-10-12 11:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09  8:28 [PATCH] bus/vmbus: add support allow/block scan mode Xiaoming Jiang
  -- strict thread matches above, loose matches on Subject: below --
2022-06-09  8:46 Xiaoming Jiang
2023-07-06 22:52 ` Stephen Hemminger
2023-07-06 23:49   ` Long Li
2023-07-07  1:32     ` Long Li
2023-07-07  1:37       ` lihuisong (C)
2023-10-12 11:39 ` David Marchand
2022-06-09  8:01 Xiaoming Jiang
2022-06-09  7:55 Xiaoming Jiang
2023-07-04  0:12 ` Stephen Hemminger

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