From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id E5B6F1B1F6 for ; Thu, 19 Oct 2017 13:42:38 +0200 (CEST) Received: by mail-wr0-f194.google.com with SMTP id u5so8005837wrc.5 for ; Thu, 19 Oct 2017 04:42:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=5iwmV47oFVT3DycoU4iqiIZnEhtNC2pkHA0GkWkOaEw=; b=02MrPCDz6p9VU3JUOvrWxRoMSK3x06KOOOPa4y0YpaIXOGLUaf448yjFObiBIQhpBb mABxwpZ0aJxtWYe40u5gfbDI3WEX/uhieUwcCSPHwG3bWDHwI1irzaUIp8IOCWZZFDdl k+uIAVc0nkFYqLddOyGaMoFG+gYoELM5KMl6U8rJtP7wOsAwOiC9W+vE7TmLfjJj0Dfu kqUP6snuJs5hYQPHHRociLYuRcR4Q3uKDGTKPtpQ+eTAkgdsxUJt49i/YR409aXZYRv5 XiOmeBt98b+GQWjZ7TxHu91Z4k8gOoe2gn5IP8jJxIjoQ18a9hE47VLnC4WYeGf3AOs4 LxhQ== 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=5iwmV47oFVT3DycoU4iqiIZnEhtNC2pkHA0GkWkOaEw=; b=pvDvRdCWzAIU6cmqzUSpDYI5B9aprQFo20ARoLisM+gFq9+Cii7EhvKsYC3AJZdMfQ Y36PGfnTx8ZQy50p8HBe/UUpnbWgA2h23lfx+OuDp1VcZbS+bal/xd69eG5+D6RbWg2k BUjER/o1uYsOo6UodYdJRpcGatcPPOef5aRUqcPoq58xos127CDocQXPM+fjroBQG2H8 GghMdjpTkL1moaWXZkRcad9VyP6E0KItQnKWuXfvzpruDRSWr0Z1gBX0+4CDaE/NIvRF LG41HGcM8Is/wngSl590lPAqF/9FXpc7/eW84b9NTrGaRMj85F2dR/wjjLZ8Jap8Gip0 txMQ== X-Gm-Message-State: AMCzsaVQR9Cc2qRTSgCW0BjT2zZqdjMejeb3qGu3A+CVtvNkAr+ufbVu iFNLRZoSABMyrVln0OU/7CxUcQ== X-Google-Smtp-Source: ABhQp+TNN5PoVFyTONKW9lDQFzgUha60BxSVq0EF1u+xzNR9n4P1Ex5GNyFmfjH0pFO11VGArjdv4g== X-Received: by 10.223.146.101 with SMTP id 92mr1232766wrj.21.1508413358204; Thu, 19 Oct 2017 04:42:38 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id s21sm8633688wra.16.2017.10.19.04.42.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2017 04:42:37 -0700 (PDT) Date: Thu, 19 Oct 2017 13:42:26 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Jianfeng Tan Cc: dev@dpdk.org, santosh.shukla@caviumnetworks.com, jerin.jacob@caviumnetworks.com, anatoly.burakov@intel.com Message-ID: <20171019114225.GF3596@bidouze.vm.6wind.com> References: <1508411909-63954-1-git-send-email-jianfeng.tan@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1508411909-63954-1-git-send-email-jianfeng.tan@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] pci: fix check uio bind 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: , X-List-Received-Date: Thu, 19 Oct 2017 11:42:39 -0000 Hi Jianfeng, On Thu, Oct 19, 2017 at 11:18:29AM +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. > > Fixes: 815c7deaed2d ("pci: get IOMMU class on Linux") > > Signed-off-by: Jianfeng Tan > --- > lib/librte_eal/linuxapp/eal/eal_pci.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c > index b4dbf95..2b23d67 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c > @@ -516,8 +516,26 @@ static inline int > pci_one_device_bound_uio(void) > { > struct rte_pci_device *dev = NULL; > + struct rte_devargs *devargs; > + int check_all = 1; > + int need_check; > + > + if (rte_pci_bus.bus.conf.scan_mode == RTE_BUS_SCAN_WHITELIST) > + check_all = 0; > > FOREACH_DEVICE_ON_PCIBUS(dev) { > + devargs = dev->device.devargs; > + > + need_check = 0; > + if (check_all) Unless I'm mistaken, you will check blacklisted devices as well here. The condition should be something like: if (check_all && devargs == NULL) Which means that both ifs can be refactored as if ((check_all ^ (devargs != NULL)) == 0) continue; Removing need_check. But it can be hard to read. > + need_check = 1; > + else if (devargs != NULL && > + devargs->policy == RTE_DEV_WHITELISTED) > + need_check = 1; > + > + 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