DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v3 0/7] Windows bus/pci support
@ 2020-05-07 12:16 talshn
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 1/7] eal: move OS common functions to single file talshn
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: talshn @ 2020-05-07 12:16 UTC (permalink / raw)
  To: dev
  Cc: thomas, pallavi.kadam, dmitry.kozliuk, david.marchand, grive,
	ranjit.menon, navasile, anatoly.burakov, Tal Shnaiderman

From: Tal Shnaiderman <talshn@mellanox.com>

This patchset implements the EAL and PCI functions needed for probing PMDs using RTE_KDRV_NONE on Windows.

Depends-on: series-9713 ("Windows basic memory management")

v3:
	* Changes in BDF and hardware ids retrieval(DmitryK).
	* Apply new generic MM to all pci unix callers(DmitryK).
	* Minor corrections in pci.c(DmitryK).
v2:
	* fix style issues.
	* fix error handing flow in pci.c
	* change eal_config.c to eal_common_config.c 

Tal Shnaiderman (7):
  eal: move OS common functions to single file
  pci: use OS generic memory mapping functions
  pci: build on Windows
  drivers: ignore pmdinfogen generation for Windows
  drivers: fix incorrect meson import folder for Windows
  bus/pci: introduce Windows support with stubs
  bus/pci: support Windows with bifurcated drivers

 drivers/baseband/meson.build                 |   4 +
 drivers/bus/ifpga/meson.build                |   6 +
 drivers/bus/pci/bsd/pci.c                    |   2 +-
 drivers/bus/pci/linux/pci_uio.c              |   2 +-
 drivers/bus/pci/linux/pci_vfio.c             |   8 +-
 drivers/bus/pci/meson.build                  |  14 +-
 drivers/bus/pci/pci_common.c                 |   2 -
 drivers/bus/pci/pci_common_uio.c             |   2 +-
 drivers/bus/pci/windows/pci.c                | 390 +++++++++++++++++++++++++++
 drivers/bus/vdev/meson.build                 |   6 +
 drivers/bus/vmbus/meson.build                |   7 +
 drivers/common/meson.build                   |   4 +
 drivers/compress/meson.build                 |   4 +
 drivers/crypto/meson.build                   |   4 +
 drivers/event/meson.build                    |   4 +
 drivers/mempool/meson.build                  |   4 +
 drivers/meson.build                          |   9 +-
 drivers/net/meson.build                      |   4 +
 drivers/raw/meson.build                      |   4 +
 drivers/vdpa/meson.build                     |   4 +
 lib/librte_eal/common/eal_common_config.c    |  34 +++
 lib/librte_eal/common/eal_private.h          |  11 +
 lib/librte_eal/common/meson.build            |   3 +
 lib/librte_eal/freebsd/eal.c                 |  34 ---
 lib/librte_eal/linux/eal.c                   |  33 ---
 lib/librte_eal/rte_eal_exports.def           |   8 +
 lib/librte_eal/windows/eal.c                 |  63 ++---
 lib/librte_eal/windows/eal_mp.c              |  14 +
 lib/librte_eal/windows/include/rte_os.h      |   1 +
 lib/librte_eal/windows/include/rte_windows.h |   1 +
 lib/librte_pci/rte_pci.c                     |  14 +-
 lib/librte_pci/rte_pci.h                     |   2 +-
 lib/meson.build                              |   5 +-
 33 files changed, 575 insertions(+), 132 deletions(-)
 create mode 100644 drivers/bus/pci/windows/pci.c
 create mode 100644 lib/librte_eal/common/eal_common_config.c

-- 
2.16.1.windows.4


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

* [dpdk-dev] [PATCH v3 1/7] eal: move OS common functions to single file
  2020-05-07 12:16 [dpdk-dev] [PATCH v3 0/7] Windows bus/pci support talshn
@ 2020-05-07 12:16 ` talshn
  2020-05-07 23:26   ` Dmitry Kozlyuk
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 2/7] pci: use OS generic memory mapping functions talshn
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: talshn @ 2020-05-07 12:16 UTC (permalink / raw)
  To: dev
  Cc: thomas, pallavi.kadam, dmitry.kozliuk, david.marchand, grive,
	ranjit.menon, navasile, anatoly.burakov, Tal Shnaiderman

From: Tal Shnaiderman <talshn@mellanox.com>

Move common functions between Unix and Windows to eal_common_config.c.

Those simple functions are getter functions for IOVA,
configuration, Multi-process.

Move rte_config and runtime_dir to be defined in a common file.

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
 lib/librte_eal/common/eal_common_config.c | 34 +++++++++++++++++++++++++++++
 lib/librte_eal/common/eal_private.h       | 11 ++++++++++
 lib/librte_eal/common/meson.build         |  2 ++
 lib/librte_eal/freebsd/eal.c              | 34 -----------------------------
 lib/librte_eal/linux/eal.c                | 33 ----------------------------
 lib/librte_eal/windows/eal.c              | 36 -------------------------------
 6 files changed, 47 insertions(+), 103 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common_config.c

diff --git a/lib/librte_eal/common/eal_common_config.c b/lib/librte_eal/common/eal_common_config.c
new file mode 100644
index 000000000..3a40df358
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_config.c
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Mellanox Technologies, Ltd
+ */
+#include <eal_private.h>
+
+#include <rte_os.h>
+
+/* platform-specific runtime dir */
+static char runtime_dir[PATH_MAX];
+
+const char *
+rte_eal_get_runtime_dir(void)
+{
+	return runtime_dir;
+}
+
+/* Return a pointer to the configuration structure */
+struct rte_config *
+rte_eal_get_configuration(void)
+{
+	return &rte_config;
+}
+
+enum rte_iova_mode
+rte_eal_iova_mode(void)
+{
+	return rte_eal_get_configuration()->iova_mode;
+}
+
+enum rte_proc_type_t
+rte_eal_process_type(void)
+{
+	return rte_config.process_type;
+}
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 4a28274ec..733ee1906 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -13,6 +13,8 @@
 #include <rte_lcore.h>
 #include <rte_memory.h>
 
+#include <eal_memcfg.h>
+
 /**
  * Structure storing internal configuration (per-lcore)
  */
@@ -60,6 +62,15 @@ struct rte_config {
 	struct rte_mem_config *mem_config;
 } __rte_packed;
 
+
+/* early configuration structure, when memory config is not mmapped */
+static struct rte_mem_config early_mem_config;
+
+/* Address of global and public configuration */
+static struct rte_config rte_config = {
+		.mem_config = &early_mem_config,
+};
+
 /**
  * Get the global configuration structure.
  *
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 9bb234009..83bac5884 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -21,6 +21,7 @@ if is_windows
 		'eal_common_string_fns.c',
 		'eal_common_tailqs.c',
 		'eal_common_thread.c',
+		'eal_common_config.c',
 		'malloc_elem.c',
 		'malloc_heap.c',
 		'rte_malloc.c',
@@ -57,6 +58,7 @@ sources += files(
 	'eal_common_trace_points.c',
 	'eal_common_trace_utils.c',
 	'eal_common_uuid.c',
+	'eal_common_config.c',
 	'hotplug_mp.c',
 	'malloc_elem.c',
 	'malloc_heap.c',
diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c
index 540b7d38c..c293c2113 100644
--- a/lib/librte_eal/freebsd/eal.c
+++ b/lib/librte_eal/freebsd/eal.c
@@ -72,11 +72,6 @@ static struct flock wr_lock = {
 		.l_len = sizeof(early_mem_config.memsegs),
 };
 
-/* Address of global and public configuration */
-static struct rte_config rte_config = {
-		.mem_config = &early_mem_config,
-};
-
 /* internal configuration (per-core) */
 struct lcore_config lcore_config[RTE_MAX_LCORE];
 
@@ -86,9 +81,6 @@ struct internal_config internal_config;
 /* used by rte_rdtsc() */
 int rte_cycles_vmware_tsc_map;
 
-/* platform-specific runtime dir */
-static char runtime_dir[PATH_MAX];
-
 static const char *default_runtime_dir = "/var/run";
 
 int
@@ -151,13 +143,6 @@ eal_clean_runtime_dir(void)
 	return 0;
 }
 
-
-const char *
-rte_eal_get_runtime_dir(void)
-{
-	return runtime_dir;
-}
-
 /* Return user provided mbuf pool ops name */
 const char *
 rte_eal_mbuf_user_pool_ops(void)
