summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Monjalon <thomas.monjalon@6wind.com>2013-09-17 12:00:57 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-01-15 18:11:17 +0100
commit79a7fbab35f9bb4ecf262267ca4dd0d0bb81f5ae (patch)
tree9c764e01132be5246330515c4a1b6773ff895f55 /lib
parentefa7e63e345b443a53b5ed49364533af946be67e (diff)
downloaddpdk-79a7fbab35f9bb4ecf262267ca4dd0d0bb81f5ae.zip
dpdk-79a7fbab35f9bb4ecf262267ca4dd0d0bb81f5ae.tar.gz
dpdk-79a7fbab35f9bb4ecf262267ca4dd0d0bb81f5ae.tar.xz
pci: use igb_uio mapping only when needed
Since DPDK 1.4, if RTE_EAL_UNBIND_PORTS is disabled, igb_uio mapping is done for all devices (commit eee16c964cd), breaking some non-Intel drivers. But pci_uio_map_resource() should only be called for Intel devices (using igb_uio kernel module). The flag RTE_PCI_DRV_NEED_IGB_UIO is set for all those devices, even when RTE_EAL_UNBIND_PORTS is disabled (fixes commit a22f5ce8fcc). Signed-off-by: David Marchand <david.marchand@6wind.com> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Damien Millescamps <damien.millescamps@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.c20
-rw-r--r--lib/librte_pmd_e1000/em_ethdev.c2
-rw-r--r--lib/librte_pmd_e1000/igb_ethdev.c4
-rw-r--r--lib/librte_pmd_ixgbe/ixgbe_ethdev.c4
5 files changed, 7 insertions, 25 deletions
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 468be2b..15474fa 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -188,10 +188,8 @@ struct rte_pci_driver {
uint32_t drv_flags; /**< Flags contolling handling of device. */
};
-#ifdef RTE_EAL_UNBIND_PORTS
/** Device needs igb_uio kernel module */
#define RTE_PCI_DRV_NEED_IGB_UIO 0x0001
-#endif
/** Device driver must be registered several times until failure */
#define RTE_PCI_DRV_MULTIPLE 0x0002
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 689369c..7a6ae3b 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -941,13 +941,6 @@ int
rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *dev)
{
struct rte_pci_id *id_table;
-#ifdef RTE_EAL_UNBIND_PORTS
- const char *module_name = NULL;
- int uio_status = -1;
-
- if (dr->drv_flags & RTE_PCI_DRV_NEED_IGB_UIO)
- module_name = IGB_UIO_NAME;
-#endif
for (id_table = dr->id_table ; id_table->vendor_id != 0; id_table++) {
@@ -981,14 +974,15 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
}
#ifdef RTE_EAL_UNBIND_PORTS
- /* Unbind PCI devices if needed */
- if (module_name != NULL)
- if (pci_switch_module(dr, dev, uio_status, module_name) < 0)
+ 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
- /* just map the NIC resources */
- if (pci_uio_map_resource(dev) < 0)
- return -1;
+ if (dr->drv_flags & RTE_PCI_DRV_NEED_IGB_UIO)
+ /* just map resources for Intel NICs */
+ if (pci_uio_map_resource(dev) < 0)
+ return -1;
#endif
/* reference driver structure */
diff --git a/lib/librte_pmd_e1000/em_ethdev.c b/lib/librte_pmd_e1000/em_ethdev.c
index fa3ebc9..fe16d8c 100644
--- a/lib/librte_pmd_e1000/em_ethdev.c
+++ b/lib/librte_pmd_e1000/em_ethdev.c
@@ -279,9 +279,7 @@ static struct eth_driver rte_em_pmd = {
{
.name = "rte_em_pmd",
.id_table = pci_id_em_map,
-#ifdef RTE_EAL_UNBIND_PORTS
.drv_flags = RTE_PCI_DRV_NEED_IGB_UIO,
-#endif
},
.eth_dev_init = eth_em_dev_init,
.dev_private_size = sizeof(struct e1000_adapter),
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c
index e485326..4561af2 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -533,9 +533,7 @@ static struct eth_driver rte_igb_pmd = {
{
.name = "rte_igb_pmd",
.id_table = pci_id_igb_map,
-#ifdef RTE_EAL_UNBIND_PORTS
.drv_flags = RTE_PCI_DRV_NEED_IGB_UIO,
-#endif
},
.eth_dev_init = eth_igb_dev_init,
.dev_private_size = sizeof(struct e1000_adapter),
@@ -548,9 +546,7 @@ static struct eth_driver rte_igbvf_pmd = {
{
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
-#ifdef RTE_EAL_UNBIND_PORTS
.drv_flags = RTE_PCI_DRV_NEED_IGB_UIO,
-#endif
},
.eth_dev_init = eth_igbvf_dev_init,
.dev_private_size = sizeof(struct e1000_adapter),
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 240106b..d53e4bd 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -875,9 +875,7 @@ static struct eth_driver rte_ixgbe_pmd = {
{
.name = "rte_ixgbe_pmd",
.id_table = pci_id_ixgbe_map,
-#ifdef RTE_EAL_UNBIND_PORTS
.drv_flags = RTE_PCI_DRV_NEED_IGB_UIO,
-#endif
},
.eth_dev_init = eth_ixgbe_dev_init,
.dev_private_size = sizeof(struct ixgbe_adapter),
@@ -890,9 +888,7 @@ static struct eth_driver rte_ixgbevf_pmd = {
{
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
-#ifdef RTE_EAL_UNBIND_PORTS
.drv_flags = RTE_PCI_DRV_NEED_IGB_UIO,
-#endif
},
.eth_dev_init = eth_ixgbevf_dev_init,
.dev_private_size = sizeof(struct ixgbe_adapter),