DPDK patches and discussions
 help / color / mirror / Atom feed
From: Damien Millescamps <damien.millescamps@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/2] eal: add flag to force unbind device
Date: Wed, 10 Jul 2013 15:14:52 +0200	[thread overview]
Message-ID: <0f890bf9b880233a2af4844f78ccef07c5018c98.1373462050.git.damien.millescamps@6wind.com> (raw)
In-Reply-To: <cover.1373462050.git.damien.millescamps@6wind.com>
In-Reply-To: <cover.1373462050.git.damien.millescamps@6wind.com>

Some devices need to be unbound in order to be used via the PMD
without kernel module.

Signed-off-by: Damien Millescamps <damien.millescamps@6wind.com>
---
 lib/librte_eal/common/include/rte_pci.h |    2 ++
 lib/librte_eal/linuxapp/eal/eal_pci.c   |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index c3937f0..6582c25 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -157,6 +157,8 @@ struct rte_pci_driver {
 #define RTE_PCI_DRV_NEED_IGB_UIO 0x0001
 /** Device driver must be registered several times until failure */
 #define RTE_PCI_DRV_MULTIPLE 0x0002
+/** Device needs to be unbound even if no module is provided */
+#define RTE_PCI_DRV_FORCE_UNBIND 0x0004
 
 /**
  * Probe the PCI bus for registered drivers.
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 882fd6f..1d087b8 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -745,6 +745,11 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
 			/* map the NIC resources */
 			if (pci_uio_map_resource(dev) < 0)
 				return -1;
+		} else if (dr->drv_flags & RTE_PCI_DRV_FORCE_UNBIND &&
+		           rte_eal_process_type() == RTE_PROC_PRIMARY) {
+			/* unbind current driver, bind ours */
+			if (pci_unbind_kernel_driver(dev) < 0)
+				return -1;
 		}
 
 		/* reference driver structure */
-- 
1.7.2.5

  reply	other threads:[~2013-07-10 13:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10 13:14 [dpdk-dev] [PATCH 0/2] *** SUBJECT HERE *** Damien Millescamps
2013-07-10 13:14 ` Damien Millescamps [this message]
2013-07-10 15:52   ` [dpdk-dev] [PATCH 1/2] eal: add flag to force unbind device Thomas Monjalon
2013-07-10 13:14 ` [dpdk-dev] [PATCH 2/2] eal: load libraries before creating threads Damien Millescamps
2013-07-10 15:52   ` 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=0f890bf9b880233a2af4844f78ccef07c5018c98.1373462050.git.damien.millescamps@6wind.com \
    --to=damien.millescamps@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).