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 02F6042DC8; Tue, 4 Jul 2023 02:12:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7F0A540F18; Tue, 4 Jul 2023 02:12:30 +0200 (CEST) Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by mails.dpdk.org (Postfix) with ESMTP id 2D41A40E03 for ; Tue, 4 Jul 2023 02:12:29 +0200 (CEST) Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-262e839647eso3770201a91.2 for ; Mon, 03 Jul 2023 17:12:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1688429548; x=1691021548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=z3SJBZNkUAwGqMhZ7PiaSpeYBRDD6TdfAK9YKQtBDPE=; b=p3T7pRLqsM33Wn6fLEdk4g5p9c9/m0+9URSBczBIw6D5WJ71z5/y13V+l6mZXoNsfN xYmi+STtZDcxboeQYFigiiQ/RQR6FjnHnrVlhy4NCP2OUomrEsyOSraMA4DMEasLP/5I 3RVKqGjbGt7/hRaKdBf0xvHZRMoXu6YkdMVqbM/Sm/KLSnzhFmPk97kQt9hlj7ItDpdm p1L9RIkhF0rBU1eUusAAnMSrYLKljaKL5SZQFHZhmL5RTb1j+NXnOPUSlFZ+1tvjiZ/3 11cQ73NpnUPuM0YUOpQbM/VxTQXUbT9rf6S6AiQmPA8RyByLHXSvCJ5LSu9dNoSNDwJn 8fGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688429548; x=1691021548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z3SJBZNkUAwGqMhZ7PiaSpeYBRDD6TdfAK9YKQtBDPE=; b=E7tRS928QtDQtzQfTNtJqm+Wv2ghzC+q5JTIBeuoFSze84MwthGFAY49I/Yv98qyuN RITw18dKblwTYn7gJwXuRcad2oZCC1UJVqvAyIEY6y23Rw/n3Is8V6WgURL5WAF9iVFu t0Cx4msmbE3JwiPCnEs+gchKYIKRMqbWuIYXPeIXI27RzmDiEXwt1Xay9tVnwV8RaXY/ Go+oJjUPMdk7GI0WjghuUJ2Eyo+IV0jsnp5iC2UhaViolbsM0Vl57HgoZpWsoDcjX13L 310W+rpXPftb5VxL3fLo1aA0iaELbttI+JL1caFrDNKi5WXznWk0jyMSpbKHbNKyy5kr VstQ== X-Gm-Message-State: ABy/qLZNAy6kUehgE12dJ9jd7NoKHEKxUvlMZB1h720Tc9JMrQFi/uQO xAsEKLAUVhaJq9q0KtoYuGccPg== X-Google-Smtp-Source: APBJJlFuOu3K5v7WcA3Nr4HbpE/Jrwb1L+W0ODWN2qElmjvPfWpMXoBq+digXE+io1CMNpoh8RoO1w== X-Received: by 2002:a17:902:c10c:b0:1b8:862:74ee with SMTP id 12-20020a170902c10c00b001b8086274eemr12819118pli.11.1688429548315; Mon, 03 Jul 2023 17:12:28 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id r11-20020a1709028bcb00b001b895fc0d30sm2435886plo.277.2023.07.03.17.12.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jul 2023 17:12:27 -0700 (PDT) Date: Mon, 3 Jul 2023 17:12:26 -0700 From: Stephen Hemminger To: Xiaoming Jiang Cc: dev@dpdk.org, Stephen Hemminger , Long Li Subject: Re: [PATCH] bus/vmbus: add support allow/block scan mode Message-ID: <20230703171226.2d3887ae@hermes.local> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Thu, 9 Jun 2022 07:55:13 +0000 Xiaoming Jiang wrote: > 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; > + } Nit: You don't need the brackets here. Looks ok to me, need ack from Long Li on this one.