From: Tal Shnaiderman <talshn@mellanox.com> This patchset enables compilation and build of librte_mbuf on Windows. Depends-on: series-10276 ("build mempool on Windows") Depends-on: series-10156 ("Windows bus/pci support") Tal Shnaiderman (4): eal: move OS common config code to single file eal: set byteorder in Windows to little endian eal: export needed functions for mbuf mbuf: build on Windows lib/librte_eal/common/eal_common_config.c | 11 +++++++++++ lib/librte_eal/common/meson.build | 1 + lib/librte_eal/freebsd/eal.c | 10 ---------- lib/librte_eal/include/generic/rte_byteorder.h | 4 +++- lib/librte_eal/linux/eal.c | 10 ---------- lib/librte_eal/rte_eal_exports.def | 3 +++ lib/librte_eal/rte_eal_version.map | 1 + lib/librte_eal/windows/eal.c | 3 --- lib/meson.build | 3 +-- 9 files changed, 20 insertions(+), 26 deletions(-) -- 2.16.1.windows.4
From: Tal Shnaiderman <talshn@mellanox.com> Move common struct rte_config and function rte_eal_mbuf_user_pool_ops to eal_config. Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> --- lib/librte_eal/common/eal_common_config.c | 11 +++++++++++ lib/librte_eal/freebsd/eal.c | 10 ---------- lib/librte_eal/linux/eal.c | 10 ---------- lib/librte_eal/windows/eal.c | 3 --- 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/lib/librte_eal/common/eal_common_config.c b/lib/librte_eal/common/eal_common_config.c index 641c7d884c..c69a088182 100644 --- a/lib/librte_eal/common/eal_common_config.c +++ b/lib/librte_eal/common/eal_common_config.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2020 Mellanox Technologies, Ltd */ +#include <eal_internal_cfg.h> #include <eal_private.h> #include <rte_os.h> @@ -13,6 +14,9 @@ struct rte_config rte_config = { .mem_config = &early_mem_config, }; +/* internal configuration */ +struct internal_config internal_config; + const char * rte_eal_get_runtime_dir(void) { @@ -37,3 +41,10 @@ rte_eal_process_type(void) { return rte_config.process_type; } + +/* Return user provided mbuf pool ops name */ +const char * +rte_eal_mbuf_user_pool_ops(void) +{ + return internal_config.user_mbuf_pool_ops_name; +} diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c index eab961232e..6be7414f1a 100644 --- a/lib/librte_eal/freebsd/eal.c +++ b/lib/librte_eal/freebsd/eal.c @@ -73,9 +73,6 @@ static struct flock wr_lock = { /* internal configuration (per-core) */ struct lcore_config lcore_config[RTE_MAX_LCORE]; -/* internal configuration */ -struct internal_config internal_config; - /* used by rte_rdtsc() */ int rte_cycles_vmware_tsc_map; @@ -141,13 +138,6 @@ eal_clean_runtime_dir(void) return 0; } -/* Return user provided mbuf pool ops name */ -const char * -rte_eal_mbuf_user_pool_ops(void) -{ - return internal_config.user_mbuf_pool_ops_name; -} - /* parse a sysfs (or other) file containing one integer value */ int eal_parse_sysfs_value(const char *filename, unsigned long *val) diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c index 8cbb8c644c..302f0a1228 100644 --- a/lib/librte_eal/linux/eal.c +++ b/lib/librte_eal/linux/eal.c @@ -86,9 +86,6 @@ static struct flock wr_lock = { /* internal configuration (per-core) */ struct lcore_config lcore_config[RTE_MAX_LCORE]; -/* internal configuration */ -struct internal_config internal_config; - /* used by rte_rdtsc() */ int rte_cycles_vmware_tsc_map; @@ -230,13 +227,6 @@ eal_clean_runtime_dir(void) return -1; } -/* Return user provided mbuf pool ops name */ -const char * -rte_eal_mbuf_user_pool_ops(void) -{ - return internal_config.user_mbuf_pool_ops_name; -} - /* parse a sysfs (or other) file containing one integer value */ int eal_parse_sysfs_value(const char *filename, unsigned long *val) diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c index 2a05f9e0da..daa238d416 100644 --- a/lib/librte_eal/windows/eal.c +++ b/lib/librte_eal/windows/eal.c @@ -35,9 +35,6 @@ static int mem_cfg_fd = -1; /* internal configuration (per-core) */ struct lcore_config lcore_config[RTE_MAX_LCORE]; -/* internal configuration */ -struct internal_config internal_config; - /* Detect if we are a primary or a secondary process */ enum rte_proc_type_t eal_proc_type_detect(void) -- 2.16.1.windows.4
From: Tal Shnaiderman <talshn@mellanox.com> Set the endianness in Windows to RTE_LITTLE_ENDIAN as support for Windows is limited to x86 architecture for now. Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> --- lib/librte_eal/include/generic/rte_byteorder.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/include/generic/rte_byteorder.h b/lib/librte_eal/include/generic/rte_byteorder.h index 9ca960932f..6cfdf68731 100644 --- a/lib/librte_eal/include/generic/rte_byteorder.h +++ b/lib/librte_eal/include/generic/rte_byteorder.h @@ -17,8 +17,10 @@ #include <stdint.h> #ifdef RTE_EXEC_ENV_FREEBSD #include <sys/endian.h> -#else +#elif defined RTE_EXEC_ENV_LINUX #include <endian.h> +#elif defined RTE_EXEC_ENV_WINDOWS && !defined RTE_BYTE_ORDER +#define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN #endif #include <rte_common.h> -- 2.16.1.windows.4
From: Tal Shnaiderman <talshn@mellanox.com> Export needed eal functions used by the lib. Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> --- lib/librte_eal/common/meson.build | 1 + lib/librte_eal/rte_eal_exports.def | 3 +++ lib/librte_eal/rte_eal_version.map | 1 + 3 files changed, 5 insertions(+) diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build index cf4b9e56eb..530e06033b 100644 --- a/lib/librte_eal/common/meson.build +++ b/lib/librte_eal/common/meson.build @@ -12,6 +12,7 @@ if is_windows 'eal_common_dynmem.c', 'eal_common_errno.c', 'eal_common_fbarray.c', + 'eal_common_hexdump.c', 'eal_common_launch.c', 'eal_common_lcore.c', 'eal_common_log.c', diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def index 9ebf0d641a..9b2ebbcdf5 100644 --- a/lib/librte_eal/rte_eal_exports.def +++ b/lib/librte_eal/rte_eal_exports.def @@ -3,6 +3,7 @@ EXPORTS per_lcore__rte_errno rte_calloc rte_calloc_socket + per_lcore__lcore_id per_lcore__rte_errno rte_bus_register rte_dev_is_probed @@ -12,6 +13,7 @@ EXPORTS rte_eal_has_hugepages rte_eal_init rte_eal_iova_mode + rte_eal_mbuf_user_pool_ops rte_eal_mp_remote_launch rte_eal_mp_wait_lcore rte_eal_process_type @@ -20,6 +22,7 @@ EXPORTS rte_eal_tailq_register rte_eal_using_phys_addrs rte_free + rte_hexdump rte_log rte_malloc rte_malloc_dump_stats diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 361d4808f5..8ecef1ace1 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -394,4 +394,5 @@ EXPERIMENTAL { rte_mem_unmap; __emutls_v.per_lcore__rte_errno; __rte_trace_mem_per_thread_alloc; + __emutls_v.per_lcore__lcore_id; }; -- 2.16.1.windows.4
From: Tal Shnaiderman <talshn@mellanox.com> Build the lib for Windows. Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> --- lib/meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/meson.build b/lib/meson.build index 5486628625..e1a729da8a 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -40,8 +40,7 @@ if is_windows 'kvargs', 'eal', 'ring', - 'mempool', - 'pci', + 'mempool', 'mbuf', 'pci', # core ] # only supported libraries for windows endif -- 2.16.1.windows.4
01/06/2020 11:38, talshn@mellanox.com: > From: Tal Shnaiderman <talshn@mellanox.com> > > Set the endianness in Windows to RTE_LITTLE_ENDIAN as support > for Windows is limited to x86 architecture for now. > > Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> > --- > --- a/lib/librte_eal/include/generic/rte_byteorder.h > +++ b/lib/librte_eal/include/generic/rte_byteorder.h > #ifdef RTE_EXEC_ENV_FREEBSD > #include <sys/endian.h> > -#else > +#elif defined RTE_EXEC_ENV_LINUX > #include <endian.h> > +#elif defined RTE_EXEC_ENV_WINDOWS && !defined RTE_BYTE_ORDER Why "&& !defined RTE_BYTE_ORDER" ? How can it be defined earlier? > +#define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN > #endif
01/06/2020 11:38, talshn@mellanox.com: > From: Tal Shnaiderman <talshn@mellanox.com> > > Export needed eal functions used by the lib. > > Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> > --- > --- a/lib/librte_eal/rte_eal_exports.def > +++ b/lib/librte_eal/rte_eal_exports.def > @@ -3,6 +3,7 @@ EXPORTS > per_lcore__rte_errno > rte_calloc > rte_calloc_socket > + per_lcore__lcore_id [...] > --- a/lib/librte_eal/rte_eal_version.map > +++ b/lib/librte_eal/rte_eal_version.map > @@ -394,4 +394,5 @@ EXPERIMENTAL { > rte_mem_unmap; > __emutls_v.per_lcore__rte_errno; > __rte_trace_mem_per_thread_alloc; > + __emutls_v.per_lcore__lcore_id; I'm surprised about this one in the Linux/BSD map. Can it be removed?
> Subject: Re: [dpdk-dev] [PATCH 3/4] eal: export needed functions for mbuf
>
> 01/06/2020 11:38, talshn@mellanox.com:
> > From: Tal Shnaiderman <talshn@mellanox.com>
> >
> > Export needed eal functions used by the lib.
> >
> > Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
> > ---
> > --- a/lib/librte_eal/rte_eal_exports.def
> > +++ b/lib/librte_eal/rte_eal_exports.def
> > @@ -3,6 +3,7 @@ EXPORTS
> > per_lcore__rte_errno
> > rte_calloc
> > rte_calloc_socket
> > + per_lcore__lcore_id
> [...]
> > --- a/lib/librte_eal/rte_eal_version.map
> > +++ b/lib/librte_eal/rte_eal_version.map
> > @@ -394,4 +394,5 @@ EXPERIMENTAL {
> > rte_mem_unmap;
> > __emutls_v.per_lcore__rte_errno;
> > __rte_trace_mem_per_thread_alloc;
> > + __emutls_v.per_lcore__lcore_id;
>
> I'm surprised about this one in the Linux/BSD map.
> Can it be removed?
>
It is needed for the MingGW build which requires the __emutls_v. prefix.
16/06/2020 10:33, Tal Shnaiderman: > > 01/06/2020 11:38, talshn@mellanox.com: > > > From: Tal Shnaiderman <talshn@mellanox.com> > > > > > > Export needed eal functions used by the lib. > > > > > > Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> > > > --- > > > --- a/lib/librte_eal/rte_eal_exports.def > > > +++ b/lib/librte_eal/rte_eal_exports.def > > > @@ -3,6 +3,7 @@ EXPORTS > > > per_lcore__rte_errno > > > rte_calloc > > > rte_calloc_socket > > > + per_lcore__lcore_id > > [...] > > > --- a/lib/librte_eal/rte_eal_version.map > > > +++ b/lib/librte_eal/rte_eal_version.map > > > @@ -394,4 +394,5 @@ EXPERIMENTAL { > > > rte_mem_unmap; > > > __emutls_v.per_lcore__rte_errno; > > > __rte_trace_mem_per_thread_alloc; > > > + __emutls_v.per_lcore__lcore_id; Note the alphabetical order is not respected above. > > I'm surprised about this one in the Linux/BSD map. > > Can it be removed? > > It is needed for the MingGW build which requires the __emutls_v. prefix. We already have per_lcore__lcore_id and per_lcore__rte_errno for Linux and FreeBSD. The prefix __emutls_v. for MinGW looks wrong. If it is really required, it should be added automatically in my opinion. I think we can do it in buildtools/map_to_def.py by adding this prefix to per_lcore__ when required.
On Tue, 16 Jun 2020 10:45:49 +0200 Thomas Monjalon <thomas@monjalon.net> wrote: > 16/06/2020 10:33, Tal Shnaiderman: > > > 01/06/2020 11:38, talshn@mellanox.com: > > > > From: Tal Shnaiderman <talshn@mellanox.com> > > > > > > > > Export needed eal functions used by the lib. > > > > > > > > Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> > > > > --- > > > > --- a/lib/librte_eal/rte_eal_exports.def > > > > +++ b/lib/librte_eal/rte_eal_exports.def > > > > @@ -3,6 +3,7 @@ EXPORTS > > > > per_lcore__rte_errno > > > > rte_calloc > > > > rte_calloc_socket > > > > + per_lcore__lcore_id > > > [...] > > > > --- a/lib/librte_eal/rte_eal_version.map > > > > +++ b/lib/librte_eal/rte_eal_version.map > > > > @@ -394,4 +394,5 @@ EXPERIMENTAL { > > > > rte_mem_unmap; > > > > __emutls_v.per_lcore__rte_errno; > > > > __rte_trace_mem_per_thread_alloc; > > > > + __emutls_v.per_lcore__lcore_id; > > Note the alphabetical order is not respected above. > > > > I'm surprised about this one in the Linux/BSD map. > > > Can it be removed? > > > > It is needed for the MingGW build which requires the __emutls_v. prefix. > > We already have per_lcore__lcore_id and per_lcore__rte_errno > for Linux and FreeBSD. > The prefix __emutls_v. for MinGW looks wrong. > If it is really required, it should be added automatically > in my opinion. > I think we can do it in buildtools/map_to_def.py > by adding this prefix to per_lcore__ when required. MinGW doesn't use .def, it's for link.exe only (used by Clang). To my understanding, multiple .map files can be used [1]. The "overlay .map" for MinGW can then be generated from the generic .map by a separate script. [1]: https://github.com/PlushBeaver/dpdk/blob/windows/lib/meson.build#L174 -- Dmitry Kozlyuk
16/06/2020 11:26, Dmitry Kozlyuk:
> Thomas Monjalon <thomas@monjalon.net> wrote:
> > 16/06/2020 10:33, Tal Shnaiderman:
> > > > 01/06/2020 11:38, talshn@mellanox.com:
> > > > > From: Tal Shnaiderman <talshn@mellanox.com>
> > > > >
> > > > > Export needed eal functions used by the lib.
> > > > >
> > > > > Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
> > > > > ---
> > > > > --- a/lib/librte_eal/rte_eal_version.map
> > > > > +++ b/lib/librte_eal/rte_eal_version.map
> > > > > @@ -394,4 +394,5 @@ EXPERIMENTAL {
> > > > > rte_mem_unmap;
> > > > > __emutls_v.per_lcore__rte_errno;
> > > > > __rte_trace_mem_per_thread_alloc;
> > > > > + __emutls_v.per_lcore__lcore_id;
> >
> > We already have per_lcore__lcore_id and per_lcore__rte_errno
> > for Linux and FreeBSD.
> > The prefix __emutls_v. for MinGW looks wrong.
> > If it is really required, it should be added automatically
> > in my opinion.
> > I think we can do it in buildtools/map_to_def.py
> > by adding this prefix to per_lcore__ when required.
>
> MinGW doesn't use .def, it's for link.exe only (used by Clang). To my
> understanding, multiple .map files can be used [1]. The "overlay .map" for
> MinGW can then be generated from the generic .map by a separate script.
>
> [1]: https://github.com/PlushBeaver/dpdk/blob/windows/lib/meson.build#L174
Yes please generate a map with the fixed prefix.
It can be done in a script similar to buildtools/map_to_def.py, right?
> Subject: Re: [dpdk-dev] [PATCH 2/4] eal: set byteorder in Windows to little > endian > > 01/06/2020 11:38, talshn@mellanox.com: > > From: Tal Shnaiderman <talshn@mellanox.com> > > > > Set the endianness in Windows to RTE_LITTLE_ENDIAN as support for > > Windows is limited to x86 architecture for now. > > > > Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> > > --- > > --- a/lib/librte_eal/include/generic/rte_byteorder.h > > +++ b/lib/librte_eal/include/generic/rte_byteorder.h > > #ifdef RTE_EXEC_ENV_FREEBSD > > #include <sys/endian.h> > > -#else > > +#elif defined RTE_EXEC_ENV_LINUX > > #include <endian.h> > > +#elif defined RTE_EXEC_ENV_WINDOWS && !defined RTE_BYTE_ORDER > > Why "&& !defined RTE_BYTE_ORDER" ? > How can it be defined earlier? > You're right, it's unneeded since it is defined later on. The entire "#elif defined RTE_EXEC_ENV_WINDOWS" section could be removed actually, looks like both clang and MinGW contain the predefined __BYTE_ORDER__ macro and detect the right endianness on compile time. > > +#define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN > > #endif > > >
From: Tal Shnaiderman <talshn@mellanox.com> This patchset enables compilation and build of librte_mbuf on Windows. --- Depends-on: series-10550 ("build mempool on Windows") v2: * Remove unneeded endianness macro check (ThomasM) * Fix export list name order (ThomasM) * Remove __emutls_v.* MinGW export as it is no longer needed. --- Tal Shnaiderman (3): eal: correct OS headers in rte_byteorder.h eal: export needed functions for mbuf mbuf: build on Windows lib/librte_eal/common/meson.build | 1 + lib/librte_eal/include/generic/rte_byteorder.h | 2 +- lib/librte_eal/rte_eal_exports.def | 3 +++ lib/meson.build | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) -- 2.16.1.windows.4
From: Tal Shnaiderman <talshn@mellanox.com> Inclusion of the endian.h header is set only for Linux OS. Windows endlessness will be determined by the predefined __BYTE_ORDER__ macro. Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> --- lib/librte_eal/include/generic/rte_byteorder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/include/generic/rte_byteorder.h b/lib/librte_eal/include/generic/rte_byteorder.h index 9ca960932f..a67e1d70d9 100644 --- a/lib/librte_eal/include/generic/rte_byteorder.h +++ b/lib/librte_eal/include/generic/rte_byteorder.h @@ -17,7 +17,7 @@ #include <stdint.h> #ifdef RTE_EXEC_ENV_FREEBSD #include <sys/endian.h> -#else +#elif defined RTE_EXEC_ENV_LINUX #include <endian.h> #endif -- 2.16.1.windows.4
From: Tal Shnaiderman <talshn@mellanox.com> Export needed eal functions used by the lib. Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> --- lib/librte_eal/common/meson.build | 1 + lib/librte_eal/rte_eal_exports.def | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build index dc9b1d2feb..c1d9f21488 100644 --- a/lib/librte_eal/common/meson.build +++ b/lib/librte_eal/common/meson.build @@ -14,6 +14,7 @@ if is_windows 'eal_common_dynmem.c', 'eal_common_errno.c', 'eal_common_fbarray.c', + 'eal_common_hexdump.c', 'eal_common_launch.c', 'eal_common_lcore.c', 'eal_common_log.c', diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def index 984c5d1698..69204a92c6 100644 --- a/lib/librte_eal/rte_eal_exports.def +++ b/lib/librte_eal/rte_eal_exports.def @@ -3,6 +3,7 @@ EXPORTS __rte_trace_mem_per_thread_alloc __rte_trace_point_emit_field __rte_trace_point_register + per_lcore__lcore_id per_lcore__rte_errno per_lcore_trace_mem per_lcore_trace_point_sz @@ -17,6 +18,7 @@ EXPORTS rte_eal_has_pci rte_eal_init rte_eal_iova_mode + rte_eal_mbuf_user_pool_ops rte_eal_mp_remote_launch rte_eal_mp_wait_lcore rte_eal_process_type @@ -26,6 +28,7 @@ EXPORTS rte_eal_tailq_register rte_eal_using_phys_addrs rte_free + rte_hexdump rte_malloc rte_malloc_dump_stats rte_malloc_get_socket_stats -- 2.16.1.windows.4
From: Tal Shnaiderman <talshn@mellanox.com> Build the lib for Windows. Signed-off-by: Tal Shnaiderman <talshn@mellanox.com> --- lib/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/meson.build b/lib/meson.build index a9a5be0e5e..dcee2e68ec 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -39,8 +39,8 @@ if is_windows libraries = [ 'kvargs','eal', 'ring', - 'mempool', 'pci', - ] # only supported libraries for windows + 'mempool', 'mbuf', 'pci', # core + ] # only supported libraries for windows endif default_cflags = machine_args -- 2.16.1.windows.4
> Tal Shnaiderman (3):
> eal: correct OS headers in rte_byteorder.h
> eal: export needed functions for mbuf
> mbuf: build on Windows
Applied, thanks