@@ -165,19 +150,6 @@ rte_eal_mbuf_user_pool_ops(void)
 	return internal_config.user_mbuf_pool_ops_name;
 }
 
-/* Return a pointer to the configuration structure */
-struct rte_config *
-rte_eal_get_configuration(void)
-{
-	return &rte_config;
-}
-
-enum rte_iova_mode
-rte_eal_iova_mode(void)
-{
-	return rte_eal_get_configuration()->iova_mode;
-}
-
 /* parse a sysfs (or other) file containing one integer value */
 int
 eal_parse_sysfs_value(const char *filename, unsigned long *val)
@@ -980,12 +952,6 @@ rte_eal_cleanup(void)
 	return 0;
 }
 
-enum rte_proc_type_t
-rte_eal_process_type(void)
-{
-	return rte_config.process_type;
-}
-
 int rte_eal_has_pci(void)
 {
 	return !internal_config.no_pci;
diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c
index aa72d3650..b24cf034f 100644
--- a/lib/librte_eal/linux/eal.c
+++ b/lib/librte_eal/linux/eal.c
@@ -86,11 +86,6 @@ static struct flock wr_lock = {
 		.l_len = sizeof(early_mem_config.memsegs),
 };
 
-/* Address of global and public configuration */
-static struct rte_config rte_config = {
-		.mem_config = &early_mem_config,
-};
-
 /* internal configuration (per-core) */
 struct lcore_config lcore_config[RTE_MAX_LCORE];
 
@@ -100,9 +95,6 @@ struct internal_config internal_config;
 /* used by rte_rdtsc() */
 int rte_cycles_vmware_tsc_map;
 
-/* platform-specific runtime dir */
-static char runtime_dir[PATH_MAX];
-
 static const char *default_runtime_dir = "/var/run";
 
 int
@@ -241,12 +233,6 @@ eal_clean_runtime_dir(void)
 	return -1;
 }
 
-const char *
-rte_eal_get_runtime_dir(void)
-{
-	return runtime_dir;
-}
-
 /* Return user provided mbuf pool ops name */
 const char *
 rte_eal_mbuf_user_pool_ops(void)
@@ -254,19 +240,6 @@ rte_eal_mbuf_user_pool_ops(void)
 	return internal_config.user_mbuf_pool_ops_name;
 }
 
-/* Return a pointer to the configuration structure */
-struct rte_config *
-rte_eal_get_configuration(void)
-{
-	return &rte_config;
-}
-
-enum rte_iova_mode
-rte_eal_iova_mode(void)
-{
-	return rte_eal_get_configuration()->iova_mode;
-}
-
 /* parse a sysfs (or other) file containing one integer value */
 int
 eal_parse_sysfs_value(const char *filename, unsigned long *val)
@@ -1340,12 +1313,6 @@ rte_eal_cleanup(void)
 	return 0;
 }
 
-enum rte_proc_type_t
-rte_eal_process_type(void)
-{
-	return rte_config.process_type;
-}
-
 int rte_eal_has_hugepages(void)
 {
 	return ! internal_config.no_hugetlbfs;
diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c
index a7ea78427..8ef7e60c1 100644
--- a/lib/librte_eal/windows/eal.c
+++ b/lib/librte_eal/windows/eal.c
@@ -31,36 +31,12 @@ static rte_usage_hook_t	rte_application_usage_hook;
  */
 static int mem_cfg_fd = -1;
 
-/* early configuration structure, when memory config is not mmapped */
-static struct rte_mem_config early_mem_config;
-
-/* Address of global and public configuration */
-static struct rte_config rte_config = {
-		.mem_config = &early_mem_config,
-};
-
 /* internal configuration (per-core) */
 struct lcore_config lcore_config[RTE_MAX_LCORE];
 
 /* internal configuration */
 struct internal_config internal_config;
 
-/* platform-specific runtime dir */
-static char runtime_dir[PATH_MAX];
-
-const char *
-rte_eal_get_runtime_dir(void)
-{
-	return runtime_dir;
-}
-
-/* Return a pointer to the configuration structure */
-struct rte_config *
-rte_eal_get_configuration(void)
-{
-	return &rte_config;
-}
-
 /* Detect if we are a primary or a secondary process */
 enum rte_proc_type_t
 eal_proc_type_detect(void)
@@ -93,24 +69,12 @@ eal_proc_type_detect(void)
 	return ptype;
 }
 
-enum rte_proc_type_t
-rte_eal_process_type(void)
-{
-	return rte_config.process_type;
-}
-
 int
 rte_eal_has_hugepages(void)
 {
 	return !internal_config.no_hugetlbfs;
 }
 
-enum rte_iova_mode
-rte_eal_iova_mode(void)
-{
-	return rte_config.iova_mode;
-}
-
 /* display usage */
 static void
 eal_usage(const char *prgname)
-- 
2.16.1.windows.4


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

