From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jianfeng Tan Subject: [PATCH v2] pci: fix check uio bind Date: Tue, 24 Oct 2017 07:44:53 +0000 Message-ID: <1508831093-139486-1-git-send-email-jianfeng.tan@intel.com> References: <1508411909-63954-1-git-send-email-jianfeng.tan@intel.com> Cc: gaetan.rivet@6wind.com, Jianfeng Tan To: dev@dpdk.org Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 8F81A1B748 for ; Tue, 24 Oct 2017 09:43:17 +0200 (CEST) In-Reply-To: <1508411909-63954-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" 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 --- 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; 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