DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 19/22] pci: reference driver structure for each device
Date: Wed, 20 Mar 2013 17:05:07 +0100	[thread overview]
Message-ID: <2a8ac043f295401533dd5b8ae0c1a5907becc6fd.1363795499.git.thomas.monjalon@6wind.com> (raw)
In-Reply-To: <cover.1363795499.git.thomas.monjalon@6wind.com>
In-Reply-To: <cover.1363795499.git.thomas.monjalon@6wind.com>

From: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Add a driver reference (if available) to every PCI devices,
even when blacklisted. This information is made available in the global
device_list variable so users know which network devices are managed or
ignored.

Acked-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Damien Millescamps <damien.millescamps@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 lib/librte_eal/common/eal_common_pci.c  |    3 +--
 lib/librte_eal/common/include/rte_pci.h |    2 ++
 lib/librte_eal/linuxapp/eal/eal_pci.c   |   11 ++++++++++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index fe24265..73d8fb3 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -81,9 +81,8 @@ pci_probe_all_drivers(struct rte_pci_device *dev)
 {
 	struct rte_pci_driver *dr = NULL;
 
+	dev->blacklisted = !!is_blacklisted(dev);
 	TAILQ_FOREACH(dr, &driver_list, next) {
-		if (is_blacklisted(dev))
-			return -1;
 		if (rte_eal_pci_probe_one_driver(dr, dev) == 0)
 			return 0;
 	}
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index f2128b5..b465995 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -111,6 +111,8 @@ struct rte_pci_device {
 	struct rte_pci_id id;                   /**< PCI ID. */
 	struct rte_pci_resource mem_resource;   /**< PCI Memory Resource */
 	struct rte_intr_handle intr_handle;     /**< Interrupt handle */
+	const struct rte_pci_driver *driver;    /**< Associated driver */
+	unsigned int blacklisted:1;             /**< Device is blacklisted */
 };
 
 /** Any PCI device identifier (vendor, device, ...) */
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 78687d6..86002bd 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -731,7 +731,8 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
 		dev->id.vendor_id, dev->id.device_id, dr->name);
 
 		/* Unbind PCI devices if needed */
-		if (module_name != NULL) {
+		if ((!dev->blacklisted) &&
+		    (module_name != NULL)) {
 			if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 			/* unbind current driver, bind ours */
 				if (pci_unbind_kernel_driver(dev) < 0)
@@ -743,6 +744,14 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
 			if (pci_uio_map_resource(dev) < 0)
 				return -1;
 		}
+
+		/* reference driver structure */
+		dev->driver = dr;
+
+		/* no initialization when blacklisted */
+		if (dev->blacklisted)
+			return -1;
+
 		/* call the driver devinit() function */
 		return dr->devinit(dr, dev);
 
-- 
1.7.2.5

  parent reply	other threads:[~2013-03-20 16:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 16:04 [dpdk-dev] [PATCH 00/22] upgrade with 6WIND's enhancements Thomas Monjalon
2013-03-20 16:04 ` [dpdk-dev] [PATCH 01/22] mk: use $CC to detect toolchain version Thomas Monjalon
2013-03-20 16:04 ` [dpdk-dev] [PATCH 02/22] mk: fix typo in LDFLAGS for 32-bit Thomas Monjalon
2013-03-20 16:04 ` [dpdk-dev] [PATCH 03/22] mk: fix verbose display of install command Thomas Monjalon
2013-03-20 16:04 ` [dpdk-dev] [PATCH 04/22] mk: add a makefile for shared libraries Thomas Monjalon
2013-03-20 16:04 ` [dpdk-dev] [PATCH 05/22] mk: allow corei7-avx flag with gcc 4.7 Thomas Monjalon
2013-03-20 16:04 ` [dpdk-dev] [PATCH 06/22] app: fix volatile read for GCC >= 4.6 Thomas Monjalon
2013-03-20 16:04 ` [dpdk-dev] [PATCH 07/22] app: fix unused values Thomas Monjalon
2013-03-20 16:04 ` [dpdk-dev] [PATCH 08/22] app: use (void)variable when unused Thomas Monjalon
2013-03-20 16:04 ` [dpdk-dev] [PATCH 09/22] app: fix testpmd compliance with __rte_mbuf_sanity_check() Thomas Monjalon
2013-03-20 16:04 ` [dpdk-dev] [PATCH 10/22] app: fix config crash in testpmd Thomas Monjalon
2013-03-20 16:04 ` [dpdk-dev] [PATCH 11/22] app: fix autotest summary in error cases Thomas Monjalon
2013-03-20 16:05 ` [dpdk-dev] [PATCH 12/22] lib: fix unused values Thomas Monjalon
2013-03-20 16:05 ` [dpdk-dev] [PATCH 13/22] lib: fix uninitialized variables Thomas Monjalon
2013-03-20 16:05 ` [dpdk-dev] [PATCH 14/22] lib: fix non-C99 macros definitions in exported headers Thomas Monjalon
2013-03-20 16:05 ` [dpdk-dev] [PATCH 15/22] mem: fix access to huge page with high address Thomas Monjalon
2013-03-20 16:05 ` [dpdk-dev] [PATCH 16/22] timer: check TSC reliability Thomas Monjalon
2013-03-20 16:05 ` [dpdk-dev] [PATCH 17/22] timer: get TSC frequency from /proc/cpuinfo Thomas Monjalon
2013-03-20 16:05 ` [dpdk-dev] [PATCH 18/22] timer: option --vmware-tsc-map for VMware guest Thomas Monjalon
2013-03-20 16:05 ` Thomas Monjalon [this message]
2013-03-20 16:05 ` [dpdk-dev] [PATCH 20/22] pci: allow drivers to be bound several times to the same PCI device Thomas Monjalon
2013-03-20 16:05 ` [dpdk-dev] [PATCH 21/22] igb_uio: fix driver dependency Thomas Monjalon
2013-03-20 16:05 ` [dpdk-dev] [PATCH 22/22] igb_uio: fix build with kernel >= 3.8 Thomas Monjalon
2013-03-20 16:58 ` [dpdk-dev] [PATCH 00/22] upgrade with 6WIND's enhancements Vincent JARDIN
2013-03-21  9:40   ` Thomas Monjalon

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=2a8ac043f295401533dd5b8ae0c1a5907becc6fd.1363795499.git.thomas.monjalon@6wind.com \
    --to=thomas.monjalon@6wind.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).