* [dpdk-dev] [PATCH v3 2/7] pci: use OS generic memory mapping functions
  2020-05-07 12:16 [dpdk-dev] [PATCH v3 0/7] Windows bus/pci support talshn
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 1/7] eal: move OS common functions to single file talshn
@ 2020-05-07 12:16 ` talshn
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 3/7] pci: build on Windows talshn
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: talshn @ 2020-05-07 12:16 UTC (permalink / raw)
  To: dev
  Cc: thomas, pallavi.kadam, dmitry.kozliuk, david.marchand, grive,
	ranjit.menon, navasile, anatoly.burakov, Tal Shnaiderman

From: Tal Shnaiderman <talshn@mellanox.com>

Changing all of PCIs Unix memory mapping to the
new memory allocation API wrapper.

Change all of PCI mapping function usage in
bus/pci to support the new API.

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
 drivers/bus/pci/bsd/pci.c        |  2 +-
 drivers/bus/pci/linux/pci_uio.c  |  2 +-
 drivers/bus/pci/linux/pci_vfio.c |  8 ++++----
 drivers/bus/pci/pci_common_uio.c |  2 +-
 lib/librte_pci/rte_pci.c         | 14 +++++++-------
 lib/librte_pci/rte_pci.h         |  2 +-
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index ebbfeb13a..a01dd59f8 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -192,7 +192,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	mapaddr = pci_map_resource(NULL, fd, (off_t)offset,
 			(size_t)dev->mem_resource[res_idx].len, 0);
 	close(fd);
-	if (mapaddr == MAP_FAILED)
+	if (mapaddr == NULL)
 		goto error;
 
 	maps[map_idx].phaddr = dev->mem_resource[res_idx].phys_addr;
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 097dc1922..b62200153 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -345,7 +345,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	mapaddr = pci_map_resource(pci_map_addr, fd, 0,
 			(size_t)dev->mem_resource[res_idx].len, 0);
 	close(fd);
-	if (mapaddr == MAP_FAILED)
+	if (mapaddr == NULL)
 		goto error;
 
 	pci_map_addr = RTE_PTR_ADD(mapaddr,
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 64cd84a68..422e4b8d7 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -524,11 +524,11 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 			map_addr = pci_map_resource(bar_addr, vfio_dev_fd,
 							memreg[0].offset,
 							memreg[0].size,
-							MAP_FIXED);
+							RTE_MAP_FORCE_ADDRESS);
 		}
 
 		/* if there's a second part, try to map it */
-		if (map_addr != MAP_FAILED
+		if (map_addr != NULL
 			&& memreg[1].offset && memreg[1].size) {
 			void *second_addr = RTE_PTR_ADD(bar_addr,
 						(uintptr_t)(memreg[1].offset -
@@ -537,10 +537,10 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 							vfio_dev_fd,
 							memreg[1].offset,
 							memreg[1].size,
-							MAP_FIXED);
+							RTE_MAP_FORCE_ADDRESS);
 		}
 
-		if (map_addr == MAP_FAILED || !map_addr) {
+		if (map_addr == NULL) {
 			munmap(bar_addr, bar->size);
 			bar_addr = MAP_FAILED;
 			RTE_LOG(ERR, EAL, "Failed to map pci BAR%d\n",
diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c
index f4dca9da9..793dfd0a7 100644
--- a/drivers/bus/pci/pci_common_uio.c
+++ b/drivers/bus/pci/pci_common_uio.c
@@ -58,7 +58,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 					"Cannot mmap device resource file %s to address: %p\n",
 					uio_res->maps[i].path,
 					uio_res->maps[i].addr);
-				if (mapaddr != MAP_FAILED) {
+				if (mapaddr != NULL) {
 					/* unmap addrs correctly mapped */
 					for (j = 0; j < i; j++)
 						pci_unmap_resource(
diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c
index d1ab6b414..58e031dcf 100644
--- a/lib/librte_pci/rte_pci.c
+++ b/lib/librte_pci/rte_pci.c
@@ -9,7 +9,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <sys/queue.h>
-#include <sys/mman.h>
 
 #include <rte_errno.h>
 #include <rte_interrupts.h>
@@ -138,14 +137,15 @@ pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
 	void *mapaddr;
 
 	/* Map the PCI memory resource of device */
-	mapaddr = mmap(requested_addr, size, PROT_READ | PROT_WRITE,
-			MAP_SHARED | additional_flags, fd, offset);
-	if (mapaddr == MAP_FAILED) {
+	mapaddr = rte_mem_map(requested_addr, size,
+		RTE_PROT_READ | RTE_PROT_WRITE,
+		RTE_MAP_SHARED | additional_flags, fd, offset);
+	if (mapaddr == NULL) {
 		RTE_LOG(ERR, EAL,
-			"%s(): cannot mmap(%d, %p, 0x%zx, 0x%llx): %s (%p)\n",
+			"%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n",
 			__func__, fd, requested_addr, size,
 			(unsigned long long)offset,
-			strerror(errno), mapaddr);
+			strerror(rte_errno), mapaddr);
 	} else
 		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
 
@@ -160,7 +160,7 @@ pci_unmap_resource(void *requested_addr, size_t size)
 		return;
 
 	/* Unmap the PCI memory resource of device */
-	if (munmap(requested_addr, size)) {
+	if (rte_mem_unmap(requested_addr, size)) {
 		RTE_LOG(ERR, EAL, "%s(): cannot munmap(%p, %#zx): %s\n",
 			__func__, requested_addr, size,
 			strerror(errno));
diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h
index 4087771c1..b721bbf58 100644
--- a/lib/librte_pci/rte_pci.h
+++ b/lib/librte_pci/rte_pci.h
@@ -159,7 +159,7 @@ int rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr);
  *      The additional flags for the mapping range.
  * @return
  *   - On success, the function returns a pointer to the mapped area.
- *   - On error, the value MAP_FAILED is returned.
+ *   - On error, NULL is returned.
  */
 void *pci_map_resource(void *requested_addr, int fd, off_t offset,
 		size_t size, int additional_flags);
-- 
2.16.1.windows.4


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

* [dpdk-dev] [PATCH v3 3/7] pci: build on Windows
  2020-05-07 12:16 [dpdk-dev] [PATCH v3 0/7] Windows bus/pci support talshn
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 1/7] eal: move OS common functions to single file talshn
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 2/7] pci: use OS generic memory mapping functions talshn
@ 2020-05-07 12:16 ` talshn
  2020-05-07 23:27   ` Dmitry Kozlyuk
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 4/7] drivers: ignore pmdinfogen generation for Windows talshn
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: talshn @ 2020-05-07 12:16 UTC (permalink / raw)
  To: dev
  Cc: thomas, pallavi.kadam, dmitry.kozliuk, david.marchand, grive,
	ranjit.menon, navasile, anatoly.burakov, Tal Shnaiderman

From: Tal Shnaiderman <talshn@mellanox.com>

Added off_t in Windows header file as a supported
type since it is needed by PCI.

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
 lib/librte_eal/windows/include/rte_os.h | 1 +
 lib/meson.build                         | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h
index 62805a307..1c433b976 100644
--- a/lib/librte_eal/windows/include/rte_os.h
+++ b/lib/librte_eal/windows/include/rte_os.h
@@ -48,6 +48,7 @@ extern "C" {
 
 /* as in <windows.h> */
 typedef long long ssize_t;
+typedef long off_t;
 
 #ifndef RTE_TOOLCHAIN_GCC
 static inline int
diff --git a/lib/meson.build b/lib/meson.build
index e48efb519..ccb1426ff 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -35,7 +35,10 @@ libraries = [
 	'flow_classify', 'bpf', 'graph', 'node', 'telemetry']
 
 if is_windows
-	libraries = ['kvargs','eal'] # only supported libraries for windows
+	libraries = [
+		'kvargs','eal',
+		'pci',
+	] # only supported libraries for windows
 endif
 
 default_cflags = machine_args
-- 
2.16.1.windows.4


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

* [dpdk-dev] [PATCH v3 4/7] drivers: ignore pmdinfogen generation for Windows
  2020-05-07 12:16 [dpdk-dev] [PATCH v3 0/7] Windows bus/pci support talshn
                   ` (2 preceding siblings ...)
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 3/7] pci: build on Windows talshn
@ 2020-05-07 12:16 ` talshn
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 5/7] drivers: fix incorrect meson import folder " talshn
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: talshn @ 2020-05-07 12:16 UTC (permalink / raw)
  To: dev
  Cc: thomas, pallavi.kadam, dmitry.kozliuk, david.marchand, grive,
	ranjit.menon, navasile, anatoly.burakov, Tal Shnaiderman

From: Tal Shnaiderman <talshn@mellanox.com>

pmdinfogen generation is currently unsupported for Windows.
The relevant part in meson.build is skipped.

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
 drivers/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/meson.build b/drivers/meson.build
index dc293b270..09d2367dc 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -110,6 +110,7 @@ foreach class:dpdk_driver_classes
 
 			dpdk_extra_ldflags += pkgconfig_extra_libs
 
+			if host_machine.system() != 'windows'
 			# generate pmdinfo sources by building a temporary
 			# lib and then running pmdinfogen on the contents of
 			# that lib. The final lib reuses the object files and
@@ -126,7 +127,7 @@ foreach class:dpdk_driver_classes
 						'@OUTPUT@', pmdinfogen],
 					output: out_filename,
 					depends: [pmdinfogen, tmp_lib])
-
+			endif
 			version_map = '@0@/@1@/@2@_version.map'.format(
 					meson.current_source_dir(),
 					drv_path, lib_name)
-- 
2.16.1.windows.4


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

* [dpdk-dev] [PATCH v3 5/7] drivers: fix incorrect meson import folder for Windows
  2020-05-07 12:16 [dpdk-dev] [PATCH v3 0/7] Windows bus/pci support talshn
                   ` (3 preceding siblings ...)
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 4/7] drivers: ignore pmdinfogen generation for Windows talshn
@ 2020-05-07 12:16 ` talshn
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 6/7] bus/pci: introduce Windows support with stubs talshn
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 7/7] bus/pci: support Windows with bifurcated drivers talshn
  6 siblings, 0 replies; 13+ messages in thread
From: talshn @ 2020-05-07 12:16 UTC (permalink / raw)
  To: dev
  Cc: thomas, pallavi.kadam, dmitry.kozliuk, david.marchand, grive,
	ranjit.menon, navasile, anatoly.burakov, Tal Shnaiderman

From: Tal Shnaiderman <talshn@mellanox.com>

import library (/IMPLIB) in meson.build should use
the 'drivers' and not 'libs' folder.

The error is: fatal error LNK1149: output filename matches input filename.
The fix uses the correct folder.

Fixes: 5ed3766981 ("drivers: process shared link dependencies as for libs")

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
 drivers/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/meson.build b/drivers/meson.build
index 09d2367dc..55c4c794d 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -165,7 +165,7 @@ foreach class:dpdk_driver_classes
 			lk_deps = [version_map, def_file]
 			if is_windows
 				lk_args = ['-Wl,/def:' + def_file.full_path(),
-					'-Wl,/implib:lib\\' + implib]
+					'-Wl,/implib:drivers\\' + implib]
 			else
 				lk_args = ['-Wl,--version-script=' + version_map]
 				# on unix systems check the output of the
-- 
2.16.1.windows.4


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

* [dpdk-dev] [PATCH v3 6/7] bus/pci: introduce Windows support with stubs
  2020-05-07 12:16 [dpdk-dev] [PATCH v3 0/7] Windows bus/pci support talshn
                   ` (4 preceding siblings ...)
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 5/7] drivers: fix incorrect meson import folder " talshn
@ 2020-05-07 12:16 ` talshn
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 7/7] bus/pci: support Windows with bifurcated drivers talshn
  6 siblings, 0 replies; 13+ messages in thread
From: talshn @ 2020-05-07 12:16 UTC (permalink / raw)
  To: dev
  Cc: thomas, pallavi.kadam, dmitry.kozliuk, david.marchand, grive,
	ranjit.menon, navasile, anatoly.burakov, Tal Shnaiderman

From: Tal Shnaiderman <talshn@mellanox.com>

Addition of stub eal and bus/pci functions to compile
bus/pci for Windows.

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
 drivers/baseband/meson.build       |   4 +
 drivers/bus/ifpga/meson.build      |   6 ++
 drivers/bus/pci/meson.build        |  14 ++-
 drivers/bus/pci/pci_common.c       |   2 -
 drivers/bus/pci/windows/pci.c      | 169 +++++++++++++++++++++++++++++++++++++
 drivers/bus/vdev/meson.build       |   6 ++
 drivers/bus/vmbus/meson.build      |   7 ++
 drivers/common/meson.build         |   4 +
 drivers/compress/meson.build       |   4 +
 drivers/crypto/meson.build         |   4 +
 drivers/event/meson.build          |   4 +
 drivers/mempool/meson.build        |   4 +
 drivers/meson.build                |   4 -
 drivers/net/meson.build            |   4 +
 drivers/raw/meson.build            |   4 +
 drivers/vdpa/meson.build           |   4 +
 lib/librte_eal/common/meson.build  |   1 +
 lib/librte_eal/rte_eal_exports.def |   8 ++
 lib/librte_eal/windows/eal.c       |  27 +++++-
 lib/librte_eal/windows/eal_mp.c    |  14 +++
 20 files changed, 283 insertions(+), 11 deletions(-)
 create mode 100644 drivers/bus/pci/windows/pci.c

diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 4d909f9a6..b299c3a06 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
 
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
+
 drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec']
 
 config_flag_fmt = 'RTE_LIBRTE_PMD_BBDEV_@0@'
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index 4ea31f174..15339e065 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -1,6 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2010-2018 Intel Corporation
 
+if host_machine.system() == 'windows'
+	build = false
+	reason = 'not supported on Windows'
+	subdir_done()
+endif
+
 deps += ['pci', 'kvargs', 'rawdev']
 install_headers('rte_bus_ifpga.h')
 sources = files('ifpga_common.c', 'ifpga_bus.c')
diff --git a/drivers/bus/pci/meson.build b/drivers/bus/pci/meson.build
index b520bdfc1..31c492021 100644
--- a/drivers/bus/pci/meson.build
+++ b/drivers/bus/pci/meson.build
@@ -4,16 +4,22 @@
 deps += ['pci']
 install_headers('rte_bus_pci.h')
 sources = files('pci_common.c',
-	'pci_common_uio.c',
 	'pci_params.c')
 if is_linux
-	sources += files('linux/pci.c',
+	sources += files('pci_common_uio.c',
+			'linux/pci.c',
 			'linux/pci_uio.c',
 			'linux/pci_vfio.c')
 	includes += include_directories('linux')
-else
-	sources += files('bsd/pci.c')
+endif
+if host_machine.system() == 'bsd'
+	sources += files('pci_common_uio.c',
+			'bsd/pci.c')
 	includes += include_directories('bsd')
 endif
+if host_machine.system() == 'windows'
+	sources += files('windows/pci.c')
+	includes += include_directories('windows')
+endif
 
 deps += ['kvargs']
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 3f5542076..1cc8d6c0f 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -10,8 +10,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <sys/queue.h>
-#include <sys/mman.h>
-
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
new file mode 100644
index 000000000..b1d34ae11
--- /dev/null
+++ b/drivers/bus/pci/windows/pci.c
@@ -0,0 +1,169 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 Mellanox Technologies, Ltd
+ */
+#include <rte_errno.h>
+#include <rte_log.h>
+
+#include <rte_string_fns.h>
+#include <rte_eal_memconfig.h>
+
+#include "private.h"
+
+/* The functions below are not implemented on Windows,
+ * but need to be defined for compilation purposes
+ */
+
+/* Map pci device */
+int
+rte_pci_map_device(struct rte_pci_device *dev __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+	return 0;
+}
+
+/* Unmap pci device */
+void
+rte_pci_unmap_device(struct rte_pci_device *dev __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+}
+
+int
+pci_update_device(const struct rte_pci_addr *addr __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+	return 0;
+}
+
+/* Read PCI config space. */
+int
+rte_pci_read_config(const struct rte_pci_device *dev __rte_unused,
+	void *buf __rte_unused, size_t len __rte_unused,
+	off_t offset __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+	return 0;
+}
+
+/* Write PCI config space. */
+int
+rte_pci_write_config(const struct rte_pci_device *dev __rte_unused,
+	const void *buf __rte_unused, size_t len __rte_unused,
+	off_t offset __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+	return 0;
+}
+
+enum rte_iova_mode
+pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused,
+		const struct rte_pci_device *pdev __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+	return RTE_IOVA_DC;
+}
+
+int
+rte_pci_ioport_map(struct rte_pci_device *dev __rte_unused,
+	int bar __rte_unused, struct rte_pci_ioport *p __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+	return -1;
+}
+
+
+void
+rte_pci_ioport_read(struct rte_pci_ioport *p __rte_unused,
+	void *data __rte_unused, size_t len __rte_unused,
+	off_t offset __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+}
+
+int
+rte_pci_ioport_unmap(struct rte_pci_ioport *p __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+	return -1;
+}
+
+bool
+pci_device_iommu_support_va(const struct rte_pci_device *dev __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+	return false;
+}
+
+void
+rte_pci_ioport_write(struct rte_pci_ioport *p __rte_unused,
+		const void *data __rte_unused, size_t len __rte_unused,
+		off_t offset __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+}
+
+
+/* remap the PCI resource of a PCI device in anonymous virtual memory */
+int
+pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused)
+{
+	/* This function is not implemented on Windows.
+	 * We really should short-circuit the call to these functions by
+	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+	 * in the rte_pci_driver flags.
+	 */
+	return -1;
+}
+/*
+ * Scan the contents of the PCI bus
+ * and add all network class devices into the devices list.
+ */
+int
+rte_pci_scan(void)
+{
+	return 0;
+}
diff --git a/drivers/bus/vdev/meson.build b/drivers/bus/vdev/meson.build
index 967d54e4f..abaf36f1d 100644
--- a/drivers/bus/vdev/meson.build
+++ b/drivers/bus/vdev/meson.build
@@ -1,6 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+if host_machine.system() == 'windows'
+	build = false
+	reason = 'not supported on Windows'
+	subdir_done()
+endif
+
 sources = files('vdev.c',
 	'vdev_params.c')
 install_headers('rte_bus_vdev.h')
diff --git a/drivers/bus/vmbus/meson.build b/drivers/bus/vmbus/meson.build
index a68a1de9d..7c9865fe8 100644
--- a/drivers/bus/vmbus/meson.build
+++ b/drivers/bus/vmbus/meson.build
@@ -1,5 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 
+if host_machine.system() == 'windows'
+	build = false
+	reason = 'not supported on Windows'
+	subdir_done()
+endif
+
+
 install_headers('rte_bus_vmbus.h','rte_vmbus_reg.h')
 
 sources = files('vmbus_common.c',
diff --git a/drivers/common/meson.build b/drivers/common/meson.build
index ffd06e2c3..1cdcd95d6 100644
--- a/drivers/common/meson.build
+++ b/drivers/common/meson.build
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Cavium, Inc
 
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
+
 std_deps = ['eal']
 drivers = ['cpt', 'dpaax', 'iavf', 'mlx5', 'mvep', 'octeontx', 'octeontx2', 'qat']
 config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
diff --git a/drivers/compress/meson.build b/drivers/compress/meson.build
index 817ef3be4..e6c7d564e 100644
--- a/drivers/compress/meson.build
+++ b/drivers/compress/meson.build
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
+
 drivers = ['isal', 'octeontx', 'qat', 'zlib']
 
 std_deps = ['compressdev'] # compressdev pulls in all other needed deps
diff --git a/drivers/crypto/meson.build b/drivers/crypto/meson.build
index 7fa1fbe26..2c591eaf0 100644
--- a/drivers/crypto/meson.build
+++ b/drivers/crypto/meson.build
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
+
 drivers = ['aesni_gcm',
 	   'aesni_mb',
 	   'armv8',
diff --git a/drivers/event/meson.build b/drivers/event/meson.build
index 50d30c53f..264d4887f 100644
--- a/drivers/event/meson.build
+++ b/drivers/event/meson.build
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
+
 drivers = ['dpaa', 'dpaa2', 'octeontx2', 'opdl', 'skeleton', 'sw', 'dsw']
 if not (toolchain == 'gcc' and cc.version().version_compare('<4.8.6') and
 	dpdk_conf.has('RTE_ARCH_ARM64'))
diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build
index 7520e489f..0c6e70082 100644
--- a/drivers/mempool/meson.build
+++ b/drivers/mempool/meson.build
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
+
 drivers = ['bucket', 'dpaa', 'dpaa2', 'octeontx', 'octeontx2', 'ring', 'stack']
 std_deps = ['mempool']
 config_flag_fmt = 'RTE_LIBRTE_@0@_MEMPOOL'
diff --git a/drivers/meson.build b/drivers/meson.build
index 55c4c794d..e11a1cd39 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -1,10 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2019 Intel Corporation
 
-if is_windows
-	subdir_done()
-endif
-
 # Defines the order in which the drivers are buit.
 dpdk_driver_classes = ['common',
 	       'bus',
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 266448ff2..7a6ea648f 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
+
 drivers = ['af_packet',
 	'af_xdp',
 	'ark',
diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build
index bb5797760..334b14ac3 100644
--- a/drivers/raw/meson.build
+++ b/drivers/raw/meson.build
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2018 NXP
 
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
+
 drivers = ['dpaa2_cmdif', 'dpaa2_qdma',
 	'ifpga', 'ioat', 'ntb',
 	'octeontx2_dma',
diff --git a/drivers/vdpa/meson.build b/drivers/vdpa/meson.build
index e3ed54a25..7eedf826d 100644
--- a/drivers/vdpa/meson.build
+++ b/drivers/vdpa/meson.build
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2019 Mellanox Technologies, Ltd
 
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
+
 drivers = ['ifc',
 	   'mlx5',]
 std_deps = ['bus_pci', 'kvargs']
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 83bac5884..2813f724a 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -7,6 +7,7 @@ if is_windows
 	sources += files(
 		'eal_common_bus.c',
 		'eal_common_class.c',
+		'eal_common_dev.c',
 		'eal_common_devargs.c',
 		'eal_common_errno.c',
 		'eal_common_fbarray.c',
diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
index 854b83bcd..edbb6b277 100644
--- a/lib/librte_eal/rte_eal_exports.def
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -2,6 +2,11 @@ EXPORTS
 	__rte_panic
 	rte_calloc
 	rte_calloc_socket
+	per_lcore__rte_errno
+	rte_bus_register
+	rte_dev_is_probed
+	rte_devargs_next
+	rte_devargs_remove
 	rte_eal_get_configuration
 	rte_eal_has_hugepages
 	rte_eal_init
@@ -46,6 +51,9 @@ EXPORTS
 	rte_memzone_reserve_aligned
 	rte_memzone_reserve_bounded
 	rte_memzone_walk
+	rte_strsplit
+	rte_vfio_container_dma_map
+	rte_vfio_container_dma_unmap
 	rte_vlog
 	rte_realloc
 	rte_zmalloc
diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c
index 8ef7e60c1..31821be43 100644
--- a/lib/librte_eal/windows/eal.c
+++ b/lib/librte_eal/windows/eal.c
@@ -293,7 +293,7 @@ eal_file_lock(int fd, enum eal_flock_op op, enum eal_flock_mode mode)
 int
 rte_eal_init(int argc, char **argv)
 {
-	int i, fctret;
+	int i, fctret, bscan;
 
 	rte_eal_log_init(NULL, 0);
 
@@ -368,6 +368,13 @@ rte_eal_init(int argc, char **argv)
 
 	eal_thread_init_master(rte_config.master_lcore);
 
+	bscan = rte_bus_scan();
+	if (bscan < 0) {
+		rte_eal_init_alert("Cannot init PCI");
+		rte_errno = ENODEV;
+		return -1;
+	}
+
 	RTE_LCORE_FOREACH_SLAVE(i) {
 
 		/*
@@ -396,3 +403,21 @@ rte_eal_init(int argc, char **argv)
 	rte_eal_mp_wait_lcore();
 	return fctret;
 }
+
+int
+rte_vfio_container_dma_map(__rte_unused int container_fd,
+			__rte_unused uint64_t vaddr,
+			__rte_unused uint64_t iova,
+			__rte_unused uint64_t len)
+{
+	return -1;
+}
+
+int
+rte_vfio_container_dma_unmap(__rte_unused int container_fd,
+			__rte_unused uint64_t vaddr,
+			__rte_unused uint64_t iova,
+			__rte_unused uint64_t len)
+{
+	return -1;
+}
diff --git a/lib/librte_eal/windows/eal_mp.c b/lib/librte_eal/windows/eal_mp.c
index 16a5e8ba0..70061bea0 100644
--- a/lib/librte_eal/windows/eal_mp.c
+++ b/lib/librte_eal/windows/eal_mp.c
@@ -101,3 +101,17 @@ request_sync(void)
 	EAL_LOG_STUB();
 	return 0;
 }
+
+int
+eal_dev_hotplug_request_to_primary(struct eal_dev_mp_req *req)
+{
+	RTE_SET_USED(req);
+	return 0;
+}
+
+int
+eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req)
+{
+	RTE_SET_USED(req);
+	return 0;
+}
-- 
2.16.1.windows.4


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

* [dpdk-dev] [PATCH v3 7/7] bus/pci: support Windows with bifurcated drivers
  2020-05-07 12:16 [dpdk-dev] [PATCH v3 0/7] Windows bus/pci support talshn
                   ` (5 preceding siblings ...)
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 6/7] bus/pci: introduce Windows support with stubs talshn
@ 2020-05-07 12:16 ` talshn
  2020-05-07 22:50   ` Dmitry Kozlyuk
  6 siblings, 1 reply; 13+ messages in thread
