From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4923A04F0; Mon, 16 Dec 2019 17:14:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4D6251D9E; Mon, 16 Dec 2019 17:14:09 +0100 (CET) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id BB0D51F5 for ; Mon, 16 Dec 2019 17:14:07 +0100 (CET) Received: by mail-pf1-f193.google.com with SMTP id d199so5820763pfd.11 for ; Mon, 16 Dec 2019 08:14:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8HB8zzIRf84Fkk22YCVa7+oibvQGyzPoB/LA0Zbf62k=; b=lijpAdPVOPMn4zHYGQDcMaLIbm5u59Zrvuv+2g47gTCkMdg8whiTE1TDZYXu+3cAmT n8ttLyiPUYI0PORSPgWq02ttksH9GXQqYavrQ5yX1k6LvuWFzCIdTlZaPC34aHaWOBEX Tzz589JAcK0oolpQ5lseiiMgfj0l1XNLnhNypOcAaOnes1BJML8bRpGO8xrwmidvrz8S euKAsBdXzLPPOH2ziliNhzpXwPmfTzgiGC4KtVOuBKHV7ELUcJGdqm8n6Pjg54yMscL1 WIwq1/+iinV5sIOfdnSVlv1Ed4bja/qq6EOVsVoG9CHz2xhiYr8V8ieHdxUL3OMzfP+y lA+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8HB8zzIRf84Fkk22YCVa7+oibvQGyzPoB/LA0Zbf62k=; b=Gn6E2/HHc2ovy/Wvitw1m07cXeHxCvKlRn+I5/0uKblwt0HZ7g+ARUhTMK4XfGOnHP oEVLFMrzk07tQoLAyh7KE03HXuFaXocE/41SDUbdi9UA7uC/OGc7hUafVUP7NAkOGJwR IcVlAMGW5+rhZDNt9v399+Rz3NW2Gy/Wnexsveg9kgNYF8aPRquYJXwl14wNwhPmSVEa hL/gD7Uii29zZip/k06eCK+jhTmlt4zeA2Aa4yL+R6/XkexRNsjrPdS4gzg7ktLQH6Mt wZiuAx62VKZwI9EUHvIQNfX9yWINq0AwhVz+HxWQ2szMaj0vptpZsg4PhAUoGqxERQpa c9fg== X-Gm-Message-State: APjAAAWzhUHg7w0wOhH348t+PAwTJuY3kAoOAZH7JcLmOArHEnPp2qtR rpAYlIFd8XxKhANwmO0zFnOY1g== X-Google-Smtp-Source: APXvYqxFrsw4jpbCO504VhUsUizsstXVpIfS2XnwvFIrbG8S74PEako4VQtab2W0E1sOGsq+mU9jJg== X-Received: by 2002:a63:6d0e:: with SMTP id i14mr19754454pgc.12.1576512846697; Mon, 16 Dec 2019 08:14:06 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id z7sm23911163pfk.41.2019.12.16.08.14.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2019 08:14:06 -0800 (PST) Date: Mon, 16 Dec 2019 08:13:17 -0800 From: Stephen Hemminger To: Sunil Kumar Kori Cc: Message-ID: <20191216081317.30f10c9d@hermes.lan> In-Reply-To: <20191216075501.15669-1-skori@marvell.com> References: <20191216075501.15669-1-skori@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] bus/pci: restricted bus scanning to allowed devices X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > /* Create dummy pci device to get devargs */ > + dummy_dev.addr.domain = matches[i].pc_sel.pc_domain; > + dummy_dev.addr.bus = matches[i].pc_sel.pc_bus; > + dummy_dev.addr.devid = matches[i].pc_sel.pc_dev; > + dummy_dev.addr.function = matches[i].pc_sel.pc_func; > + dummy_dev.device.devargs = > + pci_devargs_lookup(&dummy_dev); > + > + /* Check that device should be ignored or not */ > + if (pci_ignore_device(&dummy_dev)) > + continue; It seems that you are creating dummy_dev as an alternative to passing just the PCI bus/device/function. Wouldn't be easier to just use BDF instead. Dummy arguments on the stack can lead to more corner cases in the future if device subsystem changes. > +/** > + * Get the devargs of a PCI device. > + * > + * @param pci_dev > + * PCI device to be validated > + * @return > + * devargs on succes, NULL otherwise > + */ > +struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *pci_dev); Must be marked experimental (or internal). The pci_device should be marked const. > + > +/** > + * Validate whether a pci device should be ignored or not. > + * > + * @param pci_dev > + * PCI device to be validated > + * @return > + * 1 if device is to be ignored, 0 otherwise > + */ > +bool pci_ignore_device(const struct rte_pci_device *pci_dev); ditto