DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xiaoming Jiang <jiangxiaoming@outlook.com>
To: dev@dpdk.org
Cc: Xiaoming Jiang <jiangxiaoming@outlook.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Long Li <longli@microsoft.com>
Subject: [PATCH] bus/vmbus: add support allow/block scan mode
Date: Thu,  9 Jun 2022 08:28:01 +0000	[thread overview]
Message-ID: <SY6P282MB41022AFAB0128F80D46A415DA5A79@SY6P282MB4102.AUSP282.PROD.OUTLOOK.COM> (raw)

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


             reply	other threads:[~2022-06-09  8:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09  8:28 Xiaoming Jiang [this message]
  -- 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SY6P282MB41022AFAB0128F80D46A415DA5A79@SY6P282MB4102.AUSP282.PROD.OUTLOOK.COM \
    --to=jiangxiaoming@outlook.com \
    --cc=dev@dpdk.org \
    --cc=longli@microsoft.com \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).