From: Jianfeng Tan Date: Tue, 24 Oct 2017 07:44:53 +0000 (+0000) Subject: bus/pci: fix UIO bind check X-Git-Tag: spdx-start~1053 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=633e4c7d716e852a0a41267fd349c6275351c42f;p=dpdk.git bus/pci: fix UIO bind check When checking if any devices bound to uio, we did not exclude 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 Reviewed-by: Gaetan Rivet Acked-by: Santosh Shukla --- diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 6faeace4f9..cdf810693c 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -524,8 +524,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;