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 BA931A0557; Thu, 9 Jun 2022 10:02:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6EBDB40689; Thu, 9 Jun 2022 10:02:17 +0200 (CEST) Received: from AUS01-ME3-obe.outbound.protection.outlook.com (mail-me3aus01olkn2169.outbound.protection.outlook.com [40.92.63.169]) by mails.dpdk.org (Postfix) with ESMTP id 68C8440220 for ; Thu, 9 Jun 2022 10:02:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=husTvwvge1kOQoZRQZTxASd/Ua6+vMLRSH4jF2ndvkuZZ3wb3QIxR7KsKbYtMhWWYW3ZTxMrRKvzF/4JAPU5SJAW3IN9Mz/WepdazvB9ZW6hldTpcdux/yolMt9qZCCEyCOsZXdfbsjoMyW690jL1y1gBsXgh8Yh01FlLgjqA4sOGd+AWwy6VCu65Omd2EvRlx3XIaiID94wU0tD71aJHPbjhgU+sKPuBmLfZ8+2SWXYXLv+sYMYrLpWbcNFKYkPUBRBzx6yBkVEJ0YOS8PHcMKuAlW59fxFRq1eKUkkoknUZr+7BUmXcgs8RtXVyXo9NYBaYFD36uD0X0XrIVHGxQ== 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=Bj2duQAPIDFZ4WVDL+9XhsoA6gdUjnSJrGqFK8yMBL8=; b=Y5czQ+WOwMRtC1vpaVC8r0PUFHf7EAecc30yuUEwMNUWuVppvu7TVzvoILS08iRsnOjJeKS/AB2jrt0RyK1y5hZRThK8vr5B3e7g+c4ZVVAHodZewJsQmxqhuY9h47bniIQweIGu0rEtyYFNH9QRYrQlkwq8tWlvUcdxJompLrQDrrJNVyrFflcbLXvcb/pfBnZPMPQAZqrz7mSXoZ4XYXEPwoqaG3Du80oQMX45RUuP2HlfPdbclyrhJ08oG6VJZhlLEo1DLv5HUJZEJpRXDgWiDfvtzV+FdbtNwwxuaqPaMVFl7vz9MWHSfYdsF4LQj66MqD22nGO89P3F6BCGiQ== 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=Bj2duQAPIDFZ4WVDL+9XhsoA6gdUjnSJrGqFK8yMBL8=; b=vCF3j0siMGeRWJh0jST5CW129WsrZSLjr/L4m+u+ngyQRT5XlH1fWCW5sgioNaU/CHJUqzFMi4fwXcfJw8xjknQ3P1SqZ5CuRGHjXBPIMe4aIxqRIoL5yRSvw9guUy76eq7Islutg0dBWZvWthbh/CLNeEwqMIVkNb2kvOR7iz5S0cA1gwaEM9KnqfQuSaVxs3jBVH+SiMomrw0agKfR+vaOEjUEqczQIDZt6EC+Qc3mo0A41Tb70CglhgKZLQkrSoKj0LZ6IqrOVD3U5cIw41I7V5ZH6HNnf3e71QIldjGtjCxjNJqd0zXlmYzzEBK0KZFwXq2oNI6VHifug+fQOg== Received: from ME3P282MB4111.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:199::14) by MEYP282MB1446.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.13; Thu, 9 Jun 2022 08:02:13 +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 08:02:13 +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 08:01:09 +0000 Message-ID: X-Mailer: git-send-email 2.32.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [aH077bnrqgbUT3pEPkUCHdKcKMbYQulzHkERyTPEij8=] X-ClientProxiedBy: SG2PR01CA0123.apcprd01.prod.exchangelabs.com (2603:1096:4:40::27) To ME3P282MB4111.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:199::14) X-Microsoft-Original-Message-ID: <20220609080108.57757-1-jiangxiaoming@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e616923a-6f52-4e42-2a46-08da49ee5ced X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiTijo6adWu98SeQwQNDMnIRHmNbS3J1QK7RmCHXQgdcJSnh1FMmX4/Ybm4GwBW4mpL0yyb3iq1HuF/cjpJwE9I+x39GO5gDM1Mode23MY6GlR7PL8AzPwsl2AevfwtULN8KmRqjxJFL2QWBqRKb5W3icW0F7+z0Pxdlj35Eds3DEt3Qbi09v2WiJke70vS8nQ8Bdvj0UbbQI6g5IfKvEehwv5fIs9gIePwIPDOdiRHV+0cCJy7Z5ql4kYiQAstw/lPliRjmJBvKOkl3mXXQgSZTgy3gVLrymce63dQWHC0i1fBtZYDwxwBWuZ+y3yUvB2d59OBsLIM7E/h4U+5REqOVnimpuReXbz42iE8MuNKGHQRi9vvWHLlhXf6YwG/6tV2UvuYKIKhr1m6wmHO/LQfkaC6WdYkKgNWMDqCQPYJL3oumLmjUw1byNU58T+hsoPSORdOCqnBsUCsEf9x9ekky0WrWEuqMaH/lOocbK0YjPJWJQuq5ZZ7f8FEJO43yLjpLlNozGSwxTyJMvwuhhubqIlOvAuAj4OHeIaZbbWR/+xEmEisFZed/2iYJIz/AEtiELOCOtETaa6mjWKh8IJuvyLDEKsYtt1w/QT6405tMzLuHE+ZaJvWO7jhLW2qV4r7CaK040ALCOn/WCBzag0a5UUZSy4GiQtPrGc4d9yq8GEWPDXAcDMqzgyBwJF3YaujyPq5SsTH1tJPpZ1E3C8f7CAVp8rO3Le8Hsuq4HMPesa4wBYexrjVMcxH0e6q0Br0= X-MS-TrafficTypeDiagnostic: MEYP282MB1446:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w3BcPeqqFVoQp8sGYNpuKEadlEjLll6qn+Sve4oYZzLjiAR88SNhnpMqt+l665mezXxl2CwE0dS+v+LjA87HtZ/8tFcimR9NaHVTSvCn4KQ38X61VNVHCc7hP6W1plORTeK+sOERg6+jtkU2mcnbKsrG/tP/GWn2TJ03ui78shAxQXDvnj2hpiPTj36aQhHDXETfPIIvT74pIbwJwieCf9+VYjv+NvAA0R9TQthQ4hl8ngBP7GyJLw1ea+JxJhZGhc2TDJsKS7ruZ5v+FhutggXiSZHAORwtEqu/XAxHEAVsKHsu1hPpD7i0PP0C/5C+aJfMOcYnXYkYva7euAsbX8UpemohPupFazBNBHAchH+/c3LrQc5CZTtbIzA1ym5jsZAkm+eimuDxPOjRXIH4j6YlAX2Ac9xTH3HBsY5veVLJHTAiVK1oT/jrRJquHdOqAfIPs5E36pHIEurlT5EPIiAuycLCN4+WQvqyp9Ua1WqmNIS7/tqxiR8za1JdGSgUOfha8PR5xENztZKgAHocel4rKEKMnfyjg57Ke2MLkFEXBEsRYIB/gbEjZXRvVqzYEnJQQszQvL9lXKtp8ZQGow== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5dFzuiDR7HcGOsXZ52LalyI1OyPxClzu2zUh1yOL/PCa/zYy9JIPH9vgKwIJ?= =?us-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ONSl/fSejeZ7tw8d4fAysndYP?= =?us-ascii?Q?/zP/Optwjgy39AVb2bhOEkU1dBhiroBeGyeymh7TnDZej9rOR9yJ8/xbOp8Q?= =?us-ascii?Q?MkxS1v5BW38Ky0BMuwFcU9hsIHlOrKTRZPEOFiTPtloAfqgD9jNtfNDlF3EW?= =?us-ascii?Q?uI8O9XeXE9EMk9l5n8zBA13eW66wPdqOrAmxkFlfhgCpV7H2u1bqHUdpy8rF?= =?us-ascii?Q?lTHufS1sSspeh18Dv3cM3CuJORldDubXpd9/wvtJnKF1atVM69MzGNN+Vu1s?= =?us-ascii?Q?E7+uO4yOBM0SRcKygz7R/6V5n34K5gx8c6WaQyF7soVypl3VhWRWX8Z8pyjf?= =?us-ascii?Q?mU7I7bOedLStYrtmAmZFxHzzonUB4gzsuDgzaVwOBTkGyqSm4/5rq7ZXbpng?= =?us-ascii?Q?dG93w+UVJVMzhmFDOeQa0iKcHsV7hsEGKhYZEIiajKHhpX/7dqkHGrFgZDwD?= =?us-ascii?Q?ICrHjDZgbiZbIPBCw3tI6QHY07dZVZOxGTvB2cI9FMhBylpzbB0G7NqDvKrU?= =?us-ascii?Q?kkbpN7uOZ59h4tQz0PIcnS5uB67ufDpR?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e616923a-6f52-4e42-2a46-08da49ee5ced X-MS-Exchange-CrossTenant-AuthSource: ME3P282MB4111.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 08:02:13.8468 (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: MEYP282MB1446 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 bus/vmbus: add support allow/block scan mode 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