From: talshn @ 2020-05-07 12:16 UTC (permalink / raw)
  To: dev
  Cc: thomas, pallavi.kadam, dmitry.kozliuk, david.marchand, grive,
	ranjit.menon, navasile, anatoly.burakov, Tal Shnaiderman

From: Tal Shnaiderman <talshn@mellanox.com>

Uses SetupAPI.h functions to scan PCI tree.
Uses DEVPKEY_Device_Numa_Node to get the PCI NUMA node.
Uses SPDRP_BUSNUMBER and SPDRP_BUSNUMBER to get the BDF.
scanning currently supports types RTE_KDRV_NONE.

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
 drivers/bus/pci/windows/pci.c                | 225 ++++++++++++++++++++++++++-
 lib/librte_eal/windows/include/rte_windows.h |   1 +
 2 files changed, 224 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index b1d34ae11..e8eff4f6f 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -1,14 +1,24 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2020 Mellanox Technologies, Ltd
  */
+#include <rte_windows.h>
 #include <rte_errno.h>
 #include <rte_log.h>
-
 #include <rte_string_fns.h>
 #include <rte_eal_memconfig.h>
 
 #include "private.h"
 
+#include <devpkey.h>
+
+#define  MAX_STR_TOKENS	8
+#define  DEC			10
+#define  HEX			16
+/*
+ * This code is used to simulate a PCI probe by parsing information in
+ * the registry hive for PCI devices.
+ */
+
 /* The functions below are not implemented on Windows,
  * but need to be defined for compilation purposes
  */
