summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Millescamps <damien.millescamps@6wind.com>2013-07-10 15:14:52 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2013-07-25 16:08:01 +0200
commitb33d322d781f544d3eb258e1f4b3433ad45cacb4 (patch)
treead4cd98acb9a992fc8896d81152776d5a589ef56
parent74a5f4b0ced2fa2739fec4ac2a2cc1eab80a6ee4 (diff)
downloaddpdk-b33d322d781f544d3eb258e1f4b3433ad45cacb4.zip
dpdk-b33d322d781f544d3eb258e1f4b3433ad45cacb4.tar.gz
dpdk-b33d322d781f544d3eb258e1f4b3433ad45cacb4.tar.xz
pci: add flag to force unbind device
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> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
-rw-r--r--lib/librte_eal/common/include/rte_pci.h2
-rw-r--r--lib/librte_eal/linuxapp/eal/eal_pci.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 75f3e9a..93e3636 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -187,6 +187,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
/**
* Perform clean up of pci drivers on application exits.
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index a894a73..c793148 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -828,6 +828,13 @@ 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 */
+ pci_get_previous_driver_path(dev);
+ if (pci_unbind_kernel_driver(dev) < 0)
+ return -1;
}
/* call the driver devinit() function */