* [dpdk-dev] [PATCH v4 0/8] Windows bus/pci support
@ 2020-05-19 14:20 talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 1/8] eal: move OS common functions to single file talshn
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: talshn @ 2020-05-19 14:20 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")
v4:
* Fixed various warnings and naming conventions(DmitryK).
* Fixed broken mingw-64 build(DmitryK).
* Improved logging(DmitryK).
* Added patch to fix warnings on rte_pci_addr logging.
* Fixed broken make on linux/freebsd.
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 (8):
eal: move OS common functions to single file
pci: use OS generic memory mapping functions
pci: build on Windows
pci: fix format warning 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 | 399 +++++++++++++++++++++++++++
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 | 15 +-
drivers/net/meson.build | 4 +
drivers/raw/meson.build | 4 +
drivers/vdpa/meson.build | 4 +
lib/librte_eal/common/eal_common_config.c | 39 +++
lib/librte_eal/common/eal_private.h | 12 +
lib/librte_eal/common/meson.build | 3 +
lib/librte_eal/freebsd/Makefile | 1 +
lib/librte_eal/freebsd/eal.c | 36 ---
lib/librte_eal/linux/Makefile | 1 +
lib/librte_eal/linux/eal.c | 36 ---
lib/librte_eal/rte_eal_exports.def | 9 +
lib/librte_eal/rte_eal_version.map | 3 +
lib/librte_eal/windows/eal.c | 63 ++---
lib/librte_eal/windows/eal_mp.c | 14 +
lib/librte_eal/windows/include/rte_os.h | 2 +-
lib/librte_eal/windows/include/rte_windows.h | 1 +
lib/librte_pci/rte_pci.c | 14 +-
lib/librte_pci/rte_pci.h | 4 +-
lib/meson.build | 5 +-
36 files changed, 602 insertions(+), 140 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] 9+ messages in thread
* [dpdk-dev] [PATCH v4 1/8] eal: move OS common functions to single file
2020-05-19 14:20 [dpdk-dev] [PATCH v4 0/8] Windows bus/pci support talshn
@ 2020-05-19 14:20 ` talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 2/8] pci: use OS generic memory mapping functions talshn
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: talshn @ 2020-05-19 14:20 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 | 39 +++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_private.h | 12 ++++++++++
lib/librte_eal/common/meson.build | 2 ++
lib/librte_eal/freebsd/Makefile | 1 +
lib/librte_eal/freebsd/eal.c | 36 ----------------------------
lib/librte_eal/linux/Makefile | 1 +
lib/librte_eal/linux/eal.c | 36 ----------------------------
lib/librte_eal/windows/eal.c | 36 ----------------------------
8 files changed, 55 insertions(+), 108 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..641c7d884
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_config.c
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Mellanox Technologies, Ltd
+ */
+#include <eal_private.h>
+
+#include <rte_os.h>
+
+struct rte_mem_config early_mem_config;
+
+char runtime_dir[PATH_MAX];
+
+struct rte_config rte_config = {
+ .mem_config = &early_mem_config,
+};
+
+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 2ccdb5560..3b5e5cae5 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)
*/
@@ -34,6 +36,13 @@ struct lcore_config {
rte_cpuset_t cpuset; /**< cpu set which the lcore affinity to */
};
+
+/* early configuration structure, when memory config is not mmapped */
+extern struct rte_mem_config early_mem_config;
+
+/* platform-specific runtime dir */
+extern char runtime_dir[PATH_MAX];
+
extern struct lcore_config lcore_config[RTE_MAX_LCORE];
/**
@@ -60,6 +69,9 @@ struct rte_config {
struct rte_mem_config *mem_config;
} __rte_packed;
+/* Address of global and public configuration */
+extern struct rte_config rte_config;
+
/**
* Get the global configuration structure.
*
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 446c5a7e2..694bd8a5f 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',
@@ -56,6 +57,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/Makefile b/lib/librte_eal/freebsd/Makefile
index f64a3994c..d7faddb42 100644
--- a/lib/librte_eal/freebsd/Makefile
+++ b/lib/librte_eal/freebsd/Makefile
@@ -38,6 +38,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_alarm.c
SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_dev.c
# from common dir
+SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_config.c
SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_lcore.c
SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_memzone.c
diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c
index f681bc7a2..e5c8c7426 100644
--- a/lib/librte_eal/freebsd/eal.c
+++ b/lib/librte_eal/freebsd/eal.c
@@ -58,8 +58,6 @@
/* Allow the application to print its usage message too if set */
static rte_usage_hook_t rte_application_usage_hook = NULL;
-/* early configuration structure, when memory config is not mmapped */
-static struct rte_mem_config early_mem_config;
/* define fd variable here, because file needs to be kept open for the
* duration of the program, as we hold a write lock on it in the primary proc */
@@ -72,11 +70,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 +79,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 +141,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 +148,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 +950,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/Makefile b/lib/librte_eal/linux/Makefile
index d314648cb..1e1d65d98 100644
--- a/lib/librte_eal/linux/Makefile
+++ b/lib/librte_eal/linux/Makefile
@@ -45,6 +45,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_alarm.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_dev.c
# from common dir
+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_config.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_lcore.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_memzone.c
diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c
index 6123bb7c4..6c2c47522 100644
--- a/lib/librte_eal/linux/eal.c
+++ b/lib/librte_eal/linux/eal.c
@@ -72,9 +72,6 @@
/* Allow the application to print its usage message too if set */
static rte_usage_hook_t rte_application_usage_hook = NULL;
-/* early configuration structure, when memory config is not mmapped */
-static struct rte_mem_config early_mem_config;
-
/* define fd variable here, because file needs to be kept open for the
* duration of the program, as we hold a write lock on it in the primary proc */
static int mem_cfg_fd = -1;
@@ -86,11 +83,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 +92,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 +230,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 +237,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 +1310,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] 9+ messages in thread
* [dpdk-dev] [PATCH v4 2/8] pci: use OS generic memory mapping functions
2020-05-19 14:20 [dpdk-dev] [PATCH v4 0/8] Windows bus/pci support talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 1/8] eal: move OS common functions to single file talshn
@ 2020-05-19 14:20 ` talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 3/8] pci: build on Windows talshn
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: talshn @ 2020-05-19 14:20 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 6ec27b4b5..8bc473eb9 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] 9+ messages in thread
* [dpdk-dev] [PATCH v4 3/8] pci: build on Windows
2020-05-19 14:20 [dpdk-dev] [PATCH v4 0/8] Windows bus/pci support talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 1/8] eal: move OS common functions to single file talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 2/8] pci: use OS generic memory mapping functions talshn
@ 2020-05-19 14:20 ` talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 4/8] pci: fix format warning " talshn
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: talshn @ 2020-05-19 14:20 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 <sys/types.h> in Windows header file includes
to include off_t type since it is needed by PCI.
export per_lcore__rte_errno from eal since it is needed by PCI.
Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
lib/librte_eal/rte_eal_exports.def | 1 +
lib/librte_eal/rte_eal_version.map | 3 +++
lib/librte_eal/windows/include/rte_os.h | 2 +-
lib/meson.build | 5 ++++-
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
index 854b83bcd..cbb6b8cfe 100644
--- a/lib/librte_eal/rte_eal_exports.def
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -1,5 +1,6 @@
EXPORTS
__rte_panic
+ per_lcore__rte_errno
rte_calloc
rte_calloc_socket
rte_eal_get_configuration
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index bdd014638..0f1b983b8 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -390,4 +390,7 @@ EXPERIMENTAL {
rte_trace_point_lookup;
rte_trace_regexp;
rte_trace_save;
+
+ # added in 20.08
+ __emutls_v.per_lcore__rte_errno;
};
diff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h
index 62805a307..5774d412f 100644
--- a/lib/librte_eal/windows/include/rte_os.h
+++ b/lib/librte_eal/windows/include/rte_os.h
@@ -14,7 +14,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-
+#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/lib/meson.build b/lib/meson.build
index d190d84ef..a8fd317a1 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -36,7 +36,10 @@ libraries = [
'flow_classify', 'bpf', 'graph', 'node']
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] 9+ messages in thread
* [dpdk-dev] [PATCH v4 4/8] pci: fix format warning on Windows
2020-05-19 14:20 [dpdk-dev] [PATCH v4 0/8] Windows bus/pci support talshn
` (2 preceding siblings ...)
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 3/8] pci: build on Windows talshn
@ 2020-05-19 14:20 ` talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 5/8] drivers: ignore pmdinfogen generation for Windows talshn
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: talshn @ 2020-05-19 14:20 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>
the struct rte_pci_addr defines domain as uint32_t variable however
the PCI_PRI_FMT macro used for logging the struct sets the format
of domain to uint16_t.
The mismatch causes the following warning messages
in Windows clang build:
format specifies type 'unsigned short' but the argument
has type 'uint32_t' (aka 'unsigned int') [-Wformat]
Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
lib/librte_pci/rte_pci.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h
index b721bbf58..d119a9e4a 100644
--- a/lib/librte_pci/rte_pci.h
+++ b/lib/librte_pci/rte_pci.h
@@ -22,7 +22,7 @@ extern "C" {
#include <inttypes.h>
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
-#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_FMT "%.4" PRIx32 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
#define PCI_PRI_STR_SIZE sizeof("XXXXXXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
--
2.16.1.windows.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v4 5/8] drivers: ignore pmdinfogen generation for Windows
2020-05-19 14:20 [dpdk-dev] [PATCH v4 0/8] Windows bus/pci support talshn
` (3 preceding siblings ...)
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 4/8] pci: fix format warning " talshn
@ 2020-05-19 14:20 ` talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 6/8] drivers: fix incorrect meson import folder " talshn
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: talshn @ 2020-05-19 14:20 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] 9+ messages in thread
* [dpdk-dev] [PATCH v4 6/8] drivers: fix incorrect meson import folder for Windows
2020-05-19 14:20 [dpdk-dev] [PATCH v4 0/8] Windows bus/pci support talshn
` (4 preceding siblings ...)
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 5/8] drivers: ignore pmdinfogen generation for Windows talshn
@ 2020-05-19 14:20 ` talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 7/8] bus/pci: introduce Windows support with stubs talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 8/8] bus/pci: support Windows with bifurcated drivers talshn
7 siblings, 0 replies; 9+ messages in thread
From: talshn @ 2020-05-19 14:20 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 | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/meson.build b/drivers/meson.build
index 09d2367dc..6c8ca87ce 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -164,8 +164,12 @@ foreach class:dpdk_driver_classes
output: '@0@_exports.def'.format(lib_name))
lk_deps = [version_map, def_file]
if is_windows
- lk_args = ['-Wl,/def:' + def_file.full_path(),
- '-Wl,/implib:lib\\' + implib]
+ if is_ms_linker
+ lk_args = ['-Wl,/def:' + def_file.full_path(),
+ '-Wl,/implib:drivers\\' + implib]
+ else
+ lk_args = []
+ endif
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] 9+ messages in thread
* [dpdk-dev] [PATCH v4 7/8] bus/pci: introduce Windows support with stubs
2020-05-19 14:20 [dpdk-dev] [PATCH v4 0/8] Windows bus/pci support talshn
` (5 preceding siblings ...)
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 6/8] drivers: fix incorrect meson import folder " talshn
@ 2020-05-19 14:20 ` talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 8/8] bus/pci: support Windows with bifurcated drivers talshn
7 siblings, 0 replies; 9+ messages in thread
From: talshn @ 2020-05-19 14:20 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 245d94f59..eb0231f40 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 6c8ca87ce..e8dae03b9 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 694bd8a5f..f4d777301 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 cbb6b8cfe..9ebf0d641 100644
--- a/lib/librte_eal/rte_eal_exports.def
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -3,6 +3,11 @@ EXPORTS
per_lcore__rte_errno
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
@@ -47,6 +52,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] 9+ messages in thread
* [dpdk-dev] [PATCH v4 8/8] bus/pci: support Windows with bifurcated drivers
2020-05-19 14:20 [dpdk-dev] [PATCH v4 0/8] Windows bus/pci support talshn
` (6 preceding siblings ...)
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 7/8] bus/pci: introduce Windows support with stubs talshn
@ 2020-05-19 14:20 ` talshn
7 siblings, 0 replies; 9+ messages in thread
From: talshn @ 2020-05-19 14:20 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 | 236 ++++++++++++++++++++++++++-
lib/librte_eal/windows/include/rte_windows.h | 1 +
2 files changed, 234 insertions(+), 3 deletions(-)
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index b1d34ae11..b2d167bb5 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -1,14 +1,26 @@
/* 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>
+
+#ifdef RTE_TOOLCHAIN_GCC
+#include <Devpropdef.h>
+DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40, 0x45bc,
+ 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 3);
+#endif
+
+/*
+ * 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
*/
@@ -146,7 +158,6 @@ rte_pci_ioport_write(struct rte_pci_ioport *p __rte_unused,
*/
}
-
/* remap the PCI resource of a PCI device in anonymous virtual memory */
int
pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused)
@@ -158,6 +169,190 @@ pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused)
*/
return -1;
}
+
+static int
+get_device_pci_address(HDEVINFO dev_info,
+ PSP_DEVINFO_DATA device_info_data, struct rte_pci_addr *addr)
+{
+ BOOL res;
+ ULONG bus_num, dev_and_func;
+
+ res = SetupDiGetDeviceRegistryProperty(dev_info, device_info_data,
+ SPDRP_BUSNUMBER, NULL, (PBYTE)&bus_num, sizeof(bus_num), NULL);
+ if (!res) {
+ RTE_LOG_WIN32_ERR(
+ "SetupDiGetDeviceRegistryProperty(SPDRP_BUSNUMBER)");
+ return -1;
+ }
+
+ res = SetupDiGetDeviceRegistryProperty(dev_info, device_info_data,
+ SPDRP_ADDRESS, NULL, (PBYTE)&dev_and_func, sizeof(dev_and_func),
+ NULL);
+ if (!res) {
+ RTE_LOG_WIN32_ERR(
+ "SetupDiGetDeviceRegistryProperty(SPDRP_ADDRESS)");
+ return -1;
+ }
+
+ addr->domain = 0;
+ addr->bus = bus_num;
+ addr->devid = dev_and_func >> 16;
+ addr->function = dev_and_func & 0xffff;
+ return 0;
+}
+
+static int
+get_device_resource_info(HDEVINFO dev_info,
+ PSP_DEVINFO_DATA dev_info_data, struct rte_pci_device *dev)
+{
+ DEVPROPTYPE property_type;
+ DWORD numa_node;
+ BOOL res;
+
+ switch (dev->kdrv) {
+ case RTE_KDRV_NONE:
+ /* Get NUMA node using DEVPKEY_Device_Numa_Node */
+ res = SetupDiGetDevicePropertyW(dev_info, dev_info_data,
+ &DEVPKEY_Device_Numa_Node, &property_type,
+ (BYTE *)&numa_node, sizeof(numa_node), NULL, 0);
+ if (!res) {
+ RTE_LOG_WIN32_ERR(
+ "SetupDiGetDevicePropertyW"
+ "(DEVPKEY_Device_Numa_Node)");
+ return -1;
+ }
+ dev->device.numa_node = numa_node;
+ /* 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:
+ return ERROR_NOT_SUPPORTED;
+ }
+
+ return 0;
+}
+/*
+ * 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;
+ uint16_t vendor_id, device_id, subvendor_id = 0;
+
+ ids = sscanf_s(buf, "PCI\\VEN_%x&DEV_%x&SUBSYS_%x", &vendor_id,
+ &device_id, &subvendor_id);
+ if (ids != 3)
+ return -1;
+
+ pci_id->vendor_id = vendor_id;
+ pci_id->device_id = device_id;
+ pci_id->subsystem_vendor_id = subvendor_id >> 16;
+ pci_id->subsystem_device_id = subvendor_id & 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 dev_info, PSP_DEVINFO_DATA device_info_data)
+{
+ struct rte_pci_device *dev;
+ int ret = -1;
+
+ dev = malloc(sizeof(*dev));
+ if (dev == NULL) {
+ ret = -1;
+ goto end;
+ }
+
+ memset(dev, 0, sizeof(*dev));
+
+ char pci_device_info[PATH_MAX];
+ BOOL res;
+ struct rte_pci_addr addr;
+ struct rte_pci_id pci_id;
+
+ /* Retrieve PCI device IDs */
+ res = SetupDiGetDeviceRegistryPropertyA(dev_info, device_info_data,
+ SPDRP_HARDWAREID, NULL, (BYTE *)&pci_device_info,
+ sizeof(pci_device_info), NULL);
+ if (!res) {
+ RTE_LOG_WIN32_ERR(
+ "SetupDiGetDeviceRegistryPropertyA(SPDRP_HARDWAREID)");
+ return -1;
+ }
+
+ ret = get_pci_hardware_info((const char *)&pci_device_info, &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(dev_info, device_info_data, &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(dev_info, device_info_data, 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 +360,40 @@ pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused)
int
rte_pci_scan(void)
{
+ DWORD device_index = 0, found_device = 0;
+ HDEVINFO dev_info;
+ SP_DEVINFO_DATA device_info_data;
+ int ret = -1;
+
+ dev_info = SetupDiGetClassDevs(&GUID_DEVCLASS_NET, TEXT("PCI"), NULL,
+ DIGCF_PRESENT);
+ if (dev_info == INVALID_HANDLE_VALUE) {
+ RTE_LOG(ERR, EAL, "Unable to enumerate PCI devices.\n");
+ RTE_LOG_WIN32_ERR("SetupDiGetClassDevs(pci_scan)");
+ goto end;
+ }
+
+ device_info_data.cbSize = sizeof(SP_DEVINFO_DATA);
+ device_index = 0;
+
+ while (SetupDiEnumDeviceInfo(dev_info, device_index,
+ &device_info_data)) {
+ device_index++;
+ ret = pci_scan_one(dev_info, &device_info_data);
+ if (ret == ERROR_SUCCESS)
+ found_device++;
+ else if (ret != ERROR_CONTINUE)
+ goto end;
+
+ memset(&device_info_data, 0, sizeof(SP_DEVINFO_DATA));
+ device_info_data.cbSize = sizeof(SP_DEVINFO_DATA);
+ }
+
+ RTE_LOG(DEBUG, EAL, "PCI scan found %lu devices\n", found_device);
return 0;
+end:
+ if (dev_info != INVALID_HANDLE_VALUE)
+ SetupDiDestroyDeviceInfoList(dev_info);
+
+ 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] 9+ messages in thread
end of thread, other threads:[~2020-05-19 14:22 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 14:20 [dpdk-dev] [PATCH v4 0/8] Windows bus/pci support talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 1/8] eal: move OS common functions to single file talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 2/8] pci: use OS generic memory mapping functions talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 3/8] pci: build on Windows talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 4/8] pci: fix format warning " talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 5/8] drivers: ignore pmdinfogen generation for Windows talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 6/8] drivers: fix incorrect meson import folder " talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 7/8] bus/pci: introduce Windows support with stubs talshn
2020-05-19 14:20 ` [dpdk-dev] [PATCH v4 8/8] bus/pci: support Windows with bifurcated drivers talshn
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).