From: "John W. Linville" <linville@tuxdriver.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] rte_pmd_init_all: initialize non-PCI PMDs provided by EAL
Date: Thu, 10 Apr 2014 10:41:47 -0400 [thread overview]
Message-ID: <1397140907-17856-1-git-send-email-linville@tuxdriver.com> (raw)
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@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
next reply other threads:[~2014-04-10 14:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-10 14:41 John W. Linville [this message]
2014-04-11 13:23 ` Thomas Monjalon
2014-04-11 13:46 ` John W. Linville
2014-04-13 18:22 ` Neil Horman
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=1397140907-17856-1-git-send-email-linville@tuxdriver.com \
--to=linville@tuxdriver.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).