DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rugang Chen <rugangchen2011@gmail.com>
To: dev@dpdk.org
Cc: Rugang Chen <rugangchen2011@gmail.com>
Subject: [dpdk-dev] [PATCH] pci: don't insert an unbound device to pci_device_list in pci_scan_one
Date: Sat, 25 Jun 2016 03:30:00 -0700	[thread overview]
Message-ID: <1466850600-1483-1-git-send-email-rugangchen2011@gmail.com> (raw)
In-Reply-To: <1466815528-27163-1-git-send-email-rugangchen2011@gmail.com>

If a device isn't bound by any uio driver (vfio-pci, igb_uio, uio_pci_generic)
and is expected to owned by a kernel space driver, here it's still inserted to
pci_device_list.

This may cause application based on dpdk fetch the device by accident and then
the device is hanlded by dpdk.

For safe, skip it from pci_device_list as if it's unbound, dpdk won't want to
use it.
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f63febc..432d2e8 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -392,8 +392,12 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
 	 * fetch it from pci_device_list by accident and then dpdk handles it. Kernel
 	 * space driver maybe wants to own it.
 	 */
-	if (dev->kdrv == RTE_KDRV_NONE)
+	if (dev->kdrv == RTE_KDRV_NONE) {
+		RTE_LOG(WARNING, EAL, "Skip ubound device\n");
+		free(dev);
 		return 0;
+	}
+
 	/* device is valid, add in list (sorted) */
 	if (TAILQ_EMPTY(&pci_device_list)) {
 		TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
-- 
2.1.4

  reply	other threads:[~2016-06-25 10:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-25  0:45 [dpdk-dev] [PATCH] pci:don't " Rugang Chen
2016-06-25 10:30 ` Rugang Chen [this message]
2016-06-25 16:53 Rugang Chen
2016-06-27 10:31 ` Ferruh Yigit

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=1466850600-1483-1-git-send-email-rugangchen2011@gmail.com \
    --to=rugangchen2011@gmail.com \
    --cc=dev@dpdk.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).