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 2DF14A0558; Thu, 9 Jun 2022 10:28:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9CDC40689; Thu, 9 Jun 2022 10:28:23 +0200 (CEST) Received: from AUS01-SY4-obe.outbound.protection.outlook.com (mail-sy4aus01olkn2146.outbound.protection.outlook.com [40.92.62.146]) by mails.dpdk.org (Postfix) with ESMTP id 16AB240220 for ; Thu, 9 Jun 2022 10:28:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TLBXyq2/FrbUgOfCnGzipPCk2CS70lrtXzraIZVT4kLsF0zGzJPzRDm6nsuV33UpPMV/jX70M9nLpURGcdPQCyK5UOFKEWgnrBnbuiXjrc+am0M3Fma/x0EyUsOoUX0Ik89umFgFwNlWLAflBnO26BSowIYndsYyV7dtyyFzujjcS8jaiWEMxaujiPsat10KivlwOraTNDj03p0F0NRD5T9y0BTlC0m3ul9FyZkGyNbFUldBO29Z/FTv3aDTA2GtEhEwXNWXlVw1YguAK0jgZZ3JXHbfSIeJU6S4c4yZ3Nruz2kOgeZQnilTAR+PNhdXoQ/1GYqa4QGJvqgOcj9boA== 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=DAN6OHl+9OC74Vr0i7gkoJlUSE8jFntGDhMZJIsfbnE=; b=Wb1Y6gDfF8fgq7onoFShlu1zfA34hKzEL/iXCh8eqIAoo9DTP0SIWK2xUYfuaBsYvRHfPVhCeT1L4g77PPM9mpnaiZ5bz1Uxe0sG1BEccCPsw8BGKDPlCvLJ1iNiZbmOgS5wwMj0ThrqinE54U4WiSl8NGQuMFGKdJQtrC3w/Lf6s/yvbZUwLwBf9Ec6xvo/5tvh0gVW+DpxxaVJdUvJcVUToAo8Qubl19aXORovIf0cMz2jo5z+qJB8pJUYsvEqZzNTEUsqez4LqukyAOjqvNz9ieezVRZL9GF9r8fXnB0IrwiZ4W1uNbeOfRoUIim+9L1Vfzc9ZSAqKZ4V+7wmbg== 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=DAN6OHl+9OC74Vr0i7gkoJlUSE8jFntGDhMZJIsfbnE=; b=YotNRYyTGWYZWpgh6poiwSUCwL1RoKIaNlIhk9yRMdliVlIuT5dMxk2xvWVhUHS8o3LANecirT6hj9iP9qEWF9cRiLgmwk5L3mv4P0a/F5j9Cmiv+NUJY+/p1BuEygrsAU92v4Bjb4KRsKCal+H8lZEnpmwWGoKBYYtsTduXr4rLFd8q7eayoRMsB+u+p9kQDw+4cs+LfnJV+UZqnKdtEtFUQeeMPi4mHWxLzXALIw65eoOq3oPw0UwDgLkwzAbvlYDNu3GTJ+czKY/GV7UUivy3TnSf0W+hbS7/CJrZooyj9/TkimO5xt72hft0lF4E/EwX6EiboIkY6J1eOcvyPA== Received: from SY6P282MB4102.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:1dd::9) by SY4P282MB1388.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:a3::10) 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 08:28:20 +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:28: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 08:28:01 +0000 Message-ID: X-Mailer: git-send-email 2.32.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [gJ+GJMy5SV7vUBnugxKwazH70ZAaPGL1] X-ClientProxiedBy: SG2PR03CA0087.apcprd03.prod.outlook.com (2603:1096:4:7c::15) To SY6P282MB4102.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:1dd::9) X-Microsoft-Original-Message-ID: <20220609082800.59050-1-jiangxiaoming@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b7f99afb-2cd0-458d-5138-08da49f2029f X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiTijo6adWu98SeQwQNDMnIRHmNbS3J1QK7RmCHXQgdcJSnh1FMmX4/Ybm4GwBW4mpL0yyb3iq1HuF/cjpJwE9I+x39GO5gDM1Mode23MY6GlR7PL8AzPwsl2AevfwtULN8KmRqjxJFL2QWBqRKb5W3icW0F7+z0Pxdlj35Eds3DEt3Qbi09v2WiJke70vS8nQ8Bdvj0UbbQI6g5IfKvEehwv5fIs9gIePwIPDOdiRHV+0cCJy7Z5ql4kYiQAstw/lPliRjmJBvKOkl3mXXQgSZTgy3gVLrymce63dQWHC0i1fBtZYDwxwBWuZ+y3yUvB2d59OBsLIM7E/h4U+5REqOVnimpuReXbz42iE8MuNKGHQRi9vvWHLlhXf6YwG/6tV2UvuYKIKhr1m6wmHO/LQfkaC6WdYkKgNWMDqCQPYJL3oumLmjUw1byKzXzohYdBPB9ZGqYHAPx1oK4Exb6WRwNebMxzemvH+luo5u9hESZRj6ZkmGQJFVJ/JliEi0f/lrsNh5DGfp4M57MELhmHOdEkuvSh7W01TlYP2SddQUHGHanlvlityzpnmTRwUcQJLuRUt4d2fbijx1Z4exDVwHhGMjwoD4EyD25JhJWurrG+woCrScaTlLd2T/Kn8WYKTnxTv+mW3ilVa51ZAaoFvw4WhVzkvXJ1w6WVQgQjHMGc796PwZY2SrYnm1FWS32R0WG4PrqgmsRaxthZge7VJN4V6Bzda5X8X6nffFS8qSIaPWNnOeCwqa5KhounbH6WAE= X-MS-TrafficTypeDiagnostic: SY4P282MB1388:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 89psVKUYO1jQnEwFx7lqzVAaSYO+CExI+nTzJQegBXtVLKMqHU9CO6ftANUH1smks8tfLJkE+09YFSryOqwbxDSRDqMhXszrSM8YUEXTex7ti+M3F2kdaWt7xksEkc2oV64OEPWpWxoOjlGqMgQqq18eXNcyHUxlFajMFZnDwGDaINmB+Fh7QHExIfskjoy0J/NM4eYRSVwtM7GnMTuOjSwbDY4nIluasdvt8zoVovbF/pF0njidBpr1xvpuRxV/pjMRC4wLiKaTqlLBMqwlH+ttnFz5OfIWZDrfoGqCEruB/tWkElP72Qpo8e8f4BYy+qcBRwLDWbyJm1roJiyTTnAOEdSsttOKQ/HRw+eLHxYhgNdf2/UfKaYqrpKdsX32/VophSje222cNLfSQPxCOv4cDM7FuEvR5Eke9OBORZCK99VWJofWlKpdVif1Eoxr5xEjpC03ICqaTExJXJ06KBDFIyX7zrgrlTKvC5q6QINbO8WtVmKhJQTO51JKJ5mODoRupBdZsdVhxZ52eP1lqffRoVRdT0RboIu0SgSjNjQXmO7SsM75XxtHQGDSlsFIFpy/oTUvHQefxrcT+0YVyQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?vsn/bkEjl5Tq9fm4jPIB6z1ipZ07bVO1IZqcx/sEa6dAwnUuGXNtYes5M+ps?= =?us-ascii?Q?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kGyzm1chaTryQ3/H?= =?us-ascii?Q?0fercY5YB9D5eQ6NTspkwyZIZXGMUWe7nDJhHmzM2aINK3Pm3GPp+K1V1AC7?= =?us-ascii?Q?Lw5jVSp3sFIsqml6Gr6jwkW7UkiZEs8+Gg17/E8APl2idnZ6yP/DnuNOr/Gt?= =?us-ascii?Q?h734/XLUmWC6K0hcedzCJGrKIKlN6zLbxG1Z4FlU/8TkN12m9Va0aYY4SH90?= =?us-ascii?Q?fVxgV6nlHIWLH/DVPXa64ZtDOOgRrJ1d6hLDIXHzWyehkG3yBVXRuAq9s+q1?= =?us-ascii?Q?Go8lRKdt+5D/yKs64lUmb78hDP4YuDW7FNVSG2TTK/xMqj2YyjBGbh6f7/Bj?= =?us-ascii?Q?EI5Fp9UcRUduGUg4aGllQsnowP0g2NCs6CEa2iYA57BRDxzZfpRX1IzJK/qy?= =?us-ascii?Q?BWWv22CM/mwlVzWUvhya+XF6C8Dy0awI6DK0wuPLSpuQpJMhqLQ3quA7CLI5?= =?us-ascii?Q?XyDbgwUFOFYndt1C88PAC3q1OYtL+DKOwt3GRN+KecTuk/5ZYi6kNiMHlUsW?= =?us-ascii?Q?jUYB7BIyaLCcpmaX5wqWzLqfWIwISApP?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7f99afb-2cd0-458d-5138-08da49f2029f 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:28:20.2973 (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: SY4P282MB1388 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..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