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 197A4A0558; Thu, 9 Jun 2022 10:46:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 08FFC40689; Thu, 9 Jun 2022 10:46:48 +0200 (CEST) Received: from AUS01-SY4-obe.outbound.protection.outlook.com (mail-sy4aus01olkn2142.outbound.protection.outlook.com [40.92.62.142]) by mails.dpdk.org (Postfix) with ESMTP id 7464740220 for ; Thu, 9 Jun 2022 10:46:46 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UD9YByTDZUWf0BRWBqFYIBgX2o9LJkTZ3Wbjc5xA8i/k9OSaNmtaZIRLQT8yWVznhSKIVAbnLvTyOsOtpGvs0m2uxenulK8HGHV4ydxyRgmZz8XYwD1fvt6Eqowg5F8oOEHjPPHBIuooeTvA/upT0fn+EMIxyIJxVdoHDDDmBL/Rp5j8BbJ+loDx2CQNqh6msJ4xX0fMiCI+DgqOLIX8j3sK8UUHyEcB00FmUfX2Pvd1EIKVmG8M/LGGExWbFV6UnUlJHK6yERjV7SB3YbsAHE8ByaWUTbUltdxEPpAOinA7qKRTsKgXKfcYtLcDYcfMSyE3JDG1yYCMovXVpHzR+g== 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=96YyJRyzGiAaO3CEYhJrOS8NbnSRlccMOiHJQR2Fpvc=; b=HzVrY/CvQ8BU/TOtpIYhz9bQ3yZCm2TuPXo1XxlHC8pLf+rQG7NPauN0WAHQlFsDw8Y2/f4/+iiv7EZQpqNwRJLOcwnnBFdrESwgZsUmRd5dpPsHJdBLYddOHGMbePaqhoseM5tKX/bpq+Dfsgk2s9ZWb6ImFMRIET0eyXbxjRO2cHU7DZVXg1cv9OH+yWnY8Uu5FU66eBTzET3vBkOKHqsBX+MlpLxfxYAdStpLZGSmv1A62d2CMLq+MycZ4Q00xS4PFE1tpQJl3M++Jd2Buugy8jnpPuDbHI0EPkEBVzfnw0uwt/ICMuD7Du2Tm/k/J4509NkJApZFuYz7vgAx3w== 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=96YyJRyzGiAaO3CEYhJrOS8NbnSRlccMOiHJQR2Fpvc=; b=YcaXlo9U1k+CJrGY1XlwZnzvAEX44MpYtAD8ruJ4ZPUPAte+EXXjNQ0mkkuYBpW92/5zRkciDXJvYiCDCcPcAjwxaUbnBvQCpAtHgEYRKIJEYrD+CxkmklkkrGNCkzb3Sn2hOSPbnXpIwm7TA99uC74pXQNSscTw559YOiXXJdLos8mVuJ2S/1y0CaNwQhwcYIT5glS5BiH53Ub5DMO6BMfVith8UQl3cELIhMFkqiW83Fy5FUJ3dQ9ZTUa85h+w3ISX0zuhAZxik+MpfORb2yRJHkbBjre2lOrHRotUS9KBFyiQQ/kenS7NqfbyyoOt/5n/DFdK1hgZvc+1rqKcsA== Received: from SY6P282MB4102.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:1dd::9) by ME3P282MB2194.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:ab::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Thu, 9 Jun 2022 08:46:41 +0000 Received: from SY6P282MB4102.AUSP282.PROD.OUTLOOK.COM ([fe80::dd42:d0f6:1803:8ae1]) by SY6P282MB4102.AUSP282.PROD.OUTLOOK.COM ([fe80::dd42:d0f6:1803:8ae1%5]) with mapi id 15.20.5332.013; Thu, 9 Jun 2022 08:46:41 +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:46:18 +0000 Message-ID: X-Mailer: git-send-email 2.32.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [f+fD54rET/wn6dowOK0yZLSe1+ulyWu9khPn2J1/Y6s=] X-ClientProxiedBy: SG2P153CA0021.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::8) To SY6P282MB4102.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:1dd::9) X-Microsoft-Original-Message-ID: <20220609084617.59984-1-jiangxiaoming@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5b41bafb-38dd-4e0c-fdab-08da49f492f0 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiTijo6adWu98SeQwQNDMnIRHmNbS3J1QK60gdcCcXvwVSG3VAj2oszNMa/l97KdyQbyqSN9X/jSIYKB5hEHu8+rJRVGVtsIYCBNjFFKiwQDIhq5NpDkRpgtQ0cLKF7u1k+O+vnLoXqXvAv5EkH5Mjdy0YJuU69mPU6olQoD9W9+TIhwyGa5s4KBzqbIq7GdjmIbBlwR8a8qjocSfEagC3aGDeLUGuOxZMy20A7M3/uI5cIKCXlIyawywlTe+ybT7SWFXI8sTCfhtoMviObTheZS97WwtlKUsKzOXrxG8FkLqDaU4j3P1IuwwRkXB9Z1HT6lQPEAg1HHcdUkaxNHdVQBAD97Z2rAviFEJUUO4wluM+SknOiSNTZDzqixdBJiI+kZPNQSkxzQFgktB7I3qP78Okb0WhYL5Tp1ntuKnns4QoDD7EEUxTeY9iDoLjHNEebboqjFeqBwocZSUnjQ2yGKA/qHWqoZEiRJBV2hIwBWssroKqNv59+jJnEIPAy9TIEvpWFFVcXaShDBchHxRlP88B6VJKYkx5l+5EM2EeqxLd4RUdxNGOlH3mBEI+q5+IzwpXm8R6lmgcWNL1Q7m5rVLEskKr1PMaN9YqF/u7+W+5aBjC7oaEUbpwuFzhpHO58k+nqTezwCxZSDyr9TyRKGy9LxxV7vqJWSQ3dQEyvaZltIV/ZeZQIhJDdVdjkjQeGAJvvku+6hkBwVYaxyT2XoZTu9gKuql5SfbOZiG1gBqLpnB/w4IJJiEyexF+cSsCI= X-MS-TrafficTypeDiagnostic: ME3P282MB2194:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T5oKt5FJvq3SOkFYSnDfiYlyCzMLHKRYuXkTmq9NMFi5D1OQf6mCtERlMRJ+56KQG+1omIzmlAdUHuu6iLcui0gUHFXx5PtlowN5UEk4coDSznixD4ii9+p6979v6eSat0hcxx67VuoYfodyz5r/BcTWKpc55pfhk4YUrlh9gv90wMVBIvC5P/2Ct0toKCFZqaUf9eQXFvGnxPUk/g2Zfv+NBDgwrger6Wizdc0bTk+ub/c26e8j8BkgyfXKC1qQktqOZViaYKDvkBRDQ+ZH2PVJn2J8Ds4au9p9c0IfWgPDnGacfzr5yyeF/i2mNYSFOVBii9DnGFmHALVsVkx1AE+iQCIK9Ay+4l4AIhpRbkVmk307T602z/E0CUA6BmjG1Nb/PIOG5LLxGxD3PiMfQFwIGTMXBYb0eM2vB6SvXtFgWd6+Lt3EmS2pRCeMIq79BdWYbVSqhq3R3qToR6BsKl3B3W/+BwJAzHnPVk9MKt/axyjh+mBIezyTDC33m2LsPyoBa6tw4XcRF9YtuiM7Enr9rIznLzfCEDJAQhDsVYg0C7hioQWYIa14vhOL/O40YejvoE/Ug5lmDrHx67K2Fw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?i7IWZdnGkqZi/Rsk6FH8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ii?Q?sKy8AGUwKgE45RZ4iVsIH/npalHuOKbAJDI+pEjq0cPqG95jRz8hi+5XWWX0?= =?us-ascii?Q?FpZHlY/K4Eyk5rTqOQ0O4VPJvjjUSSsaNKmSVIon+VCFVh0FMGEZtpWEShMZ?= =?us-ascii?Q?ryR0dDW8Ow7oFWfWo8hi8aQiu+wB2/tsmcg3GDfD4/qSXJ0Jtd2eHgMm00wC?= =?us-ascii?Q?924U0jaAvB1jtq55xBftFla6/C/C2xJPZTa08scOWumiKnGJTR9Kk/xVsQQy?= =?us-ascii?Q?TsP8nPScCtkjuk72zUaOWV8JMbbCcwLPaUZMeBWjVIG2KBdiX3Zv9JBPDH1l?= =?us-ascii?Q?+yERgZWCuEybcWKeHe0RZvUnt5RzXyn1eJsyNLgacH5iGTXr442YbNieTc3J?= =?us-ascii?Q?CW1yiyMg29K6JlM/D0p/+wIdSGesVNIEy0XMgWwhucinlCRzI05NIhNe+jDT?= =?us-ascii?Q?KL370hiPygs1iByUayvFo5jWTjviOpVVlFUUuyqh0qscFCRWZ2d3mYSAVEuO?= =?us-ascii?Q?u+3DxE/sbMS1yBtorekLKizVY+IVGG0eiSSZaiAOX91YxtwMS46STcFb5mso?= =?us-ascii?Q?04OS4aeaRimwboRb+UsAsXabwCQ1dirF?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b41bafb-38dd-4e0c-fdab-08da49f492f0 X-MS-Exchange-CrossTenant-AuthSource: SY6P282MB4102.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 08:46:41.4023 (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: ME3P282MB2194 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..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