All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jianfeng Tan <jianfeng.tan@intel.com>
To: dev@dpdk.org
Cc: gaetan.rivet@6wind.com, Jianfeng Tan <jianfeng.tan@intel.com>
Subject: [PATCH v2] pci: fix check uio bind
Date: Tue, 24 Oct 2017 07:44:53 +0000	[thread overview]
Message-ID: <1508831093-139486-1-git-send-email-jianfeng.tan@intel.com> (raw)
In-Reply-To: <1508411909-63954-1-git-send-email-jianfeng.tan@intel.com>

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 <jianfeng.tan@intel.com>
---
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

  parent reply	other threads:[~2017-10-24  7:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 11:18 [PATCH] pci: fix check uio bind Jianfeng Tan
2017-10-19 11:42 ` Gaëtan Rivet
2017-10-20 16:47   ` Tan, Jianfeng
2017-10-20 20:08     ` Gaëtan Rivet
2017-10-23  3:20       ` Tan, Jianfeng
2017-10-24  7:44 ` Jianfeng Tan [this message]
2017-10-24  8:25   ` [PATCH v2] " Gaëtan Rivet
2017-10-26 21:48     ` Thomas Monjalon
2017-10-24  8:31   ` santosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1508831093-139486-1-git-send-email-jianfeng.tan@intel.com \
    --to=jianfeng.tan@intel.com \
    --cc=dev@dpdk.org \
    --cc=gaetan.rivet@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.