From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH v2] pci: fix check uio bind Date: Tue, 24 Oct 2017 10:25:40 +0200 Message-ID: <20171024082540.GO3596@bidouze.vm.6wind.com> References: <1508411909-63954-1-git-send-email-jianfeng.tan@intel.com> <1508831093-139486-1-git-send-email-jianfeng.tan@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org To: Jianfeng Tan Return-path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id A850E1B754 for ; Tue, 24 Oct 2017 10:25:52 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id z3so7500700wme.5 for ; Tue, 24 Oct 2017 01:25:52 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1508831093-139486-1-git-send-email-jianfeng.tan@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Oct 24, 2017 at 07:44:53AM +0000, Jianfeng Tan wrote: > When checking if any devices bound to uio, we did not exclud > those which are blacklisted (or in the case that a whitelist > is specified). > > This patch fixes it by only checking whitelisted devices, or > not-blacklisted devices depending on the bus scan mode. > > Fixes: 815c7deaed2d ("pci: get IOMMU class on Linux") > > Signed-off-by: Jianfeng Tan Small nit below, but otherwise: Reviewed-by: Gaetan Rivet > --- > v2: > - Accept two suggestions from Gaetan. > > lib/librte_eal/linuxapp/eal/eal_pci.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c > index b4dbf95..4d1de07 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c > @@ -516,8 +516,29 @@ static inline int > pci_one_device_bound_uio(void) > { > struct rte_pci_device *dev = NULL; > + struct rte_devargs *devargs; > + int need_check; Both could have been declared within the loop instead, but this is really a detail and isn't worth a v3 IMO, so do as you please. > > FOREACH_DEVICE_ON_PCIBUS(dev) { > + devargs = dev->device.devargs; > + > + need_check = 0; > + switch (rte_pci_bus.bus.conf.scan_mode) { > + case RTE_BUS_SCAN_WHITELIST: > + if (devargs && devargs->policy == RTE_DEV_WHITELISTED) > + need_check = 1; > + break; > + case RTE_BUS_SCAN_UNDEFINED: > + case RTE_BUS_SCAN_BLACKLIST: > + if (devargs == NULL || > + devargs->policy != RTE_DEV_BLACKLISTED) > + need_check = 1; > + break; > + } > + > + if (!need_check) > + continue; > + > if (dev->kdrv == RTE_KDRV_IGB_UIO || > dev->kdrv == RTE_KDRV_UIO_GENERIC) { > return 1; > -- > 2.7.4 > -- Gaëtan Rivet 6WIND