summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDamien Millescamps <damien.millescamps@6wind.com>2013-07-10 15:14:52 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-01-15 18:11:17 +0100
commit19ea97bd0aa7d06259c0ee0b7c8fce9c98157f01 (patch)
tree64d04a476a56c3de068349b13fe88f9eeaa3a0e6 /lib
parent79a7fbab35f9bb4ecf262267ca4dd0d0bb81f5ae (diff)
downloaddpdk-19ea97bd0aa7d06259c0ee0b7c8fce9c98157f01.zip
dpdk-19ea97bd0aa7d06259c0ee0b7c8fce9c98157f01.tar.gz
dpdk-19ea97bd0aa7d06259c0ee0b7c8fce9c98157f01.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>
Diffstat (limited to 'lib')
-rw-r--r--lib/librte_eal/common/include/rte_pci.h2
-rw-r--r--lib/librte_eal/linuxapp/eal/eal_pci.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 15474fa..4d87c5a 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -192,6 +192,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
/**< Internal use only - Macro used by pci addr parsing functions **/
#define GET_PCIADDR_FIELD(in, fd, lim, dlm) \
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 7a6ae3b..37ee6f1 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -974,10 +974,16 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
}
#ifdef RTE_EAL_UNBIND_PORTS
- if (dr->drv_flags & RTE_PCI_DRV_NEED_IGB_UIO)
+ if (dr->drv_flags & RTE_PCI_DRV_NEED_IGB_UIO) {
/* unbind driver and load uio resources for Intel NICs */
if (pci_switch_module(dr, dev, 1, IGB_UIO_NAME) < 0)
return -1;
+ } else if (dr->drv_flags & RTE_PCI_DRV_FORCE_UNBIND &&
+ rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ /* unbind current driver */
+ if (pci_unbind_kernel_driver(dev) < 0)
+ return -1;
+ }
#else
if (dr->drv_flags & RTE_PCI_DRV_NEED_IGB_UIO)
/* just map resources for Intel NICs */