@@ -158,6 +168,184 @@ pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused)
 	 */
 	return -1;
 }
+
+static
+int get_device_pci_address(HDEVINFO hDevInfo,
+	PSP_DEVINFO_DATA pDeviceInfoData, struct rte_pci_addr *addr)
+{
+	BOOL  bResult;
+	ULONG bus_num, dev_and_func;
+
+	bResult = SetupDiGetDeviceRegistryProperty(hDevInfo, pDeviceInfoData,
+		SPDRP_BUSNUMBER, NULL, (PBYTE)&bus_num, sizeof(bus_num), NULL);
+	if (!bResult)
+		goto end;
+
+	bResult = SetupDiGetDeviceRegistryProperty(hDevInfo, pDeviceInfoData,
+		SPDRP_ADDRESS, NULL, (PBYTE)&dev_and_func, sizeof(dev_and_func),
+		NULL);
+	if (!bResult)
+		goto end;
+
+	addr->domain = 0;
+	addr->bus = bus_num;
+	addr->devid = dev_and_func >> 16;
+	addr->function = dev_and_func & 0xffff;
+	return 0;
+end:
+	return GetLastError();
+
+}
+
+static
+int get_device_resource_info(HDEVINFO hDevInfo,
+	PSP_DEVINFO_DATA pDeviceInfoData, struct rte_pci_device *dev)
+{
+	int  ret = -1;
+	DEVPROPTYPE uPropertyType;
+	DWORD uNumaNode;
+	BOOL  bResult;
+
+	switch (dev->kdrv) {
+	case RTE_KDRV_NONE:
+		/* Get NUMA node using DEVPKEY_Device_Numa_Node */
+		bResult = SetupDiGetDevicePropertyW(hDevInfo, pDeviceInfoData,
+			&DEVPKEY_Device_Numa_Node, &uPropertyType,
+			(BYTE *)&uNumaNode, sizeof(uNumaNode), NULL, 0);
+		if (!bResult) {
+			ret = GetLastError();
+			goto end;
+		}
+		dev->device.numa_node = uNumaNode;
+		/* mem_resource - Unneeded for RTE_KDRV_NONE */
+		dev->mem_resource[0].phys_addr = 0;
+		dev->mem_resource[0].len = 0;
+		dev->mem_resource[0].addr = NULL;
+		break;
+	default:
+		ret = ERROR_NOT_SUPPORTED;
+		goto end;
+	}
+
+	ret = ERROR_SUCCESS;
+end:
+	return ret;
+}
+/*
+ * get_pci_hardware_info from the SPDRP_HARDWAREID output
+ */
+static int
+get_pci_hardware_info(const char *buf, struct rte_pci_id *pci_id)
+{
+	int ids = 0;
+	unsigned int  vendorID, deviceID, subvendorID = 0;
+
+	ids = sscanf_s(buf, "PCI\\VEN_%x&DEV_%x&SUBSYS_%x", &vendorID,
+		&deviceID, &subvendorID);
+	if (ids != 3)
+		return -1;
+
+	pci_id->vendor_id = vendorID;
+	pci_id->device_id = deviceID;
+	pci_id->subsystem_vendor_id = subvendorID >> 16;
+	pci_id->subsystem_device_id = subvendorID & 0xffff;
+	return 0;
+}
+
+static void
+get_kernel_driver_type(struct rte_pci_device *dev __rte_unused)
+{
+	/*
+	 * If another kernel driver is supported the relevant checking
+	 * functions should be here
+	 */
+	dev->kdrv = RTE_KDRV_NONE;
+}
+
+static int
+pci_scan_one(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDeviceInfoData)
+{
+	struct rte_pci_device *dev;
+	int    ret = -1;
+
+	dev = malloc(sizeof(struct rte_pci_device));
+	if (dev == NULL) {
+		ret = -1;
+		goto end;
+	}
+
+	memset(dev, 0, sizeof(*dev));
+
+	char  strPCIDeviceInfo[PATH_MAX];
+	BOOL  bResult;
+	struct rte_pci_addr addr;
+	struct rte_pci_id pci_id;
+
+	/* Retrieve PCI device IDs */
+	bResult = SetupDiGetDeviceRegistryPropertyA(hDevInfo, pDeviceInfoData,
+			SPDRP_HARDWAREID, NULL, (BYTE *)&strPCIDeviceInfo,
+			sizeof(strPCIDeviceInfo), NULL);
+
+	ret = get_pci_hardware_info((const char *)&strPCIDeviceInfo, &pci_id);
+	if (ret != 0) {
+		/*
+		 * We won't add this device, but we want to continue
+		 * looking for supported devices
+		 */
+		ret = ERROR_CONTINUE;
+		goto end;
+	}
+
+	ret = get_device_pci_address(hDevInfo, pDeviceInfoData, &addr);
+	if (ret != 0)
+		goto end;
+
+	dev->addr = addr;
+	dev->id = pci_id;
+	dev->max_vfs = 0; /* TODO: get max_vfs */
+
+	pci_name_set(dev);
+
+	get_kernel_driver_type(dev);
+
+	/* get resources */
+	if (get_device_resource_info(hDevInfo, pDeviceInfoData, dev)
+			!= ERROR_SUCCESS) {
+		goto end;
+	}
+
+	/* device is valid, add in list (sorted) */
+	if (TAILQ_EMPTY(&rte_pci_bus.device_list)) {
+		rte_pci_add_device(dev);
+	} else {
+		struct rte_pci_device *dev2 = NULL;
+		int ret;
+
+		TAILQ_FOREACH(dev2, &rte_pci_bus.device_list, next) {
+			ret = rte_pci_addr_cmp(&dev->addr, &dev2->addr);
+			if (ret > 0) {
+				continue;
+			} else if (ret < 0) {
+				rte_pci_insert_device(dev2, dev);
+			} else { /* already registered */
+				dev2->kdrv = dev->kdrv;
+				dev2->max_vfs = dev->max_vfs;
+				memmove(dev2->mem_resource, dev->mem_resource,
+					sizeof(dev->mem_resource));
+				free(dev);
+			}
+			return 0;
+		}
+		rte_pci_add_device(dev);
+	}
+
+	return 0;
+end:
+	if (dev)
+		free(dev);
+	return ret;
+}
+
 /*
  * Scan the contents of the PCI bus
  * and add all network class devices into the devices list.
@@ -165,5 +353,38 @@ pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused)
 int
 rte_pci_scan(void)
 {
-	return 0;
+	DWORD			DeviceIndex = 0, FoundDevice = 0;
+	HDEVINFO		hDevInfo = NULL;
+	SP_DEVINFO_DATA	DeviceInfoData = { 0 };
+	int				ret = -1;
+
+	hDevInfo = SetupDiGetClassDevs(&GUID_DEVCLASS_NET, NULL, NULL,
+				DIGCF_PRESENT);
+	if (hDevInfo == INVALID_HANDLE_VALUE) {
+		RTE_LOG(ERR, EAL, "Unable to enumerate PCI devices.\n");
+		goto end;
+	}
+
+	DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
+	DeviceIndex = 0;
+
+	while (SetupDiEnumDeviceInfo(hDevInfo, DeviceIndex, &DeviceInfoData)) {
+		DeviceIndex++;
+		ret = pci_scan_one(hDevInfo, &DeviceInfoData);
+		if (ret == ERROR_SUCCESS)
+			FoundDevice++;
+		else if (ret != ERROR_CONTINUE)
+			goto end;
+
+		memset(&DeviceInfoData, 0, sizeof(SP_DEVINFO_DATA));
+		DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
+	}
+
+	RTE_LOG(ERR, EAL, "PCI scan found %lu devices\n", FoundDevice);
+	ret = (FoundDevice != 0) ? 0 : -1;
+end:
+	if (hDevInfo != INVALID_HANDLE_VALUE)
+		SetupDiDestroyDeviceInfoList(hDevInfo);
+
+	return ret;
 }
diff --git a/lib/librte_eal/windows/include/rte_windows.h b/lib/librte_eal/windows/include/rte_windows.h
index 899ed7d87..725ac4f9b 100644
--- a/lib/librte_eal/windows/include/rte_windows.h
+++ b/lib/librte_eal/windows/include/rte_windows.h
@@ -25,6 +25,7 @@
 #include <psapi.h>
 #include <setupapi.h>
 #include <winioctl.h>
+#include <devguid.h>
 
 /* Have GUIDs defined. */
 #ifndef INITGUID
