[v2,1/2] eal/windows: add needed calls to detect vdev PMD

Message ID 20200707084823.28160-2-talshn@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series Windows bus/vdev support |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Tal Shnaiderman July 7, 2020, 8:48 a.m. UTC
  From: Tal Shnaiderman <talshn@mellanox.com>

Add needed function calls in rte_eal_init to detect vdev PMD.

eal_option_device_parse()
rte_service_init()
rte_bus_probe()

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
 lib/librte_eal/common/meson.build |  1 +
 lib/librte_eal/windows/eal.c      | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)
  

Comments

Narcisa Ana Maria Vasile July 16, 2020, 8:54 p.m. UTC | #1
On Tue, Jul 07, 2020 at 11:48:22AM +0300, talshn@mellanox.com wrote:
> From: Tal Shnaiderman <talshn@mellanox.com>
> 
> Add needed function calls in rte_eal_init to detect vdev PMD.
> 
> eal_option_device_parse()
> rte_service_init()
> rte_bus_probe()
> 
> Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
> ---
>  lib/librte_eal/common/meson.build |  1 +
>  lib/librte_eal/windows/eal.c      | 20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+)

Tested-by: Narcisa Vasile <navasile@linux.microsoft.com>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
  

Patch

diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index c1d9f21488..9f32262450 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -31,6 +31,7 @@  if is_windows
 		'malloc_heap.c',
 		'rte_malloc.c',
 		'eal_common_timer.c',
+		'rte_service.c',
 	)
 	subdir_done()
 endif
diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c
index eb10b4ef96..cbbf67e253 100644
--- a/lib/librte_eal/windows/eal.c
+++ b/lib/librte_eal/windows/eal.c
@@ -17,6 +17,7 @@ 
 #include <eal_filesystem.h>
 #include <eal_options.h>
 #include <eal_private.h>
+#include <rte_service_component.h>
 #include <rte_trace_point.h>
 #include <rte_vfio.h>
 
@@ -273,6 +274,11 @@  rte_eal_init(int argc, char **argv)
 	if (fctret < 0)
 		exit(1);
 
+	if (eal_option_device_parse()) {
+		rte_errno = ENODEV;
+		return -1;
+	}
+
 	/* Prevent creation of shared memory files. */
 	if (internal_conf->in_memory == 0) {
 		RTE_LOG(WARNING, EAL, "Multi-process support is requested, "
@@ -362,6 +368,20 @@  rte_eal_init(int argc, char **argv)
 			rte_panic("Cannot create thread\n");
 	}
 
+	/* initialize services so vdevs register service during bus_probe. */
+	if (rte_service_init()) {
+		rte_eal_init_alert("rte_service_init() failed");
+		rte_errno = ENOEXEC;
+		return -1;
+	}
+
+	/* Probe all the buses and devices/drivers on them */
+	if (rte_bus_probe()) {
+		rte_eal_init_alert("Cannot probe devices");
+		rte_errno = ENOTSUP;
+		return -1;
+	}
+
 	/*
 	 * Launch a dummy function on all slave lcores, so that master lcore
 	 * knows they are all ready when this function returns.