DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] rte_pmd_init_all: initialize non-PCI PMDs provided by EAL
@ 2014-04-10 14:41 John W. Linville
  2014-04-11 13:23 ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: John W. Linville @ 2014-04-10 14:41 UTC (permalink / raw)
  To: dev

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] rte_pmd_init_all: initialize non-PCI PMDs provided by EAL
  2014-04-10 14:41 [dpdk-dev] [PATCH] rte_pmd_init_all: initialize non-PCI PMDs provided by EAL John W. Linville
@ 2014-04-11 13:23 ` Thomas Monjalon
  2014-04-11 13:46   ` John W. Linville
  2014-04-13 18:22   ` Neil Horman
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Monjalon @ 2014-04-11 13:23 UTC (permalink / raw)
  To: John W. Linville; +Cc: dev

Hi John,

2014-04-10 10:41, John W. Linville:
> 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>

We are using constuctors to initialize these drivers. See the patches from 
Olivier Matz.
The function rte_pmd_init_all() should be removed.

So this patch won't be applied.

Your help to continue cleaning this area is welcome.
-- 
Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] rte_pmd_init_all: initialize non-PCI PMDs provided by EAL
  2014-04-11 13:23 ` Thomas Monjalon
@ 2014-04-11 13:46   ` John W. Linville
  2014-04-13 18:22   ` Neil Horman
  1 sibling, 0 replies; 4+ messages in thread
From: John W. Linville @ 2014-04-11 13:46 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On Fri, Apr 11, 2014 at 03:23:27PM +0200, Thomas Monjalon wrote:
> Hi John,
> 
> 2014-04-10 10:41, John W. Linville:
> > 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>
> 
> We are using constuctors to initialize these drivers. See the patches from 
> Olivier Matz.
> The function rte_pmd_init_all() should be removed.

So long as you make DPDK-based apps not die when only using non-PCI
(i.e. "virtual") PMDs, I'll be happy...

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] rte_pmd_init_all: initialize non-PCI PMDs provided by EAL
  2014-04-11 13:23 ` Thomas Monjalon
  2014-04-11 13:46   ` John W. Linville
@ 2014-04-13 18:22   ` Neil Horman
  1 sibling, 0 replies; 4+ messages in thread
From: Neil Horman @ 2014-04-13 18:22 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On Fri, Apr 11, 2014 at 03:23:27PM +0200, Thomas Monjalon wrote:
> Hi John,
> 
> 2014-04-10 10:41, John W. Linville:
> > 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>
> 
> We are using constuctors to initialize these drivers. See the patches from 
> Olivier Matz.
> The function rte_pmd_init_all() should be removed.
> 
Actually, from what I see in the git tree and of his patch set, he's only
converted the virtual devices to use constructors with registration functions.
The physical pmd's still use rte_pmd_init_all, so until that changes, this still
seems like a reasonable interim step.

Neil

> So this patch won't be applied.
> 
> Your help to continue cleaning this area is welcome.
> -- 
> Thomas
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-13 18:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10 14:41 [dpdk-dev] [PATCH] rte_pmd_init_all: initialize non-PCI PMDs provided by EAL John W. Linville
2014-04-11 13:23 ` Thomas Monjalon
2014-04-11 13:46   ` John W. Linville
2014-04-13 18:22   ` Neil Horman

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).