From patchwork Thu Oct 19 11:18:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianfeng Tan X-Patchwork-Id: 30582 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 96ED31B1F2; Thu, 19 Oct 2017 13:16:59 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 8406D1B1F1 for ; Thu, 19 Oct 2017 13:16:57 +0200 (CEST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Oct 2017 04:16:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,401,1503385200"; d="scan'208";a="162326072" Received: from dpdk06.sh.intel.com ([10.67.110.196]) by orsmga005.jf.intel.com with ESMTP; 19 Oct 2017 04:16:54 -0700 From: Jianfeng Tan To: dev@dpdk.org Cc: santosh.shukla@caviumnetworks.com, jerin.jacob@caviumnetworks.com, anatoly.burakov@intel.com, gaetan.rivet@6wind.com, Jianfeng Tan Date: Thu, 19 Oct 2017 11:18:29 +0000 Message-Id: <1508411909-63954-1-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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) + 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;