[dpdk-dev] [PATCH] rte_pmd_init_all: initialize non-PCI PMDs provided by EAL
John W. Linville
linville at tuxdriver.com
Thu Apr 10 16:41:47 CEST 2014
These PMDs were being initialized by the EAL layer, but many apps were
relying on the return value of rte_pmd_init_all to indicate that
ethernet interfaces were available for use. Move the initialization of
the non-PCI PMDs to this centralized function to have all of the PMDs
treated equally.
Signed-off-by: John W. Linville <linville at tuxdriver.com>
---
lib/librte_eal/bsdapp/eal/eal.c | 3 ---
lib/librte_eal/common/eal_common_nonpci_devs.c | 2 +-
lib/librte_eal/common/include/eal_private.h | 7 -------
lib/librte_eal/common/include/rte_common.h | 7 +++++++
lib/librte_eal/linuxapp/eal/eal.c | 3 ---
lib/librte_ether/rte_ethdev.h | 11 +++++++++++
6 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index be00f9120a65..a1cd683c6ff6 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -854,9 +854,6 @@ rte_eal_init(int argc, char **argv)
rte_eal_mcfg_complete();
- if (rte_eal_non_pci_ethdev_init() < 0)
- rte_panic("Cannot init non-PCI eth_devs\n");
-
RTE_LCORE_FOREACH_SLAVE(i) {
/*
diff --git a/lib/librte_eal/common/eal_common_nonpci_devs.c b/lib/librte_eal/common/eal_common_nonpci_devs.c
index 1c9c88b61535..bf645e3f6449 100644
--- a/lib/librte_eal/common/eal_common_nonpci_devs.c
+++ b/lib/librte_eal/common/eal_common_nonpci_devs.c
@@ -76,7 +76,7 @@ struct device_init dev_types[] = {
};
int
-rte_eal_non_pci_ethdev_init(void)
+rte_eal_non_pci_pmd_init(void)
{
uint8_t i, j;
for (i = 0; i < NUM_DEV_TYPES; i++) {
diff --git a/lib/librte_eal/common/include/eal_private.h b/lib/librte_eal/common/include/eal_private.h
index 251f15e71b74..a7806a957096 100644
--- a/lib/librte_eal/common/include/eal_private.h
+++ b/lib/librte_eal/common/include/eal_private.h
@@ -234,11 +234,4 @@ int eal_dev_is_whitelisted(const char *device_str, const char **params);
*/
void eal_dev_whitelist_clear(void);
-/**
- * This function initialises any non-PCI i.e. dummy ethernet devices
- *
- * This function is private to the EAL.
- */
-int rte_eal_non_pci_ethdev_init(void);
-
#endif /* _EAL_PRIVATE_H_ */
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index b6ea7f06741a..1a69711e4589 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -382,6 +382,13 @@ rte_exit(int exit_code, const char *format, ...)
__attribute__((noreturn))
__attribute__((format(printf, 2, 3)));
+/**
+ * This function initialises any non-PCI i.e. dummy ethernet devices
+ *
+ * This function is private to the EAL.
+ */
+int rte_eal_non_pci_pmd_init(void);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 72b4dd7b1333..cdd8ecd2e004 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -1029,9 +1029,6 @@ rte_eal_init(int argc, char **argv)
rte_eal_mcfg_complete();
- if (rte_eal_non_pci_ethdev_init() < 0)
- rte_panic("Cannot init non-PCI eth_devs\n");
-
TAILQ_FOREACH(solib, &solib_list, next) {
solib->lib_handle = dlopen(solib->name, RTLD_NOW);
if ((solib->lib_handle == NULL) && (solib->name[0] != '/')) {
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index dea7471d71a4..f6622990fe0a 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1389,6 +1389,9 @@ extern int rte_vmxnet3_pmd_init(void);
* - ixgbevf
* - virtio
* - vmxnet3
+ * - pcap
+ * - ring
+ * - xenvirt
* This function is invoked once at EAL start time.
* @return
* 0 on success.
@@ -1444,6 +1447,14 @@ int rte_pmd_init_all(void)
}
#endif /* RTE_LIBRTE_VMXNET3_PMD */
+#if defined(RTE_LIBRTE_PMD_PCAP) || defined(RTE_LIBRTE_PMD_RING) || \
+ defined(RTE_LIBRTE_PMD_XENVIRT)
+ if ((ret = rte_eal_non_pci_pmd_init()) != 0) {
+ RTE_LOG(ERR, PMD, "Cannot init non-PCI PMDs\n");
+ return (ret);
+ }
+#endif /* PMD_PCAP || PMD_RING || PMD_XENVIRT */
+
if (ret == -ENODEV)
RTE_LOG(ERR, PMD, "No PMD(s) are configured\n");
return (ret);
--
1.9.0
More information about the dev
mailing list