-- 
2.16.1.windows.4


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

* Re: [dpdk-dev] [PATCH v3 7/7] bus/pci: support Windows with bifurcated drivers
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 7/7] bus/pci: support Windows with bifurcated drivers talshn
@ 2020-05-07 22:50   ` Dmitry Kozlyuk
  2020-05-07 23:06     ` Dmitry Kozlyuk
  2020-05-10  9:52     ` Thomas Monjalon
  0 siblings, 2 replies; 13+ messages in thread
From: Dmitry Kozlyuk @ 2020-05-07 22:50 UTC (permalink / raw)
  To: talshn
  Cc: dev, thomas, pallavi.kadam, david.marchand, grive, ranjit.menon,
	navasile, anatoly.burakov

On 2020-05-07 15:16 GMT+0300 talshn@mellanox.com wrote:
> From: Tal Shnaiderman <talshn@mellanox.com>
> 
> Uses SetupAPI.h functions to scan PCI tree.
> Uses DEVPKEY_Device_Numa_Node to get the PCI NUMA node.
> Uses SPDRP_BUSNUMBER and SPDRP_BUSNUMBER to get the BDF.
> scanning currently supports types RTE_KDRV_NONE.
> 
> Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
> ---
>  drivers/bus/pci/windows/pci.c                | 225 ++++++++++++++++++++++++++-
>  lib/librte_eal/windows/include/rte_windows.h |   1 +
>  2 files changed, 224 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
> index b1d34ae11..e8eff4f6f 100644
> --- a/drivers/bus/pci/windows/pci.c
> +++ b/drivers/bus/pci/windows/pci.c
> @@ -1,14 +1,24 @@
>  /* SPDX-License-Identifier: BSD-3-Clause
>   * Copyright 2020 Mellanox Technologies, Ltd
>   */
> +#include <rte_windows.h>
>  #include <rte_errno.h>
>  #include <rte_log.h>
> -
>  #include <rte_string_fns.h>

Not used.

>  #include <rte_eal_memconfig.h>
>  
>  #include "private.h"
>  
> +#include <devpkey.h>
> +
> +#define  MAX_STR_TOKENS	8
> +#define  DEC			10
> +#define  HEX			16

Not used.

> +/*
> + * This code is used to simulate a PCI probe by parsing information in
> + * the registry hive for PCI devices.
> + */
> +
>  /* The functions below are not implemented on Windows,
>   * but need to be defined for compilation purposes
>   */
> @@ -158,6 +168,184 @@ pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused)
>  	 */
>  	return -1;
>  }
> +
> +static
> +int get_device_pci_address(HDEVINFO hDevInfo,
> +	PSP_DEVINFO_DATA pDeviceInfoData, struct rte_pci_addr *addr)

Result type should be on a separate line (that is, "static int <line break>").

This is also the first from numerous violations of DPDK naming conventions.
IMO, Windows EAL should strictly follow them to become "a first-class citizen"
in DPDK and to attract existing developers. Even if not, style should be at
least consistent across each file (now we have snake_case, Hungarian
notation, camelCase, and PascalCase mixed).

> +{
> +	BOOL  bResult;
> +	ULONG bus_num, dev_and_func;
> +
> +	bResult = SetupDiGetDeviceRegistryProperty(hDevInfo, pDeviceInfoData,
> +		SPDRP_BUSNUMBER, NULL, (PBYTE)&bus_num, sizeof(bus_num), NULL);
> +	if (!bResult)
> +		goto end;

RTE_LOG_WIN32_ERROR("SetupDiGetDeviceRegistryProperty(SPDRP_BUSNUMBER)"), etc.
would be more helpful in finding exact error cause here and in other places.
Since you'll have to save GetLastError() before logging, you can also get rid
of goto and just use plain return.

> +
> +	bResult = SetupDiGetDeviceRegistryProperty(hDevInfo, pDeviceInfoData,
> +		SPDRP_ADDRESS, NULL, (PBYTE)&dev_and_func, sizeof(dev_and_func),
> +		NULL);
> +	if (!bResult)
> +		goto end;
> +
> +	addr->domain = 0;
> +	addr->bus = bus_num;
> +	addr->devid = dev_and_func >> 16;
> +	addr->function = dev_and_func & 0xffff;
> +	return 0;
> +end:
> +	return GetLastError();
> +
> +}
> +
[snip]
> +
> +static int
> +pci_scan_one(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDeviceInfoData)
> +{
> +	struct rte_pci_device *dev;
> +	int    ret = -1;
> +
> +	dev = malloc(sizeof(struct rte_pci_device));

Nitpicking, but sizeof(*dev) would be more concise and robust.

> +	if (dev == NULL) {
> +		ret = -1;
> +		goto end;
> +	}
> +
> +	memset(dev, 0, sizeof(*dev));
> +
> +	char  strPCIDeviceInfo[PATH_MAX];
> +	BOOL  bResult;

[1/6] Compiling C object
'drivers/a715181@@rte_bus_pci@sta/bus_pci_windows_pci.c.obj'.
../../../drivers/bus/pci/windows/pci.c: In function ‘pci_scan_one’:
../../../drivers/bus/pci/windows/pci.c:284:8: warning: variable ‘bResult’ set but not used [-Wunused-but-set-variable]

> +	struct rte_pci_addr addr;
> +	struct rte_pci_id pci_id;
> +
[snip]
>  int
>  rte_pci_scan(void)
>  {
> -	return 0;
> +	DWORD			DeviceIndex = 0, FoundDevice = 0;
> +	HDEVINFO		hDevInfo = NULL;
> +	SP_DEVINFO_DATA	DeviceInfoData = { 0 };

No need to initialize hDevInfo and DeviceInfoData: first, there's a memset()
below and NULL is meaningless for hDevInfo, second, this way you lose
compiler warnings in case you really forget to initialize variables.

> +	int				ret = -1;
> +
> +	hDevInfo = SetupDiGetClassDevs(&GUID_DEVCLASS_NET, NULL, NULL,
> +				DIGCF_PRESENT);

Shouldn't devices be limited to PCI here?

> +	if (hDevInfo == INVALID_HANDLE_VALUE) {

Would be helpful to log error code here.

> +		RTE_LOG(ERR, EAL, "Unable to enumerate PCI devices.\n");
> +		goto end;
> +	}
> +
> +	DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
> +	DeviceIndex = 0;
> +
> +	while (SetupDiEnumDeviceInfo(hDevInfo, DeviceIndex, &DeviceInfoData)) {
> +		DeviceIndex++;
> +		ret = pci_scan_one(hDevInfo, &DeviceInfoData);
> +		if (ret == ERROR_SUCCESS)
> +			FoundDevice++;
> +		else if (ret != ERROR_CONTINUE)
> +			goto end;
> +
> +		memset(&DeviceInfoData, 0, sizeof(SP_DEVINFO_DATA));
> +		DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
> +	}
> +
> +	RTE_LOG(ERR, EAL, "PCI scan found %lu devices\n", FoundDevice);

Why ERR?

> +	ret = (FoundDevice != 0) ? 0 : -1;

Zero PCI network devices is not necessarily an error: consider testing with
--vdev only, but without explicit --no-pci.


Some issues I found when cross-compiling with MinGW-w64
(gcc 9.2.1 "cc (Arch Linux 9.2.1+20200130-2) 9.2.1 20200130").

1. Missing DEVPKEY_Device_Numa_Node (MinGW-w64 defect):

../../../drivers/bus/pci/windows/pci.c: In function ‘get_device_resource_info’:
../../../drivers/bus/pci/windows/pci.c:213:5: error: ‘DEVPKEY_Device_Numa_Node’ undeclared (first use in this function)

2. undefined reference to `__emutls_v.per_lcore__rte_errno'
   (related to TLS issues on Windows).

