From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1DD1FA0557; Thu, 9 Jun 2022 09:55:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3E3742802; Thu, 9 Jun 2022 09:55:24 +0200 (CEST) Received: from AUS01-ME3-obe.outbound.protection.outlook.com (mail-me3aus01olkn2149.outbound.protection.outlook.com [40.92.63.149]) by mails.dpdk.org (Postfix) with ESMTP id 8EADC40220 for ; Thu, 9 Jun 2022 09:55:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ea0qPaX4pEA+tKaxjHCyzxF9tgs7e/vaIiyerWNBHtT/5GN+7Nu7CZPcBXdgycifKK++gCJGtvCDDij5O1LWgWJxhAyW4wfOA9wg9UgUKF3n2+rvO0fBrOdlK8XFsdjhdTwC3qkY642tNDGZ80yXWkdENmhRSBve4kCsLmgCejlHULo2oP2htm4zGto8UvvaUl01+BTGO2bT1cE7BCWs9m2rKsqjCrbcfDun0DUULHTBdX2DPnAPPw2y5jefcKOA/8nwbAKqdroI0kP5htdlkeBYo8a3O3Gae26PgY+U4em59mjphvEwfTSEvI6YLhX9KC9daOJHh49KGnFyIBC39w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=flLXhYFKN/V+8aNTW2oZA7YkpdbgOiTuwwg1vLxhbUU=; b=Sla06pgYqym4YHCZukc1cmboE7IrPMN6fOLcpiGzKUsImC7uN1SPeAoALoG/VxnHpoC4xGbaL8pYMYJ6hsey3dzuKUfl9+IE5HaqnrvLF2bNnRHnCzHCuNUuUaZXPrdwyrh66/6Jp/8rulTqaksFegokQ/cRMk+ShbqdB73M/Kn33Hsp3HB4DED2Bn5Zlv+uhXuizfDSGtl4KLJAy7NOJ5NZnHKv0gvGWSgL3b57oemXFVyoseD4OHv9054V8Wje6Puprs8eNNRv6I+5ngWiaxGByLynVyYDg6MzXbXWM8KcFoj4APV5AV/cGAwPOI5WYnEZQnq6M8HP5dsIgowcSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=flLXhYFKN/V+8aNTW2oZA7YkpdbgOiTuwwg1vLxhbUU=; b=Xk80X40wypeACXy0Rp+bhwvXpBlx0hRaNnDebroJf+6iYTrmHrOnd7i6J02Gon3GejVOdJzhGq/e74cMuNqM/OQsBKgX6yx/3JxP62EX5Y7I33Un+fjbavBbkpzIErRModKNUlg7MMrnSAyXe37OJgG/rDDd0/HUm4uW5+3hIhFgND8G2VAOVJgPjQN6dCLiga/zAclYxAGRIMAhJV3OUprHxOhh6mrDgnlZ1IjSZITKilQm1MoATJaslpVJE4vEqGDj4gCeBIaBzCHej5Go/SkZamXO7+XISXQcXQsWhP2wUOO5ABCJf0QxpVwFvVj7T/evwRc4gw1mX+j1I7u+yw== Received: from ME3P282MB4111.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:199::14) by ME3P282MB3328.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:135::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Thu, 9 Jun 2022 07:55:20 +0000 Received: from ME3P282MB4111.AUSP282.PROD.OUTLOOK.COM ([fe80::a533:20b4:271:b00]) by ME3P282MB4111.AUSP282.PROD.OUTLOOK.COM ([fe80::a533:20b4:271:b00%5]) with mapi id 15.20.5332.012; Thu, 9 Jun 2022 07:55:20 +0000 From: Xiaoming Jiang To: dev@dpdk.org Cc: Xiaoming Jiang , Stephen Hemminger , Long Li Subject: [PATCH] bus/vmbus: add support allow/block scan mode Date: Thu, 9 Jun 2022 07:55:13 +0000 Message-ID: X-Mailer: git-send-email 2.32.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [PaZCjQz86jQq8GmvLS6f7IouD9RychKWgkovEq91Okw=] X-ClientProxiedBy: SG2PR02CA0047.apcprd02.prod.outlook.com (2603:1096:3:18::35) To ME3P282MB4111.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:199::14) X-Microsoft-Original-Message-ID: <20220609075513.57480-1-jiangxiaoming@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a32a1d35-5a43-4844-81e0-08da49ed66b9 X-MS-Exchange-SLBlob-MailProps: mBRmoEB1kyLwVP6QrrX9/TVbEbyM18exoVRUBXpAze5zV7N/U8QdRPGIjppVPhQ82vl3tk9ncgMzrjxIa2My8HDCu6kAubalCOcayYnu9bomaFREJCbi/gSICKgaPRn2dwrQ35nGbHP9v983kkG35PGOQp8CCmrsg76Pf4N43GrSMggCNNb8kfcU12MvA3rrBG4wMuJjAzFm4fvWvhEgDx8f3LWMPYIGD1eAJZOToImZACVrnk6TJTIlkIGzkb1SjDX5GLd+Lke6MhcyScOTxUCi2wmV89DnwHxoswVWffFOMIQ1ou1XLAHbV3PjQVrNOlYjWj9lR0vC8p0GVs0oiKxWU/rwZquaKVBWnJiIq0Vu1OQnZgCe2pgsgN3MUfDvVlAUgI0Oj9yKTMfJQFF9bmOTFzdTPo1waXkiKJUtlvc3j0HqiFMVm7h0NvJoAKTW3+iDpLgF4LVn1KD1Ka4eOHaHMwY3c4eXOk4UolaD+iTKUI2i9JbiIexVKYmcwTl7Qn5IoOX58m8cpBw4rjLypXExPKwJvy9+IocLr5Ge/Y82WQRn1D08DAvAd67/lHxqEx5LF8ZzO26gmTLiSf64kTtPTg+vRmp35jrtn8XibU0zccvvpVV2GjYBgoEvyKrCK8TUnvlG9jyAutxVX+leDuHwzGqMcPVgsCJvydHY8I51oBHq1lmqEXQvhJYYIpGyOtfW9L/rwaT+eJWbLliZDTuRMseOAmuopaeDGGnrIc9knL92WanYro9ywJWXAjZcduq7Ez69DvE= X-MS-TrafficTypeDiagnostic: ME3P282MB3328:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6rJaFr3B3T0eJJvcjxhzixtBw51JA6y8itPV3NBH7wfjdaeplRoaM8TZ3Gg8MbBIlXrMPZhIiY2sIzy1FWh0fmw1Re00C+/jsA7NMPvdjHBvatsbVG/zogdOAktO9Qo44cNuyFMzNSZ9vXBMKD5yrppnYY7YDZg5NjmMQ5R9hDun2fU8O6CuKiy+n4BPKkb2DoOcFQQ3ZgMNJyPUXIAjz1+cmsXjG8osNIz6bZ5G+N1Fhct/AUC3pDc7o9DCtPljO4Nkns/9xtP4wnQBC2WGQP3anR2CG7KE9GsPSOe+O5YJtDEGKjaIrnoeqAfz6vExU87J6CN4brLiYZWM7K3cuRqCEOrrUypjtuTWFN76RWYcrRuzlJxsuvI2LSQKGkOgiNFSjClv4F8V9rl9JcEF5U+kCJwB64ZsY23TpGsxlxo2CTH2RNWh4p6zN9R+Oc4dfmncE7l2qoCfAgeogZGrURZe/C7BwnA9F4c3orV+JjmXTchNpX8Ui1FcNzGyS90/lujWT06ZduAcclQNuYBrSC+XQ1t/z0CHjrcse6BNWMzYZbSViDPgK7shByWTPM1SARn+6r9QWaXg0YoKYXw9MA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Io0T8lB/llGSwoGtB2kQDJ9/FjDUtDqTMf3UyR5tBzl3PzrqKjh+A/tEjYUM?= =?us-ascii?Q?cdXSq5m0kGH8dW9nNb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XoaEKs?= =?us-ascii?Q?qRSLNltEYEMPWqjKu60Rn9Fol0yaH83t5Avf6UcfHypQQc5oW7sGQGWid3Yj?= =?us-ascii?Q?ppe07kSnLwQcXqjGIr58N61qPFIkNuFzcHMJ5LGI45T8wC2GzxIJyv7t5bUq?= =?us-ascii?Q?8ZywJfA2QbIe8Gf6+VlPeqLAaI/AObwmE+7Rc6X8baV+vT0ZQlS9sc2glSWc?= =?us-ascii?Q?t9ny3hpIqy3Ya9X93DaBR8MhW91DnJOvbriqpi5BGE1DIWI6Cp9Uozq8gtJT?= =?us-ascii?Q?ecT4dGk5zl2ICR83fTTGgtvayXqFR8sAK+9NhXlcs//Dn8kZsx6mmSi5aQYx?= =?us-ascii?Q?KI//vSuvGqS9XYCt6ZEHKsOqymCYfKZarjRZYlD9oDpVudyZGLkg1zddjeTd?= =?us-ascii?Q?HYaXNMb0az5X2wmWGCZz5XQkj0x2GoQB1RWGn52Q8IUiaiB+tXeBckx/WQQY?= =?us-ascii?Q?YGo3qMxlUGY3SKTs8qywk20j93SA2umuB6O4FYOJP0Mjcc0hfvZvCGxqoz+S?= =?us-ascii?Q?6Ius+dvMT7IbbWl6AxkqYE6pHT702qIT?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a32a1d35-5a43-4844-81e0-08da49ed66b9 X-MS-Exchange-CrossTenant-AuthSource: ME3P282MB4111.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 07:55:20.7418 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: ME3P282MB3328 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Signed-off-by: Xiaoming Jiang --- 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