3. LINK.EXE specific options:

FAILED: drivers/librte_bus_pci-20.0.dll 
/usr/bin/x86_64-w64-mingw32-gcc  -o drivers/librte_bus_pci-20.0.dll 'drivers/a715181@@rte_bus_pci@sha/bus_pci_pci_common.c.obj' 'drivers/a715181@@rte_bus_pci@sha/bus_pci_pci_params.c.obj' 'drivers/a715181@@rte_bus_pci@sha/bus_pci_windows_pci.c.obj' -Wl,--allow-shlib-undefined -Wl,-O1 -shared -Wl,--start-group -Wl,--out-implib=drivers/librte_bus_pci.dll.a -pthread -lm -ladvapi32 -lsetupapi lib/librte_eal.dll.a lib/librte_kvargs.dll.a lib/librte_pci.dll.a -Wl,/def:/home/dmitry/src/dpdk/public/build/cross/gcc/drivers/rte_bus_pci_exports.def '-Wl,/implib:drivers\\librte_pci.dll.a' -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -Wl,--end-group
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find /def:/home/dmitry/src/dpdk/public/build/cross/gcc/drivers/rte_bus_pci_exports.def: No such file or directory
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find /implib:drivers\\librte_pci.dll.a: No such file or directory


Cumulative fixes diff, feel free to distribute it among your patches:

diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index e8eff4f6f..9568a090a 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -11,6 +11,10 @@
 
 #include <devpkey.h>
 
+#ifndef DEVPKEY_Device_Numa_Node
+DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node,   0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 3);
+#endif
+
 #define  MAX_STR_TOKENS	8
 #define  DEC			10
 #define  HEX			16
diff --git a/drivers/meson.build b/drivers/meson.build
index e11a1cd39..96af28b9c 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -159,7 +159,7 @@ foreach class:dpdk_driver_classes
 				input: version_map,
 				output: '@0@_exports.def'.format(lib_name))
 			lk_deps = [version_map, def_file]
-			if is_windows
+			if is_ms_linker
 				lk_args = ['-Wl,/def:' + def_file.full_path(),
 					'-Wl,/implib:drivers\\' + implib]
 			else
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 5d6d3a8c6..74665145b 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -391,4 +391,6 @@ EXPERIMENTAL {
 	rte_trace_point_lookup;
 	rte_trace_regexp;
 	rte_trace_save;
+
+	__emutls_v.per_lcore__rte_errno;
 };

-- 
Dmitry Kozlyuk

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

* Re: [dpdk-dev] [PATCH v3 7/7] bus/pci: support Windows with bifurcated drivers
  2020-05-07 22:50   ` Dmitry Kozlyuk
@ 2020-05-07 23:06     ` Dmitry Kozlyuk
  2020-05-10  9:52     ` Thomas Monjalon
  1 sibling, 0 replies; 13+ messages in thread
From: Dmitry Kozlyuk @ 2020-05-07 23:06 UTC (permalink / raw)
  To: talshn
  Cc: dev, thomas, pallavi.kadam, david.marchand, grive, ranjit.menon,
	navasile, anatoly.burakov

On 2020-05-08 01:50 GMT+0300 Dmitry Kozlyuk wrote:
[snip]
> Cumulative fixes diff, feel free to distribute it among your patches:
> 
> diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
> index e8eff4f6f..9568a090a 100644
> --- a/drivers/bus/pci/windows/pci.c
> +++ b/drivers/bus/pci/windows/pci.c
> @@ -11,6 +11,10 @@
>  
>  #include <devpkey.h>
>  
> +#ifndef DEVPKEY_Device_Numa_Node
> +DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node,   0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 3);
> +#endif
> +
>  #define  MAX_STR_TOKENS	8
>  #define  DEC			10
>  #define  HEX			16

Correction:

#ifdef RTE_TOOLCHAIN_GCC
DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node,   0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 3);
#endif

since DEVPKEY_Device_Numa_Node is not a define.

-- 
Dmitry Kozlyuk

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

* Re: [dpdk-dev] [PATCH v3 1/7] eal: move OS common functions to single file
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 1/7] eal: move OS common functions to single file talshn
@ 2020-05-07 23:26   ` Dmitry Kozlyuk
  0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Kozlyuk @ 2020-05-07 23:26 UTC (permalink / raw)
  To: talshn
  Cc: dev, thomas, pallavi.kadam, david.marchand, grive, ranjit.menon,
	navasile, anatoly.burakov

On 2020-05-07 15:16 GMT+0300 talshn@mellanox.com wrote:
> From: Tal Shnaiderman <talshn@mellanox.com>
> 
> Move common functions between Unix and Windows to eal_common_config.c.
> 
> Those simple functions are getter functions for IOVA,
> configuration, Multi-process.
> 
> Move rte_config and runtime_dir to be defined in a common file.
> 
> Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
> ---
[snip]
> +
> +/* early configuration structure, when memory config is not mmapped */
> +static struct rte_mem_config early_mem_config;
> +
> +/* Address of global and public configuration */
> +static struct rte_config rte_config = {
> +		.mem_config = &early_mem_config,
> +};
> +

This declarations result in numerous -Wunused-variable warnings from all
files includeing eal_private.h, and rightfully so, because there must be only
one configuration structure in the program. You can use `extern` to declare
variables here and then define them non-static, e.g. in eal_common_config.c.

>  /**
>   * Get the global configuration structure.
>   *
> diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
> index 9bb234009..83bac5884 100644
> --- a/lib/librte_eal/common/meson.build
> +++ b/lib/librte_eal/common/meson.build
[snip]

-- 
Dmitry Kozlyuk

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

* Re: [dpdk-dev] [PATCH v3 3/7] pci: build on Windows
  2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 3/7] pci: build on Windows talshn
@ 2020-05-07 23:27   ` Dmitry Kozlyuk
  0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Kozlyuk @ 2020-05-07 23:27 UTC (permalink / raw)
  To: talshn
  Cc: dev, thomas, pallavi.kadam, david.marchand, grive, ranjit.menon,
	navasile, anatoly.burakov

On 2020-05-07 15:16 GMT+0300 talshn@mellanox.com wrote:
> From: Tal Shnaiderman <talshn@mellanox.com>
> 
> Added off_t in Windows header file as a supported
> type since it is needed by PCI.
> 
> Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
> ---
>  lib/librte_eal/windows/include/rte_os.h | 1 +
>  lib/meson.build                         | 5 ++++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h
> index 62805a307..1c433b976 100644
> --- a/lib/librte_eal/windows/include/rte_os.h
> +++ b/lib/librte_eal/windows/include/rte_os.h
> @@ -48,6 +48,7 @@ extern "C" {
>  
>  /* as in <windows.h> */
>  typedef long long ssize_t;
> +typedef long off_t;

Windows actually has off_t in <sys/types.h>, where it is by POSIX. Shouldn't
rte_pci.h include <sys/types.h> instead? IMO, shims should be kept at minimum.

-- 
Dmitry Kozlyuk

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

* Re: [dpdk-dev] [PATCH v3 7/7] bus/pci: support Windows with bifurcated drivers
  2020-05-07 22:50   ` Dmitry Kozlyuk
  2020-05-07 23:06     ` Dmitry Kozlyuk
@ 2020-05-10  9:52     ` Thomas Monjalon
  1 sibling, 0 replies; 13+ messages in thread
From: Thomas Monjalon @ 2020-05-10  9:52 UTC (permalink / raw)
  To: talshn, Dmitry Kozlyuk
  Cc: dev, pallavi.kadam, david.marchand, grive, ranjit.menon,
	navasile, anatoly.burakov

08/05/2020 00:50, Dmitry Kozlyuk:
> On 2020-05-07 15:16 GMT+0300 talshn@mellanox.com wrote:
> > +static
> > +int get_device_pci_address(HDEVINFO hDevInfo,
> > +	PSP_DEVINFO_DATA pDeviceInfoData, struct rte_pci_addr *addr)
> 
> Result type should be on a separate line (that is, "static int <line break>").
> 
> This is also the first from numerous violations of DPDK naming conventions.
> IMO, Windows EAL should strictly follow them to become "a first-class citizen"
> in DPDK and to attract existing developers. Even if not, style should be at
> least consistent across each file (now we have snake_case, Hungarian
> notation, camelCase, and PascalCase mixed).

I agree, snake_case must be used for all variables.



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

end of thread, other threads:[~2020-05-10  9:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 12:16 [dpdk-dev] [PATCH v3 0/7] Windows bus/pci support talshn
2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 1/7] eal: move OS common functions to single file talshn
2020-05-07 23:26   ` Dmitry Kozlyuk
2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 2/7] pci: use OS generic memory mapping functions talshn
2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 3/7] pci: build on Windows talshn
2020-05-07 23:27   ` Dmitry Kozlyuk
2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 4/7] drivers: ignore pmdinfogen generation for Windows talshn
2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 5/7] drivers: fix incorrect meson import folder " talshn
2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 6/7] bus/pci: introduce Windows support with stubs talshn
2020-05-07 12:16 ` [dpdk-dev] [PATCH v3 7/7] bus/pci: support Windows with bifurcated drivers talshn
2020-05-07 22:50   ` Dmitry Kozlyuk
2020-05-07 23:06     ` Dmitry Kozlyuk
2020-05-10  9:52     ` Thomas Monjalon

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