Skip to contentSkip to conversation

HelloWorld example for windows

PATCH Superseded Anand Rawat 14 participants 178 messages Mar 6, 2019 – Apr 2, 2019 2 messages not in the archive Page 1 of 2

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover HelloWorld example for windows

Includes Windows-specific EAL changes and meson changes to build the code on windows.
v2 Changes:
Incorporated reviews from v1.
Fixed license period for updated files. Renamed 'winapp' folder to 'windows'.
Cleaned unneeded meson changes.
Fixed code style warnings.
Added maintainers information for windows branch

lcore mask parameter for helloworld will be supported from v3.

Anand Rawat (6):
eal: eal stub to add windows support
eal: add header files to support windows
eal: add headers for compatibility with windows environment
eal: add minimum viable code for eal on windows
examples: add meson changes for windows
doc: add documention for windows

 MAINTAINERS                                   |   7 +
 config/meson.build                            |  22 +-
 config/rte_config.h                           |   7 +-
 config/x86/meson.build                        |  14 +-
 doc/guides/index.rst                          |   3 +-
 doc/guides/windows_gsg/build_dpdk.rst         |  67 ++++
 doc/guides/windows_gsg/index.rst              |  14 +
 doc/guides/windows_gsg/intro.rst              |  20 ++
 examples/meson.build                          |   9 +-
 lib/librte_eal/common/meson.build             | 160 +++++----
 lib/librte_eal/meson.build                    |  10 +-
 lib/librte_eal/windows/eal/eal.c              |  79 +++++
 lib/librte_eal/windows/eal/eal_debug.c        |  18 +
 lib/librte_eal/windows/eal/eal_lcore.c        |  99 ++++++
 lib/librte_eal/windows/eal/eal_thread.c       | 151 +++++++++
 .../windows/eal/include/exec-env/fnmatch.h    |  25 ++
 .../windows/eal/include/exec-env/pthread.h    |  19 ++
 .../windows/eal/include/exec-env/regex.h      |  52 +++
 .../eal/include/exec-env/rte_windows.h        |  47 +++
 .../windows/eal/include/exec-env/sched.h      |  41 +++
 .../windows/eal/include/exec-env/sys/queue.h  | 320 ++++++++++++++++++
 .../windows/eal/include/exec-env/unistd.h     |   7 +
 lib/librte_eal/windows/eal/meson.build        |  12 +
 lib/meson.build                               |   6 +-
 meson.build                                   |  34 +-
 25 files changed, 1135 insertions(+), 108 deletions(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/sys/queue.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/unistd.h
 create mode 100644 lib/librte_eal/windows/eal/meson.build
Signature · 1 line
2.17.1.windows.2
#1 lore raw

PATCH v2 1/6 eal: eal stub to add windows support

Added initial stub source files for windows support and meson changes to build them.

---
 config/meson.build                      | 22 ++++---
 config/x86/meson.build                  | 14 +++--
 lib/librte_eal/common/meson.build       | 84 ++++++++++++++-----------
 lib/librte_eal/meson.build              | 10 ++-
 lib/librte_eal/windows/eal/eal.c        | 11 ++++
 lib/librte_eal/windows/eal/eal_debug.c  | 12 ++++
 lib/librte_eal/windows/eal/eal_lcore.c  | 26 ++++++++
 lib/librte_eal/windows/eal/eal_thread.c | 15 +++++
 lib/librte_eal/windows/eal/meson.build  | 10 +++
 lib/meson.build                         |  6 +-
 meson.build                             | 34 +++++-----
 11 files changed, 176 insertions(+), 68 deletions(-)
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/meson.build
config/meson.build +15 -7
index 0419607d3..37adf5b03 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # set the machine type and cflags for it
 if meson.is_cross_build()
@@ -52,18 +52,26 @@ dpdk_extra_ldflags += '-Wl,--no-as-needed'
 add_project_link_arguments('-pthread', language: 'c')
 dpdk_extra_ldflags += '-pthread'
 
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+if cc.find_library('lm', required : false).found()
+	# some libs depend on maths lib
+	add_project_link_arguments('-lm', language: 'c')
+	dpdk_extra_ldflags += '-lm'
+endif
 
 # for linux link against dl, for bsd execinfo
 if host_machine.system() == 'linux'
 	link_lib = 'dl'
-else
+elif host_machine.system() == 'freebsd'
 	link_lib = 'execinfo'
+else
+	link_lib = ''
+endif
+
+# if link_lib is empty, do not add it to project properties
+if link_lib != ''
+	add_project_link_arguments('-l' + link_lib, language: 'c')
+	dpdk_extra_ldflags += '-l' + link_lib
 endif
-add_project_link_arguments('-l' + link_lib, language: 'c')
-dpdk_extra_ldflags += '-l' + link_lib
 
 # check for libraries used in multiple places in DPDK
 has_libnuma = 0
config/x86/meson.build +8 -6
index 7504cb9e5..558edfda9 100644
@@ -1,15 +1,17 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # for checking defines we need to use the correct compiler flags
 march_opt = ['-march=@0@'.format(machine)]
 
 # get binutils version for the workaround of Bug 97
-ldver = run_command('ld', '-v').stdout().strip()
-if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
 	endif
 endif
 
lib/librte_eal/common/meson.build +46 -38

111 lines not on this page · raw message

lib/librte_eal/meson.build +8 -2
index 98c1d1f31..61b654557 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # Custom EAL processing. EAL is complicated enough that it can't just
 # have a straight list of headers and source files.
@@ -17,13 +17,19 @@ elif host_machine.system() == 'freebsd'
 	dpdk_conf.set('RTE_EXEC_ENV_BSDAPP', 1)
 	subdir('bsdapp/eal')
 
+elif host_machine.system() == 'windows'
+	dpdk_conf.set('RTE_EXEC_ENV_WINDOWS', 1)
+	subdir('windows/eal')
+
 else
 	error('unsupported system type "@0@"'.format(host_machine.system()))
 endif
 
 version = 9  # the version of the EAL API
 allow_experimental_apis = true
-deps += 'kvargs'
+if host_machine.system() != 'windows'
+	deps += 'kvargs'
+endif
 if dpdk_conf.has('RTE_USE_LIBBSD')
 	ext_deps += libbsd
 endif
lib/librte_eal/windows/eal/eal.c new file +11 -0
new file mode 100644
index 000000000..134452a77
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+int
+rte_eal_init(int argc __rte_unused, char **argv __rte_unused)
+{
+	return 0;
+}
lib/librte_eal/windows/eal/eal_debug.c new file +12 -0
new file mode 100644
index 000000000..012eeccfa
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+void
+__rte_panic(const char *funcname __rte_unused,
+		const char *format __rte_unused, ...)
+{
+	abort();
+}
lib/librte_eal/windows/eal/eal_lcore.c new file +26 -0
new file mode 100644
index 000000000..be7adeb18
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	return lcore_id;
+}
+
+/* Check if a cpu is present by the presence of the cpu information for it */
+int
+eal_cpu_detected(unsigned int lcore_id __rte_unused)
+{
+	return 1;
+}
+
+/* Get CPU socket id (NUMA node) for a logical core */
+unsigned int
+eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+{
+	return 0;
+}
lib/librte_eal/windows/eal/eal_thread.c new file +15 -0
new file mode 100644
index 000000000..222bd8f4d
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include <windows.h>
+
+#include "rte_common.h"
+
+typedef uintptr_t eal_thread_t;
+
+int
+eal_thread_create(eal_thread_t *thread __rte_unused)
+{
+	return 0;
+}
lib/librte_eal/windows/eal/meson.build new file +10 -0
new file mode 100644
index 000000000..8b1735623
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+env_objs = []
+env_headers = []
+env_sources = files('eal.c',
+	'eal_debug.c',
+	'eal_lcore.c',
+	'eal_thread.c',
+)
lib/meson.build +5 -1
index 99957ba7d..995c0e1ac 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible
@@ -30,6 +30,10 @@ libraries = [
 	# flow_classify lib depends on pkt framework table lib
 	'flow_classify', 'bpf', 'telemetry']
 
+if host_machine.system() == 'windows'
+	libraries = ['eal'] # override libraries for windows
+endif
+
 default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
meson.build +20 -14
index 69833de82..856e94c37 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	version: '19.05.0-rc0',
@@ -13,6 +13,7 @@ cc = meson.get_compiler('c')
 dpdk_conf = configuration_data()
 dpdk_libraries = []
 dpdk_static_libraries = []
+driver_classes = []
 dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_app_link_libraries = []
@@ -35,28 +36,33 @@ eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
 global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
 subdir('config')
 
-# build libs and drivers
+# build libs
 subdir('lib')
-subdir('buildtools')
-subdir('drivers')
 
-# build binaries and installable tools
-subdir('usertools')
-subdir('app')
+if host_machine.system() != 'windows'
+	# build buildtools and drivers
+	subdir('buildtools')
+	subdir('drivers')
 
-# build docs
-subdir('doc')
+	# build binaries and installable tools
+	subdir('usertools')
+	subdir('app')
+	subdir('test')
+
+	# build kernel modules if enabled
+	if get_option('enable_kmods')
+		subdir('kernel')
+	endif
+
+	# build docs
+	subdir('doc')
+endif
 
 # build any examples explicitly requested - useful for developers
 if get_option('examples') != ''
 	subdir('examples')
 endif
 
-# build kernel modules if enabled
-if get_option('enable_kmods')
-	subdir('kernel')
-endif
-
 # write the build config
 build_cfg = 'rte_build_config.h'
 configure_file(output: build_cfg,
Signature · 1 line
2.17.1.windows.2
#2 lore raw

Re: [PATCH v2 1/6] eal: eal stub to add windows support

Hi,

06/03/2019 05:16, Anand Rawat:

config/meson.build dpdk_extra_ldflags += '-Wl,--no-as-needed' · line 59

Quoted 8 lines
config/meson.build +5 -3
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+if cc.find_library('lm', required : false).found()
+	# some libs depend on maths lib
+	add_project_link_arguments('-lm', language: 'c')
+	dpdk_extra_ldflags += '-lm'
+endif

Either libmath is required or not.
I don't think it can be optional.
Why is it changed?

Quoted 5 lines
 # get binutils version for the workaround of Bug 97
config/x86/meson.build +0 -4
-ldver = run_command('ld', '-v').stdout().strip()
-if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'

config/x86/meson.build line 16

Quoted 10 lines
config/x86/meson.build +7 -1
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
 	endif
 endif

Same comment as in v1, you should check which linker is used. This check is only for GNU ld 2.30.

lib/librte_eal/common/meson.build line 11

Quoted 2 lines
lib/librte_eal/common/meson.build +2 -0
+if host_machine.system() != 'windows'
+	common_sources = files(

The definitive solution should be to compile all common EAL files. Please explain what are the issues in the common files. I think we should not remove them and fix them one by one. You could provide a separate patch to skip some files for making helloworld working.

lib/librte_eal/common/meson.build line 53

Quoted 6 lines
lib/librte_eal/common/meson.build +5 -1
-subdir(join_paths('arch', arch_subdir))
+
+common_headers += files('include/rte_common.h')
+if host_machine.system() != 'windows'
+	subdir(join_paths('arch', arch_subdir))
+endif

Same comment as above, it should not be changed.

lib/librte_eal/common/meson.build line 55

Quoted 8 lines
lib/librte_eal/common/meson.build +1 -2
-common_headers = files(
+common_headers += files(
 	'include/rte_alarm.h',
 	'include/rte_branch_prediction.h',
 	'include/rte_bus.h',
 	'include/rte_bitmap.h',
 	'include/rte_class.h',
-	'include/rte_common.h',

Why rte_common.h is moved first in the list?

lib/librte_eal/meson.build elif host_machine.system() == 'freebsd' · line 32

Quoted 4 lines
lib/librte_eal/meson.build +3 -1
-deps += 'kvargs'
+if host_machine.system() != 'windows'
+	deps += 'kvargs'
+endif

Why kvargs is removed?

lib/librte_eal/windows/eal/eal_lcore.c line 12

Quoted 8 lines
lib/librte_eal/windows/eal/eal_lcore.c new file +6 -0
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	return lcore_id;
+}

For this function and the others in this file,
please add a comment explaining this is a stub, not the expected result. You can add a TODO or FIXME tag.

lib/meson.build libraries = [ · line 35

Quoted 5 lines
lib/meson.build +3 -0
+if host_machine.system() == 'windows'
+	libraries = ['eal'] # override libraries for windows
+endif

Instead of simply "override", you could explain that the other libraries are not yet supported on Windows.

Quoted 21 lines
meson.build +8 -8
-# build libs and drivers
+# build libs
 subdir('lib')
-subdir('buildtools')
-subdir('drivers')
 
-# build binaries and installable tools
-subdir('usertools')
-subdir('app')
+if host_machine.system() != 'windows'
+	# build buildtools and drivers
+	subdir('buildtools')
+	subdir('drivers')
 
-# build docs
-subdir('doc')
+	# build binaries and installable tools
+	subdir('usertools')
+	subdir('app')

meson.build eal_pmd_path = join_paths(get_option('prefix'), driver_install_path) · line 59

Quoted 10 lines
meson.build +10 -0
+	subdir('test')
+
+	# build kernel modules if enabled
+	if get_option('enable_kmods')
+		subdir('kernel')
+	endif
+
+	# build docs
+	subdir('doc')
+endif

I don't like modifying this file.
Can we skip not supported directories inside the sub meson files?

#3 lore raw

Re: [PATCH v2 1/6] eal: eal stub to add windows support

Quoted 16 lines · Thomas Monjalon

Hi,

06/03/2019 05:16, Anand Rawat:

config/meson.build dpdk_extra_ldflags += '-Wl,--no-as-needed' · line 59

Quoted 8 lines
config/meson.build +5 -3
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+if cc.find_library('lm', required : false).found()
+	# some libs depend on maths lib
+	add_project_link_arguments('-lm', language: 'c')
+	dpdk_extra_ldflags += '-lm'
+endif

Either libmath is required or not.
I don't think it can be optional.
Why is it changed?

I think these come as part of libc, it's just on Linux they are not in the main libc library but need to be linked in separately.

https://en.wikipedia.org/wiki/C_mathematical_functions#libm

Therefore, this looks the best way of dealing with this.

Quoted 10 lines
Quoted 10 lines
 # get binutils version for the workaround of Bug 97
config/x86/meson.build +4 -5
-ldver = run_command('ld', '-v').stdout().strip()
-if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
Quoted 9 lines

config/x86/meson.build line 16

Quoted 5 lines
config/x86/meson.build +3 -0
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
 	endif
 endif

Same comment as in v1, you should check which linker is used. This check is only for GNU ld 2.30.

I'm not aware of any better way to implement this in meson right now, sadly. Through the compiler object we can get information about linker flags, but not about the specific linker itself, since it is only called through the compiler.

Quoted 9 lines

lib/librte_eal/common/meson.build line 11

Quoted 2 lines
lib/librte_eal/common/meson.build +2 -0
+if host_machine.system() != 'windows'
+	common_sources = files(

The definitive solution should be to compile all common EAL files. Please explain what are the issues in the common files. I think we should not remove them and fix them one by one. You could provide a separate patch to skip some files for making helloworld working.

I believe that is exactly what this patch is trying to do - it's skipping the files unneeded to get helloworld working, and the intention is to fix them one by one and add them back in later. Perhaps this sort of change should be a separate (precursor) patch where the cover letter can call this out explicitly?

Quoted 20 lines

lib/librte_eal/common/meson.build line 53

Quoted 6 lines
lib/librte_eal/common/meson.build +5 -1
-subdir(join_paths('arch', arch_subdir))
+
+common_headers += files('include/rte_common.h')
+if host_machine.system() != 'windows'
+	subdir(join_paths('arch', arch_subdir))
+endif

Same comment as above, it should not be changed.

lib/librte_eal/common/meson.build line 55

Quoted 8 lines
lib/librte_eal/common/meson.build +1 -2
-common_headers = files(
+common_headers += files(
 	'include/rte_alarm.h',
 	'include/rte_branch_prediction.h',
 	'include/rte_bus.h',
 	'include/rte_bitmap.h',
 	'include/rte_class.h',
-	'include/rte_common.h',

Why rte_common.h is moved first in the list?

Quoted 7 lines

lib/librte_eal/meson.build elif host_machine.system() == 'freebsd' · line 32

Quoted 4 lines
lib/librte_eal/meson.build +3 -1
-deps += 'kvargs'
+if host_machine.system() != 'windows'
+	deps += 'kvargs'
+endif

Why kvargs is removed?

Again, I believe these actions are to disable the parts of DPDK that are not needed to enable helloworld, allowing later patches to come in and fix them.

Quoted 48 lines

lib/librte_eal/windows/eal/eal_lcore.c line 12

Quoted 8 lines
lib/librte_eal/windows/eal/eal_lcore.c new file +6 -0
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	return lcore_id;
+}

For this function and the others in this file,
please add a comment explaining this is a stub, not the expected result. You can add a TODO or FIXME tag.

lib/meson.build libraries = [ · line 35

Quoted 5 lines
lib/meson.build +3 -0
+if host_machine.system() == 'windows'
+	libraries = ['eal'] # override libraries for windows
+endif

Instead of simply "override", you could explain that the other libraries are not yet supported on Windows.

Quoted 26 lines
meson.build +13 -8
-# build libs and drivers
+# build libs
 subdir('lib')
-subdir('buildtools')
-subdir('drivers')
 
-# build binaries and installable tools
-subdir('usertools')
-subdir('app')
+if host_machine.system() != 'windows'
+	# build buildtools and drivers
+	subdir('buildtools')
+	subdir('drivers')
 
-# build docs
-subdir('doc')
+	# build binaries and installable tools
+	subdir('usertools')
+	subdir('app')
+	subdir('test')
+
+	# build kernel modules if enabled
+	if get_option('enable_kmods')
+		subdir('kernel')
Quoted 9 lines

meson.build eal_pmd_path = join_paths(get_option('prefix'), driver_install_path) · line 59

Quoted 5 lines
meson.build +5 -0
+	endif
+
+	# build docs
+	subdir('doc')
+endif

I don't like modifying this file.
Can we skip not supported directories inside the sub meson files?

Since we now mandate meson 0.47 we can use the "subdir_done()" function to this.

/Bruce

#4 lore raw

Re: [PATCH v2 1/6] eal: eal stub to add windows support

06/03/2019 12:20, Bruce Richardson:

Quoted 18 lines · Thomas Monjalon
Quoted 16 lines

Hi,

06/03/2019 05:16, Anand Rawat:

config/meson.build dpdk_extra_ldflags += '-Wl,--no-as-needed' · line 59

Quoted 8 lines
config/meson.build +5 -3
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+if cc.find_library('lm', required : false).found()
+	# some libs depend on maths lib
+	add_project_link_arguments('-lm', language: 'c')
+	dpdk_extra_ldflags += '-lm'
+endif

Either libmath is required or not.
I don't think it can be optional.
Why is it changed?

Quoted 6 lines

I think these come as part of libc, it's just on Linux they are not in the main libc library but need to be linked in separately.

https://en.wikipedia.org/wiki/C_mathematical_functions#libm

Therefore, this looks the best way of dealing with this.

If it's the only solution, at least it deserves a comment.

Quoted 23 lines
Quoted 9 lines

lib/librte_eal/common/meson.build line 11

Quoted 2 lines
lib/librte_eal/common/meson.build +2 -0
+if host_machine.system() != 'windows'
+	common_sources = files(

The definitive solution should be to compile all common EAL files. Please explain what are the issues in the common files. I think we should not remove them and fix them one by one. You could provide a separate patch to skip some files for making helloworld working.

I believe that is exactly what this patch is trying to do - it's skipping the files unneeded to get helloworld working, and the intention is to fix them one by one and add them back in later. Perhaps this sort of change should be a separate (precursor) patch where the cover letter can call this out explicitly?

Quoted 6 lines

lib/librte_eal/meson.build elif host_machine.system() == 'freebsd' · line 32

Quoted 4 lines
lib/librte_eal/meson.build +3 -1
-deps += 'kvargs'
+if host_machine.system() != 'windows'
+	deps += 'kvargs'
+endif

Why kvargs is removed?

Quoted 3 lines

Again, I believe these actions are to disable the parts of DPDK that are not needed to enable helloworld, allowing later patches to come in and fix them.

They are workarounds to build helloworld.
It is good to have progress in the draft tree,
but I see no point in merging this in master.
I think we should separate patches which are doing definitive changes from temporary workaround patches disabling some files.
It is not an issue to merge some patches for Windows which are not compiling.

#5 lore raw

Re: [PATCH v2 1/6] eal: eal stub to add windows support

Quoted 31 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, March 6, 2019 11:36 AM
To: Richardson, Bruce <[email protected]>
Cc: [email protected]; Rawat, Anand <[email protected]>; Kadam, Pallavi <[email protected]>; Menon, Ranjit <[email protected]>; Shaw, Jeffrey B <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support

06/03/2019 12:20, Bruce Richardson:

Quoted 18 lines · Thomas Monjalon
Quoted 16 lines

Hi,

06/03/2019 05:16, Anand Rawat:

config/meson.build dpdk_extra_ldflags += '-Wl,--no-as-needed' · line 59

Quoted 8 lines
config/meson.build +5 -3
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+if cc.find_library('lm', required : false).found()
+	# some libs depend on maths lib
+	add_project_link_arguments('-lm', language: 'c')
+	dpdk_extra_ldflags += '-lm'
+endif

Either libmath is required or not.
I don't think it can be optional.
Why is it changed?

Quoted 8 lines
Quoted 6 lines

I think these come as part of libc, it's just on Linux they are not in the main libc library but need to be linked in separately.

https://en.wikipedia.org/wiki/C_mathematical_functions#libm

Therefore, this looks the best way of dealing with this.

If it's the only solution, at least it deserves a comment.

Yes. I'd suggest changing the existing comment rather than adding a new one. Update it to point out that on some OS's the maths functions are in a separate library.

Quoted 36 lines
Quoted 24 lines
Quoted 10 lines

lib/librte_eal/common/meson.build line 11

Quoted 3 lines
lib/librte_eal/common/meson.build +2 -0
+if host_machine.system() != 'windows'
+	common_sources = files(

The definitive solution should be to compile all common EAL files. Please explain what are the issues in the common files. I think we should not remove them and fix them one by one. You could provide a separate patch to skip some files for making helloworld working.

I believe that is exactly what this patch is trying to do - it's skipping the files unneeded to get helloworld working, and the intention is to fix them one by one and add them back in later. Perhaps this sort of change should be a separate (precursor) patch where the cover letter can call this out explicitly?

Quoted 6 lines

lib/librte_eal/meson.build elif host_machine.system() == 'freebsd' · line 32

Quoted 4 lines
lib/librte_eal/meson.build +3 -1
-deps += 'kvargs'
+if host_machine.system() != 'windows'
+	deps += 'kvargs'
+endif

Why kvargs is removed?

Quoted 3 lines

Again, I believe these actions are to disable the parts of DPDK that are not needed to enable helloworld, allowing later patches to come in and fix them.

They are workarounds to build helloworld.
It is good to have progress in the draft tree, but I see no point in merging this in master.
I think we should separate patches which are doing definitive changes from temporary workaround patches disabling some files.
It is not an issue to merge some patches for Windows which are not compiling.

#6 lore raw

Re: [PATCH v2 1/6] eal: eal stub to add windows support

Quoted 34 lines · Bruce
Quoted 34 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, March 6, 2019 11:36 AM
To: Richardson, Bruce <[email protected]>
Cc: [email protected]; Rawat, Anand <[email protected]>; Kadam, Pallavi <[email protected]>; Menon, Ranjit <[email protected]>; Shaw, Jeffrey B <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support

06/03/2019 12:20, Bruce Richardson:

Quoted 21 lines · Thomas Monjalon
Quoted 16 lines

Hi,

06/03/2019 05:16, Anand Rawat:

config/meson.build dpdk_extra_ldflags += '-Wl,--no-as-needed' · line 59

Quoted 8 lines
config/meson.build +5 -3
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+if cc.find_library('lm', required : false).found()
+       # some libs depend on maths lib
+       add_project_link_arguments('-lm', language: 'c')
+       dpdk_extra_ldflags += '-lm'
+endif

Either libmath is required or not.
I don't think it can be optional.
Why is it changed?

I think these come as part of libc, it's just on Linux they are not in the main libc library but need to be linked in separately.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

https://en.wikipedia.org/wiki/C_mathematical_functions#libm

Therefore, this looks the best way of dealing with this.

If it's the only solution, at least it deserves a comment.

Yes. I'd suggest changing the existing comment rather than adding a new one. Update it to point out that on some OS's the maths functions are in a separate library.

Bruce is right, both pthreads and math lib are not required for windows as the functionalities associated with them are a part of the standard library. Not having the check for pthread cause a warning at link time. I will update the comment in v3 as suggested.

Quoted 29 lines
Quoted 29 lines
Quoted 28 lines
Quoted 11 lines

lib/librte_eal/common/meson.build line 11

Quoted 4 lines
lib/librte_eal/common/meson.build +2 -0
+if host_machine.system() != 'windows'
+       common_sources = files(

The definitive solution should be to compile all common EAL files. Please explain what are the issues in the common files. I think we should not remove them and fix them one by one. You could provide a separate patch to skip some files for making helloworld working.

I believe that is exactly what this patch is trying to do - it's skipping the files unneeded to get helloworld working, and the intention is to fix them one by one and add them back in later. Perhaps this sort of change should be a separate (precursor) patch where the cover letter can call this out explicitly?

Quoted 6 lines

lib/librte_eal/meson.build elif host_machine.system() == 'freebsd' · line 32

Quoted 4 lines
lib/librte_eal/meson.build +3 -1
-deps += 'kvargs'
+if host_machine.system() != 'windows'
+       deps += 'kvargs'
+endif

Why kvargs is removed?

Again, I believe these actions are to disable the parts of DPDK that are not needed to enable helloworld, allowing later patches to come in and fix them.

Quoted 9 lines
Quoted 8 lines

They are workarounds to build helloworld.
It is good to have progress in the draft tree, but I see no point in merging this in master.
I think we should separate patches which are doing definitive changes from temporary workaround patches disabling some files.
It is not an issue to merge some patches for Windows which are not compiling.

Bruce is right, we only compile required header and source files in order to avoid compatibility errors on windows. Without these change helloworld on windows would fail to compile. Adding windows specific implementations of the common headers and sources would bloat up individual patches as well the number of patches. kvargs is removed as a dependency to have minimum viable product for helloworld. If required for lcore mask, it'll added back in v3.

Signature · 1 line
Anand Rawat
#7 lore raw

Re: [PATCH v2 1/6] eal: eal stub to add windows support

07/03/2019 02:04, Anand Rawat:

Quoted 40 lines · Bruce
Quoted 38 lines

From: Thomas Monjalon [mailto:[email protected]]

Quoted 37 lines

06/03/2019 12:20, Bruce Richardson:

Quoted 25 lines · Thomas Monjalon
Quoted 10 lines

06/03/2019 05:16, Anand Rawat:

lib/librte_eal/common/meson.build line 11

Quoted 2 lines
lib/librte_eal/common/meson.build +2 -0
+if host_machine.system() != 'windows'
+       common_sources = files(

The definitive solution should be to compile all common EAL files. Please explain what are the issues in the common files. I think we should not remove them and fix them one by one. You could provide a separate patch to skip some files for making helloworld working.

I believe that is exactly what this patch is trying to do - it's skipping the files unneeded to get helloworld working, and the intention is to fix them one by one and add them back in later. Perhaps this sort of change should be a separate (precursor) patch where the cover letter can call this out explicitly?

Quoted 6 lines

lib/librte_eal/meson.build elif host_machine.system() == 'freebsd' · line 32

Quoted 4 lines
lib/librte_eal/meson.build +3 -1
-deps += 'kvargs'
+if host_machine.system() != 'windows'
+       deps += 'kvargs'
+endif

Why kvargs is removed?

Quoted 3 lines

Again, I believe these actions are to disable the parts of DPDK that are not needed to enable helloworld, allowing later patches to come in and fix them.

They are workarounds to build helloworld.
It is good to have progress in the draft tree, but I see no point in merging this in master.
I think we should separate patches which are doing definitive changes from temporary workaround patches disabling some files.
It is not an issue to merge some patches for Windows which are not compiling.

Quoted 7 lines

Bruce is right, we only compile required header and source files in order to avoid compatibility errors on windows. Without these change helloworld on windows would fail to compile. Adding windows specific implementations of the common headers and sources would bloat up individual patches as well the number of patches. kvargs is removed as a dependency to have minimum viable product for helloworld. If required for lcore mask, it'll added back in v3.

Please make separate patches for workarounds.
I am interested to push some patches which are really required in master, but the workarounds should stay in the Windows draft repository.

#8 lore raw

Re: [PATCH v2 1/6] eal: eal stub to add windows support

In reply to Bruce Richardson
Quoted 22 lines · Bruce
Quoted 10 lines · Thomas Monjalon
Quoted 10 lines
  # get binutils version for the workaround of Bug 97
config/x86/meson.build +4 -5
-ldver = run_command('ld', '-v').stdout().strip()
-if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
Quoted 9 lines

config/x86/meson.build line 16

Quoted 5 lines
config/x86/meson.build +3 -0
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
  	endif
  endif

Same comment as in v1, you should check which linker is used. This check is only for GNU ld 2.30.

Quoted 4 lines

I'm not aware of any better way to implement this in meson right now, sadly. Through the compiler object we can get information about linker flags, but not about the specific linker itself, since it is only called through the compiler.

Since on windows we only support clang, this check cause an error. 'ERROR: Program or command 'ld' not found or not executable' It is for this reason we excluded this check from the build flow. Clang uses lld as linker from the LLVM project.

Quoted 58 lines
Quoted 49 lines

lib/librte_eal/windows/eal/eal_lcore.c line 12

Quoted 9 lines
lib/librte_eal/windows/eal/eal_lcore.c new file +6 -0
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	return lcore_id;
+}

For this function and the others in this file,
please add a comment explaining this is a stub, not the expected result. You can add a TODO or FIXME tag.

lib/meson.build libraries = [ · line 35

Quoted 5 lines
lib/meson.build +3 -0
+if host_machine.system() == 'windows'
+	libraries = ['eal'] # override libraries for windows
+endif

Instead of simply "override", you could explain that the other libraries are not yet supported on Windows.

Quoted 26 lines
meson.build +13 -8
-# build libs and drivers
+# build libs
  subdir('lib')
-subdir('buildtools')
-subdir('drivers')
 
-# build binaries and installable tools
-subdir('usertools')
-subdir('app')
+if host_machine.system() != 'windows'
+	# build buildtools and drivers
+	subdir('buildtools')
+	subdir('drivers')
 
-# build docs
-subdir('doc')
+	# build binaries and installable tools
+	subdir('usertools')
+	subdir('app')
+	subdir('test')
+
+	# build kernel modules if enabled
+	if get_option('enable_kmods')
+		subdir('kernel')
Quoted 9 lines

meson.build eal_pmd_path = join_paths(get_option('prefix'), driver_install_path) · line 59

Quoted 5 lines
meson.build +5 -0
+	endif
+
+	# build docs
+	subdir('doc')
+endif

I don't like modifying this file.
Can we skip not supported directories inside the sub meson files?

Quoted 5 lines

Since we now mandate meson 0.47 we can use the "subdir_done()" function to this.

/Bruce

Will be done as a part of v3

Signature · 1 line
Anand Rawat
#9 lore raw

PATCH v2 2/6 eal: add header files to support windows

In reply to Anand Rawat

Added header files to support windows on x86 platforms. Updated rte_config to include rte_windows.h for windows build.

---
 config/rte_config.h                           |  7 +++++-
 .../eal/include/exec-env/rte_windows.h        | 23 +++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  2 ++
 3 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
config/rte_config.h +6 -1
index 7606f5d7b..1ad7e1d30 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2017 Intel Corporation
+ * Copyright(c) 2017-2019 Intel Corporation
  */
 
 /**
@@ -118,4 +118,9 @@
 /* QEDE PMD defines */
 #define RTE_LIBRTE_QEDE_FW ""
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+
 #endif /* _RTE_CONFIG_H_ */
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h new file +23 -0
new file mode 100644
index 000000000..8e4dc72bb
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_WINDOWS_H_
+#define _RTE_WINDOWS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __extension__
+#define __thread __declspec(thread)
+
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+typedef void *ssize_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_WINDOWS_H_ */
lib/librte_eal/windows/eal/meson.build +2 -0
index 8b1735623..d6c540f82 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include/exec-env')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
Signature · 1 line
2.17.1.windows.2
#10 lore raw

Re: [PATCH v2 2/6] eal: add header files to support windows

06/03/2019 05:16, Anand Rawat:

Quoted 3 lines

Added header files to support windows on x86 platforms. Updated rte_config to include rte_windows.h for windows build.

[...]

config/rte_config.h line 124

Quoted 6 lines
config/rte_config.h +4 -0
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif

Include in the config file looks wrong.

lib/librte_eal/windows/eal/include/exec-env/rte_windows.h

Quoted 2 lines
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h new file +0 -0

I think we could remove the sub-directory exec-env. Could we include this file from rte_common.h?

Quoted 14 lines
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h new file +13 -0
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_WINDOWS_H_
+#define _RTE_WINDOWS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __extension__
+#define __thread __declspec(thread)

lib/librte_eal/windows/eal/include/exec-env/rte_windows.h line 23

Quoted 10 lines
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h new file +10 -0
+
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+typedef void *ssize_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_WINDOWS_H_ */

It is missing comments to explain the need of each line.

#11 lore raw

Re: [PATCH v2 2/6] eal: add header files to support windows

Quoted 13 lines · Thomas Monjalon

06/03/2019 05:16, Anand Rawat:

Quoted 3 lines

Added header files to support windows on x86 platforms. Updated rte_config to include rte_windows.h for windows build.

[...]

config/rte_config.h line 124

Quoted 6 lines
config/rte_config.h +4 -0
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif

Include in the config file looks wrong. >

Quoted 5 lines

lib/librte_eal/windows/eal/include/exec-env/rte_windows.h

Quoted 2 lines
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h new file +0 -0

I think we could remove the sub-directory exec-env. Could we include this file from rte_common.h?

rte_windows.h defines types and substitution macros which are needed to support common code on windows. So it should be included as a global include for every library on windows. rte_common.h is not included in all the source code and headers we currently build for windows.

Quoted 19 lines
Quoted 19 lines
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h new file +17 -0
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_WINDOWS_H_
+#define _RTE_WINDOWS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __extension__
+#define __thread __declspec(thread)
+
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+typedef void *ssize_t;
Quoted 10 lines

lib/librte_eal/windows/eal/include/exec-env/rte_windows.h line 23

Quoted 6 lines
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h new file +6 -0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_WINDOWS_H_ */

It is missing comments to explain the need of each line.

Will be done in v3

Signature · 1 line
Anand Rawat
#12 lore raw

Re: [PATCH v2 2/6] eal: add header files to support windows

07/03/2019 04:27, Anand Rawat:

Quoted 19 lines · Thomas Monjalon
Quoted 13 lines

06/03/2019 05:16, Anand Rawat:

Quoted 3 lines

Added header files to support windows on x86 platforms. Updated rte_config to include rte_windows.h for windows build.

[...]

config/rte_config.h line 124

Quoted 6 lines
config/rte_config.h +4 -0
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif

Include in the config file looks wrong. >

Quoted 5 lines

lib/librte_eal/windows/eal/include/exec-env/rte_windows.h

Quoted 2 lines
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h new file +0 -0

I think we could remove the sub-directory exec-env. Could we include this file from rte_common.h?

Quoted 5 lines

rte_windows.h defines types and substitution macros which are needed to support common code on windows. So it should be included as a global include for every library on windows. rte_common.h is not included in all the source code and headers we currently build for windows.

I think it is not an issue adding some rte_common.h include here and there.

#13 lore raw

Re: [PATCH v2 2/6] eal: add header files to support windows

Quoted 20 lines · Thomas Monjalon

07/03/2019 04:27, Anand Rawat:

Quoted 19 lines · Thomas Monjalon
Quoted 18 lines

06/03/2019 05:16, Anand Rawat:

Quoted 3 lines

Added header files to support windows on x86 platforms. Updated rte_config to include rte_windows.h for windows build.

[...]

config/rte_config.h line 124

Quoted 6 lines
config/rte_config.h +4 -0
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif

Include in the config file looks wrong. >

lib/librte_eal/windows/eal/include/exec-env/rte_windows.h

Quoted 2 lines
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h new file +0 -0

I think we could remove the sub-directory exec-env. Could we include this file from rte_common.h?

Quoted 9 lines
Quoted 5 lines

rte_windows.h defines types and substitution macros which are needed to support common code on windows. So it should be included as a global include for every library on windows. rte_common.h is not included in all the source code and headers we currently build for windows.

I think it is not an issue adding some rte_common.h include here and there.

I'd be hesitant about putting it in rte_common.h without knowing the scope of the changes - "here and there" could end up being "everywhere".

Another alternative is to see if most/all the definitions could actually be put in dpdk_conf and thereby go into the standard config.h file generated at build time. Anything that couldn't be done via macros or defines in the config could then look to be put maybe in rte_common.h or other locations, perhaps.

/Bruce

#14 lore raw

Re: [PATCH v2 2/6] eal: add header files to support windows

07/03/2019 11:24, Bruce Richardson:

Quoted 27 lines · Thomas Monjalon
Quoted 26 lines

07/03/2019 04:27, Anand Rawat:

Quoted 24 lines · Thomas Monjalon
Quoted 13 lines

06/03/2019 05:16, Anand Rawat:

Quoted 3 lines

Added header files to support windows on x86 platforms. Updated rte_config to include rte_windows.h for windows build.

[...]

config/rte_config.h line 124

Quoted 6 lines
config/rte_config.h +4 -0
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif

Include in the config file looks wrong. >

Quoted 5 lines

lib/librte_eal/windows/eal/include/exec-env/rte_windows.h

Quoted 2 lines
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h new file +0 -0

I think we could remove the sub-directory exec-env. Could we include this file from rte_common.h?

rte_windows.h defines types and substitution macros which are needed to support common code on windows. So it should be included as a global include for every library on windows. rte_common.h is not included in all the source code and headers we currently build for windows.

Quoted 6 lines
Quoted 3 lines

I think it is not an issue adding some rte_common.h include here and there.

I'd be hesitant about putting it in rte_common.h without knowing the scope of the changes - "here and there" could end up being "everywhere".

It's already almost everywhere, and I think it's normal, it is the meaning of "common".

% git grep rte_common.h | wc -l
459

% git grep rte_common.h lib | fgrep .h: | wc -l
79

If some .c files doesn't have rte_common.h included directly or indirectly from other includes, it may be fixed.

Quoted 5 lines

Another alternative is to see if most/all the definitions could actually be put in dpdk_conf and thereby go into the standard config.h file generated at build time. Anything that couldn't be done via macros or defines in the config could then look to be put maybe in rte_common.h or other locations, perhaps.

I think we should keep the semantic of what a config file is. I don't see the need of adding more than strict config in it.

#15 lore raw

Re: [PATCH v2 2/6] eal: add header files to support windows

Quoted 58 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Thursday, March 7, 2019 11:33 AM
To: Richardson, Bruce <[email protected]>
Cc: Rawat, Anand <[email protected]>; [email protected]; Kadam, Pallavi <[email protected]>; Menon, Ranjit <[email protected]>; Shaw, Jeffrey B <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows

07/03/2019 11:24, Bruce Richardson:

Quoted 26 lines · Thomas Monjalon
Quoted 25 lines

07/03/2019 04:27, Anand Rawat:

Quoted 23 lines · Thomas Monjalon
Quoted 12 lines

06/03/2019 05:16, Anand Rawat:

Quoted 2 lines

Added header files to support windows on x86 platforms. Updated rte_config to include rte_windows.h for windows build.

[...]

config/rte_config.h line 124

Quoted 6 lines
config/rte_config.h +4 -0
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif

Include in the config file looks wrong. >

Quoted 5 lines

lib/librte_eal/windows/eal/include/exec-env/rte_windows.h

Quoted 2 lines
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h new file +0 -0

I think we could remove the sub-directory exec-env. Could we include this file from rte_common.h?

rte_windows.h defines types and substitution macros which are needed to support common code on windows. So it should be included as a global include for every library on windows. rte_common.h is not included in all the source code and headers we currently build for windows.

Quoted 6 lines
Quoted 3 lines

I think it is not an issue adding some rte_common.h include here and there.

I'd be hesitant about putting it in rte_common.h without knowing the scope of the changes - "here and there" could end up being "everywhere".

It's already almost everywhere, and I think it's normal, it is the meaning of "common".

% git grep rte_common.h | wc -l
459

% git grep rte_common.h lib | fgrep .h: | wc -l
79

If some .c files doesn't have rte_common.h included directly or indirectly from other includes, it may be fixed.

Quoted 9 lines
Quoted 5 lines

Another alternative is to see if most/all the definitions could actually be put in dpdk_conf and thereby go into the standard config.h file generated at build time. Anything that couldn't be done via macros or defines in the config could then look to be put maybe in rte_common.h or other locations, perhaps.

I think we should keep the semantic of what a config file is. I don't see the need of adding more than strict config in it.

Ok.

#16 lore raw

PATCH v2 3/6 eal: add headers for compatibility with windows environment

In reply to Anand Rawat

Added headers to support windows environment for common source. These headers will have windows specific implementions of the system library apis provided in linux and freebsd.

---
 .../windows/eal/include/exec-env/fnmatch.h    |  25 ++
 .../windows/eal/include/exec-env/pthread.h    |  19 ++
 .../windows/eal/include/exec-env/regex.h      |  50 +++
 .../windows/eal/include/exec-env/sched.h      |  41 +++
 .../windows/eal/include/exec-env/sys/queue.h  | 320 ++++++++++++++++++
 .../windows/eal/include/exec-env/unistd.h     |   7 +
 6 files changed, 462 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/sys/queue.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/unistd.h
lib/librte_eal/windows/eal/include/exec-env/fnmatch.h new file +25 -0
new file mode 100644
index 000000000..1422ba56a
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FNM_NOMATCH 1
+
+static inline int fnmatch(__rte_unused const char *pattern,
+		__rte_unused const char *string,
+		__rte_unused int flags)
+{
+	return FNM_NOMATCH;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FNMATCH_H_ */
lib/librte_eal/windows/eal/include/exec-env/pthread.h new file +19 -0
new file mode 100644
index 000000000..431550577
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef uintptr_t pthread_t;
+typedef void *pthread_attr_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PTHREAD_H_ */
lib/librte_eal/windows/eal/include/exec-env/regex.h new file +50 -0

50 lines not on this page · raw message

lib/librte_eal/windows/eal/include/exec-env/sched.h new file +41 -0

41 lines not on this page · raw message

lib/librte_eal/windows/eal/include/exec-env/sys/queue.h new file +320 -0

320 lines not on this page · raw message

lib/librte_eal/windows/eal/include/exec-env/unistd.h new file +7 -0
new file mode 100644
index 000000000..4973fc793
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+#endif /* _UNISTD_H_ */
Signature · 1 line
2.17.1.windows.2
#17 lore raw

PATCH v2 4/6 eal: add minimum viable code for eal on windows

In reply to Anand Rawat

Add windows specific logic for eal.c, eal_lcore.c, eal_debug.c and eal_thread.c. Update meson logic to build eal on windows.

---
 lib/librte_eal/common/meson.build             |  94 +++++------
 lib/librte_eal/windows/eal/eal.c              |  70 ++++++++-
 lib/librte_eal/windows/eal/eal_debug.c        |  12 +-
 lib/librte_eal/windows/eal/eal_lcore.c        |  97 ++++++++++--
 lib/librte_eal/windows/eal/eal_thread.c       | 146 +++++++++++++++++-
 .../windows/eal/include/exec-env/regex.h      |   2 +
 .../eal/include/exec-env/rte_windows.h        |  24 +++
 7 files changed, 379 insertions(+), 66 deletions(-)
lib/librte_eal/common/meson.build +49 -45
index c010e8737..759516e2a 100644
@@ -5,8 +5,14 @@ eal_inc += include_directories('.', 'include',
 		join_paths('include/arch', arch_subdir))
 
 common_objs = []
-common_sources = []
 common_headers = []
+
+common_sources = files(
+		'eal_common_errno.c',
+		'eal_common_launch.c',
+		'eal_common_lcore.c',
+		'eal_common_log.c'
+	)
 if host_machine.system() != 'windows'
 	common_sources = files(
 		'eal_common_bus.c',
@@ -14,13 +20,9 @@ if host_machine.system() != 'windows'
 		'eal_common_class.c',
 		'eal_common_devargs.c',
 		'eal_common_dev.c',
-		'eal_common_errno.c',
 		'eal_common_fbarray.c',
 		'eal_common_hexdump.c',
 		'eal_common_hypervisor.c',
-		'eal_common_launch.c',
-		'eal_common_lcore.c',
-		'eal_common_log.c',
 		'eal_common_memalloc.c',
 		'eal_common_memory.c',
 		'eal_common_memzone.c',
@@ -47,7 +49,22 @@ endif
 eal_common_arch_sources = []
 eal_common_arch_objs = []
 
-common_headers += files('include/rte_common.h')
+common_headers += files(
+		'include/rte_branch_prediction.h',
+		'include/rte_bus.h',
+		'include/rte_common.h',
+		'include/rte_debug.h',
+		'include/rte_dev.h',
+		'include/rte_eal.h',
+		'include/rte_errno.h',
+		'include/rte_launch.h',
+		'include/rte_lcore.h',
+		'include/rte_log.h',
+		'include/rte_memory.h',
+		'include/rte_pci_dev_feature_defs.h',
+		'include/rte_per_lcore.h',
+		'include/rte_string_fns.h'
+	)
 if host_machine.system() != 'windows'
 	subdir(join_paths('arch', arch_subdir))
 endif
@@ -55,45 +72,32 @@ common_sources += eal_common_arch_sources
 common_objs += eal_common_arch_objs
 
 common_headers += files(
-	'include/rte_alarm.h',
-	'include/rte_branch_prediction.h',
-	'include/rte_bus.h',
-	'include/rte_bitmap.h',
-	'include/rte_class.h',
-	'include/rte_compat.h',
-	'include/rte_debug.h',
-	'include/rte_devargs.h',
-	'include/rte_dev.h',
-	'include/rte_eal.h',
-	'include/rte_eal_memconfig.h',
-	'include/rte_eal_interrupts.h',
-	'include/rte_errno.h',
-	'include/rte_fbarray.h',
-	'include/rte_hexdump.h',
-	'include/rte_hypervisor.h',
-	'include/rte_interrupts.h',
-	'include/rte_keepalive.h',
-	'include/rte_launch.h',
-	'include/rte_lcore.h',
-	'include/rte_log.h',
-	'include/rte_malloc.h',
-	'include/rte_malloc_heap.h',
-	'include/rte_memory.h',
-	'include/rte_memzone.h',
-	'include/rte_option.h',
-	'include/rte_pci_dev_feature_defs.h',
-	'include/rte_pci_dev_features.h',
-	'include/rte_per_lcore.h',
-	'include/rte_random.h',
-	'include/rte_reciprocal.h',
-	'include/rte_service.h',
-	'include/rte_service_component.h',
-	'include/rte_string_fns.h',
-	'include/rte_tailq.h',
-	'include/rte_time.h',
-	'include/rte_uuid.h',
-	'include/rte_version.h'
-)
+		'include/rte_alarm.h',
+		'include/rte_bitmap.h',
+		'include/rte_class.h',
+		'include/rte_compat.h',
+		'include/rte_devargs.h',
+		'include/rte_eal_memconfig.h',
+		'include/rte_eal_interrupts.h',
+		'include/rte_fbarray.h',
+		'include/rte_hexdump.h',
+		'include/rte_hypervisor.h',
+		'include/rte_interrupts.h',
+		'include/rte_keepalive.h',
+		'include/rte_malloc.h',
+		'include/rte_malloc_heap.h',
+		'include/rte_memzone.h',
+		'include/rte_option.h',
+		'include/rte_pci_dev_features.h',
+		'include/rte_random.h',
+		'include/rte_reciprocal.h',
+		'include/rte_service.h',
+		'include/rte_service_component.h',
+		'include/rte_tailq.h',
+		'include/rte_time.h',
+		'include/rte_uuid.h',
+		'include/rte_version.h'
+	)
 
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
lib/librte_eal/windows/eal/eal.c +69 -1

79 lines not on this page · raw message

lib/librte_eal/windows/eal/eal_debug.c +9 -3
index 012eeccfa..72e5cb97e 100644
@@ -2,11 +2,17 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdarg.h>
+#include <rte_log.h>
 
 void
-__rte_panic(const char *funcname __rte_unused,
-		const char *format __rte_unused, ...)
+__rte_panic(const char *funcname, const char *format, ...)
 {
+	va_list ap;
+
+	rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n", funcname);
+	va_start(ap, format);
+	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
+	va_end(ap);
 	abort();
 }
lib/librte_eal/windows/eal/eal_lcore.c +85 -12

110 lines not on this page · raw message

lib/librte_eal/windows/eal/eal_thread.c +141 -5

156 lines not on this page · raw message

lib/librte_eal/windows/eal/include/exec-env/regex.h +2 -0
index efd3f1ecd..512e5723e 100644
@@ -12,6 +12,8 @@ extern "C" {
 #define REG_NOMATCH 1
 #define REG_ESPACE 12
 
+#include "rte_common.h"
+
 typedef void *regex_t;
 typedef void *regmatch_t;
 
lib/librte_eal/windows/eal/include/exec-env/rte_windows.h +24 -0
index 8e4dc72bb..9f1a9ad62 100644
@@ -9,13 +9,37 @@
 extern "C" {
 #endif
 
+#include <windows.h>
+
 #define __extension__
 #define __thread __declspec(thread)
 
 #define strerror_r(a, b, c) strerror_s(b, c, a)
 
+#define strdup(str)	_strdup(str)
+
 typedef void *ssize_t;
 
+typedef uintptr_t eal_thread_t;
+
+/**
+ * Create a thread.
+ * This function is private to EAL.
+ *
+ * @param thread
+ *   The location to store the thread id if successful.
+ * @return
+ *   0 for success, -1 if the thread is not created.
+ */
+int eal_thread_create(eal_thread_t *thread);
+
+/**
+ * Create a map of processors and cores on the system.
+ * This function is private to EAL.
+ *
+ */
+void eal_create_cpu_map(void);
+
 #ifdef __cplusplus
 }
 #endif
Signature · 1 line
2.17.1.windows.2
#18 lore raw

PATCH v2 5/6 examples: add meson changes for windows

In reply to Anand Rawat

Add meson changes to build helloworld example on windows. Only EAL is supported currently.

---
 examples/meson.build | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
examples/meson.build +7 -2
index af81c762e..2e638399e 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 driver_libs = []
 if get_option('default_library') == 'static'
@@ -35,7 +35,12 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+
+	if host_machine.system() != 'windows'
+		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	else
+		deps = ['eal']
+	endif
 	subdir(example)
 
 	if build
Signature · 1 line
2.17.1.windows.2
#19 lore raw

PATCH v2 6/6 doc: add documention for windows

In reply to Anand Rawat

Added documentation to build helloworld example
on windows using meson and clang. Updated the
maintainers list to include windows maintainers.

---
 MAINTAINERS                           |  7 +++
 doc/guides/index.rst                  |  3 +-
 doc/guides/windows_gsg/build_dpdk.rst | 67 +++++++++++++++++++++++++++
 doc/guides/windows_gsg/index.rst      | 14 ++++++
 doc/guides/windows_gsg/intro.rst      | 20 ++++++++
 5 files changed, 110 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
MAINTAINERS +7 -0
index 097cfb4f3..c1187da8c 100644
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <[email protected]>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <[email protected]>
+M: Omar Cardona <[email protected]>
+M: Anand Rawat <[email protected]>
+M: Ranjit Menon <[email protected]>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
doc/guides/index.rst +2 -1
index 8a9ed65c8..8a1601b27 100644
@@ -1,5 +1,5 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2010-2014 Intel Corporation.
+    Copyright(c) 2010-2019 Intel Corporation.
 
 DPDK documentation
 ==================
@@ -9,6 +9,7 @@ DPDK documentation
 
    linux_gsg/index
    freebsd_gsg/index
+   windows_gsg/index
    sample_app_ug/index
    prog_guide/index
    howto/index
doc/guides/windows_gsg/build_dpdk.rst new file +67 -0

67 lines not on this page · raw message

doc/guides/windows_gsg/index.rst new file +14 -0
new file mode 100644
index 000000000..d9b7990a8
@@ -0,0 +1,14 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+.. _windows_gsg:
+
+Getting Started Guide for Windows
+=================================
+
+.. toctree::
+    :maxdepth: 2
+    :numbered:
+
+    intro
+    build_dpdk
doc/guides/windows_gsg/intro.rst new file +20 -0
new file mode 100644
index 000000000..a0285732d
@@ -0,0 +1,20 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Introduction
+============
+
+This document contains instructions for installing and configuring the Data
+Plane Development Kit (DPDK) software. The document describes how to compile
+and run a DPDK application in a Windows* OS application environment, without
+going deeply into detail.
+
+\*Other names and brands may be claimed as the property of others.
+
+Limitations
+===========
+
+DPDK for Windows is currently a work in progress. Not all DPDK source files
+compile. Support is being added in pieces so as to limit the overall scope
+of any individual patch series. The goal is to be able to run any DPDK
+application natively on Windows.
Signature · 1 line
2.17.1.windows.2
#20 lore raw

Re: [PATCH v2 6/6] doc: add documention for windows

Quoted 17 lines

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

---
 MAINTAINERS                           |  7 +++
 doc/guides/index.rst                  |  3 +-
 doc/guides/windows_gsg/build_dpdk.rst | 67
+++++++++++++++++++++++++++
 doc/guides/windows_gsg/index.rst      | 14 ++++++
 doc/guides/windows_gsg/intro.rst      | 20 ++++++++
 5 files changed, 110 insertions(+), 1 deletion(-)  create mode 100644
doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst  create mode
Quoted 2 lines

100644 doc/guides/windows_gsg/intro.rst

Make doc html 50848
sphinx processing guides-html...
dpdk/doc/guides/windows_gsg/build_dpdk.rst:28: WARNING: Unknown target name: "meson's website<http://mesonbuild.com/getting-meson.html>". dpdk/doc/guides/windows_gsg/build_dpdk.rst:36: WARNING: Unknown target name: "ninja's website<https://ninja-build.org/>".

<...>

Quoted 9 lines
doc/guides/windows_gsg/build_dpdk.rst new file +5 -0
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson's

website<http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+

Space is needed after website for the link to be properly made.

-Download and install the build system from Meson's website<http://mesonbuild.com/Getting-meson.html>_. +Download and install the build system from Meson's website <http://mesonbuild.com/Getting-meson.html>_.

Quoted 10 lines
(quoted diff) +2 -0
+
+http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-

wit

doc/guides/windows_gsg/build_dpdk.rst new file +7 -0
+h-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja's
+website<https://ninja-build.org/>`_ or install along with the meson build
Quoted 2 lines

system.
+

Also here:
-If using Ninja, download and install the backend from Ninja's website<https://ninja-build.org/>_ or +If using Ninja, download and install the backend from Ninja's website <https://ninja-build.org/>_ or

<...>

#21 lore raw

Re: [PATCH v2 6/6] doc: add documention for windows

Quoted 58 lines · Marko
Quoted 15 lines

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

---
  MAINTAINERS                           |  7 +++
  doc/guides/index.rst                  |  3 +-
  doc/guides/windows_gsg/build_dpdk.rst | 67
+++++++++++++++++++++++++++
  doc/guides/windows_gsg/index.rst      | 14 ++++++
  doc/guides/windows_gsg/intro.rst      | 20 ++++++++
  5 files changed, 110 insertions(+), 1 deletion(-)  create mode 100644
Quoted 4 lines

doc/guides/windows_gsg/build_dpdk.rst
create mode 100644 doc/guides/windows_gsg/index.rst create mode
100644 doc/guides/windows_gsg/intro.rst

Make doc html 50848
sphinx processing guides-html...
dpdk/doc/guides/windows_gsg/build_dpdk.rst:28: WARNING: Unknown target name: "meson's website<http://mesonbuild.com/getting-meson.html>". dpdk/doc/guides/windows_gsg/build_dpdk.rst:36: WARNING: Unknown target name: "ninja's website<https://ninja-build.org/>".

<...>

Quoted 9 lines
doc/guides/windows_gsg/build_dpdk.rst new file +5 -0
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson's

website<http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+

Space is needed after website for the link to be properly made.

(quoted diff) +1 -1
-Download and install the build system from `Meson's website<http://mesonbuild.com/Getting-meson.html>`_.
+Download and install the build system from `Meson's website <http://mesonbuild.com/Getting-meson.html>`_.
Quoted 11 lines
(quoted diff) +2 -0
+
+http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-

wit

doc/guides/windows_gsg/build_dpdk.rst new file +7 -0
+h-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja's
+website<https://ninja-build.org/>`_ or install along with the meson build
Quoted 2 lines

system.
+

Also here:

Review

Quoted 4 lines
(quoted diff) +1 -1
-If using Ninja, download and install the backend from `Ninja's website<https://ninja-build.org/>`_ or
+If using Ninja, download and install the backend from `Ninja's website <https://ninja-build.org/>`_ or
 
<...>

Thank You, will update in v3

Signature · 1 line
Anand Rawat
#22 lore raw

Re: [PATCH v2 6/6] doc: add documention for windows

In reply to Anand Rawat
Quoted 9 lines · Anand Rawat

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

---

doc/guides/windows_gsg/build_dpdk.rst line 51

Quoted 8 lines
doc/guides/windows_gsg/build_dpdk.rst new file +8 -0
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build

I think, there is one more dependency with link.exe or so. Could you please check the log and update the documentation.

PS C:\Users\jerin\dpdk.org> meson build
The Meson build system
Version: 0.49.2
Source dir: C:\Users\jerin\dpdk.org
Build dir: C:\Users\jerin\dpdk.org\build
Build type: native build
Project name: DPDK
Project version: 19.05.0-rc0

meson.build:4:0: ERROR: Compiler clang can not compile programs.

A full log can be found at C:\Users\jerin\dpdk.org\build\meson- logs\meson-log.txt

PS C:\Users\jerin\dpdk.org> cat .\build\meson-logs\meson-log.txt Build started at 2019-03-11T07:52:15.487361
Main binary: C:\Program Files\Meson\meson.exe
Python system: Windows
The Meson build system
Version: 0.49.2
Source dir: C:\Users\jerin\dpdk.org
Build dir: C:\Users\jerin\dpdk.org\build
Build type: native build
Project name: DPDK
Project version: 19.05.0-rc0
Sanity testing C compiler: clang
Is cross compiler: False.
Sanity check compiler command line: clang C:\Users\jerin\dpdk.org\build\meson-private\sanitycheckc.c -o C:\Users\jerin\dpdk.org\build\meson-private\sanitycheckc.exe Sanity check compile stdout:

-----
Sanity check compile stderr:
clang.exe: warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt [-Wmsvc-not-found] clang.exe: error: unable to execute command: program not executable clang.exe: error: linker command failed with exit code 1 (use -v to see invocation)

-----

meson.build:4:0: ERROR: Compiler clang can not compile programs. PS C:\Users\jerin\dpdk.org> clang C:\Users\jerin\dpdk.org\build\meson- private\sanitycheckc.c -o C:\Users\jerin\dpdk.org\build\meson-private\s anitycheckc.exe
clang.exe: warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt [-Wmsvc-not-found] clang.exe: error: unable to execute command: program not executable clang.exe: error: linker command failed with exit code 1 (use -v to see invocation)

PS C:\Users\jerin\dpdk.org> clang -v C:\Users\jerin\dpdk.org\build\meson-private\sanitycheckc.c -o C:\Users\jerin\dpdk.org\build\meson-private\sanitycheckc.exe clang version 7.0.1 (tags/RELEASE_701/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
clang.exe: warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt [-Wmsvc-not-found]
"C:\\Program Files\\LLVM\\bin\\clang.exe" -cc1 -triple x86_64-pc-
windows-msvc19.11.0 -emit-obj -mrelax-all -mincremental-linker- compatible -disable-free -disable-llvm-verifier -discard-value-names -main-file-name sanitycheckc.c -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger- tuning=gdb -momit-leaf-frame-pointer -v -resource-dir "C:\\Program Files\\LLVM\\lib\\clang\\7.0.1" -internal-isystem "C:\\Program Files\\LLVM\\lib\\clang\\7.0.1\\include" -internal-isystem C:/Program Files/Microsoft Visual Studio 10.0/VC/include -internal-isystem C:/Program Files/Microsoft Visual Studio 9.0/VC/include -internal- isystem C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include -internal-isystem C:/Program Files/Microsoft Visual Studio 8/VC/include -internal-isystem C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include -fdebug-compilation-dir "C:\\Users\\jerin\\dpdk.org" -ferror-limit 19 -fmessage-length 168 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms- compatibility-version=19.11 -fdelayed-template-parsing -fobjc- runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\jerin\\AppData\\Local\\Temp\\sanitycheckc-9dd0a9.o" -x c "C:\\Users\\jerin\\dpdk.org\\build\\meson-private\\sanitycheckc.c" clang -cc1 version 7.0.1 based upon LLVM 7.0.1 default target x86_64- pc-win32
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 10.0/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include"
#include "..." search starts here:
#include <...> search starts here:
C:\Program Files\LLVM\lib\clang\7.0.1\include
End of search list.
"link.exe" "-out:C:\\Users\\jerin\\dpdk.org\\build\\meson-
private\\sanitycheckc.exe" -defaultlib:libcmt "-libpath:lib\\amd64" -nologo "C:\\Users\\jerin\\AppData\\Local\\Temp\\sanitycheckc-9dd0a9.o" clang.exe: error: unable to execute command: program not executable clang.exe: error: linker command failed with exit code 1 (use -v to see invocation)

PS C:\Users\jerin\dpdk.org> clang.exe
clang.exe: error: no input files
PS C:\Users\jerin\dpdk.org>

Quoted 3 lines
doc/guides/windows_gsg/build_dpdk.rst new file +2 -0
+    cd build
+    ninja
#23 lore raw

Re: [PATCH v2 6/6] doc: add documention for windows

Quoted 17 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Jerin Jacob Kollanukkaran
Sent: Monday, March 11, 2019 12:45 PM
To: Rawat, Anand <[email protected]>; [email protected]
Cc: Kadam, Pallavi <[email protected]>; [email protected]; Menon, Ranjit <[email protected]>; Shaw, Jeffrey B <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows

Quoted 4 lines · Anand Rawat

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

Quoted 18 lines

doc/guides/windows_gsg/build_dpdk.rst line 51

Quoted 13 lines

---

doc/guides/windows_gsg/build_dpdk.rst new file +8 -0
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build

I think, there is one more dependency with link.exe or so. Could you please check the log and update the documentation.

Out of interest, can you try with "meson -Dc_link_args=-fuse-lld build"?

#24 lore raw

Re: [PATCH v2 6/6] doc: add documention for windows

Hi,
I've been trying to compile it as well without installing the VS stuff. But, it's always failing to compile:
Even the sanitycheck.c file is failing with such error:
lld-link.exe: error: could not open libcmt.lib: no such file or directory

Kindest regards,
Raslan Darawsheh

Quoted 47 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Richardson, Bruce
Sent: Monday, March 11, 2019 3:51 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; Rawat, Anand <[email protected]>; [email protected]
Cc: Kadam, Pallavi <[email protected]>; Thomas Monjalon <[email protected]>; Menon, Ranjit <[email protected]>; Shaw, Jeffrey B <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows

Quoted 16 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Jerin Jacob Kollanukkaran
Sent: Monday, March 11, 2019 12:45 PM
To: Rawat, Anand <[email protected]>; [email protected]
Cc: Kadam, Pallavi <[email protected]>; [email protected]; Menon, Ranjit <[email protected]>; Shaw, Jeffrey B <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows

Quoted 4 lines · Anand Rawat

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

Quoted 18 lines

doc/guides/windows_gsg/build_dpdk.rst line 51

Quoted 13 lines

---

doc/guides/windows_gsg/build_dpdk.rst new file +8 -0
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build

I think, there is one more dependency with link.exe or so. Could you please check the log and update the documentation.

Out of interest, can you try with "meson -Dc_link_args=-fuse-lld build"?

#25 lore raw

Re: [PATCH v2 6/6] doc: add documention for windows

In reply to Richardson, Bruce
Quoted 40 lines · Bruce

-------------------------------------------------------------------
---

Quoted 18 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Jerin Jacob Kollanukkaran
Sent: Monday, March 11, 2019 12:45 PM
To: Rawat, Anand <[email protected]>; [email protected]
Cc: Kadam, Pallavi <[email protected]>; [email protected]; Menon,
Ranjit <[email protected]>; Shaw, Jeffrey B <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows

Quoted 5 lines · Anand Rawat

Added documentation to build helloworld example on windows using meson
and clang. Updated the maintainers list to include windows maintainers.

Quoted 18 lines

doc/guides/windows_gsg/build_dpdk.rst line 51

Quoted 13 lines

---

doc/guides/windows_gsg/build_dpdk.rst new file +8 -0
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build

I think, there is one more dependency with link.exe or so. Could you please check the log and update the documentation.

Quoted 2 lines

Out of interest, can you try with "meson -Dc_link_args=-fuse-lld build"?

Seen the same issue with above command.

#26 lore raw

Re: [PATCH v2 6/6] doc: add documention for windows

In reply to Jerin Jacob Kollanukkaran
Quoted 5 lines · Jerin Jacob Kollanukkaran
Quoted 4 lines · Anand Rawat

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

Quoted 17 lines

doc/guides/windows_gsg/build_dpdk.rst line 51

Quoted 13 lines

---

doc/guides/windows_gsg/build_dpdk.rst new file +8 -0
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build

I think, there is one more dependency with link.exe or so. Could you please check the log and update the documentation.

This is correct, link.exe is needed by clang on windows. I will update the document in V3 to reflect that. We were able to build by using only the buildtools from vs2017 and not the whole installation.

Signature · 1 line
Anand Rawat
#27 lore raw
In reply to Anand Rawat

Hi,

06/03/2019 05:16, Anand Rawat:

Quoted 7 lines

v2 Changes:
Incorporated reviews from v1.
Fixed license period for updated files. Renamed 'winapp' folder to 'windows'. Cleaned unneeded meson changes.
Fixed code style warnings.
Added maintainers information for windows branch

About the method, two advices:

- Please reply to the questions asked during the review of the previous version before doing a new version. It is with discussion that we can find the best solutions.

- Please use --in-reply-to for new revisions in order to have all revisions in the same mail thread.
The best is to make all revisions as replies of the first cover letter.

#28 lore raw
Quoted 11 lines · Thomas Monjalon

Hi,

06/03/2019 05:16, Anand Rawat:

Quoted 7 lines

v2 Changes:
Incorporated reviews from v1.
Fixed license period for updated files. Renamed 'winapp' folder to 'windows'. Cleaned unneeded meson changes.
Fixed code style warnings.
Added maintainers information for windows branch

Quoted 6 lines

About the method, two advices:

- Please reply to the questions asked during the review of the previous version before doing a new version. It is with discussion that we can find the best solutions.

Apologies, my email client was not setup to respond as per the community guidelines. There will be more interaction for v2

Quoted 5 lines

- Please use --in-reply-to for new revisions in order to have all revisions in the same mail thread.
The best is to make all revisions as replies of the first cover letter.

I will make sure to follow this from v3 onward.
Since now that there two cover letters, which one would you like me to have --in-reply-to for v3

Signature · 1 line
Anand Rawat
#29 lore raw

06/03/2019 23:45, Anand Rawat:

Quoted 9 lines
Quoted 5 lines

- Please use --in-reply-to for new revisions in order to have all revisions in the same mail thread.
The best is to make all revisions as replies of the first cover letter.

I will make sure to follow this from v3 onward.
Since now that there two cover letters, which one would you like me to have --in-reply-to for v3

You can continue on top of v2.

#30 lore raw

v3 cover HelloWorld example for windows

In reply to Anand Rawat

Includes Windows-specific EAL changes and meson changes to build the code on windows.
v2 Changes:
Incorporated reviews from v1.
Fixed license period for updated files. Renamed 'winapp' folder to 'windows'.
Cleaned unneeded meson changes.
Fixed code style warnings.
Added maintainers information for windows branch

v3 Changes:
Separated meson workarounds from the essential code changes Added support for kvargs
Updated meson for building DLL on windows using DEF files Fixed documentation for html links and linker dependency Added comments for windows header and source files

notes:
*patch 8/8 contains meson workarounds to build helloworld on windows, which will later be a part of the draft repository

*command-line parsing is not a part of this version as a result lcore mask is currently not supported.

Anand Rawat (8):
eal: eal stub to add windows support
eal: add header files to support windows
kvargs: adding a module definition file
eal: sys/queue.h implementation for windows
eal: add headers for compatibility with windows environment
eal: add minimum viable code for eal on windows
doc: add documention for windows
build: meson changes to build on windows

 MAINTAINERS                                   |   7 +
 config/meson.build                            |  23 +-
 config/x86/meson.build                        |  14 +-
 doc/guides/index.rst                          |   3 +-
 doc/guides/windows_gsg/build_dpdk.rst         |  73 ++++
 doc/guides/windows_gsg/index.rst              |  14 +
 doc/guides/windows_gsg/intro.rst              |  20 ++
 examples/meson.build                          |   6 +-
 lib/librte_eal/common/include/rte_common.h    |   7 +-
 .../common/include/rte_string_fns.h           |   4 +-
 lib/librte_eal/common/meson.build             | 159 +++++----
 lib/librte_eal/meson.build                    |   6 +-
 lib/librte_eal/rte_eal_exports.def            |   2 +
 lib/librte_eal/windows/eal/eal.c              |  84 +++++
 lib/librte_eal/windows/eal/eal_debug.c        |  19 ++
 lib/librte_eal/windows/eal/eal_lcore.c        | 100 ++++++
 lib/librte_eal/windows/eal/eal_thread.c       | 153 +++++++++
 lib/librte_eal/windows/eal/include/fnmatch.h  |  43 +++
 lib/librte_eal/windows/eal/include/pthread.h  |  22 ++
 lib/librte_eal/windows/eal/include/regex.h    |  85 +++++
 .../windows/eal/include/rte_windows.h         |  50 +++
 lib/librte_eal/windows/eal/include/sched.h    |  41 +++
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/include/unistd.h   |   8 +
 lib/librte_eal/windows/eal/meson.build        |  12 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  23 +-
 meson.build                                   |  34 +-
 28 files changed, 1230 insertions(+), 109 deletions(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
 create mode 100644 lib/librte_eal/windows/eal/meson.build
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
Signature · 1 line
2.17.1.windows.2
#31 lore raw

PATCH v3 1/8 eal: eal stub to add windows support

Added initial stub source files for windows support and only the required meson changes for windows.

---
 config/meson.build                      | 23 ++++++++++++------
 config/x86/meson.build                  | 14 ++++++-----
 lib/librte_eal/meson.build              |  6 ++++-
 lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
 lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++
 lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++
 lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++
 lib/librte_eal/windows/eal/meson.build  | 10 ++++++++
 meson.build                             |  1 +
 9 files changed, 119 insertions(+), 14 deletions(-)
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/meson.build
config/meson.build +16 -7
index 0419607d3..71a0120b6 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # set the machine type and cflags for it
 if meson.is_cross_build()
@@ -52,18 +52,27 @@ dpdk_extra_ldflags += '-Wl,--no-as-needed'
 add_project_link_arguments('-pthread', language: 'c')
 dpdk_extra_ldflags += '-pthread'
 
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+# on some OS, maths functions are in a separate library
+if cc.find_library('lm', required : false).found()
+	# some libs depend on maths lib
+	add_project_link_arguments('-lm', language: 'c')
+	dpdk_extra_ldflags += '-lm'
+endif
 
 # for linux link against dl, for bsd execinfo
 if host_machine.system() == 'linux'
 	link_lib = 'dl'
-else
+elif host_machine.system() == 'freebsd'
 	link_lib = 'execinfo'
+else
+	link_lib = ''
+endif
+
+# if link_lib is empty, do not add it to project properties
+if link_lib != ''
+	add_project_link_arguments('-l' + link_lib, language: 'c')
+	dpdk_extra_ldflags += '-l' + link_lib
 endif
-add_project_link_arguments('-l' + link_lib, language: 'c')
-dpdk_extra_ldflags += '-l' + link_lib
 
 # check for libraries used in multiple places in DPDK
 has_libnuma = 0
config/x86/meson.build +8 -6
index 7504cb9e5..558edfda9 100644
@@ -1,15 +1,17 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # for checking defines we need to use the correct compiler flags
 march_opt = ['-march=@0@'.format(machine)]
 
 # get binutils version for the workaround of Bug 97
-ldver = run_command('ld', '-v').stdout().strip()
-if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
 	endif
 endif
 
lib/librte_eal/meson.build +5 -1
index c592c6747..c2249855a 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # Custom EAL processing. EAL is complicated enough that it can't just
 # have a straight list of headers and source files.
@@ -17,6 +17,10 @@ elif host_machine.system() == 'freebsd'
 	dpdk_conf.set('RTE_EXEC_ENV_FREEBSD', 1)
 	subdir('freebsd/eal')
 
+elif host_machine.system() == 'windows'
+	dpdk_conf.set('RTE_EXEC_ENV_WINDOWS', 1)
+	subdir('windows/eal')
+
 else
 	error('unsupported system type "@0@"'.format(host_machine.system()))
 endif
lib/librte_eal/windows/eal/eal.c new file +14 -0
new file mode 100644
index 000000000..13e41ea30
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* Launch threads, called at application init(). */
+int
+rte_eal_init(int argc __rte_unused, char **argv __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_debug.c new file +15 -0
new file mode 100644
index 000000000..6e07fe10c
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* call abort(), it will generate a coredump if enabled */
+void
+__rte_panic(const char *funcname __rte_unused,
+		const char *format __rte_unused, ...)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	abort();
+}
lib/librte_eal/windows/eal/eal_lcore.c new file +32 -0
new file mode 100644
index 000000000..4ddf51aa8
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return lcore_id;
+}
+
+/* Check if a cpu is present by the presence of the cpu information for it */
+int
+eal_cpu_detected(unsigned int lcore_id __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 1;
+}
+
+/* Get CPU socket id (NUMA node) for a logical core */
+unsigned int
+eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_thread.c new file +18 -0
new file mode 100644
index 000000000..e74f8893b
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <windows.h>
+
+#include "rte_common.h"
+
+typedef uintptr_t eal_thread_t;
+
+/* function to create threads */
+int
+eal_thread_create(eal_thread_t *thread __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/meson.build new file +10 -0
new file mode 100644
index 000000000..8b1735623
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+env_objs = []
+env_headers = []
+env_sources = files('eal.c',
+	'eal_debug.c',
+	'eal_lcore.c',
+	'eal_thread.c',
+)
meson.build +1 -0
index 69833de82..797c86c44 100644
@@ -13,6 +13,7 @@ cc = meson.get_compiler('c')
 dpdk_conf = configuration_data()
 dpdk_libraries = []
 dpdk_static_libraries = []
+driver_classes = []
 dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_app_link_libraries = []
Signature · 1 line
2.17.1.windows.2
#32 lore raw

PATCH v3 2/8 eal: add header files to support windows

In reply to Anand Rawat

Added header files to support windows on x86 platforms. Updated rte_common.h to include rte_windows.h for windows build. Updated lib/meson.build to create shared libraries on windows. Added def file to list the exports for the eal library.

---
 lib/librte_eal/common/include/rte_common.h    |  7 ++++-
 .../common/include/rte_string_fns.h           |  4 ++-
 lib/librte_eal/rte_eal_exports.def            |  2 ++
 .../windows/eal/include/rte_windows.h         | 30 +++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  2 ++
 lib/meson.build                               | 19 ++++++++++--
 6 files changed, 59 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
lib/librte_eal/common/include/rte_common.h +6 -1
index 7178ba1e9..4775c84f5 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_
@@ -24,6 +24,11 @@ extern "C" {
 
 #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+
 #ifndef typeof
 #define typeof __typeof__
 #endif
lib/librte_eal/common/include/rte_string_fns.h +3 -1
index 85bfe6c9a..8bac8243c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 /**
@@ -18,6 +18,8 @@ extern "C" {
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
+
 /**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like
lib/librte_eal/rte_eal_exports.def new file +2 -0
new file mode 100644
index 000000000..e20319ecf
@@ -0,0 +1,2 @@
+EXPORTS
+	__rte_panic
\ No newline at end of file
lib/librte_eal/windows/eal/include/rte_windows.h new file +30 -0
new file mode 100644
index 000000000..af24ef39f
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_WINDOWS_H_
+#define _RTE_WINDOWS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+/* macro substitution for windows supported strerror_r */
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* macro substitution for windows supported strdup */
+#define strdup(str)	_strdup(str)
+
+/* macro substitution for windows supported ssize_t type */
+typedef SSIZE_T ssize_t;
+
+/* macro substitution for windows supported strtok_r */
+#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_WINDOWS_H_ */
lib/librte_eal/windows/eal/meson.build +2 -0
index 8b1735623..6bc577e5c 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
lib/meson.build +16 -3
index 99957ba7d..1fe1b4677 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible
@@ -64,6 +64,11 @@ foreach l:libraries
 	dir_name = 'librte_' + l
 	subdir(dir_name)
 
+	if host_machine.system() == 'windows'
+		# injecting rte_windows.h in every library in windows
+		includes += include_directories('librte_eal/windows/eal/include')
+	endif
+
 	if build
 		enabled_libs += name
 		dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
@@ -117,14 +122,22 @@ foreach l:libraries
 			objs += static_lib.extract_all_objects(recursive: false)
 			version_map = '@0@/@1@/rte_@2@_version.map'.format(
 					meson.current_source_dir(), dir_name, name)
+			exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				lk_args = ['-Wl,/def:' + exports, '-Wl,/implib:lib\\' + implib]
+			else
+				lk_args = ['-Wl,--version-script=' + version_map]
+			endif
 			shared_lib = shared_library(libname,
 					sources,
 					objects: objs,
 					c_args: cflags,
 					dependencies: shared_deps,
 					include_directories: includes,
-					link_args: '-Wl,--version-script=' + version_map,
-					link_depends: version_map,
+					link_args: lk_args,
+					link_depends: [version_map, exports],
 					version: lib_version,
 					soversion: so_version,
 					install: true)
Signature · 1 line
2.17.1.windows.2
#33 lore raw

PATCH v3 3/8 kvargs: adding a module definition file

In reply to Anand Rawat

adding a DEF file for kvargs to specify the exports for the creation of the shared library.

---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
lib/librte_kvargs/rte_kvargs_exports.def new file +7 -0
new file mode 100644
index 000000000..265d3cc9a
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
\ No newline at end of file
Signature · 1 line
2.17.1.windows.2
#34 lore raw

PATCH v3 4/8 eal: sys/queue.h implementation for windows

In reply to Anand Rawat

Adding sys/queue.h on windows for supporting common code. This is implementation has BSD-3-Clause licensing.

---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
lib/librte_eal/windows/eal/include/sys/queue.h new file +320 -0
new file mode 100644
index 000000000..5ee4916ad
@@ -0,0 +1,320 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+/*
+ * This file defines tail queues.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * Below is a summary of implemented functions where:
+ *  +  means the macro is available
+ *  -  means the macro is not available
+ *  s  means the macro is available but is slow (runs in O(n) time)
+ *
+ *				TAILQ
+ * _HEAD			+
+ * _CLASS_HEAD			+
+ * _HEAD_INITIALIZER		+
+ * _ENTRY			+
+ * _CLASS_ENTRY			+
+ * _INIT			+
+ * _EMPTY			+
+ * _FIRST			+
+ * _NEXT			+
+ * _PREV			+
+ * _LAST			+
+ * _LAST_FAST			+
+ * _FOREACH			+
+ * _FOREACH_FROM		+
+ * _FOREACH_SAFE		+
+ * _FOREACH_FROM_SAFE		+
+ * _FOREACH_REVERSE		+
+ * _FOREACH_REVERSE_FROM	+
+ * _FOREACH_REVERSE_SAFE	+
+ * _FOREACH_REVERSE_FROM_SAFE	+
+ * _INSERT_HEAD			+
+ * _INSERT_BEFORE		+
+ * _INSERT_AFTER		+
+ * _INSERT_TAIL			+
+ * _CONCAT			+
+ * _REMOVE_AFTER		-
+ * _REMOVE_HEAD			-
+ * _REMOVE			+
+ * _SWAP			+
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	QMD_TRACE_ELEM(elem)
+#define	QMD_TRACE_HEAD(head)
+#define	TRACEBUF
+#define	TRACEBUF_INITIALIZER
+
+#define	TRASHIT(x)
+#define	QMD_IS_TRASHED(x)	0
+
+#define	QMD_SAVELINK(name, link)
+
+#ifdef __cplusplus
+/*
+ * In C++ there can be structure lists and class lists:
+ */
+#define	QUEUE_TYPEOF(type) type
+#else
+#define	QUEUE_TYPEOF(type) struct type
+#endif
+
+/*
+ * Tail queue declarations.
+ */
+#define	TAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *tqh_first;	/* first element */			\
+	struct type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_HEAD(name, type)					\
+struct name {								\
+	class type *tqh_first;	/* first element */			\
+	class type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
+
+#define	TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_ENTRY(type)						\
+struct {								\
+	class type *tqe_next;	/* next element */			\
+	class type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+/*
+ * Tail queue functions.
+ */
+#define	QMD_TAILQ_CHECK_HEAD(head, field)
+#define	QMD_TAILQ_CHECK_TAIL(head, headname)
+#define	QMD_TAILQ_CHECK_NEXT(elm, field)
+#define	QMD_TAILQ_CHECK_PREV(elm, field)
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+		QMD_TRACE_HEAD(head1);					\
+		QMD_TRACE_HEAD(head2);					\
+	}								\
+} while (0)
+
+#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
+
+#define	TAILQ_FIRST(head)	((head)->tqh_first)
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_FROM(var, head, field)				\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)			\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field)		\
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_INIT(head) do {						\
+	TAILQ_FIRST((head)) = NULL;					\
+	(head)->tqh_last = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+} while (0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field);	\
+	if (TAILQ_NEXT((listelm), field) != NULL)			\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    &TAILQ_NEXT((elm), field);				\
+	else {								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	TAILQ_NEXT((listelm), field) = (elm);				\
+	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_TAILQ_CHECK_PREV(listelm, field);				\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	TAILQ_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_HEAD(head, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_FIRST((head));			\
+	if (TAILQ_FIRST((head)) != NULL)				\
+		TAILQ_FIRST((head))->field.tqe_prev =			\
+		    &TAILQ_NEXT((elm), field);				\
+	else								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+	TAILQ_FIRST((head)) = (elm);					\
+	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_TAIL(head, field);				\
+	TAILQ_NEXT((elm), field) = NULL;				\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_LAST(head, headname)					\
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+
+/*
+ * The FAST function is fast in that it causes no data access other
+ * then the access to the head. The standard LAST function above
+ * will cause a data access of both the element you want and
+ * the previous element. FAST is very useful for instances when
+ * you may want to prefetch the last data element.
+ */
+#define	TAILQ_LAST_FAST(head, type, field)			\
+	(TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last,	\
+	QUEUE_TYPEOF(type), field.tqe_next))
+
+#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define	TAILQ_PREV(elm, headname, field)				\
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
+	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
+	QMD_TAILQ_CHECK_NEXT(elm, field);				\
+	QMD_TAILQ_CHECK_PREV(elm, field);				\
+	if ((TAILQ_NEXT((elm), field)) != NULL)				\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    (elm)->field.tqe_prev;				\
+	else {								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
+	TRASHIT(*oldnext);						\
+	TRASHIT(*oldprev);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define TAILQ_SWAP(head1, head2, type, field) do {			\
+	QUEUE_TYPEOF(type) * swap_first = (head1)->tqh_first;		\
+	QUEUE_TYPEOF(type) * *swap_last = (head1)->tqh_last;		\
+	(head1)->tqh_first = (head2)->tqh_first;			\
+	(head1)->tqh_last = (head2)->tqh_last;				\
+	(head2)->tqh_first = swap_first;				\
+	(head2)->tqh_last = swap_last;					\
+	swap_first = (head1)->tqh_first;				\
+	if (swap_first != NULL)						\
+		swap_first->field.tqe_prev = &(head1)->tqh_first;	\
+	else								\
+		(head1)->tqh_last = &(head1)->tqh_first;		\
+	swap_first = (head2)->tqh_first;				\
+	if (swap_first != NULL)			\
+		swap_first->field.tqe_prev = &(head2)->tqh_first;	\
+	else								\
+		(head2)->tqh_last = &(head2)->tqh_first;		\
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_QUEUE_H_ */
Signature · 1 line
2.17.1.windows.2
#35 lore raw

PATCH v3 5/8 eal: add headers for compatibility with windows environment

In reply to Anand Rawat

Added headers to support windows environment for common source. These headers will have windows specific implementions of the system library apis provided in linux and freebsd.

---
 lib/librte_eal/windows/eal/include/fnmatch.h | 43 ++++++++++
 lib/librte_eal/windows/eal/include/pthread.h | 22 ++++++
 lib/librte_eal/windows/eal/include/regex.h   | 83 ++++++++++++++++++++
 lib/librte_eal/windows/eal/include/sched.h   | 41 ++++++++++
 lib/librte_eal/windows/eal/include/unistd.h  |  8 ++
 5 files changed, 197 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
lib/librte_eal/windows/eal/include/fnmatch.h new file +43 -0
new file mode 100644
index 000000000..c2e2131b1
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FNM_NOMATCH 1
+
+/**
+ * This function is used for searhing a given string source
+ * with the given regular expression pattern.
+ *
+ * @param pattern
+ *	regular expression notation decribing the pattern to match
+ *
+ * @param string
+ *	source string to searcg for the pattern
+ *
+ * @param flag
+ *	containing information about the pattern
+ *
+ * @return
+ *	if the pattern is found then return 0 or else FNM_NOMATCH
+ */
+static inline int fnmatch(__rte_unused const char *pattern,
+		__rte_unused const char *string,
+		__rte_unused int flags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return FNM_NOMATCH;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FNMATCH_H_ */
lib/librte_eal/windows/eal/include/pthread.h new file +22 -0
new file mode 100644
index 000000000..a62b25bf6
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* defining pthread_t type on windows */
+typedef uintptr_t pthread_t;
+
+/* defining pthread_attr_t type on windows */
+typedef void *pthread_attr_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PTHREAD_H_ */
lib/librte_eal/windows/eal/include/regex.h new file +83 -0

83 lines not on this page · raw message

lib/librte_eal/windows/eal/include/sched.h new file +41 -0

41 lines not on this page · raw message

lib/librte_eal/windows/eal/include/unistd.h new file +8 -0
new file mode 100644
index 000000000..fe3d9b579
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+/* Added to support common code on windows */
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+#endif /* _UNISTD_H_ */
Signature · 1 line
2.17.1.windows.2
#36 lore raw

PATCH v3 6/8 eal: add minimum viable code for eal on windows

In reply to Anand Rawat

Add windows specific logic for eal.c, eal_lcore.c, eal_debug.c and eal_thread.c. Updated header files to contain suitable function declaractions.

---
 lib/librte_eal/windows/eal/eal.c              |  76 ++++++++-
 lib/librte_eal/windows/eal/eal_debug.c        |  14 +-
 lib/librte_eal/windows/eal/eal_lcore.c        | 104 ++++++++++---
 lib/librte_eal/windows/eal/eal_thread.c       | 147 +++++++++++++++++-
 lib/librte_eal/windows/eal/include/regex.h    |   2 +
 .../windows/eal/include/rte_windows.h         |  20 +++
 6 files changed, 331 insertions(+), 32 deletions(-)
lib/librte_eal/windows/eal/eal.c +73 -3
index 13e41ea30..ce460481f 100644
@@ -2,13 +2,83 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <io.h>
+#include <fcntl.h>
+#include <rte_debug.h>
+#include <rte_eal.h>
+#include <rte_errno.h>
+#include <rte_lcore.h>
+#include <eal_thread.h>
+#include <eal_private.h>
+
+/* Address of global and public configuration */
+static struct rte_config rte_config;
+
+/* internal configuration (per-core) */
+struct lcore_config lcore_config[RTE_MAX_LCORE];
+
+/* Return a pointer to the configuration structure */
+struct rte_config *
+rte_eal_get_configuration(void)
+{
+	return &rte_config;
+}
+
+static int
+sync_func(void *arg __rte_unused)
+{
+	return 0;
+}
+
+static void
+rte_eal_init_alert(const char *msg)
+{
+	fprintf(stderr, "EAL: FATAL: %s\n", msg);
+	RTE_LOG(ERR, EAL, "%s\n", msg);
+}
 
  /* Launch threads, called at application init(). */
 int
 rte_eal_init(int argc __rte_unused, char **argv __rte_unused)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	int i;
+
+	/* create a map of all processors in the system */
+	eal_create_cpu_map();
+
+	if (rte_eal_cpu_init() < 0) {
+		rte_eal_init_alert("Cannot detect lcores.");
+		rte_errno = ENOTSUP;
+		return -1;
+	}
+
+	eal_thread_init_master(rte_config.master_lcore);
+
+	RTE_LCORE_FOREACH_SLAVE(i) {
+
+		/*
+		 * create communication pipes between master thread
+		 * and children
+		 */
+		if (_pipe(lcore_config[i].pipe_master2slave,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");
+		if (_pipe(lcore_config[i].pipe_slave2master,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");
+
+		lcore_config[i].state = WAIT;
+
+		/* create a thread for each lcore */
+		if (eal_thread_create(&lcore_config[i].thread_id) != 0)
+			rte_panic("Cannot create thread\n");
+	}
+
+	/*
+	 * Launch a dummy function on all slave lcores, so that master lcore
+	 * knows they are all ready when this function returns.
+	 */
+	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
+	rte_eal_mp_wait_lcore();
 	return 0;
 }
lib/librte_eal/windows/eal/eal_debug.c +9 -5
index 6e07fe10c..edcf257cc 100644
@@ -2,14 +2,18 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdarg.h>
+#include <rte_log.h>
 
  /* call abort(), it will generate a coredump if enabled */
 void
-__rte_panic(const char *funcname __rte_unused,
-		const char *format __rte_unused, ...)
+__rte_panic(const char *funcname, const char *format, ...)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	va_list ap;
+
+	rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n", funcname);
+	va_start(ap, format);
+	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
+	va_end(ap);
 	abort();
 }
lib/librte_eal/windows/eal/eal_lcore.c +86 -18

117 lines not on this page · raw message

lib/librte_eal/windows/eal/eal_thread.c +141 -6

158 lines not on this page · raw message

lib/librte_eal/windows/eal/include/regex.h +2 -0
index daa102f74..412b4edc5 100644
@@ -12,6 +12,8 @@ extern "C" {
 #define REG_NOMATCH 1
 #define REG_ESPACE 12
 
+#include <rte_common.h>
+
 /* defining regex_t for windows */
 typedef void *regex_t;
 /* defining regmatch_t for windows */
lib/librte_eal/windows/eal/include/rte_windows.h +20 -0
index af24ef39f..46146e59b 100644
@@ -9,7 +9,9 @@
 extern "C" {
 #endif
 
+#include <Windows.h>
 #include <BaseTsd.h>
+#include <pthread.h>
 
 /* macro substitution for windows supported strerror_r */
 #define strerror_r(a, b, c) strerror_s(b, c, a)
@@ -23,6 +25,24 @@ typedef SSIZE_T ssize_t;
 /* macro substitution for windows supported strtok_r */
 #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
 
+/**
+ * Create a thread.
+ * This function is private to EAL.
+ *
+ * @param thread
+ *   The location to store the thread id if successful.
+ * @return
+ *   0 for success, -1 if the thread is not created.
+ */
+int eal_thread_create(pthread_t *thread);
+
+/**
+ * Create a map of processors and cores on the system.
+ * This function is private to EAL.
+ *
+ */
+void eal_create_cpu_map(void);
+
 #ifdef __cplusplus
 }
 #endif
Signature · 1 line
2.17.1.windows.2
#37 lore raw

PATCH v3 7/8 doc: add documention for windows

In reply to Anand Rawat

Added documentation to build helloworld example
on windows using meson and clang. Updated the
maintainers list to include windows maintainers.

---
 MAINTAINERS                           |  7 +++
 doc/guides/index.rst                  |  3 +-
 doc/guides/windows_gsg/build_dpdk.rst | 73 +++++++++++++++++++++++++++
 doc/guides/windows_gsg/index.rst      | 14 +++++
 doc/guides/windows_gsg/intro.rst      | 20 ++++++++
 5 files changed, 116 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
MAINTAINERS +7 -0
index 452b8eb82..0080c8f4c 100644
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <[email protected]>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <[email protected]>
+M: Omar Cardona <[email protected]>
+M: Anand Rawat <[email protected]>
+M: Ranjit Menon <[email protected]>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
doc/guides/index.rst +2 -1
index 8a9ed65c8..8a1601b27 100644
@@ -1,5 +1,5 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2010-2014 Intel Corporation.
+    Copyright(c) 2010-2019 Intel Corporation.
 
 DPDK documentation
 ==================
@@ -9,6 +9,7 @@ DPDK documentation
 
    linux_gsg/index
    freebsd_gsg/index
+   windows_gsg/index
    sample_app_ug/index
    prog_guide/index
    howto/index
doc/guides/windows_gsg/build_dpdk.rst new file +73 -0

73 lines not on this page · raw message

doc/guides/windows_gsg/index.rst new file +14 -0
new file mode 100644
index 000000000..d9b7990a8
@@ -0,0 +1,14 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+.. _windows_gsg:
+
+Getting Started Guide for Windows
+=================================
+
+.. toctree::
+    :maxdepth: 2
+    :numbered:
+
+    intro
+    build_dpdk
doc/guides/windows_gsg/intro.rst new file +20 -0
new file mode 100644
index 000000000..a0285732d
@@ -0,0 +1,20 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Introduction
+============
+
+This document contains instructions for installing and configuring the Data
+Plane Development Kit (DPDK) software. The document describes how to compile
+and run a DPDK application in a Windows* OS application environment, without
+going deeply into detail.
+
+\*Other names and brands may be claimed as the property of others.
+
+Limitations
+===========
+
+DPDK for Windows is currently a work in progress. Not all DPDK source files
+compile. Support is being added in pieces so as to limit the overall scope
+of any individual patch series. The goal is to be able to run any DPDK
+application natively on Windows.
Signature · 1 line
2.17.1.windows.2
#38 lore raw

PATCH v3 8/8 build: meson changes to build on windows

In reply to Anand Rawat

Added meson workarounds to build helloworld on windows. Windows currently only supports kvargs and eal libraries. This change restricts the build flow to supported libraries only.

---
 examples/meson.build              |   6 +-
 lib/librte_eal/common/meson.build | 159 ++++++++++++++++--------------
 lib/meson.build                   |   4 +
 meson.build                       |  33 ++++---
 4 files changed, 113 insertions(+), 89 deletions(-)
examples/meson.build +5 -1
index af81c762e..107e378e7 100644
@@ -35,7 +35,11 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() != 'windows'
+		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	else
+		deps = ['eal']
+	endif
 	subdir(example)
 
 	if build
lib/librte_eal/common/meson.build +85 -74

176 lines not on this page · raw message

lib/meson.build +4 -0
index 1fe1b4677..8d7711090 100644
@@ -30,6 +30,10 @@ libraries = [
 	# flow_classify lib depends on pkt framework table lib
 	'flow_classify', 'bpf', 'telemetry']
 
+if host_machine.system() == 'windows'
+	libraries = ['kvargs','eal'] # override libraries for windows
+endif
+
 default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
meson.build +19 -14
index 797c86c44..856e94c37 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	version: '19.05.0-rc0',
@@ -36,28 +36,33 @@ eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
 global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
 subdir('config')
 
-# build libs and drivers
+# build libs
 subdir('lib')
-subdir('buildtools')
-subdir('drivers')
 
-# build binaries and installable tools
-subdir('usertools')
-subdir('app')
+if host_machine.system() != 'windows'
+	# build buildtools and drivers
+	subdir('buildtools')
+	subdir('drivers')
 
-# build docs
-subdir('doc')
+	# build binaries and installable tools
+	subdir('usertools')
+	subdir('app')
+	subdir('test')
+
+	# build kernel modules if enabled
+	if get_option('enable_kmods')
+		subdir('kernel')
+	endif
+
+	# build docs
+	subdir('doc')
+endif
 
 # build any examples explicitly requested - useful for developers
 if get_option('examples') != ''
 	subdir('examples')
 endif
 
-# build kernel modules if enabled
-if get_option('enable_kmods')
-	subdir('kernel')
-endif
-
 # write the build config
 build_cfg = 'rte_build_config.h'
 configure_file(output: build_cfg,
Signature · 1 line
2.17.1.windows.2
#39 lore raw

v4 cover HelloWorld example for windows

In reply to Anand Rawat

Includes Windows-specific EAL changes and meson changes to build the code on windows.

v4 Changes:
1. Exposed more functions for eal DLL in the module definition file
2. Moved disabling meson logic to sub directories

v3 Changes:
1. Separated meson workarounds from the essential code changes
2. Added support for kvargs
3. Updated meson for building DLL on windows using DEF files
4. Fixed documentation for html links and linker dependency
5. Added comments for windows header and source files

v2 Changes:
1. Incorporated reviews from v1.
2. Fixed license period for updated files.
3. Renamed 'winapp' folder to 'windows'.
4. Cleaned unneeded meson changes.
5. Fixed code style warnings.
6. Added maintainers information for windows branch

notes:
*patch 8/8 contains meson workarounds to build helloworld on windows, which will later be a part of the draft repository

*command-line parsing is not a part of this version as a result lcore mask is currently not supported.

Anand Rawat (8):
eal: eal stub to add windows support
eal: add header files to support windows
kvargs: adding a module definition file
eal: sys/queue.h implementation for windows
eal: add headers for compatibility with windows environment
eal: add minimum viable code for eal on windows
doc: add documention for windows
build: meson changes to build on windows

 MAINTAINERS                                   |   7 +
 app/meson.build                               |   6 +-
 buildtools/meson.build                        |   6 +-
 config/meson.build                            |  23 +-
 config/x86/meson.build                        |  14 +-
 doc/guides/index.rst                          |   3 +-
 doc/guides/windows_gsg/build_dpdk.rst         |  73 ++++
 doc/guides/windows_gsg/index.rst              |  14 +
 doc/guides/windows_gsg/intro.rst              |  20 ++
 doc/meson.build                               |   5 +
 drivers/meson.build                           |   6 +-
 examples/meson.build                          |   6 +-
 kernel/meson.build                            |   6 +-
 lib/librte_eal/common/include/rte_common.h    |   7 +-
 .../common/include/rte_string_fns.h           |   4 +-
 lib/librte_eal/common/meson.build             | 159 +++++----
 lib/librte_eal/meson.build                    |   6 +-
 lib/librte_eal/rte_eal_exports.def            |   9 +
 lib/librte_eal/windows/eal/eal.c              |  84 +++++
 lib/librte_eal/windows/eal/eal_debug.c        |  19 ++
 lib/librte_eal/windows/eal/eal_lcore.c        | 100 ++++++
 lib/librte_eal/windows/eal/eal_thread.c       | 153 +++++++++
 lib/librte_eal/windows/eal/include/fnmatch.h  |  43 +++
 lib/librte_eal/windows/eal/include/pthread.h  |  22 ++
 lib/librte_eal/windows/eal/include/regex.h    |  85 +++++
 .../windows/eal/include/rte_windows.h         |  50 +++
 lib/librte_eal/windows/eal/include/sched.h    |  41 +++
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/include/unistd.h   |   8 +
 lib/librte_eal/windows/eal/meson.build        |  12 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  23 +-
 meson.build                                   |   3 +-
 usertools/meson.build                         |   6 +-
 34 files changed, 1249 insertions(+), 101 deletions(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
 create mode 100644 lib/librte_eal/windows/eal/meson.build
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
Signature · 1 line
2.17.1.windows.2
#40 lore raw

PATCH v4 1/8 eal: eal stub to add windows support

Added initial stub source files for windows support and only the required meson changes for windows.

---
 config/meson.build                      | 23 ++++++++++++------
 config/x86/meson.build                  | 14 ++++++-----
 lib/librte_eal/meson.build              |  6 ++++-
 lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
 lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++
 lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++
 lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++
 lib/librte_eal/windows/eal/meson.build  | 10 ++++++++
 meson.build                             |  3 ++-
 9 files changed, 120 insertions(+), 15 deletions(-)
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/meson.build
config/meson.build +16 -7
index 0419607d3..71a0120b6 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # set the machine type and cflags for it
 if meson.is_cross_build()
@@ -52,18 +52,27 @@ dpdk_extra_ldflags += '-Wl,--no-as-needed'
 add_project_link_arguments('-pthread', language: 'c')
 dpdk_extra_ldflags += '-pthread'
 
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+# on some OS, maths functions are in a separate library
+if cc.find_library('lm', required : false).found()
+	# some libs depend on maths lib
+	add_project_link_arguments('-lm', language: 'c')
+	dpdk_extra_ldflags += '-lm'
+endif
 
 # for linux link against dl, for bsd execinfo
 if host_machine.system() == 'linux'
 	link_lib = 'dl'
-else
+elif host_machine.system() == 'freebsd'
 	link_lib = 'execinfo'
+else
+	link_lib = ''
+endif
+
+# if link_lib is empty, do not add it to project properties
+if link_lib != ''
+	add_project_link_arguments('-l' + link_lib, language: 'c')
+	dpdk_extra_ldflags += '-l' + link_lib
 endif
-add_project_link_arguments('-l' + link_lib, language: 'c')
-dpdk_extra_ldflags += '-l' + link_lib
 
 # check for libraries used in multiple places in DPDK
 has_libnuma = 0
config/x86/meson.build +8 -6
index 7504cb9e5..558edfda9 100644
@@ -1,15 +1,17 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # for checking defines we need to use the correct compiler flags
 march_opt = ['-march=@0@'.format(machine)]
 
 # get binutils version for the workaround of Bug 97
-ldver = run_command('ld', '-v').stdout().strip()
-if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
 	endif
 endif
 
lib/librte_eal/meson.build +5 -1
index c592c6747..c2249855a 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # Custom EAL processing. EAL is complicated enough that it can't just
 # have a straight list of headers and source files.
@@ -17,6 +17,10 @@ elif host_machine.system() == 'freebsd'
 	dpdk_conf.set('RTE_EXEC_ENV_FREEBSD', 1)
 	subdir('freebsd/eal')
 
+elif host_machine.system() == 'windows'
+	dpdk_conf.set('RTE_EXEC_ENV_WINDOWS', 1)
+	subdir('windows/eal')
+
 else
 	error('unsupported system type "@0@"'.format(host_machine.system()))
 endif
lib/librte_eal/windows/eal/eal.c new file +14 -0
new file mode 100644
index 000000000..13e41ea30
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* Launch threads, called at application init(). */
+int
+rte_eal_init(int argc __rte_unused, char **argv __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_debug.c new file +15 -0
new file mode 100644
index 000000000..6e07fe10c
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* call abort(), it will generate a coredump if enabled */
+void
+__rte_panic(const char *funcname __rte_unused,
+		const char *format __rte_unused, ...)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	abort();
+}
lib/librte_eal/windows/eal/eal_lcore.c new file +32 -0
new file mode 100644
index 000000000..4ddf51aa8
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return lcore_id;
+}
+
+/* Check if a cpu is present by the presence of the cpu information for it */
+int
+eal_cpu_detected(unsigned int lcore_id __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 1;
+}
+
+/* Get CPU socket id (NUMA node) for a logical core */
+unsigned int
+eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_thread.c new file +18 -0
new file mode 100644
index 000000000..e74f8893b
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <windows.h>
+
+#include "rte_common.h"
+
+typedef uintptr_t eal_thread_t;
+
+/* function to create threads */
+int
+eal_thread_create(eal_thread_t *thread __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/meson.build new file +10 -0
new file mode 100644
index 000000000..8b1735623
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+env_objs = []
+env_headers = []
+env_sources = files('eal.c',
+	'eal_debug.c',
+	'eal_lcore.c',
+	'eal_thread.c',
+)
meson.build +2 -1
index 69833de82..9959dc54f 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	version: '19.05.0-rc0',
@@ -13,6 +13,7 @@ cc = meson.get_compiler('c')
 dpdk_conf = configuration_data()
 dpdk_libraries = []
 dpdk_static_libraries = []
+driver_classes = []
 dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_app_link_libraries = []
Signature · 1 line
2.17.1.windows.2
#41 lore raw

PATCH v4 2/8 eal: add header files to support windows

In reply to Anand Rawat

Added header files to support windows on x86 platforms. Updated rte_common.h to include rte_windows.h for windows build. Updated lib/meson.build to create shared libraries on windows. Added def file to list the exports for the eal library.

---
 lib/librte_eal/common/include/rte_common.h    |  7 ++++-
 .../common/include/rte_string_fns.h           |  4 ++-
 lib/librte_eal/rte_eal_exports.def            |  9 ++++++
 .../windows/eal/include/rte_windows.h         | 30 +++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  2 ++
 lib/meson.build                               | 19 ++++++++++--
 6 files changed, 66 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
lib/librte_eal/common/include/rte_common.h +6 -1
index 7178ba1e9..4775c84f5 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_
@@ -24,6 +24,11 @@ extern "C" {
 
 #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+
 #ifndef typeof
 #define typeof __typeof__
 #endif
lib/librte_eal/common/include/rte_string_fns.h +3 -1
index 85bfe6c9a..8bac8243c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 /**
@@ -18,6 +18,8 @@ extern "C" {
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
+
 /**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like
lib/librte_eal/rte_eal_exports.def new file +9 -0
new file mode 100644
index 000000000..7805aeeaa
@@ -0,0 +1,9 @@
+EXPORTS
+	__rte_panic
+	rte_eal_get_configuration
+	rte_eal_init
+	rte_eal_mp_remote_launch
+	rte_eal_mp_wait_lcore
+	rte_eal_remote_launch
+	rte_log
+	rte_vlog
\ No newline at end of file
lib/librte_eal/windows/eal/include/rte_windows.h new file +30 -0
new file mode 100644
index 000000000..af24ef39f
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_WINDOWS_H_
+#define _RTE_WINDOWS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+/* macro substitution for windows supported strerror_r */
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* macro substitution for windows supported strdup */
+#define strdup(str)	_strdup(str)
+
+/* macro substitution for windows supported ssize_t type */
+typedef SSIZE_T ssize_t;
+
+/* macro substitution for windows supported strtok_r */
+#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_WINDOWS_H_ */
lib/librte_eal/windows/eal/meson.build +2 -0
index 8b1735623..6bc577e5c 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
lib/meson.build +16 -3
index 99957ba7d..1fe1b4677 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible
@@ -64,6 +64,11 @@ foreach l:libraries
 	dir_name = 'librte_' + l
 	subdir(dir_name)
 
+	if host_machine.system() == 'windows'
+		# injecting rte_windows.h in every library in windows
+		includes += include_directories('librte_eal/windows/eal/include')
+	endif
+
 	if build
 		enabled_libs += name
 		dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
@@ -117,14 +122,22 @@ foreach l:libraries
 			objs += static_lib.extract_all_objects(recursive: false)
 			version_map = '@0@/@1@/rte_@2@_version.map'.format(
 					meson.current_source_dir(), dir_name, name)
+			exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				lk_args = ['-Wl,/def:' + exports, '-Wl,/implib:lib\\' + implib]
+			else
+				lk_args = ['-Wl,--version-script=' + version_map]
+			endif
 			shared_lib = shared_library(libname,
 					sources,
 					objects: objs,
 					c_args: cflags,
 					dependencies: shared_deps,
 					include_directories: includes,
-					link_args: '-Wl,--version-script=' + version_map,
-					link_depends: version_map,
+					link_args: lk_args,
+					link_depends: [version_map, exports],
 					version: lib_version,
 					soversion: so_version,
 					install: true)
Signature · 1 line
2.17.1.windows.2
#42 lore raw

PATCH v4 3/8 kvargs: adding a module definition file

In reply to Anand Rawat

adding a DEF file for kvargs to specify the exports for the creation of the shared library.

---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
lib/librte_kvargs/rte_kvargs_exports.def new file +7 -0
new file mode 100644
index 000000000..265d3cc9a
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
\ No newline at end of file
Signature · 1 line
2.17.1.windows.2
#43 lore raw

PATCH v4 4/8 eal: sys/queue.h implementation for windows

In reply to Anand Rawat

Adding sys/queue.h on windows for supporting common code. This is implementation has BSD-3-Clause licensing.

---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
lib/librte_eal/windows/eal/include/sys/queue.h new file +320 -0
new file mode 100644
index 000000000..5ee4916ad
@@ -0,0 +1,320 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+/*
+ * This file defines tail queues.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * Below is a summary of implemented functions where:
+ *  +  means the macro is available
+ *  -  means the macro is not available
+ *  s  means the macro is available but is slow (runs in O(n) time)
+ *
+ *				TAILQ
+ * _HEAD			+
+ * _CLASS_HEAD			+
+ * _HEAD_INITIALIZER		+
+ * _ENTRY			+
+ * _CLASS_ENTRY			+
+ * _INIT			+
+ * _EMPTY			+
+ * _FIRST			+
+ * _NEXT			+
+ * _PREV			+
+ * _LAST			+
+ * _LAST_FAST			+
+ * _FOREACH			+
+ * _FOREACH_FROM		+
+ * _FOREACH_SAFE		+
+ * _FOREACH_FROM_SAFE		+
+ * _FOREACH_REVERSE		+
+ * _FOREACH_REVERSE_FROM	+
+ * _FOREACH_REVERSE_SAFE	+
+ * _FOREACH_REVERSE_FROM_SAFE	+
+ * _INSERT_HEAD			+
+ * _INSERT_BEFORE		+
+ * _INSERT_AFTER		+
+ * _INSERT_TAIL			+
+ * _CONCAT			+
+ * _REMOVE_AFTER		-
+ * _REMOVE_HEAD			-
+ * _REMOVE			+
+ * _SWAP			+
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	QMD_TRACE_ELEM(elem)
+#define	QMD_TRACE_HEAD(head)
+#define	TRACEBUF
+#define	TRACEBUF_INITIALIZER
+
+#define	TRASHIT(x)
+#define	QMD_IS_TRASHED(x)	0
+
+#define	QMD_SAVELINK(name, link)
+
+#ifdef __cplusplus
+/*
+ * In C++ there can be structure lists and class lists:
+ */
+#define	QUEUE_TYPEOF(type) type
+#else
+#define	QUEUE_TYPEOF(type) struct type
+#endif
+
+/*
+ * Tail queue declarations.
+ */
+#define	TAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *tqh_first;	/* first element */			\
+	struct type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_HEAD(name, type)					\
+struct name {								\
+	class type *tqh_first;	/* first element */			\
+	class type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
+
+#define	TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_ENTRY(type)						\
+struct {								\
+	class type *tqe_next;	/* next element */			\
+	class type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+/*
+ * Tail queue functions.
+ */
+#define	QMD_TAILQ_CHECK_HEAD(head, field)
+#define	QMD_TAILQ_CHECK_TAIL(head, headname)
+#define	QMD_TAILQ_CHECK_NEXT(elm, field)
+#define	QMD_TAILQ_CHECK_PREV(elm, field)
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+		QMD_TRACE_HEAD(head1);					\
+		QMD_TRACE_HEAD(head2);					\
+	}								\
+} while (0)
+
+#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
+
+#define	TAILQ_FIRST(head)	((head)->tqh_first)
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_FROM(var, head, field)				\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)			\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field)		\
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_INIT(head) do {						\
+	TAILQ_FIRST((head)) = NULL;					\
+	(head)->tqh_last = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+} while (0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field);	\
+	if (TAILQ_NEXT((listelm), field) != NULL)			\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    &TAILQ_NEXT((elm), field);				\
+	else {								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	TAILQ_NEXT((listelm), field) = (elm);				\
+	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_TAILQ_CHECK_PREV(listelm, field);				\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	TAILQ_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_HEAD(head, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_FIRST((head));			\
+	if (TAILQ_FIRST((head)) != NULL)				\
+		TAILQ_FIRST((head))->field.tqe_prev =			\
+		    &TAILQ_NEXT((elm), field);				\
+	else								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+	TAILQ_FIRST((head)) = (elm);					\
+	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_TAIL(head, field);				\
+	TAILQ_NEXT((elm), field) = NULL;				\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_LAST(head, headname)					\
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+
+/*
+ * The FAST function is fast in that it causes no data access other
+ * then the access to the head. The standard LAST function above
+ * will cause a data access of both the element you want and
+ * the previous element. FAST is very useful for instances when
+ * you may want to prefetch the last data element.
+ */
+#define	TAILQ_LAST_FAST(head, type, field)			\
+	(TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last,	\
+	QUEUE_TYPEOF(type), field.tqe_next))
+
+#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define	TAILQ_PREV(elm, headname, field)				\
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
+	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
+	QMD_TAILQ_CHECK_NEXT(elm, field);				\
+	QMD_TAILQ_CHECK_PREV(elm, field);				\
+	if ((TAILQ_NEXT((elm), field)) != NULL)				\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    (elm)->field.tqe_prev;				\
+	else {								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
+	TRASHIT(*oldnext);						\
+	TRASHIT(*oldprev);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define TAILQ_SWAP(head1, head2, type, field) do {			\
+	QUEUE_TYPEOF(type) * swap_first = (head1)->tqh_first;		\
+	QUEUE_TYPEOF(type) * *swap_last = (head1)->tqh_last;		\
+	(head1)->tqh_first = (head2)->tqh_first;			\
+	(head1)->tqh_last = (head2)->tqh_last;				\
+	(head2)->tqh_first = swap_first;				\
+	(head2)->tqh_last = swap_last;					\
+	swap_first = (head1)->tqh_first;				\
+	if (swap_first != NULL)						\
+		swap_first->field.tqe_prev = &(head1)->tqh_first;	\
+	else								\
+		(head1)->tqh_last = &(head1)->tqh_first;		\
+	swap_first = (head2)->tqh_first;				\
+	if (swap_first != NULL)			\
+		swap_first->field.tqe_prev = &(head2)->tqh_first;	\
+	else								\
+		(head2)->tqh_last = &(head2)->tqh_first;		\
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_QUEUE_H_ */
Signature · 1 line
2.17.1.windows.2
#44 lore raw

PATCH v4 5/8 eal: add headers for compatibility with windows environment

In reply to Anand Rawat

Added headers to support windows environment for common source. These headers will have windows specific implementions of the system library apis provided in linux and freebsd.

---
 lib/librte_eal/windows/eal/include/fnmatch.h | 43 ++++++++++
 lib/librte_eal/windows/eal/include/pthread.h | 22 ++++++
 lib/librte_eal/windows/eal/include/regex.h   | 83 ++++++++++++++++++++
 lib/librte_eal/windows/eal/include/sched.h   | 41 ++++++++++
 lib/librte_eal/windows/eal/include/unistd.h  |  8 ++
 5 files changed, 197 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
lib/librte_eal/windows/eal/include/fnmatch.h new file +43 -0
new file mode 100644
index 000000000..c2e2131b1
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FNM_NOMATCH 1
+
+/**
+ * This function is used for searhing a given string source
+ * with the given regular expression pattern.
+ *
+ * @param pattern
+ *	regular expression notation decribing the pattern to match
+ *
+ * @param string
+ *	source string to searcg for the pattern
+ *
+ * @param flag
+ *	containing information about the pattern
+ *
+ * @return
+ *	if the pattern is found then return 0 or else FNM_NOMATCH
+ */
+static inline int fnmatch(__rte_unused const char *pattern,
+		__rte_unused const char *string,
+		__rte_unused int flags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return FNM_NOMATCH;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FNMATCH_H_ */
lib/librte_eal/windows/eal/include/pthread.h new file +22 -0
new file mode 100644
index 000000000..a62b25bf6
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* defining pthread_t type on windows */
+typedef uintptr_t pthread_t;
+
+/* defining pthread_attr_t type on windows */
+typedef void *pthread_attr_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PTHREAD_H_ */
lib/librte_eal/windows/eal/include/regex.h new file +83 -0

83 lines not on this page · raw message

lib/librte_eal/windows/eal/include/sched.h new file +41 -0

41 lines not on this page · raw message

lib/librte_eal/windows/eal/include/unistd.h new file +8 -0
new file mode 100644
index 000000000..fe3d9b579
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+/* Added to support common code on windows */
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+#endif /* _UNISTD_H_ */
Signature · 1 line
2.17.1.windows.2
#45 lore raw

PATCH v4 6/8 eal: add minimum viable code for eal on windows

In reply to Anand Rawat

Add windows specific logic for eal.c, eal_lcore.c, eal_debug.c and eal_thread.c. Updated header files to contain suitable function declaractions.

---
 lib/librte_eal/windows/eal/eal.c              |  76 ++++++++-
 lib/librte_eal/windows/eal/eal_debug.c        |  14 +-
 lib/librte_eal/windows/eal/eal_lcore.c        | 104 ++++++++++---
 lib/librte_eal/windows/eal/eal_thread.c       | 147 +++++++++++++++++-
 lib/librte_eal/windows/eal/include/regex.h    |   2 +
 .../windows/eal/include/rte_windows.h         |  20 +++
 6 files changed, 331 insertions(+), 32 deletions(-)
lib/librte_eal/windows/eal/eal.c +73 -3
index 13e41ea30..ce460481f 100644
@@ -2,13 +2,83 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <io.h>
+#include <fcntl.h>
+#include <rte_debug.h>
+#include <rte_eal.h>
+#include <rte_errno.h>
+#include <rte_lcore.h>
+#include <eal_thread.h>
+#include <eal_private.h>
+
+/* Address of global and public configuration */
+static struct rte_config rte_config;
+
+/* internal configuration (per-core) */
+struct lcore_config lcore_config[RTE_MAX_LCORE];
+
+/* Return a pointer to the configuration structure */
+struct rte_config *
+rte_eal_get_configuration(void)
+{
+	return &rte_config;
+}
+
+static int
+sync_func(void *arg __rte_unused)
+{
+	return 0;
+}
+
+static void
+rte_eal_init_alert(const char *msg)
+{
+	fprintf(stderr, "EAL: FATAL: %s\n", msg);
+	RTE_LOG(ERR, EAL, "%s\n", msg);
+}
 
  /* Launch threads, called at application init(). */
 int
 rte_eal_init(int argc __rte_unused, char **argv __rte_unused)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	int i;
+
+	/* create a map of all processors in the system */
+	eal_create_cpu_map();
+
+	if (rte_eal_cpu_init() < 0) {
+		rte_eal_init_alert("Cannot detect lcores.");
+		rte_errno = ENOTSUP;
+		return -1;
+	}
+
+	eal_thread_init_master(rte_config.master_lcore);
+
+	RTE_LCORE_FOREACH_SLAVE(i) {
+
+		/*
+		 * create communication pipes between master thread
+		 * and children
+		 */
+		if (_pipe(lcore_config[i].pipe_master2slave,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");
+		if (_pipe(lcore_config[i].pipe_slave2master,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");
+
+		lcore_config[i].state = WAIT;
+
+		/* create a thread for each lcore */
+		if (eal_thread_create(&lcore_config[i].thread_id) != 0)
+			rte_panic("Cannot create thread\n");
+	}
+
+	/*
+	 * Launch a dummy function on all slave lcores, so that master lcore
+	 * knows they are all ready when this function returns.
+	 */
+	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
+	rte_eal_mp_wait_lcore();
 	return 0;
 }
lib/librte_eal/windows/eal/eal_debug.c +9 -5
index 6e07fe10c..edcf257cc 100644
@@ -2,14 +2,18 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdarg.h>
+#include <rte_log.h>
 
  /* call abort(), it will generate a coredump if enabled */
 void
-__rte_panic(const char *funcname __rte_unused,
-		const char *format __rte_unused, ...)
+__rte_panic(const char *funcname, const char *format, ...)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	va_list ap;
+
+	rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n", funcname);
+	va_start(ap, format);
+	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
+	va_end(ap);
 	abort();
 }
lib/librte_eal/windows/eal/eal_lcore.c +86 -18

117 lines not on this page · raw message

lib/librte_eal/windows/eal/eal_thread.c +141 -6

158 lines not on this page · raw message

lib/librte_eal/windows/eal/include/regex.h +2 -0
index daa102f74..412b4edc5 100644
@@ -12,6 +12,8 @@ extern "C" {
 #define REG_NOMATCH 1
 #define REG_ESPACE 12
 
+#include <rte_common.h>
+
 /* defining regex_t for windows */
 typedef void *regex_t;
 /* defining regmatch_t for windows */
lib/librte_eal/windows/eal/include/rte_windows.h +20 -0
index af24ef39f..46146e59b 100644
@@ -9,7 +9,9 @@
 extern "C" {
 #endif
 
+#include <Windows.h>
 #include <BaseTsd.h>
+#include <pthread.h>
 
 /* macro substitution for windows supported strerror_r */
 #define strerror_r(a, b, c) strerror_s(b, c, a)
@@ -23,6 +25,24 @@ typedef SSIZE_T ssize_t;
 /* macro substitution for windows supported strtok_r */
 #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
 
+/**
+ * Create a thread.
+ * This function is private to EAL.
+ *
+ * @param thread
+ *   The location to store the thread id if successful.
+ * @return
+ *   0 for success, -1 if the thread is not created.
+ */
+int eal_thread_create(pthread_t *thread);
+
+/**
+ * Create a map of processors and cores on the system.
+ * This function is private to EAL.
+ *
+ */
+void eal_create_cpu_map(void);
+
 #ifdef __cplusplus
 }
 #endif
Signature · 1 line
2.17.1.windows.2
#46 lore raw

PATCH v4 7/8 doc: add documention for windows

In reply to Anand Rawat

Added documentation to build helloworld example
on windows using meson and clang. Updated the
maintainers list to include windows maintainers.

---
 MAINTAINERS                           |  7 +++
 doc/guides/index.rst                  |  3 +-
 doc/guides/windows_gsg/build_dpdk.rst | 73 +++++++++++++++++++++++++++
 doc/guides/windows_gsg/index.rst      | 14 +++++
 doc/guides/windows_gsg/intro.rst      | 20 ++++++++
 5 files changed, 116 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
MAINTAINERS +7 -0
index 452b8eb82..0080c8f4c 100644
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <[email protected]>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <[email protected]>
+M: Omar Cardona <[email protected]>
+M: Anand Rawat <[email protected]>
+M: Ranjit Menon <[email protected]>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
doc/guides/index.rst +2 -1
index 8a9ed65c8..8a1601b27 100644
@@ -1,5 +1,5 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2010-2014 Intel Corporation.
+    Copyright(c) 2010-2019 Intel Corporation.
 
 DPDK documentation
 ==================
@@ -9,6 +9,7 @@ DPDK documentation
 
    linux_gsg/index
    freebsd_gsg/index
+   windows_gsg/index
    sample_app_ug/index
    prog_guide/index
    howto/index
doc/guides/windows_gsg/build_dpdk.rst new file +73 -0

73 lines not on this page · raw message

doc/guides/windows_gsg/index.rst new file +14 -0
new file mode 100644
index 000000000..d9b7990a8
@@ -0,0 +1,14 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+.. _windows_gsg:
+
+Getting Started Guide for Windows
+=================================
+
+.. toctree::
+    :maxdepth: 2
+    :numbered:
+
+    intro
+    build_dpdk
doc/guides/windows_gsg/intro.rst new file +20 -0
new file mode 100644
index 000000000..a0285732d
@@ -0,0 +1,20 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Introduction
+============
+
+This document contains instructions for installing and configuring the Data
+Plane Development Kit (DPDK) software. The document describes how to compile
+and run a DPDK application in a Windows* OS application environment, without
+going deeply into detail.
+
+\*Other names and brands may be claimed as the property of others.
+
+Limitations
+===========
+
+DPDK for Windows is currently a work in progress. Not all DPDK source files
+compile. Support is being added in pieces so as to limit the overall scope
+of any individual patch series. The goal is to be able to run any DPDK
+application natively on Windows.
Signature · 1 line
2.17.1.windows.2
#47 lore raw

Re: [PATCH v4 7/8] doc: add documention for windows

Quoted 14 lines · Anand Rawat

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

---

doc/guides/windows_gsg/build_dpdk.rst new file +4 -0
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and
Quoted 3 lines

build the files
+on windwos, from `Microsoft* website <
https://visualstudio.microsoft.com/downloads>`_.

# I think, Build tools does not have link.exe. Based on my testing, I need to install Micro soft Visual studio community edition get the link.exe.

For instance, in my case, link.exe is installed in following URL in Visual Studio, not anywhere in build tools path.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64

If it is correct then doc needs to be updated.

# I could compile and run the dpdk-helloworld.exe, Are following warnings expected?

[16/16] Linking target examples/dpdk-helloworld.exe. clang.exe: warning: argument unused during compilation: '-pthread' [- Wunused-command-line-argument]
LINK : warning LNK4044: unrecognized option '/O1'; ignored LINK : warning LNK4044: unrecognized option '/-no-as-needed'; ignored LINK : warning LNK4044: unrecognized option '/-start-group'; ignored LINK : warning LNK4044: unrecognized option '/-end-group'; ignored LINK : warning LNK4044: unrecognized option '/-no-as-needed'; ignored

#48 lore raw

Re: [PATCH v4 7/8] doc: add documention for windows

Quoted 35 lines · Jerin Jacob Kollanukkaran
Quoted 14 lines · Anand Rawat

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

---

doc/guides/windows_gsg/build_dpdk.rst new file +4 -0
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and
Quoted 3 lines

build the files
+on windwos, from `Microsoft* website <
https://visualstudio.microsoft.com/downloads>`_.

# I think, Build tools does not have link.exe. Based on my testing, I need to install Micro soft Visual studio community edition get the link.exe.

For instance, in my case, link.exe is installed in following URL in Visual Studio, not anywhere in build tools path.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64

If it is correct then doc needs to be updated.

# I could compile and run the dpdk-helloworld.exe, Are following warnings expected?

Quoted 8 lines

[16/16] Linking target examples/dpdk-helloworld.exe. clang.exe: warning: argument unused during compilation: '-pthread' [- Wunused-command-line-argument]
LINK : warning LNK4044: unrecognized option '/O1'; ignored LINK : warning LNK4044: unrecognized option '/-no-as-needed'; ignored LINK : warning LNK4044: unrecognized option '/-start-group'; ignored LINK : warning LNK4044: unrecognized option '/-end-group'; ignored LINK : warning LNK4044: unrecognized option '/-no-as-needed'; ignored

Yes, they are, and, in my investigations anyway, I haven't found any way to get rid of them. The meson support for windows is very much targetted at users of msvc and clang-cl (which uses the msvc-style flags) rather than regular clang, so the support is not as clean as I would like. Thankfully, though, it does appear to be working thus far! :-)

#49 lore raw

Re: [PATCH v4 7/8] doc: add documention for windows

Quoted 43 lines · Bruce Richardson
Quoted 34 lines · Jerin Jacob Kollanukkaran
Quoted 14 lines · Anand Rawat

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

---

doc/guides/windows_gsg/build_dpdk.rst new file +4 -0
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and
Quoted 3 lines

build the files
+on windwos, from `Microsoft* website <
https://visualstudio.microsoft.com/downloads>`_.

# I think, Build tools does not have link.exe. Based on my testing, I need to install Micro soft Visual studio community edition get the link.exe.

For instance, in my case, link.exe is installed in following URL in Visual Studio, not anywhere in build tools path.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64

If it is correct then doc needs to be updated.

# I could compile and run the dpdk-helloworld.exe, Are following warnings expected?

Quoted 8 lines

[16/16] Linking target examples/dpdk-helloworld.exe. clang.exe: warning: argument unused during compilation: '-pthread' [- Wunused-command-line-argument]
LINK : warning LNK4044: unrecognized option '/O1'; ignored LINK : warning LNK4044: unrecognized option '/-no-as-needed'; ignored LINK : warning LNK4044: unrecognized option '/-start-group'; ignored LINK : warning LNK4044: unrecognized option '/-end-group'; ignored LINK : warning LNK4044: unrecognized option '/-no-as-needed'; ignored

Quoted 5 lines

Yes, they are, and, in my investigations anyway, I haven't found any way to get rid of them. The meson support for windows is very much targetted at users of msvc and clang-cl (which uses the msvc-style flags) rather than regular clang, so the support is not as clean as I would like. Thankfully, though, it does appear to be working thus far! :-)

Thanks, Bruce. Yes, few warnings are expected for now.

Regarding link.exe, will update the docs to install the build tools and select the 'Visual C++ build tools' option which also installs the linker and SDK required to build on windows.

Doing so, link.exe can be installed in the following URL and installing Visual Studio can be avoided.

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64

#50 lore raw

PATCH v4 8/8 build: meson changes to build on windows

In reply to Anand Rawat

Added meson workarounds to build helloworld on windows. Windows currently only supports kvargs and eal libraries. This change restricts the build flow to supported libraries only.

---
 app/meson.build                   |   6 +-
 buildtools/meson.build            |   6 +-
 doc/meson.build                   |   5 +
 drivers/meson.build               |   6 +-
 examples/meson.build              |   6 +-
 kernel/meson.build                |   6 +-
 lib/librte_eal/common/meson.build | 159 ++++++++++++++++--------------
 lib/meson.build                   |   4 +
 usertools/meson.build             |   6 +-
 9 files changed, 124 insertions(+), 80 deletions(-)
app/meson.build +5 -1
index aa353f657..e949624b7 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 apps = [
 	'pdump',
buildtools/meson.build +5 -1
index cdd38ed24..0209bec8f 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 subdir('pmdinfogen')
 
doc/meson.build +5 -0
index c5410d85d..20c74ee36 100644
@@ -1,5 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Luca Boccassi <[email protected]>
+# Copyright(c) 2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 doc_targets = []
 doc_target_names = []
drivers/meson.build +5 -1
index 69d0556d3..33d1503f3 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 # Defines the order in which the drivers are buit.
 driver_classes = ['common',
examples/meson.build +5 -1
index af81c762e..107e378e7 100644
@@ -35,7 +35,11 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() != 'windows'
+		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	else
+		deps = ['eal']
+	endif
 	subdir(example)
 
 	if build
kernel/meson.build +5 -1
index 2c8fa76d0..a7ab219d2 100644
@@ -1,4 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 subdir(host_machine.system())
lib/librte_eal/common/meson.build +85 -74

176 lines not on this page · raw message

lib/meson.build +4 -0
index 1fe1b4677..8d7711090 100644
@@ -30,6 +30,10 @@ libraries = [
 	# flow_classify lib depends on pkt framework table lib
 	'flow_classify', 'bpf', 'telemetry']
 
+if host_machine.system() == 'windows'
+	libraries = ['kvargs','eal'] # override libraries for windows
+endif
+
 default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
usertools/meson.build +5 -1
index 149e788e3..a00fcaa6a 100644
@@ -1,4 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 install_data(['dpdk-devbind.py', 'dpdk-pmdinfo.py'], install_dir: 'bin')
Signature · 1 line
2.17.1.windows.2
#51 lore raw

Re: [PATCH v4 8/8] build: meson changes to build on windows

Quoted 10 lines · Anand Rawat

Added meson workarounds to build helloworld on windows. Windows currently only supports kvargs and eal libraries. This change restricts the build flow to supported libraries only.

---

Comments inline below.
/Bruce

Quoted 46 lines
 app/meson.build                   |   6 +-
 buildtools/meson.build            |   6 +-
 doc/meson.build                   |   5 +
 drivers/meson.build               |   6 +-
 examples/meson.build              |   6 +-
 kernel/meson.build                |   6 +-
 lib/librte_eal/common/meson.build | 159 ++++++++++++++++--------------
 lib/meson.build                   |   4 +
 usertools/meson.build             |   6 +-
 9 files changed, 124 insertions(+), 80 deletions(-)
app/meson.build +5 -1
index aa353f657..e949624b7 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 apps = [
 	'pdump',
buildtools/meson.build +5 -1
index cdd38ed24..0209bec8f 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 subdir('pmdinfogen')
 
doc/meson.build +0 -0
index c5410d85d..20c74ee36 100644

doc/meson.build line 8

Quoted 8 lines
doc/meson.build +5 -0
@@ -1,5 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Luca Boccassi <[email protected]>
+# Copyright(c) 2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 

This isn't really necessary, I think, since the docs are not built by default. I think we should just document the fact that you can't turn on the doc building in windows.

Quoted 39 lines
doc/meson.build +0 -0
 doc_targets = []
 doc_target_names = []
drivers/meson.build +5 -1
index 69d0556d3..33d1503f3 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 # Defines the order in which the drivers are buit.
 driver_classes = ['common',
examples/meson.build +5 -1
index af81c762e..107e378e7 100644
@@ -35,7 +35,11 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() != 'windows'
+		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	else
+		deps = ['eal']
+	endif
 	subdir(example)
 
 	if build
kernel/meson.build +0 -0
index 2c8fa76d0..a7ab219d2 100644

kernel/meson.build line 7

Quoted 8 lines
kernel/meson.build +5 -1
@@ -1,4 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 

I think a better fix here is to create a windows subdirectory and put an empty meson.build file there. Alternatively just document that for windows you need to disable kernel module building.

Quoted 97 lines
kernel/meson.build +0 -0
 subdir(host_machine.system())
lib/librte_eal/common/meson.build +46 -34
index 5ecae0b1f..05ebd06b6 100644
@@ -1,91 +1,102 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 eal_inc += include_directories('.', 'include',
 		join_paths('include/arch', arch_subdir))
 
 common_objs = []
+common_headers = []
+
 common_sources = files(
-	'eal_common_bus.c',
-	'eal_common_cpuflags.c',
-	'eal_common_class.c',
-	'eal_common_devargs.c',
-	'eal_common_dev.c',
-	'eal_common_errno.c',
-	'eal_common_fbarray.c',
-	'eal_common_hexdump.c',
-	'eal_common_hypervisor.c',
-	'eal_common_launch.c',
-	'eal_common_lcore.c',
-	'eal_common_log.c',
-	'eal_common_memalloc.c',
-	'eal_common_memory.c',
-	'eal_common_memzone.c',
-	'eal_common_options.c',
-	'eal_common_proc.c',
-	'eal_common_string_fns.c',
-	'eal_common_tailqs.c',
-	'eal_common_thread.c',
-	'eal_common_timer.c',
-	'eal_common_uuid.c',
-	'hotplug_mp.c',
-	'malloc_elem.c',
-	'malloc_heap.c',
-	'malloc_mp.c',
-	'rte_keepalive.c',
-	'rte_malloc.c',
-	'rte_option.c',
-	'rte_reciprocal.c',
-	'rte_service.c'
-)
+		'eal_common_errno.c',
+		'eal_common_launch.c',
+		'eal_common_lcore.c',
+		'eal_common_log.c'
+	)
+if host_machine.system() != 'windows'
+	common_sources = files(
+		'eal_common_bus.c',
+		'eal_common_cpuflags.c',
+		'eal_common_class.c',
+		'eal_common_devargs.c',
+		'eal_common_dev.c',
+		'eal_common_fbarray.c',
+		'eal_common_hexdump.c',
+		'eal_common_hypervisor.c',
+		'eal_common_memalloc.c',
+		'eal_common_memory.c',
+		'eal_common_memzone.c',
+		'eal_common_options.c',
+		'eal_common_proc.c',
+		'eal_common_string_fns.c',
+		'eal_common_tailqs.c',
+		'eal_common_thread.c',
+		'eal_common_timer.c',
+		'eal_common_uuid.c',
+		'hotplug_mp.c',
+		'malloc_elem.c',
+		'malloc_heap.c',
+		'malloc_mp.c',
+		'rte_keepalive.c',
+		'rte_malloc.c',
+		'rte_option.c',
+		'rte_reciprocal.c',
+		'rte_service.c'
+	)
+endif
 
 # get architecture specific sources and objs
 eal_common_arch_sources = []
 eal_common_arch_objs = []
-subdir(join_paths('arch', arch_subdir))
+
+common_headers += files(
+		'include/rte_branch_prediction.h',
+		'include/rte_bus.h',
+		'include/rte_common.h',
+		'include/rte_debug.h',
+		'include/rte_dev.h',

lib/librte_eal/common/meson.build line 67

Quoted 10 lines
lib/librte_eal/common/meson.build +10 -0
+		'include/rte_eal.h',
+		'include/rte_errno.h',
+		'include/rte_launch.h',
+		'include/rte_lcore.h',
+		'include/rte_log.h',
+		'include/rte_memory.h',
+		'include/rte_pci_dev_feature_defs.h',
+		'include/rte_per_lcore.h',
+		'include/rte_string_fns.h'
+	)

Why is the common_headers list split into two? The headers should need no adjustment in order to get things building, the header lists are only used for the install phase, not the build one.

Quoted 95 lines
lib/librte_eal/common/meson.build +29 -40
+if host_machine.system() != 'windows'
+	subdir(join_paths('arch', arch_subdir))
+endif
 common_sources += eal_common_arch_sources
 common_objs += eal_common_arch_objs
 
-common_headers = files(
-	'include/rte_alarm.h',
-	'include/rte_branch_prediction.h',
-	'include/rte_bus.h',
-	'include/rte_bitmap.h',
-	'include/rte_class.h',
-	'include/rte_common.h',
-	'include/rte_compat.h',
-	'include/rte_debug.h',
-	'include/rte_devargs.h',
-	'include/rte_dev.h',
-	'include/rte_eal.h',
-	'include/rte_eal_memconfig.h',
-	'include/rte_eal_interrupts.h',
-	'include/rte_errno.h',
-	'include/rte_fbarray.h',
-	'include/rte_hexdump.h',
-	'include/rte_hypervisor.h',
-	'include/rte_interrupts.h',
-	'include/rte_keepalive.h',
-	'include/rte_launch.h',
-	'include/rte_lcore.h',
-	'include/rte_log.h',
-	'include/rte_malloc.h',
-	'include/rte_malloc_heap.h',
-	'include/rte_memory.h',
-	'include/rte_memzone.h',
-	'include/rte_option.h',
-	'include/rte_pci_dev_feature_defs.h',
-	'include/rte_pci_dev_features.h',
-	'include/rte_per_lcore.h',
-	'include/rte_random.h',
-	'include/rte_reciprocal.h',
-	'include/rte_service.h',
-	'include/rte_service_component.h',
-	'include/rte_string_fns.h',
-	'include/rte_tailq.h',
-	'include/rte_time.h',
-	'include/rte_uuid.h',
-	'include/rte_version.h')
+common_headers += files(
+		'include/rte_alarm.h',
+		'include/rte_bitmap.h',
+		'include/rte_class.h',
+		'include/rte_compat.h',
+		'include/rte_devargs.h',
+		'include/rte_eal_memconfig.h',
+		'include/rte_eal_interrupts.h',
+		'include/rte_fbarray.h',
+		'include/rte_hexdump.h',
+		'include/rte_hypervisor.h',
+		'include/rte_interrupts.h',
+		'include/rte_keepalive.h',
+		'include/rte_malloc.h',
+		'include/rte_malloc_heap.h',
+		'include/rte_memzone.h',
+		'include/rte_option.h',
+		'include/rte_pci_dev_features.h',
+		'include/rte_random.h',
+		'include/rte_reciprocal.h',
+		'include/rte_service.h',
+		'include/rte_service_component.h',
+		'include/rte_tailq.h',
+		'include/rte_time.h',
+		'include/rte_uuid.h',
+		'include/rte_version.h')
 
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
lib/meson.build +4 -0
index 1fe1b4677..8d7711090 100644
@@ -30,6 +30,10 @@ libraries = [
 	# flow_classify lib depends on pkt framework table lib
 	'flow_classify', 'bpf', 'telemetry']
 
+if host_machine.system() == 'windows'
+	libraries = ['kvargs','eal'] # override libraries for windows
+endif
+
 default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
usertools/meson.build +0 -0
index 149e788e3..a00fcaa6a 100644

usertools/meson.build line 7

Quoted 8 lines
usertools/meson.build +5 -1
@@ -1,4 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 

This change is unnecessary, as there is no build work being done here, just configuring files for installation.

Quoted 4 lines
usertools/meson.build +0 -0
 install_data(['dpdk-devbind.py', 'dpdk-pmdinfo.py'], install_dir: 'bin')
Signature · 1 line
2.17.1.windows.2
Acked-by on the v4 series
#52 lore raw
In reply to Anand Rawat

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Friday, March 22, 2019 3:55 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows

Includes Windows-specific EAL changes and meson changes to build the code on windows.

v4 Changes:
1. Exposed more functions for eal DLL in the module definition file 2. Moved disabling meson logic to sub directories

v3 Changes:
1. Separated meson workarounds from the essential code changes 2. Added support for kvargs 3. Updated meson for building DLL on windows using DEF files 4. Fixed documentation for html links and linker dependency 5. Added comments for windows header and source files

v2 Changes:
1. Incorporated reviews from v1.
2. Fixed license period for updated files.
3. Renamed 'winapp' folder to 'windows'.
4. Cleaned unneeded meson changes.
5. Fixed code style warnings.
6. Added maintainers information for windows branch

notes:
*patch 8/8 contains meson workarounds to build helloworld on windows, which will later be a part of the draft repository

*command-line parsing is not a part of this version as a result lcore mask is currently not supported.

Anand Rawat (8):
eal: eal stub to add windows support
eal: add header files to support windows
kvargs: adding a module definition file
eal: sys/queue.h implementation for windows
eal: add headers for compatibility with windows environment
eal: add minimum viable code for eal on windows
doc: add documention for windows
build: meson changes to build on windows

 MAINTAINERS                                   |   7 +
 app/meson.build                               |   6 +-
 buildtools/meson.build                        |   6 +-
 config/meson.build                            |  23 +-
 config/x86/meson.build                        |  14 +-
 doc/guides/index.rst                          |   3 +-
 doc/guides/windows_gsg/build_dpdk.rst         |  73 ++++
 doc/guides/windows_gsg/index.rst              |  14 +
 doc/guides/windows_gsg/intro.rst              |  20 ++
 doc/meson.build                               |   5 +
 drivers/meson.build                           |   6 +-
 examples/meson.build                          |   6 +-
 kernel/meson.build                            |   6 +-
 lib/librte_eal/common/include/rte_common.h    |   7 +-
 .../common/include/rte_string_fns.h           |   4 +-
 lib/librte_eal/common/meson.build             | 159 +++++----
 lib/librte_eal/meson.build                    |   6 +-
 lib/librte_eal/rte_eal_exports.def            |   9 +
 lib/librte_eal/windows/eal/eal.c              |  84 +++++
 lib/librte_eal/windows/eal/eal_debug.c        |  19 ++
 lib/librte_eal/windows/eal/eal_lcore.c        | 100 ++++++
 lib/librte_eal/windows/eal/eal_thread.c       | 153 +++++++++
 lib/librte_eal/windows/eal/include/fnmatch.h  |  43 +++  lib/librte_eal/windows/eal/include/pthread.h  |  22 ++
 lib/librte_eal/windows/eal/include/regex.h    |  85 +++++
 .../windows/eal/include/rte_windows.h         |  50 +++
 lib/librte_eal/windows/eal/include/sched.h    |  41 +++
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/include/unistd.h   |   8 +
 lib/librte_eal/windows/eal/meson.build        |  12 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  23 +-
 meson.build                                   |   3 +-
 usertools/meson.build                         |   6 +-
 34 files changed, 1249 insertions(+), 101 deletions(-)  create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst  create mode 100644 doc/guides/windows_gsg/intro.rst  create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/eal.c  create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
 create mode 100644 lib/librte_eal/windows/eal/meson.build
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

--
2.17.1.windows.2

#53 lore raw

v5 cover HelloWorld example for windows

In reply to Anand Rawat

Includes Windows-specific EAL changes and meson changes to build the code on windows.

v5 Changes:
1. Reduced meson workrounds for windows.
2. Updated documention to include details about buildtool options

v4 Changes:
1. Exposed more functions for eal DLL in the module definition file
2. Moved disabling meson logic to sub directories

v3 Changes:
1. Separated meson workarounds from the essential code changes
2. Added support for kvargs
3. Updated meson for building DLL on windows using DEF files
4. Fixed documentation for html links and linker dependency
5. Added comments for windows header and source files

v2 Changes:
1. Incorporated reviews from v1.
2. Fixed license period for updated files.
3. Renamed 'winapp' folder to 'windows'.
4. Cleaned unneeded meson changes.
5. Fixed code style warnings.
6. Added maintainers information for windows branch

notes:
*patch 8/8 contains meson workarounds to build helloworld on windows, which will later be a part of the draft repository

*command-line parsing is not a part of this version as a result lcore mask is currently not supported.

*kernel modules and documentation can not be built on windows currently and should not be enabled.

Anand Rawat (8):
eal: eal stub to add windows support
eal: add header files to support windows
kvargs: adding a module definition file
eal: sys/queue.h implementation for windows
eal: add headers for compatibility with windows environment
eal: add minimum viable code for eal on windows
doc: add documention for windows
build: meson changes to build on windows

 MAINTAINERS                                   |   7 +
 app/meson.build                               |   6 +-
 buildtools/meson.build                        |   6 +-
 config/meson.build                            |  23 +-
 config/x86/meson.build                        |  14 +-
 doc/guides/index.rst                          |   3 +-
 doc/guides/windows_gsg/build_dpdk.rst         |  73 ++++
 doc/guides/windows_gsg/index.rst              |  14 +
 doc/guides/windows_gsg/intro.rst              |  20 ++
 drivers/meson.build                           |   6 +-
 examples/meson.build                          |   6 +-
 kernel/windows/meson.build                    |   4 +
 lib/librte_eal/common/include/rte_common.h    |   7 +-
 .../common/include/rte_string_fns.h           |   4 +-
 lib/librte_eal/common/meson.build             |  14 +-
 lib/librte_eal/meson.build                    |   6 +-
 lib/librte_eal/rte_eal_exports.def            |   9 +
 lib/librte_eal/windows/eal/eal.c              |  84 +++++
 lib/librte_eal/windows/eal/eal_debug.c        |  19 ++
 lib/librte_eal/windows/eal/eal_lcore.c        | 100 ++++++
 lib/librte_eal/windows/eal/eal_thread.c       | 153 +++++++++
 lib/librte_eal/windows/eal/include/fnmatch.h  |  43 +++
 lib/librte_eal/windows/eal/include/pthread.h  |  22 ++
 lib/librte_eal/windows/eal/include/regex.h    |  85 +++++
 .../windows/eal/include/rte_windows.h         |  50 +++
 lib/librte_eal/windows/eal/include/sched.h    |  41 +++
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/include/unistd.h   |   8 +
 lib/librte_eal/windows/eal/meson.build        |  12 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  23 +-
 meson.build                                   |   3 +-
 32 files changed, 1162 insertions(+), 30 deletions(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
 create mode 100644 kernel/windows/meson.build
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
 create mode 100644 lib/librte_eal/windows/eal/meson.build
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
Signature · 1 line
2.17.1.windows.2
#54 lore raw

PATCH v5 1/8 eal: eal stub to add windows support

Added initial stub source files for windows support and only the required meson changes for windows.

---
 config/meson.build                      | 23 ++++++++++++------
 config/x86/meson.build                  | 14 ++++++-----
 lib/librte_eal/meson.build              |  6 ++++-
 lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
 lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++
 lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++
 lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++
 lib/librte_eal/windows/eal/meson.build  | 10 ++++++++
 meson.build                             |  3 ++-
 9 files changed, 120 insertions(+), 15 deletions(-)
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/meson.build
config/meson.build +16 -7
index 0419607d3..71a0120b6 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # set the machine type and cflags for it
 if meson.is_cross_build()
@@ -52,18 +52,27 @@ dpdk_extra_ldflags += '-Wl,--no-as-needed'
 add_project_link_arguments('-pthread', language: 'c')
 dpdk_extra_ldflags += '-pthread'
 
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+# on some OS, maths functions are in a separate library
+if cc.find_library('lm', required : false).found()
+	# some libs depend on maths lib
+	add_project_link_arguments('-lm', language: 'c')
+	dpdk_extra_ldflags += '-lm'
+endif
 
 # for linux link against dl, for bsd execinfo
 if host_machine.system() == 'linux'
 	link_lib = 'dl'
-else
+elif host_machine.system() == 'freebsd'
 	link_lib = 'execinfo'
+else
+	link_lib = ''
+endif
+
+# if link_lib is empty, do not add it to project properties
+if link_lib != ''
+	add_project_link_arguments('-l' + link_lib, language: 'c')
+	dpdk_extra_ldflags += '-l' + link_lib
 endif
-add_project_link_arguments('-l' + link_lib, language: 'c')
-dpdk_extra_ldflags += '-l' + link_lib
 
 # check for libraries used in multiple places in DPDK
 has_libnuma = 0
config/x86/meson.build +8 -6
index 7504cb9e5..558edfda9 100644
@@ -1,15 +1,17 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # for checking defines we need to use the correct compiler flags
 march_opt = ['-march=@0@'.format(machine)]
 
 # get binutils version for the workaround of Bug 97
-ldver = run_command('ld', '-v').stdout().strip()
-if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
 	endif
 endif
 
lib/librte_eal/meson.build +5 -1
index c592c6747..c2249855a 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # Custom EAL processing. EAL is complicated enough that it can't just
 # have a straight list of headers and source files.
@@ -17,6 +17,10 @@ elif host_machine.system() == 'freebsd'
 	dpdk_conf.set('RTE_EXEC_ENV_FREEBSD', 1)
 	subdir('freebsd/eal')
 
+elif host_machine.system() == 'windows'
+	dpdk_conf.set('RTE_EXEC_ENV_WINDOWS', 1)
+	subdir('windows/eal')
+
 else
 	error('unsupported system type "@0@"'.format(host_machine.system()))
 endif
lib/librte_eal/windows/eal/eal.c new file +14 -0
new file mode 100644
index 000000000..13e41ea30
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* Launch threads, called at application init(). */
+int
+rte_eal_init(int argc __rte_unused, char **argv __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_debug.c new file +15 -0
new file mode 100644
index 000000000..6e07fe10c
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* call abort(), it will generate a coredump if enabled */
+void
+__rte_panic(const char *funcname __rte_unused,
+		const char *format __rte_unused, ...)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	abort();
+}
lib/librte_eal/windows/eal/eal_lcore.c new file +32 -0
new file mode 100644
index 000000000..4ddf51aa8
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return lcore_id;
+}
+
+/* Check if a cpu is present by the presence of the cpu information for it */
+int
+eal_cpu_detected(unsigned int lcore_id __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 1;
+}
+
+/* Get CPU socket id (NUMA node) for a logical core */
+unsigned int
+eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_thread.c new file +18 -0
new file mode 100644
index 000000000..e74f8893b
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <windows.h>
+
+#include "rte_common.h"
+
+typedef uintptr_t eal_thread_t;
+
+/* function to create threads */
+int
+eal_thread_create(eal_thread_t *thread __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/meson.build new file +10 -0
new file mode 100644
index 000000000..8b1735623
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+env_objs = []
+env_headers = []
+env_sources = files('eal.c',
+	'eal_debug.c',
+	'eal_lcore.c',
+	'eal_thread.c',
+)
meson.build +2 -1
index 69833de82..9959dc54f 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	version: '19.05.0-rc0',
@@ -13,6 +13,7 @@ cc = meson.get_compiler('c')
 dpdk_conf = configuration_data()
 dpdk_libraries = []
 dpdk_static_libraries = []
+driver_classes = []
 dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_app_link_libraries = []
Signature · 1 line
2.17.1.windows.2
Reviewed-by Jeff Shaw Reviewed-by Ranjit Menon Acked-by on v5 1/8
#55 lore raw

Re: [PATCH v5 1/8] eal: eal stub to add windows support

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support

Added initial stub source files for windows support and only the required meson changes for windows.

---
 config/meson.build                      | 23 ++++++++++++------
 config/x86/meson.build                  | 14 ++++++-----
 lib/librte_eal/meson.build              |  6 ++++-
 lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
 lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++  lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++  lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++  lib/librte_eal/windows/eal/meson.build  | 10 ++++++++
 meson.build                             |  3 ++-
 9 files changed, 120 insertions(+), 15 deletions(-)  create mode 100644 lib/librte_eal/windows/eal/eal.c  create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/meson.build
config/meson.build +1 -0
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # set the machine type and cflags for it  if meson.is_cross_build() @@ -52,18 +52,27 @@ dpdk_extra_ldflags += '-Wl,--no-as-needed'
 add_project_link_arguments('-pthread', language: 'c')  dpdk_extra_ldflags += '-pthread'

-# some libs depend on maths lib -add_project_link_arguments('-lm', language: 'c') -dpdk_extra_ldflags += '-lm' +# on some OS, maths functions are in a separate library if +cc.find_library('lm', required : false).found()
+ # some libs depend on maths lib
+ add_project_link_arguments('-lm', language: 'c')
+ dpdk_extra_ldflags += '-lm'
+endif

 # for linux link against dl, for bsd execinfo  if host_machine.system() == 'linux'
 	link_lib = 'dl'
-else
+elif host_machine.system() == 'freebsd'
 	link_lib = 'execinfo'
+else
+	link_lib = ''
+endif
+
+# if link_lib is empty, do not add it to project properties if link_lib 
+!= ''
+	add_project_link_arguments('-l' + link_lib, language: 'c')
+	dpdk_extra_ldflags += '-l' + link_lib
 endif
-add_project_link_arguments('-l' + link_lib, language: 'c') -dpdk_extra_ldflags += '-l' + link_lib
 # check for libraries used in multiple places in DPDK  has_libnuma = 0 diff --git a/config/x86/meson.build b/config/x86/meson.build index 7504cb9e5..558edfda9 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -1,15 +1,17 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 # for checking defines we need to use the correct compiler flags  march_opt = ['-march=@0@'.format(machine)]
 # get binutils version for the workaround of Bug 97 -ldver = run_command('ld', '-v').stdout().strip() -if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
 	endif
 endif
lib/librte_eal/meson.build +5 -0
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # Custom EAL processing. EAL is complicated enough that it can't just  # have a straight list of headers and source files.
@@ -17,6 +17,10 @@ elif host_machine.system() == 'freebsd'
 	dpdk_conf.set('RTE_EXEC_ENV_FREEBSD', 1)
 	subdir('freebsd/eal')
 
+elif host_machine.system() == 'windows'
+	dpdk_conf.set('RTE_EXEC_ENV_WINDOWS', 1)
+	subdir('windows/eal')
+
 else
 	error('unsupported system type "@0@"'.format(host_machine.system()))
 endif
lib/librte_eal/windows/eal/eal.c new file +12 -0
new file mode 100644
index 000000000..13e41ea30
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* Launch threads, called at application init(). */ int 
+rte_eal_init(int argc __rte_unused, char **argv __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_debug.c new file +13 -0
new file mode 100644
index 000000000..6e07fe10c
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* call abort(), it will generate a coredump if enabled */ void 
+__rte_panic(const char *funcname __rte_unused,
+		const char *format __rte_unused, ...) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	abort();
+}
lib/librte_eal/windows/eal/eal_lcore.c new file +28 -0
new file mode 100644
index 000000000..4ddf51aa8
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return lcore_id;
+}
+
+/* Check if a cpu is present by the presence of the cpu information for 
+it */ int eal_cpu_detected(unsigned int lcore_id __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 1;
+}
+
+/* Get CPU socket id (NUMA node) for a logical core */ unsigned int 
+eal_cpu_socket_id(unsigned int cpu_id __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_thread.c new file +17 -0
new file mode 100644
index 000000000..e74f8893b
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <windows.h>
+
+#include "rte_common.h"
+
+typedef uintptr_t eal_thread_t;
+
+/* function to create threads */
+int
+eal_thread_create(eal_thread_t *thread __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/meson.build new file +10 -0
new file mode 100644
index 000000000..8b1735623
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel 
+Corporation
+
+env_objs = []
+env_headers = []
+env_sources = files('eal.c',
+	'eal_debug.c',
+	'eal_lcore.c',
+	'eal_thread.c',
+)
meson.build +2 -1
index 69833de82..9959dc54f 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	version: '19.05.0-rc0',
@@ -13,6 +13,7 @@ cc = meson.get_compiler('c')  dpdk_conf = configuration_data()  dpdk_libraries = []  dpdk_static_libraries = []
+driver_classes = []
 dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_app_link_libraries = []
--

2.17.1.windows.2

A message that is not in the archive (sent off-list or not yet received): MWHPR21MB0638113CDE9F61F8EC3E63D0EF5F0@MWHPR21MB0638.namprd21.prod.outlook.com

Acked-by Reviewed-by Jeff Shaw Reviewed-by Ranjit Menon
#57 lore raw

Re: [PATCH v5 1/8] eal: eal stub to add windows support

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support

Added initial stub source files for windows support and only the required meson changes for windows.

---
 config/meson.build                      | 23 ++++++++++++------
 config/x86/meson.build                  | 14 ++++++-----
 lib/librte_eal/meson.build              |  6 ++++-
 lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
 lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++  lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++  lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++  lib/librte_eal/windows/eal/meson.build  | 10 ++++++++
 meson.build                             |  3 ++-
 9 files changed, 120 insertions(+), 15 deletions(-)  create mode 100644 lib/librte_eal/windows/eal/eal.c  create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/meson.build
config/meson.build +1 -0
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # set the machine type and cflags for it  if meson.is_cross_build() @@ -52,18 +52,27 @@ dpdk_extra_ldflags += '-Wl,--no-as-needed'
 add_project_link_arguments('-pthread', language: 'c')  dpdk_extra_ldflags += '-pthread'

-# some libs depend on maths lib -add_project_link_arguments('-lm', language: 'c') -dpdk_extra_ldflags += '-lm' +# on some OS, maths functions are in a separate library if +cc.find_library('lm', required : false).found()
+ # some libs depend on maths lib
+ add_project_link_arguments('-lm', language: 'c')
+ dpdk_extra_ldflags += '-lm'
+endif

 # for linux link against dl, for bsd execinfo  if host_machine.system() == 'linux'
 	link_lib = 'dl'
-else
+elif host_machine.system() == 'freebsd'
 	link_lib = 'execinfo'
+else
+	link_lib = ''
+endif
+
+# if link_lib is empty, do not add it to project properties if link_lib 
+!= ''
+	add_project_link_arguments('-l' + link_lib, language: 'c')
+	dpdk_extra_ldflags += '-l' + link_lib
 endif
-add_project_link_arguments('-l' + link_lib, language: 'c') -dpdk_extra_ldflags += '-l' + link_lib
 # check for libraries used in multiple places in DPDK  has_libnuma = 0 diff --git a/config/x86/meson.build b/config/x86/meson.build index 7504cb9e5..558edfda9 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -1,15 +1,17 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 # for checking defines we need to use the correct compiler flags  march_opt = ['-march=@0@'.format(machine)]
 # get binutils version for the workaround of Bug 97 -ldver = run_command('ld', '-v').stdout().strip() -if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
 	endif
 endif
lib/librte_eal/meson.build +5 -0
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # Custom EAL processing. EAL is complicated enough that it can't just  # have a straight list of headers and source files.
@@ -17,6 +17,10 @@ elif host_machine.system() == 'freebsd'
 	dpdk_conf.set('RTE_EXEC_ENV_FREEBSD', 1)
 	subdir('freebsd/eal')
 
+elif host_machine.system() == 'windows'
+	dpdk_conf.set('RTE_EXEC_ENV_WINDOWS', 1)
+	subdir('windows/eal')
+
 else
 	error('unsupported system type "@0@"'.format(host_machine.system()))
 endif
lib/librte_eal/windows/eal/eal.c new file +12 -0
new file mode 100644
index 000000000..13e41ea30
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* Launch threads, called at application init(). */ int 
+rte_eal_init(int argc __rte_unused, char **argv __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_debug.c new file +13 -0
new file mode 100644
index 000000000..6e07fe10c
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* call abort(), it will generate a coredump if enabled */ void 
+__rte_panic(const char *funcname __rte_unused,
+		const char *format __rte_unused, ...) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	abort();
+}
lib/librte_eal/windows/eal/eal_lcore.c new file +28 -0
new file mode 100644
index 000000000..4ddf51aa8
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_common.h"
+
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return lcore_id;
+}
+
+/* Check if a cpu is present by the presence of the cpu information for 
+it */ int eal_cpu_detected(unsigned int lcore_id __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 1;
+}
+
+/* Get CPU socket id (NUMA node) for a logical core */ unsigned int 
+eal_cpu_socket_id(unsigned int cpu_id __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_thread.c new file +17 -0
new file mode 100644
index 000000000..e74f8893b
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <windows.h>
+
+#include "rte_common.h"
+
+typedef uintptr_t eal_thread_t;
+
+/* function to create threads */
+int
+eal_thread_create(eal_thread_t *thread __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/meson.build new file +10 -0
new file mode 100644
index 000000000..8b1735623
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel 
+Corporation
+
+env_objs = []
+env_headers = []
+env_sources = files('eal.c',
+	'eal_debug.c',
+	'eal_lcore.c',
+	'eal_thread.c',
+)
meson.build +2 -1
index 69833de82..9959dc54f 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	version: '19.05.0-rc0',
@@ -13,6 +13,7 @@ cc = meson.get_compiler('c')  dpdk_conf = configuration_data()  dpdk_libraries = []  dpdk_static_libraries = []
+driver_classes = []
 dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_app_link_libraries = []
--

2.17.1.windows.2

#58 lore raw

PATCH v5 2/8 eal: add header files to support windows

In reply to Anand Rawat

Added header files to support windows on x86 platforms. Updated rte_common.h to include rte_windows.h for windows build. Updated lib/meson.build to create shared libraries on windows. Added def file to list the exports for the eal library.

---
 lib/librte_eal/common/include/rte_common.h    |  7 ++++-
 .../common/include/rte_string_fns.h           |  4 ++-
 lib/librte_eal/rte_eal_exports.def            |  9 ++++++
 .../windows/eal/include/rte_windows.h         | 30 +++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  2 ++
 lib/meson.build                               | 19 ++++++++++--
 6 files changed, 66 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
lib/librte_eal/common/include/rte_common.h +6 -1
index 7178ba1e9..4775c84f5 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_
@@ -24,6 +24,11 @@ extern "C" {
 
 #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+
 #ifndef typeof
 #define typeof __typeof__
 #endif
lib/librte_eal/common/include/rte_string_fns.h +3 -1
index 85bfe6c9a..8bac8243c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 /**
@@ -18,6 +18,8 @@ extern "C" {
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
+
 /**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like
lib/librte_eal/rte_eal_exports.def new file +9 -0
new file mode 100644
index 000000000..7805aeeaa
@@ -0,0 +1,9 @@
+EXPORTS
+	__rte_panic
+	rte_eal_get_configuration
+	rte_eal_init
+	rte_eal_mp_remote_launch
+	rte_eal_mp_wait_lcore
+	rte_eal_remote_launch
+	rte_log
+	rte_vlog
\ No newline at end of file
lib/librte_eal/windows/eal/include/rte_windows.h new file +30 -0
new file mode 100644
index 000000000..af24ef39f
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_WINDOWS_H_
+#define _RTE_WINDOWS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+/* macro substitution for windows supported strerror_r */
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* macro substitution for windows supported strdup */
+#define strdup(str)	_strdup(str)
+
+/* macro substitution for windows supported ssize_t type */
+typedef SSIZE_T ssize_t;
+
+/* macro substitution for windows supported strtok_r */
+#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_WINDOWS_H_ */
lib/librte_eal/windows/eal/meson.build +2 -0
index 8b1735623..6bc577e5c 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
lib/meson.build +16 -3
index 99957ba7d..1fe1b4677 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible
@@ -64,6 +64,11 @@ foreach l:libraries
 	dir_name = 'librte_' + l
 	subdir(dir_name)
 
+	if host_machine.system() == 'windows'
+		# injecting rte_windows.h in every library in windows
+		includes += include_directories('librte_eal/windows/eal/include')
+	endif
+
 	if build
 		enabled_libs += name
 		dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
@@ -117,14 +122,22 @@ foreach l:libraries
 			objs += static_lib.extract_all_objects(recursive: false)
 			version_map = '@0@/@1@/rte_@2@_version.map'.format(
 					meson.current_source_dir(), dir_name, name)
+			exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				lk_args = ['-Wl,/def:' + exports, '-Wl,/implib:lib\\' + implib]
+			else
+				lk_args = ['-Wl,--version-script=' + version_map]
+			endif
 			shared_lib = shared_library(libname,
 					sources,
 					objects: objs,
 					c_args: cflags,
 					dependencies: shared_deps,
 					include_directories: includes,
-					link_args: '-Wl,--version-script=' + version_map,
-					link_depends: version_map,
+					link_args: lk_args,
+					link_depends: [version_map, exports],
 					version: lib_version,
 					soversion: so_version,
 					install: true)
Signature · 1 line
2.17.1.windows.2
#59 lore raw

Re: [PATCH v5 2/8] eal: add header files to support windows

Quoted 36 lines · Anand Rawat

Added header files to support windows on x86 platforms. Updated rte_common.h to include rte_windows.h for windows build. Updated lib/meson.build to create shared libraries on windows. Added def file to list the exports for the eal library.

---
 lib/librte_eal/common/include/rte_common.h    |  7 ++++-
 .../common/include/rte_string_fns.h           |  4 ++-
 lib/librte_eal/rte_eal_exports.def            |  9 ++++++
 .../windows/eal/include/rte_windows.h         | 30
+++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  2 ++
 lib/meson.build                               | 19 ++++++++++--
 6 files changed, 66 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
lib/librte_eal/common/include/rte_common.h +1 -1
index 7178ba1e9..4775c84f5 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_

lib/librte_eal/common/include/rte_common.h extern "C" { · line 31

Quoted 8 lines
lib/librte_eal/common/include/rte_common.h +5 -0
@@ -24,6 +24,11 @@ extern "C" {
 
 #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+

IMO, Updating the rte_common.h for each execution environment is not clean and unnecessary #ifdef clutter in the common code.

I think, it can be fixed by adding new os or eal specific header file at the following location and simply include it(without any #ifdef)

lib/librte_eal/linux/eal/include/exec-env/rte_eal.h lib/librte_eal/freebsd/eal/include/exec-env/rte_eal.h lib/librte_eal/windows/eal/include/exec-env/rte_eal.h # the content of exiting rte_windows.h goes here.

It can be rte_eal.h or rte_os.h or anything similar.

#60 lore raw

Re: [PATCH v5 2/8] eal: add header files to support windows

Quoted 52 lines · Jerin Jacob Kollanukkaran
Quoted 36 lines · Anand Rawat

Added header files to support windows on x86 platforms. Updated rte_common.h to include rte_windows.h for windows build. Updated lib/meson.build to create shared libraries on windows. Added def file to list the exports for the eal library.

---
  lib/librte_eal/common/include/rte_common.h    |  7 ++++-
  .../common/include/rte_string_fns.h           |  4 ++-
  lib/librte_eal/rte_eal_exports.def            |  9 ++++++
  .../windows/eal/include/rte_windows.h         | 30
+++++++++++++++++++
  lib/librte_eal/windows/eal/meson.build        |  2 ++
  lib/meson.build                               | 19 ++++++++++--
  6 files changed, 66 insertions(+), 5 deletions(-)

create mode 100644 lib/librte_eal/rte_eal_exports.def create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h

lib/librte_eal/common/include/rte_common.h +1 -1
index 7178ba1e9..4775c84f5 100644
@@ -1,5 +1,5 @@
  /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
   */
 
  #ifndef _RTE_COMMON_H_

lib/librte_eal/common/include/rte_common.h extern "C" { · line 31

Quoted 8 lines
lib/librte_eal/common/include/rte_common.h +5 -0
@@ -24,6 +24,11 @@ extern "C" {
 
  #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+

IMO, Updating the rte_common.h for each execution environment is not clean and unnecessary #ifdef clutter in the common code.

I think, it can be fixed by adding new os or eal specific header file at the following location and simply include it(without any #ifdef)

Quoted 8 lines

lib/librte_eal/linux/eal/include/exec-env/rte_eal.h lib/librte_eal/freebsd/eal/include/exec-env/rte_eal.h lib/librte_eal/windows/eal/include/exec-env/rte_eal.h # the content of exiting rte_windows.h goes here.

It can be rte_eal.h or rte_os.h or anything similar.

This was done based on a suggestion from Thomas:
(http://patches.dpdk.org/patch/50844/)

But, I agree. Your suggestion would be a good enhancement. There is already an existing rte_eal.h in common/include, so an rte_os.h or something similar might make sense.

ranjit m.

#61 lore raw

Re: [PATCH v5 2/8] eal: add header files to support windows

27/03/2019 22:23, Ranjit Menon:

Quoted 61 lines · Jerin Jacob Kollanukkaran
Quoted 52 lines · Anand Rawat
Quoted 36 lines

Added header files to support windows on x86 platforms. Updated rte_common.h to include rte_windows.h for windows build. Updated lib/meson.build to create shared libraries on windows. Added def file to list the exports for the eal library.

---
  lib/librte_eal/common/include/rte_common.h    |  7 ++++-
  .../common/include/rte_string_fns.h           |  4 ++-
  lib/librte_eal/rte_eal_exports.def            |  9 ++++++
  .../windows/eal/include/rte_windows.h         | 30
+++++++++++++++++++
  lib/librte_eal/windows/eal/meson.build        |  2 ++
  lib/meson.build                               | 19 ++++++++++--
  6 files changed, 66 insertions(+), 5 deletions(-)

create mode 100644 lib/librte_eal/rte_eal_exports.def create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h

lib/librte_eal/common/include/rte_common.h +1 -1
index 7178ba1e9..4775c84f5 100644
@@ -1,5 +1,5 @@
  /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
   */
 
  #ifndef _RTE_COMMON_H_

lib/librte_eal/common/include/rte_common.h extern "C" { · line 31

Quoted 8 lines
lib/librte_eal/common/include/rte_common.h +5 -0
@@ -24,6 +24,11 @@ extern "C" {
 
  #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+

IMO, Updating the rte_common.h for each execution environment is not clean and unnecessary #ifdef clutter in the common code.

I think, it can be fixed by adding new os or eal specific header file at the following location and simply include it(without any #ifdef)

Quoted 8 lines

lib/librte_eal/linux/eal/include/exec-env/rte_eal.h lib/librte_eal/freebsd/eal/include/exec-env/rte_eal.h lib/librte_eal/windows/eal/include/exec-env/rte_eal.h # the content of exiting rte_windows.h goes here.

It can be rte_eal.h or rte_os.h or anything similar.

Quoted 6 lines

This was done based on a suggestion from Thomas:
(http://patches.dpdk.org/patch/50844/)

But, I agree. Your suggestion would be a good enhancement. There is already an existing rte_eal.h in common/include, so an rte_os.h or something similar might make sense.

Yes I agree with rte_os.h

#62 lore raw

Re: [PATCH v5 2/8] eal: add header files to support windows

Quoted 62 lines · Thomas Monjalon

27/03/2019 22:23, Ranjit Menon:

Quoted 61 lines · Jerin Jacob Kollanukkaran
Quoted 60 lines · Anand Rawat
Quoted 36 lines

Added header files to support windows on x86 platforms. Updated rte_common.h to include rte_windows.h for windows build. Updated lib/meson.build to create shared libraries on windows. Added def file to list the exports for the eal library.

---
    lib/librte_eal/common/include/rte_common.h    |  7 ++++- .../common/include/rte_string_fns.h           |  4 ++- lib/librte_eal/rte_eal_exports.def            |  9 ++++++ .../windows/eal/include/rte_windows.h         | 30
+++++++++++++++++++
    lib/librte_eal/windows/eal/meson.build        |  2 ++ lib/meson.build                               | 19 ++++++++++--

    6 files changed, 66 insertions(+), 5 deletions(-)

    create mode 100644 lib/librte_eal/rte_eal_exports.def create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h

lib/librte_eal/common/include/rte_common.h +1 -1
index 7178ba1e9..4775c84f5 100644
@@ -1,5 +1,5 @@
     /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
      */
 
     #ifndef _RTE_COMMON_H_

lib/librte_eal/common/include/rte_common.h extern "C" { · line 31

Quoted 8 lines
lib/librte_eal/common/include/rte_common.h +5 -0
@@ -24,6 +24,11 @@ extern "C" {
 
     #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+

IMO, Updating the rte_common.h for each execution environment is not clean and unnecessary #ifdef clutter in the common code.

I think, it can be fixed by adding new os or eal specific header file at the following location and simply include it(without any #ifdef)

lib/librte_eal/linux/eal/include/exec-env/rte_eal.h lib/librte_eal/freebsd/eal/include/exec-env/rte_eal.h lib/librte_eal/windows/eal/include/exec-env/rte_eal.h # the content of exiting rte_windows.h goes here.

It can be rte_eal.h or rte_os.h or anything similar.

Quoted 10 lines
Quoted 6 lines

This was done based on a suggestion from Thomas:
(http://patches.dpdk.org/patch/50844/)

But, I agree. Your suggestion would be a good enhancement. There is already an existing rte_eal.h in common/include, so an rte_os.h or something similar might make sense.

Yes I agree with rte_os.h

I can include this change in v6. I am looking to add rte_os.h under windows/eal/include/exec-env/ and include the header in rte_common.h as a separate patch. This change would require new files for linux and freebsd. What be should be the content of that?

Signature · 1 line
Anand Rawat
#63 lore raw

Re: [PATCH v5 2/8] eal: add header files to support windows

28/03/2019 00:10, Anand Rawat:

Quoted 70 lines · Thomas Monjalon
Quoted 69 lines

27/03/2019 22:23, Ranjit Menon:

Quoted 67 lines · Jerin Jacob Kollanukkaran
Quoted 52 lines · Anand Rawat
Quoted 36 lines

Added header files to support windows on x86 platforms. Updated rte_common.h to include rte_windows.h for windows build. Updated lib/meson.build to create shared libraries on windows. Added def file to list the exports for the eal library.

---
   lib/librte_eal/common/include/rte_common.h    |  7 ++++-
   .../common/include/rte_string_fns.h           |  4 ++-
   lib/librte_eal/rte_eal_exports.def            |  9 ++++++
   .../windows/eal/include/rte_windows.h         | 30
+++++++++++++++++++
   lib/librte_eal/windows/eal/meson.build        |  2 ++
   lib/meson.build                               | 19 ++++++++++--
   6 files changed, 66 insertions(+), 5 deletions(-)

create mode 100644 lib/librte_eal/rte_eal_exports.def create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h

lib/librte_eal/common/include/rte_common.h +1 -1
index 7178ba1e9..4775c84f5 100644
@@ -1,5 +1,5 @@
   /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
    */
 
   #ifndef _RTE_COMMON_H_

lib/librte_eal/common/include/rte_common.h extern "C" { · line 31

Quoted 8 lines
lib/librte_eal/common/include/rte_common.h +5 -0
@@ -24,6 +24,11 @@ extern "C" {
 
   #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+

IMO, Updating the rte_common.h for each execution environment is not clean and unnecessary #ifdef clutter in the common code.

I think, it can be fixed by adding new os or eal specific header file at the following location and simply include it(without any #ifdef)

Quoted 8 lines

lib/librte_eal/linux/eal/include/exec-env/rte_eal.h lib/librte_eal/freebsd/eal/include/exec-env/rte_eal.h lib/librte_eal/windows/eal/include/exec-env/rte_eal.h # the content of exiting rte_windows.h goes here.

It can be rte_eal.h or rte_os.h or anything similar.

This was done based on a suggestion from Thomas:
(http://patches.dpdk.org/patch/50844/)

But, I agree. Your suggestion would be a good enhancement. There is already an existing rte_eal.h in common/include, so an rte_os.h or something similar might make sense.

Quoted 7 lines
Quoted 3 lines

Yes I agree with rte_os.h

I can include this change in v6. I am looking to add rte_os.h under windows/eal/include/exec-env/ and include the header in rte_common.h as a separate patch. This change would require new files for linux and freebsd. What be should be the content of that?

I think you can add empty files.
Later we may discover some definitions to move from common code to rte_os.h.

Reviewed-by Jeff Shaw Reviewed-by Ranjit Menon Acked-by on v5 2/8
#64 lore raw

Re: [PATCH v5 2/8] eal: add header files to support windows

In reply to Anand Rawat

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows

Added header files to support windows on x86 platforms.
Updated rte_common.h to include rte_windows.h for windows build. Updated lib/meson.build to create shared libraries on windows. Added def file to list the exports for the eal library.

---
 lib/librte_eal/common/include/rte_common.h    |  7 ++++-
 .../common/include/rte_string_fns.h           |  4 ++-
 lib/librte_eal/rte_eal_exports.def            |  9 ++++++
 .../windows/eal/include/rte_windows.h         | 30 +++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  2 ++
 lib/meson.build                               | 19 ++++++++++--
 6 files changed, 66 insertions(+), 5 deletions(-)  create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
lib/librte_eal/common/include/rte_common.h +6 -1
index 7178ba1e9..4775c84f5 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_
@@ -24,6 +24,11 @@ extern "C" {
 
 #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+
 #ifndef typeof
 #define typeof __typeof__
 #endif
lib/librte_eal/common/include/rte_string_fns.h +3 -1
index 85bfe6c9a..8bac8243c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 /**
@@ -18,6 +18,8 @@ extern "C" {
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
+
 /**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def

new file mode 100644
index 000000000..7805aeeaa

lib/librte_eal/rte_eal_exports.def new file +9 -0
@@ -0,0 +1,9 @@
+EXPORTS
+	__rte_panic
+	rte_eal_get_configuration
+	rte_eal_init
+	rte_eal_mp_remote_launch
+	rte_eal_mp_wait_lcore
+	rte_eal_remote_launch
+	rte_log
+	rte_vlog
\ No newline at end of file
lib/librte_eal/windows/eal/include/rte_windows.h new file +30 -0
new file mode 100644
index 000000000..af24ef39f
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_WINDOWS_H_
+#define _RTE_WINDOWS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+/* macro substitution for windows supported strerror_r */ #define 
+strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* macro substitution for windows supported strdup */
+#define strdup(str)	_strdup(str)
+
+/* macro substitution for windows supported ssize_t type */ typedef 
+SSIZE_T ssize_t;
+
+/* macro substitution for windows supported strtok_r */ #define 
+strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_WINDOWS_H_ */
lib/librte_eal/windows/eal/meson.build +2 -0
index 8b1735623..6bc577e5c 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
lib/meson.build +1 -0
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible @@ -64,6 +64,11 @@ foreach l:libraries

dir_name = 'librte_' + l
subdir(dir_name)

+ if host_machine.system() == 'windows'
+ # injecting rte_windows.h in every library in windows
+ includes += include_directories('librte_eal/windows/eal/include')
+ endif
+
if build
enabled_libs += name
dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1) @@ -117,14 +122,22 @@ foreach l:libraries
objs += static_lib.extract_all_objects(recursive: false) version_map = '@0@/@1@/rte_@2@_version.map'.format(
meson.current_source_dir(), dir_name, name)
+ exports = '@0@/@1@/rte_@2@_exports.def'.format(
+ meson.current_source_dir(), dir_name, name)
+ implib = dir_name + '.dll.a'
+ if host_machine.system() == 'windows'
+ lk_args = ['-Wl,/def:' + exports, '-Wl,/implib:lib\\' + implib]
+ else
+ lk_args = ['-Wl,--version-script=' + version_map]
+ endif
shared_lib = shared_library(libname,
sources,
objects: objs,
c_args: cflags,
dependencies: shared_deps,
include_directories: includes,
- link_args: '-Wl,--version-script=' + version_map,
- link_depends: version_map,
+ link_args: lk_args,
+ link_depends: [version_map, exports],
version: lib_version,
soversion: so_version,
install: true)
--
2.17.1.windows.2

#65 lore raw

PATCH v5 3/8 kvargs: adding a module definition file

In reply to Anand Rawat

adding a DEF file for kvargs to specify the exports for the creation of the shared library.

---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
lib/librte_kvargs/rte_kvargs_exports.def new file +7 -0
new file mode 100644
index 000000000..265d3cc9a
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
\ No newline at end of file
Signature · 1 line
2.17.1.windows.2
#66 lore raw

Re: [PATCH v5 3/8] kvargs: adding a module definition file

lib/librte_kvargs/rte_kvargs_exports.def

Quoted 18 lines · Anand Rawat

adding a DEF file for kvargs to specify the exports for the creation of the shared library.

---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
lib/librte_kvargs/rte_kvargs_exports.def new file +0 -0
new file mode 100644
index 000000000..265d3cc9a

Maintaining two separate files (.map and .def) for shared library definition will be pain full.

# Is it possible to add neutral file format if windows is not happy with .map file?
# I am not sure, How we can express "EXPERIMENTAL" tag with .def file. # It is good to check, How OTHER cross platform libraries addressing this problem

Quoted 9 lines
lib/librte_kvargs/rte_kvargs_exports.def new file +7 -0
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
\ No newline at end of file
#67 lore raw

Re: [PATCH v5 3/8] kvargs: adding a module definition file

Quoted 13 lines · Jerin Jacob Kollanukkaran
Quoted 12 lines · Anand Rawat

adding a DEF file for kvargs to specify the exports for the creation of the shared library.

---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
Quoted 10 lines

lib/librte_kvargs/rte_kvargs_exports.def

Quoted 6 lines
lib/librte_kvargs/rte_kvargs_exports.def new file +0 -0
new file mode 100644
index 000000000..265d3cc9a

Maintaining two separate files (.map and .def) for shared library definition will be pain full.

Yes, though I'd question how much more painful it is than having to update a separate map file anyway - just consider the number of patches that have been submitted over the years which failed shared library build because map file updates were forgotten.

However, my hope is that down the road we can have the def file generated from the map file (or potentially vice versa). Perhaps the meson python module could be used to allow us to script it a bit.

Quoted 6 lines

# Is it possible to add neutral file format if windows is not happy with .map file?
# I am not sure, How we can express "EXPERIMENTAL" tag with .def file. # It is good to check, How OTHER cross platform libraries addressing this problem

A wider question is whether it is possible at all to have ABI versions associated with functions? I didn't find any mention of it in the documentations, and if it's not possible, then the question of how to put an experimental version is moot, I think.

/Bruce

#68 lore raw

Re: [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file

Quoted 28 lines · Bruce Richardson

-------------------------------------------------------------------
---

Quoted 13 lines · Jerin Jacob Kollanukkaran
Quoted 12 lines · Anand Rawat

adding a DEF file for kvargs to specify the exports for the creation of the shared library.

---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
Quoted 10 lines

lib/librte_kvargs/rte_kvargs_exports.def

Quoted 6 lines
lib/librte_kvargs/rte_kvargs_exports.def new file +0 -0
new file mode 100644
index 000000000..265d3cc9a

Maintaining two separate files (.map and .def) for shared library definition will be pain full.

Quoted 3 lines

Yes, though I'd question how much more painful it is than having to update
a separate map file anyway - just consider the number of patches that

It is painful due to the fact that, If it is windows ONLY file then developer need to test on Windows as well as it may break Windows. If it is a common file, at least, it will be tested on one platform. So responsibly wise it is a clean partition between windows eal maintainers vs generic library maintainers.

Quoted 10 lines

have
been submitted over the years which failed shared library build because map
file updates were forgotten.

However, my hope is that down the road we can have the def file generated
from the map file (or potentially vice versa). Perhaps the meson python
module could be used to allow us to script it a bit.

Make sense. Do we want to support shared lib for Windows for the first version? or Can we live with static lib till we find a proper solution. I do believe the base Windows Helloworld support needs to added this release in main repo and add the subsequent features step by step. I would treat, shared lib as subsequent feature if it is not clean.

Quoted 9 lines
Quoted 9 lines

# Is it possible to add neutral file format if windows is not happy with .map file?
# I am not sure, How we can express "EXPERIMENTAL" tag with .def file.
# It is good to check, How OTHER cross platform libraries addressing
this problem

Quoted 6 lines

A wider question is whether it is possible at all to have ABI versions
associated with functions? I didn't find any mention of it in the documentations, and if it's not possible, then the question of how to put
an experimental version is moot, I think.

Yes, Waiting for the comments from Wider audience.

Quoted 2 lines

/Bruce

#69 lore raw

Re: [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file

26/03/2019 14:37, Jerin Jacob Kollanukkaran:

Quoted 7 lines · Bruce Richardson
Quoted 5 lines

However, my hope is that down the road we can have the def file generated
from the map file (or potentially vice versa). Perhaps the meson python
module could be used to allow us to script it a bit.

Quoted 5 lines

Make sense. Do we want to support shared lib for Windows for the first version? or Can we live with static lib till we find a proper solution. I do believe the base Windows Helloworld support needs to added this release in main repo and add the subsequent features step by step. I would treat, shared lib as subsequent feature if it is not clean.

I agree, shared library can be supported later.

#70 lore raw

Re: [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file

Quoted 8 lines · Thomas Monjalon

26/03/2019 14:37, Jerin Jacob Kollanukkaran:

Quoted 7 lines · Bruce Richardson
Quoted 5 lines

However, my hope is that down the road we can have the def file generated
from the map file (or potentially vice versa). Perhaps the meson python
module could be used to allow us to script it a bit.

Quoted 8 lines
Quoted 5 lines

Make sense. Do we want to support shared lib for Windows for the first version? or Can we live with static lib till we find a proper solution. I do believe the base Windows Helloworld support needs to added this release in main repo and add the subsequent features step by step. I would treat, shared lib as subsequent feature if it is not clean.

I agree, shared library can be supported later.

I would agree, except *not* supporting it will be more painful than what is proposed here. :-)

/Bruce

#71 lore raw

Re: [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file

26/03/2019 15:41, Bruce Richardson:

Quoted 15 lines · Thomas Monjalon
Quoted 14 lines

26/03/2019 14:37, Jerin Jacob Kollanukkaran:

Quoted 12 lines · Bruce Richardson
Quoted 5 lines

However, my hope is that down the road we can have the def file generated
from the map file (or potentially vice versa). Perhaps the meson python
module could be used to allow us to script it a bit.

Make sense. Do we want to support shared lib for Windows for the first version? or Can we live with static lib till we find a proper solution. I do believe the base Windows Helloworld support needs to added this release in main repo and add the subsequent features step by step. I would treat, shared lib as subsequent feature if it is not clean.

Quoted 4 lines
Quoted 2 lines

I agree, shared library can be supported later.

I would agree, except *not* supporting it will be more painful than what is proposed here. :-)

Why?
We can just document it as broken, and test only "static" compilation. Am I missing something?

#72 lore raw

Re: [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file

Quoted 16 lines · Thomas Monjalon

26/03/2019 15:41, Bruce Richardson:

Quoted 15 lines · Thomas Monjalon
Quoted 14 lines

26/03/2019 14:37, Jerin Jacob Kollanukkaran:

Quoted 12 lines · Bruce Richardson
Quoted 5 lines

However, my hope is that down the road we can have the def file generated
from the map file (or potentially vice versa). Perhaps the meson python
module could be used to allow us to script it a bit.

Make sense. Do we want to support shared lib for Windows for the first version? or Can we live with static lib till we find a proper solution. I do believe the base Windows Helloworld support needs to added this release in main repo and add the subsequent features step by step. I would treat, shared lib as subsequent feature if it is not clean.

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

I agree, shared library can be supported later.

I would agree, except *not* supporting it will be more painful than what is proposed here. :-)

Why?
We can just document it as broken, and test only "static" compilation. Am I missing something?

Yes, static compilation also builds the shared libraries too. To turn that off, you'd have to modify the meson.build files to conditionally undefine the shared library builds on windows. Then undefine out the assignment to any dependency variables that are using those libraries, etc. It's doable, but it's a lot messier than adding in 2 .def files.

/Bruce

#73 lore raw

Re: [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file

26/03/2019 16:17, Bruce Richardson:

Quoted 26 lines · Thomas Monjalon
Quoted 16 lines

26/03/2019 15:41, Bruce Richardson:

Quoted 15 lines · Thomas Monjalon
Quoted 14 lines

26/03/2019 14:37, Jerin Jacob Kollanukkaran:

Quoted 12 lines · Bruce Richardson
Quoted 5 lines

However, my hope is that down the road we can have the def file generated
from the map file (or potentially vice versa). Perhaps the meson python
module could be used to allow us to script it a bit.

Make sense. Do we want to support shared lib for Windows for the first version? or Can we live with static lib till we find a proper solution. I do believe the base Windows Helloworld support needs to added this release in main repo and add the subsequent features step by step. I would treat, shared lib as subsequent feature if it is not clean.

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

I agree, shared library can be supported later.

I would agree, except *not* supporting it will be more painful than what is proposed here. :-)

Why?
We can just document it as broken, and test only "static" compilation. Am I missing something?

Quoted 5 lines

Yes, static compilation also builds the shared libraries too. To turn that off, you'd have to modify the meson.build files to conditionally undefine the shared library builds on windows. Then undefine out the assignment to any dependency variables that are using those libraries, etc. It's doable, but it's a lot messier than adding in 2 .def files.

OK, thanks

#74 lore raw

Re: [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file

In reply to Jerin Jacob Kollanukkaran
Quoted 33 lines · Jerin Jacob Kollanukkaran
Quoted 28 lines · Bruce Richardson

-------------------------------------------------------------------
---

Quoted 13 lines · Jerin Jacob Kollanukkaran
Quoted 12 lines · Anand Rawat

adding a DEF file for kvargs to specify the exports for the creation of the shared library.

---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
Quoted 10 lines

lib/librte_kvargs/rte_kvargs_exports.def

Quoted 6 lines
lib/librte_kvargs/rte_kvargs_exports.def new file +0 -0
new file mode 100644
index 000000000..265d3cc9a

Maintaining two separate files (.map and .def) for shared library definition will be pain full.

Quoted 3 lines

Yes, though I'd question how much more painful it is than having to update
a separate map file anyway - just consider the number of patches that

Quoted 6 lines

It is painful due to the fact that, If it is windows ONLY file then developer need to test on Windows as well as it may break Windows. If it is a common file, at least, it will be tested on one platform. So responsibly wise it is a clean partition between windows eal maintainers vs generic library maintainers.

Yes, good point. However, once we get some windows support into the main repo then there is the requirement not to break that, so some testing on windows before merge will prove necessary. Hopefully that can be done just via CI, rather than having maintainers/committers do so manually.

Quoted 7 lines
Quoted 6 lines

have been submitted over the years which failed shared library build because map file updates were forgotten.

However, my hope is that down the road we can have the def file generated from the map file (or potentially vice versa). Perhaps the meson python module could be used to allow us to script it a bit.

Quoted 6 lines

Make sense. Do we want to support shared lib for Windows for the first version? or Can we live with static lib till we find a proper solution. I do believe the base Windows Helloworld support needs to added this release in main repo and add the subsequent features step by step. I would treat, shared lib as subsequent feature if it is not clean.

Yes, I did consider that possibility. However, turning off shared builds for windows is more of a hack than adding a definition file, since it involves more (temporary) changes to the meson.build for both lib and driver. If I get the chance, I'll see how complicated it might be to autogenerate them at build. Otherwise, I'd suggest keeping the .def files for now, since only 2 libraries are involved, but then we need to come up with a proper solution before the number of libraries compiled on windows goes above that initial 2.

/Bruce

#75 lore raw

Re: [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file

Quoted 34 lines · Bruce Richardson
Quoted 7 lines

It is painful due to the fact that, If it is windows ONLY file then developer need to test on Windows as well as it may break Windows. If it is a common file, at least, it will be tested on one platform.
So responsibly wise it is a clean partition between windows eal maintainers vs generic library maintainers.

Yes, good point. However, once we get some windows support into the main
repo then there is the requirement not to break that, so some testing on
windows before merge will prove necessary. Hopefully that can be done just
via CI, rather than having maintainers/committers do so manually.

Quoted 9 lines
Quoted 8 lines

have been submitted over the years which failed shared library build
because map file updates were forgotten.

However, my hope is that down the road we can have the def file generated from the map file (or potentially vice versa). Perhaps the
meson python module could be used to allow us to script it a bit.

Quoted 10 lines

Make sense. Do we want to support shared lib for Windows for the first
version? or Can we live with static lib till we find a proper solution.
I do believe the base Windows Helloworld support needs to added this
release in main repo and add the subsequent features step by step. I
would treat, shared lib as subsequent feature if it is not clean.

Quoted 12 lines

Yes, I did consider that possibility. However, turning off shared builds
for windows is more of a hack than adding a definition file, since it involves more (temporary) changes to the meson.build for both lib and driver. If I get the chance, I'll see how complicated it might be to autogenerate them at build. Otherwise, I'd suggest keeping the .def files
for now, since only 2 libraries are involved, but then we need to come up
with a proper solution before the number of libraries compiled on windows
goes above that initial 2.

I am OK with a short term hack to get Window support for DPDK, Provided it will be revisited before adding the next .def file.

Quoted 2 lines

/Bruce

#76 lore raw

Re: [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file

Quoted 48 lines · Jerin Jacob Kollanukkaran
Quoted 34 lines · Bruce Richardson
Quoted 7 lines

It is painful due to the fact that, If it is windows ONLY file then developer need to test on Windows as well as it may break Windows. If it is a common file, at least, it will be tested on one platform.
So responsibly wise it is a clean partition between windows eal maintainers vs generic library maintainers.

Yes, good point. However, once we get some windows support into the main
repo then there is the requirement not to break that, so some testing on
windows before merge will prove necessary. Hopefully that can be done just
via CI, rather than having maintainers/committers do so manually.

Quoted 9 lines
Quoted 8 lines

have been submitted over the years which failed shared library build
because map file updates were forgotten.

However, my hope is that down the road we can have the def file generated from the map file (or potentially vice versa). Perhaps the
meson python module could be used to allow us to script it a bit.

Quoted 10 lines

Make sense. Do we want to support shared lib for Windows for the first
version? or Can we live with static lib till we find a proper solution.
I do believe the base Windows Helloworld support needs to added this
release in main repo and add the subsequent features step by step. I
would treat, shared lib as subsequent feature if it is not clean.

Quoted 12 lines

Yes, I did consider that possibility. However, turning off shared builds
for windows is more of a hack than adding a definition file, since it involves more (temporary) changes to the meson.build for both lib and driver. If I get the chance, I'll see how complicated it might be to autogenerate them at build. Otherwise, I'd suggest keeping the .def files
for now, since only 2 libraries are involved, but then we need to come up
with a proper solution before the number of libraries compiled on windows
goes above that initial 2.

Quoted 3 lines

I am OK with a short term hack to get Window support for DPDK, Provided it will be revisited before adding the next .def file.

Ok, some hacking has led to this as a possible approach to solve this. I've only tested this on linux to verify it creates something approximating a module definition file but not actually tried using it on windows. The nice thing about meson being based on python is that we are guaranteed to have a python3 interpreter available on whatever os we are running on. [Yes, I made the script python2 compatible too, though I probably didn't need to!]

I've also included in this version an (untested) override option for EAL, to allow us to keep the .def file for EAL until we can export all the functions listed in the map file for it. Other libraries shouldn't need this, since they aren't as insanely big as EAL.

/Bruce

buildtools/map_to_def.py new file +30 -0
new file mode 100644
index 000000000..6c2f56c5d
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+from __future__ import print_function
+import sys
+from os.path import dirname, basename, join, exists
+
+def main(args):
+  if not args[1].endswith('version.map') or not args[2].endswith('exports.def'):
+    return 1
+
+# special case, allow override if an def file already exists alongside map file
+  override_file = join(dirname(args[1]), basename(args[2]))
+  if exists(override_file):
+    with open(override_file) as f_in:
+      functions = f_in.readlines()
+  else:
+# generate def file from map file
+    with open(args[1]) as f_in:
+      functions = ["EXPORTS\n"] + \
+           [ln[:-2] + '\n' for ln in sorted(f_in.readlines()) \
+              if ln.startswith('\t') and ln.endswith(';\n') and ":" not in ln]
+
+  with open(args[2], 'w') as f_out:
+    f_out.writelines(functions)
+  return 0;
+
+if __name__ == "__main__":
+  sys.exit(main(sys.argv))
buildtools/meson.build +1 -0
index cdd38ed24..9ae2bc7c8 100644
@@ -4,3 +4,4 @@
 subdir('pmdinfogen')
 
 pmdinfo = find_program('gen-pmdinfo-cfile.sh')
+map_to_def = files('map_to_def.py')
buildtools/pmdinfogen/meson.build +2 -1
index a219a8e96..938137300 100644
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-pmdinfogen_inc = eal_inc
+pmdinfogen_inc = [global_inc]
+pmdinfogen_inc += include_directories('../../lib/librte_eal/common/include')
 pmdinfogen_inc += include_directories('../../lib/librte_pci')
 pmdinfogen = executable('pmdinfogen',
 	'pmdinfogen.c',
lib/meson.build +6 -0
index 99957ba7d..c4606e7f2 100644
@@ -117,6 +117,12 @@ foreach l:libraries
 			objs += static_lib.extract_all_objects(recursive: false)
 			version_map = '@0@/@1@/rte_@2@_version.map'.format(
 					meson.current_source_dir(), dir_name, name)
+			exports_def = 'rte_@0@_exports.def'.format(name)
+			def_file = custom_target(exports_def,
+				command: [python3, map_to_def, '@INPUT@', '@OUTPUT@'],
+				input: version_map,
+				output: exports_def,
+				build_by_default: true)
 			shared_lib = shared_library(libname,
 					sources,
 					objects: objs,
meson.build +5 -1
index 69833de82..81a9e93f7 100644
@@ -8,6 +8,10 @@ project('DPDK', 'C',
 	meson_version: '>= 0.47.1'
 )
 
+# get python available, using the python interpreter for running meson
+pymod = import('python')
+python3 = pymod.find_installation()
+
 # set up some global vars for compiler, platform, configuration, etc.
 cc = meson.get_compiler('c')
 dpdk_conf = configuration_data()
@@ -36,8 +40,8 @@ global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
 subdir('config')
 
 # build libs and drivers
-subdir('lib')
 subdir('buildtools')
+subdir('lib')
 subdir('drivers')
 
 # build binaries and installable tools
#77 lore raw

Re: [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file

Quoted 59 lines · Bruce Richardson
Quoted 48 lines · Jerin Jacob Kollanukkaran
Quoted 34 lines · Bruce Richardson
Quoted 7 lines

It is painful due to the fact that, If it is windows ONLY file then developer need to test on Windows as well as it may break Windows. If it is a common file, at least, it will be tested on one platform.
So responsibly wise it is a clean partition between windows eal maintainers vs generic library maintainers.

Yes, good point. However, once we get some windows support into the main
repo then there is the requirement not to break that, so some testing on
windows before merge will prove necessary. Hopefully that can be done just
via CI, rather than having maintainers/committers do so manually.

Quoted 9 lines
Quoted 8 lines

have been submitted over the years which failed shared library build
because map file updates were forgotten.

However, my hope is that down the road we can have the def file generated from the map file (or potentially vice versa). Perhaps the
meson python module could be used to allow us to script it a bit.

Quoted 10 lines

Make sense. Do we want to support shared lib for Windows for the first
version? or Can we live with static lib till we find a proper solution.
I do believe the base Windows Helloworld support needs to added this
release in main repo and add the subsequent features step by step. I
would treat, shared lib as subsequent feature if it is not clean.

Quoted 12 lines

Yes, I did consider that possibility. However, turning off shared builds
for windows is more of a hack than adding a definition file, since it involves more (temporary) changes to the meson.build for both lib and driver. If I get the chance, I'll see how complicated it might be to autogenerate them at build. Otherwise, I'd suggest keeping the .def files
for now, since only 2 libraries are involved, but then we need to come up
with a proper solution before the number of libraries compiled on windows
goes above that initial 2.

Quoted 3 lines

I am OK with a short term hack to get Window support for DPDK, Provided it will be revisited before adding the next .def file.

Ok, some hacking has led to this as a possible approach to solve this. I've only tested this on linux to verify it creates something approximating a module definition file but not actually tried using it on windows. The nice thing about meson being based on python is that we are guaranteed to have a python3 interpreter available on whatever os we are running on. [Yes, I made the script python2 compatible too, though I probably didn't need to!]

Quoted 7 lines

I've also included in this version an (untested) override option for EAL, to allow us to keep the .def file for EAL until we can export all the functions listed in the map file for it. Other libraries shouldn't need this, since they aren't as insanely big as EAL.

/Bruce

I agree with Bruce, adding the two def files is the cleaner option and involves the least amount of changes in the common build flow. But if required shared library logic can be disabled as a part of meson workaround for windows for the initial release.

Signature · 1 line
Anand Rawat
Reviewed-by Pallavi Kadam Reviewed-by Ranjit Menon Acked-by on v5 3/8
#78 lore raw

Re: [PATCH v5 3/8] kvargs: adding a module definition file

In reply to Anand Rawat

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file

adding a DEF file for kvargs to specify the exports for the creation of the shared library.

---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
lib/librte_kvargs/rte_kvargs_exports.def new file +7 -0
new file mode 100644
index 000000000..265d3cc9a
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
\ No newline at end of file

--
2.17.1.windows.2

#79 lore raw

Re: [PATCH v5 3/8] kvargs: adding a module definition file

In reply to Anand Rawat
Quoted 6 lines · On Mon, 25 Mar 2019 23:02:33 -0700 Anand Rawat <[email protected]> wrote:
lib/librte_kvargs/rte_kvargs_exports.def new file +0 -0
new file mode 100644
index 000000000..265d3cc9a

lib/librte_kvargs/rte_kvargs_exports.def line 7

Quoted 8 lines
lib/librte_kvargs/rte_kvargs_exports.def new file +7 -0
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
\ No newline at end of file

Fix your editor.

#80 lore raw

PATCH v5 4/8 eal: sys/queue.h implementation for windows

In reply to Anand Rawat

Adding sys/queue.h on windows for supporting common code. This is implementation has BSD-3-Clause licensing.

---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
lib/librte_eal/windows/eal/include/sys/queue.h new file +320 -0
new file mode 100644
index 000000000..5ee4916ad
@@ -0,0 +1,320 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+/*
+ * This file defines tail queues.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * Below is a summary of implemented functions where:
+ *  +  means the macro is available
+ *  -  means the macro is not available
+ *  s  means the macro is available but is slow (runs in O(n) time)
+ *
+ *				TAILQ
+ * _HEAD			+
+ * _CLASS_HEAD			+
+ * _HEAD_INITIALIZER		+
+ * _ENTRY			+
+ * _CLASS_ENTRY			+
+ * _INIT			+
+ * _EMPTY			+
+ * _FIRST			+
+ * _NEXT			+
+ * _PREV			+
+ * _LAST			+
+ * _LAST_FAST			+
+ * _FOREACH			+
+ * _FOREACH_FROM		+
+ * _FOREACH_SAFE		+
+ * _FOREACH_FROM_SAFE		+
+ * _FOREACH_REVERSE		+
+ * _FOREACH_REVERSE_FROM	+
+ * _FOREACH_REVERSE_SAFE	+
+ * _FOREACH_REVERSE_FROM_SAFE	+
+ * _INSERT_HEAD			+
+ * _INSERT_BEFORE		+
+ * _INSERT_AFTER		+
+ * _INSERT_TAIL			+
+ * _CONCAT			+
+ * _REMOVE_AFTER		-
+ * _REMOVE_HEAD			-
+ * _REMOVE			+
+ * _SWAP			+
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	QMD_TRACE_ELEM(elem)
+#define	QMD_TRACE_HEAD(head)
+#define	TRACEBUF
+#define	TRACEBUF_INITIALIZER
+
+#define	TRASHIT(x)
+#define	QMD_IS_TRASHED(x)	0
+
+#define	QMD_SAVELINK(name, link)
+
+#ifdef __cplusplus
+/*
+ * In C++ there can be structure lists and class lists:
+ */
+#define	QUEUE_TYPEOF(type) type
+#else
+#define	QUEUE_TYPEOF(type) struct type
+#endif
+
+/*
+ * Tail queue declarations.
+ */
+#define	TAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *tqh_first;	/* first element */			\
+	struct type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_HEAD(name, type)					\
+struct name {								\
+	class type *tqh_first;	/* first element */			\
+	class type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
+
+#define	TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_ENTRY(type)						\
+struct {								\
+	class type *tqe_next;	/* next element */			\
+	class type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+/*
+ * Tail queue functions.
+ */
+#define	QMD_TAILQ_CHECK_HEAD(head, field)
+#define	QMD_TAILQ_CHECK_TAIL(head, headname)
+#define	QMD_TAILQ_CHECK_NEXT(elm, field)
+#define	QMD_TAILQ_CHECK_PREV(elm, field)
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+		QMD_TRACE_HEAD(head1);					\
+		QMD_TRACE_HEAD(head2);					\
+	}								\
+} while (0)
+
+#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
+
+#define	TAILQ_FIRST(head)	((head)->tqh_first)
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_FROM(var, head, field)				\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)			\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field)		\
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_INIT(head) do {						\
+	TAILQ_FIRST((head)) = NULL;					\
+	(head)->tqh_last = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+} while (0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field);	\
+	if (TAILQ_NEXT((listelm), field) != NULL)			\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    &TAILQ_NEXT((elm), field);				\
+	else {								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	TAILQ_NEXT((listelm), field) = (elm);				\
+	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_TAILQ_CHECK_PREV(listelm, field);				\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	TAILQ_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_HEAD(head, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_FIRST((head));			\
+	if (TAILQ_FIRST((head)) != NULL)				\
+		TAILQ_FIRST((head))->field.tqe_prev =			\
+		    &TAILQ_NEXT((elm), field);				\
+	else								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+	TAILQ_FIRST((head)) = (elm);					\
+	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_TAIL(head, field);				\
+	TAILQ_NEXT((elm), field) = NULL;				\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_LAST(head, headname)					\
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+
+/*
+ * The FAST function is fast in that it causes no data access other
+ * then the access to the head. The standard LAST function above
+ * will cause a data access of both the element you want and
+ * the previous element. FAST is very useful for instances when
+ * you may want to prefetch the last data element.
+ */
+#define	TAILQ_LAST_FAST(head, type, field)			\
+	(TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last,	\
+	QUEUE_TYPEOF(type), field.tqe_next))
+
+#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define	TAILQ_PREV(elm, headname, field)				\
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
+	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
+	QMD_TAILQ_CHECK_NEXT(elm, field);				\
+	QMD_TAILQ_CHECK_PREV(elm, field);				\
+	if ((TAILQ_NEXT((elm), field)) != NULL)				\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    (elm)->field.tqe_prev;				\
+	else {								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
+	TRASHIT(*oldnext);						\
+	TRASHIT(*oldprev);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define TAILQ_SWAP(head1, head2, type, field) do {			\
+	QUEUE_TYPEOF(type) * swap_first = (head1)->tqh_first;		\
+	QUEUE_TYPEOF(type) * *swap_last = (head1)->tqh_last;		\
+	(head1)->tqh_first = (head2)->tqh_first;			\
+	(head1)->tqh_last = (head2)->tqh_last;				\
+	(head2)->tqh_first = swap_first;				\
+	(head2)->tqh_last = swap_last;					\
+	swap_first = (head1)->tqh_first;				\
+	if (swap_first != NULL)						\
+		swap_first->field.tqe_prev = &(head1)->tqh_first;	\
+	else								\
+		(head1)->tqh_last = &(head1)->tqh_first;		\
+	swap_first = (head2)->tqh_first;				\
+	if (swap_first != NULL)			\
+		swap_first->field.tqe_prev = &(head2)->tqh_first;	\
+	else								\
+		(head2)->tqh_last = &(head2)->tqh_first;		\
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_QUEUE_H_ */
Signature · 1 line
2.17.1.windows.2
Reviewed-by Jeff Shaw Acked-by on v5 4/8
#81 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows

Adding sys/queue.h on windows for supporting common code. This is implementation has BSD-3-Clause licensing.

---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
lib/librte_eal/windows/eal/include/sys/queue.h new file +320 -0
new file mode 100644
index 000000000..5ee4916ad
@@ -0,0 +1,320 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+/*
+ * This file defines tail queues.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * Below is a summary of implemented functions where:
+ *  +  means the macro is available
+ *  -  means the macro is not available
+ *  s  means the macro is available but is slow (runs in O(n) time)
+ *
+ *				TAILQ
+ * _HEAD			+
+ * _CLASS_HEAD			+
+ * _HEAD_INITIALIZER		+
+ * _ENTRY			+
+ * _CLASS_ENTRY			+
+ * _INIT			+
+ * _EMPTY			+
+ * _FIRST			+
+ * _NEXT			+
+ * _PREV			+
+ * _LAST			+
+ * _LAST_FAST			+
+ * _FOREACH			+
+ * _FOREACH_FROM		+
+ * _FOREACH_SAFE		+
+ * _FOREACH_FROM_SAFE		+
+ * _FOREACH_REVERSE		+
+ * _FOREACH_REVERSE_FROM	+
+ * _FOREACH_REVERSE_SAFE	+
+ * _FOREACH_REVERSE_FROM_SAFE	+
+ * _INSERT_HEAD			+
+ * _INSERT_BEFORE		+
+ * _INSERT_AFTER		+
+ * _INSERT_TAIL			+
+ * _CONCAT			+
+ * _REMOVE_AFTER		-
+ * _REMOVE_HEAD			-
+ * _REMOVE			+
+ * _SWAP			+
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	QMD_TRACE_ELEM(elem)
+#define	QMD_TRACE_HEAD(head)
+#define	TRACEBUF
+#define	TRACEBUF_INITIALIZER
+
+#define	TRASHIT(x)
+#define	QMD_IS_TRASHED(x)	0
+
+#define	QMD_SAVELINK(name, link)
+
+#ifdef __cplusplus
+/*
+ * In C++ there can be structure lists and class lists:
+ */
+#define	QUEUE_TYPEOF(type) type
+#else
+#define	QUEUE_TYPEOF(type) struct type
+#endif
+
+/*
+ * Tail queue declarations.
+ */
+#define	TAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *tqh_first;	/* first element */			\
+	struct type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_HEAD(name, type)					\
+struct name {								\
+	class type *tqh_first;	/* first element */			\
+	class type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
+
+#define	TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_ENTRY(type)						\
+struct {								\
+	class type *tqe_next;	/* next element */			\
+	class type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+/*
+ * Tail queue functions.
+ */
+#define	QMD_TAILQ_CHECK_HEAD(head, field)
+#define	QMD_TAILQ_CHECK_TAIL(head, headname)
+#define	QMD_TAILQ_CHECK_NEXT(elm, field)
+#define	QMD_TAILQ_CHECK_PREV(elm, field)
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+		QMD_TRACE_HEAD(head1);					\
+		QMD_TRACE_HEAD(head2);					\
+	}								\
+} while (0)
+
+#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
+
+#define	TAILQ_FIRST(head)	((head)->tqh_first)
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_FROM(var, head, field)				\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)			\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field)		\
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_INIT(head) do {						\
+	TAILQ_FIRST((head)) = NULL;					\
+	(head)->tqh_last = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+} while (0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field);	\
+	if (TAILQ_NEXT((listelm), field) != NULL)			\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    &TAILQ_NEXT((elm), field);				\
+	else {								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	TAILQ_NEXT((listelm), field) = (elm);				\
+	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_TAILQ_CHECK_PREV(listelm, field);				\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	TAILQ_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_HEAD(head, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_FIRST((head));			\
+	if (TAILQ_FIRST((head)) != NULL)				\
+		TAILQ_FIRST((head))->field.tqe_prev =			\
+		    &TAILQ_NEXT((elm), field);				\
+	else								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+	TAILQ_FIRST((head)) = (elm);					\
+	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_TAIL(head, field);				\
+	TAILQ_NEXT((elm), field) = NULL;				\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_LAST(head, headname)					\
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+
+/*
+ * The FAST function is fast in that it causes no data access other
+ * then the access to the head. The standard LAST function above
+ * will cause a data access of both the element you want and
+ * the previous element. FAST is very useful for instances when
+ * you may want to prefetch the last data element.
+ */
+#define	TAILQ_LAST_FAST(head, type, field)			\
+	(TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last,	\
+	QUEUE_TYPEOF(type), field.tqe_next))
+
+#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define	TAILQ_PREV(elm, headname, field)				\
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
+	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
+	QMD_TAILQ_CHECK_NEXT(elm, field);				\
+	QMD_TAILQ_CHECK_PREV(elm, field);				\
+	if ((TAILQ_NEXT((elm), field)) != NULL)				\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    (elm)->field.tqe_prev;				\
+	else {								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
+	TRASHIT(*oldnext);						\
+	TRASHIT(*oldprev);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define TAILQ_SWAP(head1, head2, type, field) do {			\
+	QUEUE_TYPEOF(type) * swap_first = (head1)->tqh_first;		\
+	QUEUE_TYPEOF(type) * *swap_last = (head1)->tqh_last;		\
+	(head1)->tqh_first = (head2)->tqh_first;			\
+	(head1)->tqh_last = (head2)->tqh_last;				\
+	(head2)->tqh_first = swap_first;				\
+	(head2)->tqh_last = swap_last;					\
+	swap_first = (head1)->tqh_first;				\
+	if (swap_first != NULL)						\
+		swap_first->field.tqe_prev = &(head1)->tqh_first;	\
+	else								\
+		(head1)->tqh_last = &(head1)->tqh_first;		\
+	swap_first = (head2)->tqh_first;				\
+	if (swap_first != NULL)			\
+		swap_first->field.tqe_prev = &(head2)->tqh_first;	\
+	else								\
+		(head2)->tqh_last = &(head2)->tqh_first;		\
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_QUEUE_H_ */
Signature · 1 line
2.17.1.windows.2
#82 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

In reply to Anand Rawat
Quoted 22 lines · On Mon, 25 Mar 2019 23:02:34 -0700 Anand Rawat <[email protected]> wrote:

+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE

Quoted 8 lines

+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *

If you have SPDX license identifier then the text boilerplate is unnecessary and not desired.

#83 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

26/03/2019 20:06, Stephen Hemminger:

Quoted 34 lines
Quoted 22 lines · On Mon, 25 Mar 2019 23:02:34 -0700 Anand Rawat <[email protected]> wrote:

+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE

Quoted 8 lines

+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *

Quoted 2 lines

If you have SPDX license identifier then the text boilerplate is unnecessary and not desired.

Even better would be to get it as a dependency outside of DPDK. Where this code come from?
How other projects on Windows get it?

#84 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

Quoted 37 lines · Thomas Monjalon

26/03/2019 20:06, Stephen Hemminger:

Quoted 36 lines
Quoted 22 lines · On Mon, 25 Mar 2019 23:02:34 -0700 Anand Rawat <[email protected]> wrote:

+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE

Quoted 8 lines

+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *

If you have SPDX license identifier then the text boilerplate is unnecessary and not desired.

I think we'd still need the Copyright statement there, right?

Quoted 5 lines

Even better would be to get it as a dependency outside of DPDK. Where this code come from?
How other projects on Windows get it?

It comes from FreeBSD 12.0, specifically
https://github.com/freebsd/freebsd/blob/releng/12.0/sys/sys/queue.h

It has been modified such that only the parts used by DPDK (i.e. TAILQ) are implemented. The other stuff has been deleted. Windows does not have sys/queue.h, so we reproduce it here.

Would it better to have this as a dependency outside of DPDK? I think pulling a file from the internet and applying a patch (where we'd have to maintain a patch file inside of DPDK's repo anyway) would be overkill when we just need a few lines of code that will change very infrequently.

#85 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

26/03/2019 22:14, Jeff Shaw:

Quoted 8 lines · Thomas Monjalon
Quoted 3 lines

Even better would be to get it as a dependency outside of DPDK. Where this code come from?
How other projects on Windows get it?

It comes from FreeBSD 12.0, specifically
https://github.com/freebsd/freebsd/blob/releng/12.0/sys/sys/queue.h

Quoted 8 lines

It has been modified such that only the parts used by DPDK (i.e. TAILQ) are implemented. The other stuff has been deleted. Windows does not have sys/queue.h, so we reproduce it here.

Would it better to have this as a dependency outside of DPDK? I think pulling a file from the internet and applying a patch (where we'd have to maintain a patch file inside of DPDK's repo anyway) would be overkill when we just need a few lines of code that will change very infrequently.

We already try to get the libbsd dependency on Linux. Why not mandate libbsd for Windows?
It has this header file and a lot more:
https://gitlab.freedesktop.org/libbsd/libbsd/blob/master/include/bsd/sys/queue.h

Relying on libbsd may avoid copying other files for Windows port.

#86 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

Quoted 18 lines · Thomas Monjalon

26/03/2019 22:14, Jeff Shaw:

Quoted 8 lines · Thomas Monjalon
Quoted 3 lines

Even better would be to get it as a dependency outside of DPDK. Where this code come from?
How other projects on Windows get it?

It comes from FreeBSD 12.0, specifically
https://github.com/freebsd/freebsd/blob/releng/12.0/sys/sys/queue.h

Quoted 8 lines

It has been modified such that only the parts used by DPDK (i.e. TAILQ) are implemented. The other stuff has been deleted. Windows does not have sys/queue.h, so we reproduce it here.

Would it better to have this as a dependency outside of DPDK? I think pulling a file from the internet and applying a patch (where we'd have to maintain a patch file inside of DPDK's repo anyway) would be overkill when we just need a few lines of code that will change very infrequently.

Quoted 6 lines

We already try to get the libbsd dependency on Linux. Why not mandate libbsd for Windows?
It has this header file and a lot more:
https://gitlab.freedesktop.org/libbsd/libbsd/blob/master/include/bsd/sys/queue.h

Relying on libbsd may avoid copying other files for Windows port.

I like that idea, though it doesn't look like libbsd builds on Windows, do you know of a Windows version or one that doesn't depend on autotools to build?

#87 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

26/03/2019 22:54, Jeff Shaw:

Quoted 24 lines · Thomas Monjalon
Quoted 23 lines

26/03/2019 22:14, Jeff Shaw:

Quoted 8 lines · Thomas Monjalon
Quoted 3 lines

Even better would be to get it as a dependency outside of DPDK. Where this code come from?
How other projects on Windows get it?

It comes from FreeBSD 12.0, specifically
https://github.com/freebsd/freebsd/blob/releng/12.0/sys/sys/queue.h

Quoted 8 lines

It has been modified such that only the parts used by DPDK (i.e. TAILQ) are implemented. The other stuff has been deleted. Windows does not have sys/queue.h, so we reproduce it here.

Would it better to have this as a dependency outside of DPDK? I think pulling a file from the internet and applying a patch (where we'd have to maintain a patch file inside of DPDK's repo anyway) would be overkill when we just need a few lines of code that will change very infrequently.

We already try to get the libbsd dependency on Linux. Why not mandate libbsd for Windows?
It has this header file and a lot more:
https://gitlab.freedesktop.org/libbsd/libbsd/blob/master/include/bsd/sys/queue.h

Quoted 4 lines
Quoted 1 line

Relying on libbsd may avoid copying other files for Windows port.

I like that idea, though it doesn't look like libbsd builds on Windows, do you know of a Windows version or one that doesn't depend on autotools to build?

It seems libbsd is not packaged for Windows. May be worth to ask opinions to libbsd maintainers.

Please could you list which other headers are required for the Windows port?

#88 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

Quoted 27 lines · Thomas Monjalon

26/03/2019 22:54, Jeff Shaw:

Quoted 26 lines · Thomas Monjalon
Quoted 24 lines

26/03/2019 22:14, Jeff Shaw:

Quoted 8 lines · Thomas Monjalon
Quoted 3 lines

Even better would be to get it as a dependency outside of DPDK. Where this code come from?
How other projects on Windows get it?

It comes from FreeBSD 12.0, specifically
https://github.com/freebsd/freebsd/blob/releng/12.0/sys/sys/queue.h

Quoted 8 lines

It has been modified such that only the parts used by DPDK (i.e. TAILQ) are implemented. The other stuff has been deleted. Windows does not have sys/queue.h, so we reproduce it here.

Would it better to have this as a dependency outside of DPDK? I think pulling a file from the internet and applying a patch (where we'd have to maintain a patch file inside of DPDK's repo anyway) would be overkill when we just need a few lines of code that will change very infrequently.

We already try to get the libbsd dependency on Linux. Why not mandate libbsd for Windows?
It has this header file and a lot more:
https://gitlab.freedesktop.org/libbsd/libbsd/blob/master/include/bsd/sys/queue.h

Relying on libbsd may avoid copying other files for Windows port.

Quoted 7 lines
Quoted 2 lines

I like that idea, though it doesn't look like libbsd builds on Windows, do you know of a Windows version or one that doesn't depend on autotools to build?

It seems libbsd is not packaged for Windows. May be worth to ask opinions to libbsd maintainers.

Please could you list which other headers are required for the Windows port?

For helloworld the only one is sys/queue.h.

The dpdk-draft-windows repo has at least these (non-empty) ones:
dirent.h
getopt.h
net/ethernet.h
net/socket.h
netinet/in.h
netinet/tcp.h
pthread.h
rand48.h
sched.h
sys/_iovec.h
sys/_sockaddr_storage.h
sys/_termios.h
sys/_types.h
sys/cdefs.h
sys/mman.h
sys/netbsd/queue.h
sys/queue.h
sys/sysctl.h
syslog.h
termios.h
unistd.h

There will likely be more as more libraries are identified with dependencies on UNIX-like headers.

#89 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

26/03/2019 23:34, Jeff Shaw:

Quoted 61 lines · Thomas Monjalon
Quoted 27 lines

26/03/2019 22:54, Jeff Shaw:

Quoted 26 lines · Thomas Monjalon
Quoted 24 lines

26/03/2019 22:14, Jeff Shaw:

Quoted 8 lines · Thomas Monjalon
Quoted 3 lines

Even better would be to get it as a dependency outside of DPDK. Where this code come from?
How other projects on Windows get it?

It comes from FreeBSD 12.0, specifically
https://github.com/freebsd/freebsd/blob/releng/12.0/sys/sys/queue.h

Quoted 8 lines

It has been modified such that only the parts used by DPDK (i.e. TAILQ) are implemented. The other stuff has been deleted. Windows does not have sys/queue.h, so we reproduce it here.

Would it better to have this as a dependency outside of DPDK? I think pulling a file from the internet and applying a patch (where we'd have to maintain a patch file inside of DPDK's repo anyway) would be overkill when we just need a few lines of code that will change very infrequently.

We already try to get the libbsd dependency on Linux. Why not mandate libbsd for Windows?
It has this header file and a lot more:
https://gitlab.freedesktop.org/libbsd/libbsd/blob/master/include/bsd/sys/queue.h

Relying on libbsd may avoid copying other files for Windows port.

Quoted 7 lines
Quoted 2 lines

I like that idea, though it doesn't look like libbsd builds on Windows, do you know of a Windows version or one that doesn't depend on autotools to build?

It seems libbsd is not packaged for Windows. May be worth to ask opinions to libbsd maintainers.

Please could you list which other headers are required for the Windows port?

For helloworld the only one is sys/queue.h.

The dpdk-draft-windows repo has at least these (non-empty) ones:
dirent.h
getopt.h
net/ethernet.h
net/socket.h
netinet/in.h
netinet/tcp.h
pthread.h
rand48.h
sched.h
sys/_iovec.h
sys/_sockaddr_storage.h
sys/_termios.h
sys/_types.h
sys/cdefs.h
sys/mman.h
sys/netbsd/queue.h
sys/queue.h
sys/sysctl.h
syslog.h
termios.h
unistd.h

Quoted 2 lines

There will likely be more as more libraries are identified with dependencies on UNIX-like headers.

I would like we find a good solution for these headers. How other cross-platform projects are getting such dependencies? Is Cygwin a solution?

#90 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

Quoted 62 lines · Thomas Monjalon

26/03/2019 23:34, Jeff Shaw:

Quoted 61 lines · Thomas Monjalon
Quoted 27 lines

26/03/2019 22:54, Jeff Shaw:

Quoted 26 lines · Thomas Monjalon
Quoted 24 lines

26/03/2019 22:14, Jeff Shaw:

Quoted 8 lines · Thomas Monjalon
Quoted 3 lines

Even better would be to get it as a dependency outside of DPDK. Where this code come from?
How other projects on Windows get it?

It comes from FreeBSD 12.0, specifically
https://github.com/freebsd/freebsd/blob/releng/12.0/sys/sys/queue.h

Quoted 8 lines

It has been modified such that only the parts used by DPDK (i.e. TAILQ) are implemented. The other stuff has been deleted. Windows does not have sys/queue.h, so we reproduce it here.

Would it better to have this as a dependency outside of DPDK? I think pulling a file from the internet and applying a patch (where we'd have to maintain a patch file inside of DPDK's repo anyway) would be overkill when we just need a few lines of code that will change very infrequently.

We already try to get the libbsd dependency on Linux. Why not mandate libbsd for Windows?
It has this header file and a lot more:
https://gitlab.freedesktop.org/libbsd/libbsd/blob/master/include/bsd/sys/queue.h

Relying on libbsd may avoid copying other files for Windows port.

Quoted 7 lines
Quoted 2 lines

I like that idea, though it doesn't look like libbsd builds on Windows, do you know of a Windows version or one that doesn't depend on autotools to build?

It seems libbsd is not packaged for Windows. May be worth to ask opinions to libbsd maintainers.

Please could you list which other headers are required for the Windows port?

For helloworld the only one is sys/queue.h.

The dpdk-draft-windows repo has at least these (non-empty) ones:
dirent.h
getopt.h
net/ethernet.h
net/socket.h
netinet/in.h
netinet/tcp.h
pthread.h
rand48.h
sched.h
sys/_iovec.h
sys/_sockaddr_storage.h
sys/_termios.h
sys/_types.h
sys/cdefs.h
sys/mman.h
sys/netbsd/queue.h
sys/queue.h
sys/sysctl.h
syslog.h
termios.h
unistd.h

Quoted 4 lines
Quoted 2 lines

There will likely be more as more libraries are identified with dependencies on UNIX-like headers.

I would like we find a good solution for these headers.

I agree. I think the EAL is supposed to do this, however the current implementation generally assums a UNIX OS under the EAL. The libbsd might be a possiblity.

Quoted 1 line

How other cross-platform projects are getting such dependencies?

One example is Python. I just briefly reviewed the code and they go through great lengths to abstract the OS and implement custom, OS independent layers wherever required (e.g. sockets, getopt). See Modules/posixmodule.c for a 14K LOC example.

Another example is Nginx. The underlying OS is always abstracted with disparate implementations for, e.g. unix & windows. See src/os/unix and src/os/win32. An example is the "socket()" call on unix, nginx "core" would call "ngx_socket()" which is a macro that is defined to use "WSASocketW" on windows, and "socket" on unix.

Quoted 1 line

Is Cygwin a solution?

I think the goal is to be a native Windows application.

#91 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

27/03/2019 00:43, Jeff Shaw:

Quoted 63 lines · Thomas Monjalon
Quoted 62 lines

26/03/2019 23:34, Jeff Shaw:

Quoted 61 lines · Thomas Monjalon
Quoted 27 lines

26/03/2019 22:54, Jeff Shaw:

Quoted 26 lines · Thomas Monjalon
Quoted 24 lines

26/03/2019 22:14, Jeff Shaw:

Quoted 8 lines · Thomas Monjalon
Quoted 3 lines

Even better would be to get it as a dependency outside of DPDK. Where this code come from?
How other projects on Windows get it?

It comes from FreeBSD 12.0, specifically
https://github.com/freebsd/freebsd/blob/releng/12.0/sys/sys/queue.h

Quoted 8 lines

It has been modified such that only the parts used by DPDK (i.e. TAILQ) are implemented. The other stuff has been deleted. Windows does not have sys/queue.h, so we reproduce it here.

Would it better to have this as a dependency outside of DPDK? I think pulling a file from the internet and applying a patch (where we'd have to maintain a patch file inside of DPDK's repo anyway) would be overkill when we just need a few lines of code that will change very infrequently.

We already try to get the libbsd dependency on Linux. Why not mandate libbsd for Windows?
It has this header file and a lot more:
https://gitlab.freedesktop.org/libbsd/libbsd/blob/master/include/bsd/sys/queue.h

Relying on libbsd may avoid copying other files for Windows port.

Quoted 7 lines
Quoted 2 lines

I like that idea, though it doesn't look like libbsd builds on Windows, do you know of a Windows version or one that doesn't depend on autotools to build?

It seems libbsd is not packaged for Windows. May be worth to ask opinions to libbsd maintainers.

Please could you list which other headers are required for the Windows port?

For helloworld the only one is sys/queue.h.

The dpdk-draft-windows repo has at least these (non-empty) ones:
dirent.h
getopt.h
net/ethernet.h
net/socket.h
netinet/in.h
netinet/tcp.h
pthread.h
rand48.h
sched.h
sys/_iovec.h
sys/_sockaddr_storage.h
sys/_termios.h
sys/_types.h
sys/cdefs.h
sys/mman.h
sys/netbsd/queue.h
sys/queue.h
sys/sysctl.h
syslog.h
termios.h
unistd.h

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

There will likely be more as more libraries are identified with dependencies on UNIX-like headers.

I would like we find a good solution for these headers.

I agree. I think the EAL is supposed to do this, however the current implementation generally assums a UNIX OS under the EAL. The libbsd might be a possiblity.

Yes, EAL is supposed to be the layer hiding the OS specifics. It would be interesting to check how much libbsd may help EAL.

Quoted 10 lines
Quoted 1 line

How other cross-platform projects are getting such dependencies?

One example is Python. I just briefly reviewed the code and they go through great lengths to abstract the OS and implement custom, OS independent layers wherever required (e.g. sockets, getopt). See Modules/posixmodule.c for a 14K LOC example.

Another example is Nginx. The underlying OS is always abstracted with disparate implementations for, e.g. unix & windows. See src/os/unix and src/os/win32. An example is the "socket()" call on unix, nginx "core" would call "ngx_socket()" which is a macro that is defined to use "WSASocketW" on windows, and "socket" on unix.

Yes we may need to introduce more wrappers.

Quoted 3 lines
Quoted 1 line

Is Cygwin a solution?

I think the goal is to be a native Windows application.

Yes

#92 lore raw

Re: [PATCH v5 4/8] eal: sys/queue.h implementation for windows

In reply to Stephen Hemminger
Quoted 34 lines · Stephen Hemminger
Quoted 22 lines · On Mon, 25 Mar 2019 23:02:34 -0700 Anand Rawat <[email protected]> wrote:

+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE

Quoted 8 lines

+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *

Quoted 3 lines

If you have SPDX license identifier then the text boilerplate is unnecessary and not desired.

The information I have received about the editing license text is to leave it as it is. Can continue to have boiler plate text until there is more clarity on it?

Signature · 1 line
Anand Rawat
#93 lore raw

PATCH v5 5/8 eal: add headers for compatibility with windows environment

In reply to Anand Rawat

Added headers to support windows environment for common source. These headers will have windows specific implementions of the system library apis provided in linux and freebsd.

---
 lib/librte_eal/windows/eal/include/fnmatch.h | 43 ++++++++++
 lib/librte_eal/windows/eal/include/pthread.h | 22 ++++++
 lib/librte_eal/windows/eal/include/regex.h   | 83 ++++++++++++++++++++
 lib/librte_eal/windows/eal/include/sched.h   | 41 ++++++++++
 lib/librte_eal/windows/eal/include/unistd.h  |  8 ++
 5 files changed, 197 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
lib/librte_eal/windows/eal/include/fnmatch.h new file +43 -0
new file mode 100644
index 000000000..c2e2131b1
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FNM_NOMATCH 1
+
+/**
+ * This function is used for searhing a given string source
+ * with the given regular expression pattern.
+ *
+ * @param pattern
+ *	regular expression notation decribing the pattern to match
+ *
+ * @param string
+ *	source string to searcg for the pattern
+ *
+ * @param flag
+ *	containing information about the pattern
+ *
+ * @return
+ *	if the pattern is found then return 0 or else FNM_NOMATCH
+ */
+static inline int fnmatch(__rte_unused const char *pattern,
+		__rte_unused const char *string,
+		__rte_unused int flags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return FNM_NOMATCH;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FNMATCH_H_ */
lib/librte_eal/windows/eal/include/pthread.h new file +22 -0
new file mode 100644
index 000000000..a62b25bf6
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* defining pthread_t type on windows */
+typedef uintptr_t pthread_t;
+
+/* defining pthread_attr_t type on windows */
+typedef void *pthread_attr_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PTHREAD_H_ */
lib/librte_eal/windows/eal/include/regex.h new file +83 -0

83 lines not on this page · raw message

lib/librte_eal/windows/eal/include/sched.h new file +41 -0

41 lines not on this page · raw message

lib/librte_eal/windows/eal/include/unistd.h new file +8 -0
new file mode 100644
index 000000000..fe3d9b579
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+/* Added to support common code on windows */
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+#endif /* _UNISTD_H_ */
Signature · 1 line
2.17.1.windows.2
Reviewed-by Jeff Shaw Reviewed-by Ranjit Menon Acked-by on v5 5/8
#94 lore raw

Re: [PATCH v5 5/8] eal: add headers for compatibility with windows environment

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment

Added headers to support windows environment for common source.
These headers will have windows specific implementions of the system library apis provided in linux and freebsd.

---
 lib/librte_eal/windows/eal/include/fnmatch.h | 43 ++++++++++  lib/librte_eal/windows/eal/include/pthread.h | 22 ++++++
 lib/librte_eal/windows/eal/include/regex.h   | 83 ++++++++++++++++++++
 lib/librte_eal/windows/eal/include/sched.h   | 41 ++++++++++
 lib/librte_eal/windows/eal/include/unistd.h  |  8 ++
 5 files changed, 197 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
lib/librte_eal/windows/eal/include/fnmatch.h new file +43 -0
new file mode 100644
index 000000000..c2e2131b1
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FNM_NOMATCH 1
+
+/**
+ * This function is used for searhing a given string source
+ * with the given regular expression pattern.
+ *
+ * @param pattern
+ *	regular expression notation decribing the pattern to match
+ *
+ * @param string
+ *	source string to searcg for the pattern
+ *
+ * @param flag
+ *	containing information about the pattern
+ *
+ * @return
+ *	if the pattern is found then return 0 or else FNM_NOMATCH
+ */
+static inline int fnmatch(__rte_unused const char *pattern,
+		__rte_unused const char *string,
+		__rte_unused int flags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return FNM_NOMATCH;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FNMATCH_H_ */
lib/librte_eal/windows/eal/include/pthread.h new file +21 -0
new file mode 100644
index 000000000..a62b25bf6
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* defining pthread_t type on windows */ typedef uintptr_t pthread_t;
+
+/* defining pthread_attr_t type on windows */ typedef void 
+*pthread_attr_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PTHREAD_H_ */
lib/librte_eal/windows/eal/include/regex.h new file +79 -0

79 lines not on this page · raw message

lib/librte_eal/windows/eal/include/sched.h new file +41 -0

41 lines not on this page · raw message

lib/librte_eal/windows/eal/include/unistd.h new file +6 -0
new file mode 100644
index 000000000..fe3d9b579
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+/* Added to support common code on windows */ #ifndef _UNISTD_H_ 
+#define _UNISTD_H_ #endif /* _UNISTD_H_ */

--
2.17.1.windows.2

#95 lore raw

PATCH v5 6/8 eal: add minimum viable code for eal on windows

In reply to Anand Rawat

Add windows specific logic for eal.c, eal_lcore.c, eal_debug.c and eal_thread.c. Updated header files to contain suitable function declaractions.

---
 lib/librte_eal/windows/eal/eal.c              |  76 ++++++++-
 lib/librte_eal/windows/eal/eal_debug.c        |  14 +-
 lib/librte_eal/windows/eal/eal_lcore.c        | 104 ++++++++++---
 lib/librte_eal/windows/eal/eal_thread.c       | 147 +++++++++++++++++-
 lib/librte_eal/windows/eal/include/regex.h    |   2 +
 .../windows/eal/include/rte_windows.h         |  20 +++
 6 files changed, 331 insertions(+), 32 deletions(-)
lib/librte_eal/windows/eal/eal.c +73 -3
index 13e41ea30..ce460481f 100644
@@ -2,13 +2,83 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <io.h>
+#include <fcntl.h>
+#include <rte_debug.h>
+#include <rte_eal.h>
+#include <rte_errno.h>
+#include <rte_lcore.h>
+#include <eal_thread.h>
+#include <eal_private.h>
+
+/* Address of global and public configuration */
+static struct rte_config rte_config;
+
+/* internal configuration (per-core) */
+struct lcore_config lcore_config[RTE_MAX_LCORE];
+
+/* Return a pointer to the configuration structure */
+struct rte_config *
+rte_eal_get_configuration(void)
+{
+	return &rte_config;
+}
+
+static int
+sync_func(void *arg __rte_unused)
+{
+	return 0;
+}
+
+static void
+rte_eal_init_alert(const char *msg)
+{
+	fprintf(stderr, "EAL: FATAL: %s\n", msg);
+	RTE_LOG(ERR, EAL, "%s\n", msg);
+}
 
  /* Launch threads, called at application init(). */
 int
 rte_eal_init(int argc __rte_unused, char **argv __rte_unused)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	int i;
+
+	/* create a map of all processors in the system */
+	eal_create_cpu_map();
+
+	if (rte_eal_cpu_init() < 0) {
+		rte_eal_init_alert("Cannot detect lcores.");
+		rte_errno = ENOTSUP;
+		return -1;
+	}
+
+	eal_thread_init_master(rte_config.master_lcore);
+
+	RTE_LCORE_FOREACH_SLAVE(i) {
+
+		/*
+		 * create communication pipes between master thread
+		 * and children
+		 */
+		if (_pipe(lcore_config[i].pipe_master2slave,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");
+		if (_pipe(lcore_config[i].pipe_slave2master,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");
+
+		lcore_config[i].state = WAIT;
+
+		/* create a thread for each lcore */
+		if (eal_thread_create(&lcore_config[i].thread_id) != 0)
+			rte_panic("Cannot create thread\n");
+	}
+
+	/*
+	 * Launch a dummy function on all slave lcores, so that master lcore
+	 * knows they are all ready when this function returns.
+	 */
+	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
+	rte_eal_mp_wait_lcore();
 	return 0;
 }
lib/librte_eal/windows/eal/eal_debug.c +9 -5
index 6e07fe10c..edcf257cc 100644
@@ -2,14 +2,18 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdarg.h>
+#include <rte_log.h>
 
  /* call abort(), it will generate a coredump if enabled */
 void
-__rte_panic(const char *funcname __rte_unused,
-		const char *format __rte_unused, ...)
+__rte_panic(const char *funcname, const char *format, ...)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	va_list ap;
+
+	rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n", funcname);
+	va_start(ap, format);
+	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
+	va_end(ap);
 	abort();
 }
lib/librte_eal/windows/eal/eal_lcore.c +86 -18

117 lines not on this page · raw message

lib/librte_eal/windows/eal/eal_thread.c +141 -6

158 lines not on this page · raw message

lib/librte_eal/windows/eal/include/regex.h +2 -0
index daa102f74..412b4edc5 100644
@@ -12,6 +12,8 @@ extern "C" {
 #define REG_NOMATCH 1
 #define REG_ESPACE 12
 
+#include <rte_common.h>
+
 /* defining regex_t for windows */
 typedef void *regex_t;
 /* defining regmatch_t for windows */
lib/librte_eal/windows/eal/include/rte_windows.h +20 -0
index af24ef39f..46146e59b 100644
@@ -9,7 +9,9 @@
 extern "C" {
 #endif
 
+#include <Windows.h>
 #include <BaseTsd.h>
+#include <pthread.h>
 
 /* macro substitution for windows supported strerror_r */
 #define strerror_r(a, b, c) strerror_s(b, c, a)
@@ -23,6 +25,24 @@ typedef SSIZE_T ssize_t;
 /* macro substitution for windows supported strtok_r */
 #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
 
+/**
+ * Create a thread.
+ * This function is private to EAL.
+ *
+ * @param thread
+ *   The location to store the thread id if successful.
+ * @return
+ *   0 for success, -1 if the thread is not created.
+ */
+int eal_thread_create(pthread_t *thread);
+
+/**
+ * Create a map of processors and cores on the system.
+ * This function is private to EAL.
+ *
+ */
+void eal_create_cpu_map(void);
+
 #ifdef __cplusplus
 }
 #endif
Signature · 1 line
2.17.1.windows.2
Reviewed-by Jeff Shaw Reviewed-by Ranjit Menon Acked-by on v5 6/8
#96 lore raw

Re: [PATCH v5 6/8] eal: add minimum viable code for eal on windows

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5 6/8] eal: add minimum viable code for eal on windows

Add windows specific logic for eal.c, eal_lcore.c, eal_debug.c and eal_thread.c. Updated header files to contain suitable function declaractions.

---
 lib/librte_eal/windows/eal/eal.c              |  76 ++++++++-
 lib/librte_eal/windows/eal/eal_debug.c        |  14 +-
 lib/librte_eal/windows/eal/eal_lcore.c        | 104 ++++++++++---
 lib/librte_eal/windows/eal/eal_thread.c       | 147 +++++++++++++++++-
 lib/librte_eal/windows/eal/include/regex.h    |   2 +
 .../windows/eal/include/rte_windows.h         |  20 +++
 6 files changed, 331 insertions(+), 32 deletions(-)
lib/librte_eal/windows/eal/eal.c +73 -3
index 13e41ea30..ce460481f 100644
@@ -2,13 +2,83 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <io.h>
+#include <fcntl.h>
+#include <rte_debug.h>
+#include <rte_eal.h>
+#include <rte_errno.h>
+#include <rte_lcore.h>
+#include <eal_thread.h>
+#include <eal_private.h>
+
+/* Address of global and public configuration */ static struct 
+rte_config rte_config;
+
+/* internal configuration (per-core) */ struct lcore_config 
+lcore_config[RTE_MAX_LCORE];
+
+/* Return a pointer to the configuration structure */ struct rte_config 
+*
+rte_eal_get_configuration(void)
+{
+	return &rte_config;
+}
+
+static int
+sync_func(void *arg __rte_unused)
+{
+	return 0;
+}
+
+static void
+rte_eal_init_alert(const char *msg)
+{
+	fprintf(stderr, "EAL: FATAL: %s\n", msg);
+	RTE_LOG(ERR, EAL, "%s\n", msg);
+}
 
  /* Launch threads, called at application init(). */  int  rte_eal_init(int argc __rte_unused, char **argv __rte_unused)  {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	int i;
+
+	/* create a map of all processors in the system */
+	eal_create_cpu_map();
+
+	if (rte_eal_cpu_init() < 0) {
+		rte_eal_init_alert("Cannot detect lcores.");
+		rte_errno = ENOTSUP;
+		return -1;
+	}
+
+	eal_thread_init_master(rte_config.master_lcore);
+
+	RTE_LCORE_FOREACH_SLAVE(i) {
+
+		/*
+		 * create communication pipes between master thread
+		 * and children
+		 */
+		if (_pipe(lcore_config[i].pipe_master2slave,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");
+		if (_pipe(lcore_config[i].pipe_slave2master,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");
+
+		lcore_config[i].state = WAIT;
+
+		/* create a thread for each lcore */
+		if (eal_thread_create(&lcore_config[i].thread_id) != 0)
+			rte_panic("Cannot create thread\n");
+	}
+
+	/*
+	 * Launch a dummy function on all slave lcores, so that master lcore
+	 * knows they are all ready when this function returns.
+	 */
+	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
+	rte_eal_mp_wait_lcore();
 	return 0;
 }
lib/librte_eal/windows/eal/eal_debug.c +9 -4
index 6e07fe10c..edcf257cc 100644
@@ -2,14 +2,18 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdarg.h>
+#include <rte_log.h>
 
  /* call abort(), it will generate a coredump if enabled */  void -__rte_panic(const char *funcname __rte_unused,
-		const char *format __rte_unused, ...)
+__rte_panic(const char *funcname, const char *format, ...)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	va_list ap;
+
+	rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n", funcname);
+	va_start(ap, format);
+	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
+	va_end(ap);
 	abort();
 }
lib/librte_eal/windows/eal/eal_lcore.c +79 -16

108 lines not on this page · raw message

lib/librte_eal/windows/eal/eal_thread.c +139 -6

156 lines not on this page · raw message

lib/librte_eal/windows/eal/include/regex.h +2 -0
index daa102f74..412b4edc5 100644
@@ -12,6 +12,8 @@ extern "C" {
 #define REG_NOMATCH 1
 #define REG_ESPACE 12
 
+#include <rte_common.h>
+
 /* defining regex_t for windows */
 typedef void *regex_t;
 /* defining regmatch_t for windows */
lib/librte_eal/windows/eal/include/rte_windows.h +2 -0
index af24ef39f..46146e59b 100644
@@ -9,7 +9,9 @@
 extern "C" {
 #endif
 
+#include <Windows.h>
 #include <BaseTsd.h>
+#include <pthread.h>
 
 /* macro substitution for windows supported strerror_r */  #define strerror_r(a, b, c) strerror_s(b, c, a) @@ -23,6 +25,24 @@ typedef SSIZE_T ssize_t;
 /* macro substitution for windows supported strtok_r */  #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)

+/**
+ * Create a thread.
+ * This function is private to EAL.
+ *
+ * @param thread
+ * The location to store the thread id if successful.
+ * @return
+ * 0 for success, -1 if the thread is not created.
+ */
+int eal_thread_create(pthread_t *thread);
+
+/**
+ * Create a map of processors and cores on the system.
+ * This function is private to EAL.
+ *
+ */
+void eal_create_cpu_map(void);
+
#ifdef __cplusplus
}
#endif
--
2.17.1.windows.2

#97 lore raw

PATCH v5 7/8 doc: add documention for windows

In reply to Anand Rawat

Added documentation to build helloworld example
on windows using meson and clang. Updated the
maintainers list to include windows maintainers.

---
 MAINTAINERS                           |  7 +++
 doc/guides/index.rst                  |  3 +-
 doc/guides/windows_gsg/build_dpdk.rst | 73 +++++++++++++++++++++++++++
 doc/guides/windows_gsg/index.rst      | 14 +++++
 doc/guides/windows_gsg/intro.rst      | 20 ++++++++
 5 files changed, 116 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
MAINTAINERS +7 -0
index 452b8eb82..0080c8f4c 100644
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <[email protected]>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <[email protected]>
+M: Omar Cardona <[email protected]>
+M: Anand Rawat <[email protected]>
+M: Ranjit Menon <[email protected]>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
doc/guides/index.rst +2 -1
index 8a9ed65c8..8a1601b27 100644
@@ -1,5 +1,5 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2010-2014 Intel Corporation.
+    Copyright(c) 2010-2019 Intel Corporation.
 
 DPDK documentation
 ==================
@@ -9,6 +9,7 @@ DPDK documentation
 
    linux_gsg/index
    freebsd_gsg/index
+   windows_gsg/index
    sample_app_ug/index
    prog_guide/index
    howto/index
doc/guides/windows_gsg/build_dpdk.rst new file +73 -0

73 lines not on this page · raw message

doc/guides/windows_gsg/index.rst new file +14 -0
new file mode 100644
index 000000000..d9b7990a8
@@ -0,0 +1,14 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+.. _windows_gsg:
+
+Getting Started Guide for Windows
+=================================
+
+.. toctree::
+    :maxdepth: 2
+    :numbered:
+
+    intro
+    build_dpdk
doc/guides/windows_gsg/intro.rst new file +20 -0
new file mode 100644
index 000000000..a0285732d
@@ -0,0 +1,20 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Introduction
+============
+
+This document contains instructions for installing and configuring the Data
+Plane Development Kit (DPDK) software. The document describes how to compile
+and run a DPDK application in a Windows* OS application environment, without
+going deeply into detail.
+
+\*Other names and brands may be claimed as the property of others.
+
+Limitations
+===========
+
+DPDK for Windows is currently a work in progress. Not all DPDK source files
+compile. Support is being added in pieces so as to limit the overall scope
+of any individual patch series. The goal is to be able to run any DPDK
+application natively on Windows.
Signature · 1 line
2.17.1.windows.2
Tested-by on v5 7/8
#98 lore raw

Re: [PATCH v5 7/8] doc: add documention for windows

Quoted 8 lines · Anand Rawat

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

Verified the build steps.

#99 lore raw

Re: [PATCH v5 7/8] doc: add documention for windows

In reply to Anand Rawat
Quoted 4 lines · Anand Rawat

Added documentation to build helloworld example
on windows using meson and clang. Updated the
maintainers list to include windows maintainers.

Can you fix the patch subject ?

Signature · 1 line
David Marchand
#100 lore raw

Re: [PATCH v5 7/8] doc: add documention for windows

Quoted 11 lines · David Marchand

On Tue, Mar 26, 2019 at 7:04 AM Anand Rawat <[email protected] <mailto:[email protected]>> wrote:

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

Can you fix the patch subject ?

Signature · 1 line
David Marchand

Will correct in the next version, Thanks.

Signature · 1 line
Anand Rawat
Reviewed-by Jeff Shaw Reviewed-by Ranjit Menon Acked-by on v5 7/8
#101 lore raw

Re: [PATCH v5 7/8] doc: add documention for windows

In reply to Anand Rawat

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows

Added documentation to build helloworld example on windows using meson and clang. Updated the maintainers list to include windows maintainers.

---
 MAINTAINERS                           |  7 +++
 doc/guides/index.rst                  |  3 +-
 doc/guides/windows_gsg/build_dpdk.rst | 73 +++++++++++++++++++++++++++
 doc/guides/windows_gsg/index.rst      | 14 +++++
 doc/guides/windows_gsg/intro.rst      | 20 ++++++++
 5 files changed, 116 insertions(+), 1 deletion(-)  create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst  create mode 100644 doc/guides/windows_gsg/intro.rst
MAINTAINERS +7 -0
index 452b8eb82..0080c8f4c 100644
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <[email protected]>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <[email protected]>
+M: Omar Cardona <[email protected]>
+M: Anand Rawat <[email protected]>
+M: Ranjit Menon <[email protected]>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
doc/guides/index.rst +2 -1
@@ -1,5 +1,5 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2010-2014 Intel Corporation.
+    Copyright(c) 2010-2019 Intel Corporation.
 
 DPDK documentation
 ==================
@@ -9,6 +9,7 @@ DPDK documentation
 
    linux_gsg/index
    freebsd_gsg/index
+   windows_gsg/index
    sample_app_ug/index
    prog_guide/index
    howto/index
doc/guides/windows_gsg/build_dpdk.rst new file +73 -0

73 lines not on this page · raw message

+
+Navigate to the build directory and run dpdk-helloworld.exe. +
+.. code-block:: console
+

+    cd C:\Users\me\dpdk\build
+    helloworld.exe
+    hello from core 1
+    hello from core 3
+    hello from core 0
+    hello from core 2
doc/guides/windows_gsg/index.rst new file +14 -0
new file mode 100644
index 000000000..d9b7990a8
@@ -0,0 +1,14 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+.. _windows_gsg:
+
+Getting Started Guide for Windows
+=================================
+
+.. toctree::
+    :maxdepth: 2
+    :numbered:
+
+    intro
+    build_dpdk
doc/guides/windows_gsg/intro.rst new file +20 -0
new file mode 100644
index 000000000..a0285732d
@@ -0,0 +1,20 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Introduction
+============
+
+This document contains instructions for installing and configuring the 
+Data Plane Development Kit (DPDK) software. The document describes how 
+to compile and run a DPDK application in a Windows* OS application 
+environment, without going deeply into detail.
+
+\*Other names and brands may be claimed as the property of others.
+
+Limitations
+===========
+
+DPDK for Windows is currently a work in progress. Not all DPDK source 
+files compile. Support is being added in pieces so as to limit the 
+overall scope of any individual patch series. The goal is to be able to 
+run any DPDK application natively on Windows.

--
2.17.1.windows.2

#102 lore raw

PATCH v5 8/8 build: meson changes to build on windows

In reply to Anand Rawat

Added meson workarounds to build helloworld on windows. Windows currently only supports kvargs and eal libraries. This change restricts the build flow to supported libraries only.

---
 app/meson.build                   |  6 +++++-
 buildtools/meson.build            |  6 +++++-
 drivers/meson.build               |  6 +++++-
 examples/meson.build              |  6 +++++-
 kernel/windows/meson.build        |  4 ++++
 lib/librte_eal/common/meson.build | 14 +++++++++-----
 lib/meson.build                   |  4 ++++
 7 files changed, 37 insertions(+), 9 deletions(-)
 create mode 100644 kernel/windows/meson.build
app/meson.build +5 -1
index aa353f657..e949624b7 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 apps = [
 	'pdump',
buildtools/meson.build +5 -1
index cdd38ed24..0209bec8f 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 subdir('pmdinfogen')
 
drivers/meson.build +5 -1
index 69d0556d3..33d1503f3 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 # Defines the order in which the drivers are buit.
 driver_classes = ['common',
examples/meson.build +5 -1
index af81c762e..bc1430fa8 100644
@@ -35,7 +35,11 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() != 'windows'
+		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	else
+		deps = ['eal'] # only supported lib on windows currently
+	endif
 	subdir(example)
 
 	if build
kernel/windows/meson.build new file +4 -0
new file mode 100644
index 000000000..c4a2a656a
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+# stub file for supporting windows logic in future release
\ No newline at end of file
lib/librte_eal/common/meson.build +9 -5
index 5ecae0b1f..e9021c00c 100644
@@ -1,23 +1,26 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 eal_inc += include_directories('.', 'include',
 		join_paths('include/arch', arch_subdir))
 
 common_objs = []
+common_sources = files(
+		'eal_common_errno.c',
+		'eal_common_launch.c',
+		'eal_common_lcore.c',
+		'eal_common_log.c'
+	)
+if host_machine.system() != 'windows'
 common_sources = files(
 	'eal_common_bus.c',
 	'eal_common_cpuflags.c',
 	'eal_common_class.c',
 	'eal_common_devargs.c',
 	'eal_common_dev.c',
-	'eal_common_errno.c',
 	'eal_common_fbarray.c',
 	'eal_common_hexdump.c',
 	'eal_common_hypervisor.c',
-	'eal_common_launch.c',
-	'eal_common_lcore.c',
-	'eal_common_log.c',
 	'eal_common_memalloc.c',
 	'eal_common_memory.c',
 	'eal_common_memzone.c',
@@ -38,6 +41,7 @@ common_sources = files(
 	'rte_reciprocal.c',
 	'rte_service.c'
 )
+endif
 
 # get architecture specific sources and objs
 eal_common_arch_sources = []
lib/meson.build +4 -0
index 1fe1b4677..8d7711090 100644
@@ -30,6 +30,10 @@ libraries = [
 	# flow_classify lib depends on pkt framework table lib
 	'flow_classify', 'bpf', 'telemetry']
 
+if host_machine.system() == 'windows'
+	libraries = ['kvargs','eal'] # override libraries for windows
+endif
+
 default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
Signature · 1 line
2.17.1.windows.2
Reviewed-by Jeff Shaw Reviewed-by Ranjit Menon Acked-by on v5 8/8
#103 lore raw

Re: [PATCH v5 8/8] build: meson changes to build on windows

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5 8/8] build: meson changes to build on windows

Added meson workarounds to build helloworld on windows. Windows currently only supports kvargs and eal libraries. This change restricts the build flow to supported libraries only.

---
 app/meson.build                   |  6 +++++-
 buildtools/meson.build            |  6 +++++-
 drivers/meson.build               |  6 +++++-
 examples/meson.build              |  6 +++++-
 kernel/windows/meson.build        |  4 ++++
 lib/librte_eal/common/meson.build | 14 +++++++++-----
 lib/meson.build                   |  4 ++++
 7 files changed, 37 insertions(+), 9 deletions(-)  create mode 100644 kernel/windows/meson.build
app/meson.build +5 -0
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 apps = [
 	'pdump',
buildtools/meson.build +5 -0
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 subdir('pmdinfogen')
 
drivers/meson.build +5 -0
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 # Defines the order in which the drivers are buit.
 driver_classes = ['common',
examples/meson.build +5 -1
@@ -35,7 +35,11 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() != 'windows'
+		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	else
+		deps = ['eal'] # only supported lib on windows currently
+	endif
 	subdir(example)
 
 	if build
kernel/windows/meson.build new file +4 -0
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel 
+Corporation
+
+# stub file for supporting windows logic in future release
\ No newline at end of file
lib/librte_eal/common/meson.build +13 -5
index 5ecae0b1f..e9021c00c 100644
@@ -1,23 +1,26 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 eal_inc += include_directories('.', 'include',
 		join_paths('include/arch', arch_subdir))
 
 common_objs = []
+common_sources = files(
+		'eal_common_errno.c',
+		'eal_common_launch.c',
+		'eal_common_lcore.c',
+		'eal_common_log.c'
+	)
+if host_machine.system() != 'windows'
 common_sources = files(
 	'eal_common_bus.c',
 	'eal_common_cpuflags.c',
 	'eal_common_class.c',
 	'eal_common_devargs.c',
 	'eal_common_dev.c',
-	'eal_common_errno.c',
 	'eal_common_fbarray.c',
 	'eal_common_hexdump.c',
 	'eal_common_hypervisor.c',
-	'eal_common_launch.c',
-	'eal_common_lcore.c',
-	'eal_common_log.c',
 	'eal_common_memalloc.c',
 	'eal_common_memory.c',
 	'eal_common_memzone.c',
@@ -38,6 +41,7 @@ common_sources = files(
 	'rte_reciprocal.c',
 	'rte_service.c'
 )
+endif
 
 # get architecture specific sources and objs  eal_common_arch_sources = [] diff --git a/lib/meson.build b/lib/meson.build index 1fe1b4677..8d7711090 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -30,6 +30,10 @@ libraries = [
 	# flow_classify lib depends on pkt framework table lib
 	'flow_classify', 'bpf', 'telemetry']
 
+if host_machine.system() == 'windows'
+	libraries = ['kvargs','eal'] # override libraries for windows endif
+
 default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'

--
2.17.1.windows.2

Acked-by on the v5 series
#104 lore raw
In reply to Anand Rawat

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5 0/8] HelloWorld example for windows

Includes Windows-specific EAL changes and meson changes to build the code on windows.

v5 Changes:
1. Reduced meson workrounds for windows.
2. Updated documention to include details about buildtool options

v4 Changes:
1. Exposed more functions for eal DLL in the module definition file 2. Moved disabling meson logic to sub directories

v3 Changes:
1. Separated meson workarounds from the essential code changes 2. Added support for kvargs 3. Updated meson for building DLL on windows using DEF files 4. Fixed documentation for html links and linker dependency 5. Added comments for windows header and source files

v2 Changes:
1. Incorporated reviews from v1.
2. Fixed license period for updated files.
3. Renamed 'winapp' folder to 'windows'.
4. Cleaned unneeded meson changes.
5. Fixed code style warnings.
6. Added maintainers information for windows branch

notes:
*patch 8/8 contains meson workarounds to build helloworld on windows, which will later be a part of the draft repository

*command-line parsing is not a part of this version as a result lcore mask is currently not supported.

*kernel modules and documentation can not be built on windows currently and should not be enabled.

Anand Rawat (8):
eal: eal stub to add windows support
eal: add header files to support windows
kvargs: adding a module definition file
eal: sys/queue.h implementation for windows
eal: add headers for compatibility with windows environment
eal: add minimum viable code for eal on windows
doc: add documention for windows
build: meson changes to build on windows

 MAINTAINERS                                   |   7 +
 app/meson.build                               |   6 +-
 buildtools/meson.build                        |   6 +-
 config/meson.build                            |  23 +-
 config/x86/meson.build                        |  14 +-
 doc/guides/index.rst                          |   3 +-
 doc/guides/windows_gsg/build_dpdk.rst         |  73 ++++
 doc/guides/windows_gsg/index.rst              |  14 +
 doc/guides/windows_gsg/intro.rst              |  20 ++
 drivers/meson.build                           |   6 +-
 examples/meson.build                          |   6 +-
 kernel/windows/meson.build                    |   4 +
 lib/librte_eal/common/include/rte_common.h    |   7 +-
 .../common/include/rte_string_fns.h           |   4 +-
 lib/librte_eal/common/meson.build             |  14 +-
 lib/librte_eal/meson.build                    |   6 +-
 lib/librte_eal/rte_eal_exports.def            |   9 +
 lib/librte_eal/windows/eal/eal.c              |  84 +++++
 lib/librte_eal/windows/eal/eal_debug.c        |  19 ++
 lib/librte_eal/windows/eal/eal_lcore.c        | 100 ++++++
 lib/librte_eal/windows/eal/eal_thread.c       | 153 +++++++++
 lib/librte_eal/windows/eal/include/fnmatch.h  |  43 +++  lib/librte_eal/windows/eal/include/pthread.h  |  22 ++
 lib/librte_eal/windows/eal/include/regex.h    |  85 +++++
 .../windows/eal/include/rte_windows.h         |  50 +++
 lib/librte_eal/windows/eal/include/sched.h    |  41 +++
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/include/unistd.h   |   8 +
 lib/librte_eal/windows/eal/meson.build        |  12 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  23 +-
 meson.build                                   |   3 +-
 32 files changed, 1162 insertions(+), 30 deletions(-)  create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst  create mode 100644 doc/guides/windows_gsg/intro.rst  create mode 100644 kernel/windows/meson.build  create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/eal.c  create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
 create mode 100644 lib/librte_eal/windows/eal/meson.build
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

--
2.17.1.windows.2

A message that is not in the archive (sent off-list or not yet received): MWHPR21MB06380D6FA7CF5513DDC3820AEF5F0@MWHPR21MB0638.namprd21.prod.outlook.com

Acked-by
#106 lore raw

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5 0/8] HelloWorld example for windows

Includes Windows-specific EAL changes and meson changes to build the code on windows.

v5 Changes:
1. Reduced meson workrounds for windows.
2. Updated documention to include details about buildtool options

v4 Changes:
1. Exposed more functions for eal DLL in the module definition file 2. Moved disabling meson logic to sub directories

v3 Changes:
1. Separated meson workarounds from the essential code changes 2. Added support for kvargs 3. Updated meson for building DLL on windows using DEF files 4. Fixed documentation for html links and linker dependency 5. Added comments for windows header and source files

v2 Changes:
1. Incorporated reviews from v1.
2. Fixed license period for updated files.
3. Renamed 'winapp' folder to 'windows'.
4. Cleaned unneeded meson changes.
5. Fixed code style warnings.
6. Added maintainers information for windows branch

notes:
*patch 8/8 contains meson workarounds to build helloworld on windows, which will later be a part of the draft repository

*command-line parsing is not a part of this version as a result lcore mask is currently not supported.

*kernel modules and documentation can not be built on windows currently and should not be enabled.

Anand Rawat (8):
eal: eal stub to add windows support
eal: add header files to support windows
kvargs: adding a module definition file
eal: sys/queue.h implementation for windows
eal: add headers for compatibility with windows environment
eal: add minimum viable code for eal on windows
doc: add documention for windows
build: meson changes to build on windows

 MAINTAINERS                                   |   7 +
 app/meson.build                               |   6 +-
 buildtools/meson.build                        |   6 +-
 config/meson.build                            |  23 +-
 config/x86/meson.build                        |  14 +-
 doc/guides/index.rst                          |   3 +-
 doc/guides/windows_gsg/build_dpdk.rst         |  73 ++++
 doc/guides/windows_gsg/index.rst              |  14 +
 doc/guides/windows_gsg/intro.rst              |  20 ++
 drivers/meson.build                           |   6 +-
 examples/meson.build                          |   6 +-
 kernel/windows/meson.build                    |   4 +
 lib/librte_eal/common/include/rte_common.h    |   7 +-
 .../common/include/rte_string_fns.h           |   4 +-
 lib/librte_eal/common/meson.build             |  14 +-
 lib/librte_eal/meson.build                    |   6 +-
 lib/librte_eal/rte_eal_exports.def            |   9 +
 lib/librte_eal/windows/eal/eal.c              |  84 +++++
 lib/librte_eal/windows/eal/eal_debug.c        |  19 ++
 lib/librte_eal/windows/eal/eal_lcore.c        | 100 ++++++
 lib/librte_eal/windows/eal/eal_thread.c       | 153 +++++++++
 lib/librte_eal/windows/eal/include/fnmatch.h  |  43 +++  lib/librte_eal/windows/eal/include/pthread.h  |  22 ++
 lib/librte_eal/windows/eal/include/regex.h    |  85 +++++
 .../windows/eal/include/rte_windows.h         |  50 +++
 lib/librte_eal/windows/eal/include/sched.h    |  41 +++
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/include/unistd.h   |   8 +
 lib/librte_eal/windows/eal/meson.build        |  12 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  23 +-
 meson.build                                   |   3 +-
 32 files changed, 1162 insertions(+), 30 deletions(-)  create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst  create mode 100644 doc/guides/windows_gsg/intro.rst  create mode 100644 kernel/windows/meson.build  create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/eal.c  create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
 create mode 100644 lib/librte_eal/windows/eal/meson.build
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

--
2.17.1.windows.2

#107 lore raw

v6 cover HelloWorld example for windows

In reply to Anand Rawat

Includes Windows-specific EAL changes and meson changes to build the code on windows.

v6 Changes:
1. Introduced rte_os.h for esstential os specific macros and typedefs.
2. Fixed commit typos and 'new line required at eof' issues.

v5 Changes:
1. Reduced meson workrounds for windows.
2. Updated documention to include details about buildtool options

v4 Changes:
1. Exposed more functions for eal DLL in the module definition file
2. Moved disabling meson logic to sub directories

v3 Changes:
1. Separated meson workarounds from the essential code changes
2. Added support for kvargs
3. Updated meson for building DLL on windows using DEF files
4. Fixed documentation for html links and linker dependency
5. Added comments for windows header and source files

v2 Changes:
1. Incorporated reviews from v1.
2. Fixed license period for updated files.
3. Renamed 'winapp' folder to 'windows'.
4. Cleaned unneeded meson changes.
5. Fixed code style warnings.
6. Added maintainers information for windows branch

notes:
*patch 3/8 contains module definition files and meson changes required to build shared libraries on windows. These may be removed in the future releases to be generated from the existing .map files.

*patch 8/8 contains meson workarounds to build helloworld on windows, which will later be a part of the draft repository

*command-line parsing is not a part of this version as a result lcore mask is currently not supported.

*kernel modules and documentation can not be built on windows currently and should not be enabled.
Anand Rawat (8):
eal: eal stub to add windows support
eal: add header files to support os specifics
build: add module definition file for windows
eal: sys/queue.h implementation for windows
eal: add headers for compatibility with windows
eal: add minimum viable code for eal on windows
doc: add documentation for windows
build: meson changes to build on windows

 MAINTAINERS                                   |   7 +
 app/meson.build                               |   6 +-
 buildtools/meson.build                        |   6 +-
 config/meson.build                            |  23 +-
 config/x86/meson.build                        |  14 +-
 doc/guides/index.rst                          |   3 +-
 doc/guides/windows_gsg/build_dpdk.rst         |  73 ++++
 doc/guides/windows_gsg/index.rst              |  14 +
 doc/guides/windows_gsg/intro.rst              |  20 ++
 drivers/meson.build                           |   6 +-
 examples/meson.build                          |   6 +-
 kernel/windows/meson.build                    |   4 +
 lib/librte_eal/common/include/rte_common.h    |   5 +-
 .../common/include/rte_string_fns.h           |   4 +-
 lib/librte_eal/common/meson.build             |  14 +-
 .../freebsd/eal/include/exec-env/rte_os.h     |  10 +
 .../linux/eal/include/exec-env/rte_os.h       |   8 +
 lib/librte_eal/meson.build                    |   6 +-
 lib/librte_eal/rte_eal_exports.def            |   9 +
 lib/librte_eal/windows/eal/eal.c              |  84 +++++
 lib/librte_eal/windows/eal/eal_debug.c        |  19 ++
 lib/librte_eal/windows/eal/eal_lcore.c        | 100 ++++++
 lib/librte_eal/windows/eal/eal_thread.c       | 153 +++++++++
 .../windows/eal/include/exec-env/fnmatch.h    |  43 +++
 .../windows/eal/include/exec-env/pthread.h    |  22 ++
 .../windows/eal/include/exec-env/regex.h      |  85 +++++
 .../windows/eal/include/exec-env/rte_os.h     |  50 +++
 .../windows/eal/include/exec-env/sched.h      |  41 +++
 .../windows/eal/include/exec-env/unistd.h     |   8 +
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  12 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  23 +-
 33 files changed, 1176 insertions(+), 29 deletions(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
 create mode 100644 kernel/windows/meson.build
 create mode 100644 lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/unistd.h
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
 create mode 100644 lib/librte_eal/windows/eal/meson.build
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
Signature · 1 line
2.17.1.windows.2
#108 lore raw

PATCH v6 1/8 eal: eal stub to add windows support

Added initial stub source files for windows support and only the required meson changes for windows.

---
 config/meson.build                      | 23 ++++++++++++------
 config/x86/meson.build                  | 14 ++++++-----
 lib/librte_eal/meson.build              |  6 ++++-
 lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
 lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++
 lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++
 lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++
 lib/librte_eal/windows/eal/meson.build  | 10 ++++++++
 8 files changed, 118 insertions(+), 14 deletions(-)
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/meson.build
config/meson.build +16 -7
index 30a7261a5..4bd73b1e9 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # set the major version, which might be used by drivers and libraries
 # depending on the configuration options
@@ -80,18 +80,27 @@ dpdk_extra_ldflags += '-Wl,--no-as-needed'
 add_project_link_arguments('-pthread', language: 'c')
 dpdk_extra_ldflags += '-pthread'
 
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+# on some OS, maths functions are in a separate library
+if cc.find_library('lm', required : false).found()
+	# some libs depend on maths lib
+	add_project_link_arguments('-lm', language: 'c')
+	dpdk_extra_ldflags += '-lm'
+endif
 
 # for linux link against dl, for bsd execinfo
 if host_machine.system() == 'linux'
 	link_lib = 'dl'
-else
+elif host_machine.system() == 'freebsd'
 	link_lib = 'execinfo'
+else
+	link_lib = ''
+endif
+
+# if link_lib is empty, do not add it to project properties
+if link_lib != ''
+	add_project_link_arguments('-l' + link_lib, language: 'c')
+	dpdk_extra_ldflags += '-l' + link_lib
 endif
-add_project_link_arguments('-l' + link_lib, language: 'c')
-dpdk_extra_ldflags += '-l' + link_lib
 
 # check for libraries used in multiple places in DPDK
 has_libnuma = 0
config/x86/meson.build +8 -6
index 7504cb9e5..558edfda9 100644
@@ -1,15 +1,17 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # for checking defines we need to use the correct compiler flags
 march_opt = ['-march=@0@'.format(machine)]
 
 # get binutils version for the workaround of Bug 97
-ldver = run_command('ld', '-v').stdout().strip()
-if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
 	endif
 endif
 
lib/librte_eal/meson.build +5 -1
index c592c6747..c2249855a 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # Custom EAL processing. EAL is complicated enough that it can't just
 # have a straight list of headers and source files.
@@ -17,6 +17,10 @@ elif host_machine.system() == 'freebsd'
 	dpdk_conf.set('RTE_EXEC_ENV_FREEBSD', 1)
 	subdir('freebsd/eal')
 
+elif host_machine.system() == 'windows'
+	dpdk_conf.set('RTE_EXEC_ENV_WINDOWS', 1)
+	subdir('windows/eal')
+
 else
 	error('unsupported system type "@0@"'.format(host_machine.system()))
 endif
lib/librte_eal/windows/eal/eal.c new file +14 -0
new file mode 100644
index 000000000..37ed42233
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_common.h>
+
+ /* Launch threads, called at application init(). */
+int
+rte_eal_init(int argc __rte_unused, char **argv __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_debug.c new file +15 -0
new file mode 100644
index 000000000..a9705e257
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_common.h>
+
+ /* call abort(), it will generate a coredump if enabled */
+void
+__rte_panic(const char *funcname __rte_unused,
+		const char *format __rte_unused, ...)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	abort();
+}
lib/librte_eal/windows/eal/eal_lcore.c new file +32 -0
new file mode 100644
index 000000000..e4fcb2615
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_common.h>
+
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return lcore_id;
+}
+
+/* Check if a cpu is present by the presence of the cpu information for it */
+int
+eal_cpu_detected(unsigned int lcore_id __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 1;
+}
+
+/* Get CPU socket id (NUMA node) for a logical core */
+unsigned int
+eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_thread.c new file +18 -0
new file mode 100644
index 000000000..f701443c3
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <windows.h>
+
+#include <rte_common.h>
+
+typedef uintptr_t eal_thread_t;
+
+/* function to create threads */
+int
+eal_thread_create(eal_thread_t *thread __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/meson.build new file +10 -0
new file mode 100644
index 000000000..8b1735623
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+env_objs = []
+env_headers = []
+env_sources = files('eal.c',
+	'eal_debug.c',
+	'eal_lcore.c',
+	'eal_thread.c',
+)
Signature · 1 line
2.17.1.windows.2
Acked-by Reviewed-by Jeff Shaw Reviewed-by Ranjit Menon on v6 1/8
#109 lore raw

Re: [PATCH v6 1/8] eal: eal stub to add windows support

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v6 1/8] eal: eal stub to add windows support

Added initial stub source files for windows support and only the required meson changes for windows.

---
 config/meson.build                      | 23 ++++++++++++------
 config/x86/meson.build                  | 14 ++++++-----
 lib/librte_eal/meson.build              |  6 ++++-
 lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
 lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++  lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++  lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++  lib/librte_eal/windows/eal/meson.build  | 10 ++++++++
 8 files changed, 118 insertions(+), 14 deletions(-)  create mode 100644 lib/librte_eal/windows/eal/eal.c  create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/meson.build
config/meson.build +1 -0
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # set the major version, which might be used by drivers and libraries  # depending on the configuration options @@ -80,18 +80,27 @@ dpdk_extra_ldflags += '-Wl,--no-as-needed'
 add_project_link_arguments('-pthread', language: 'c')  dpdk_extra_ldflags += '-pthread'

-# some libs depend on maths lib -add_project_link_arguments('-lm', language: 'c') -dpdk_extra_ldflags += '-lm' +# on some OS, maths functions are in a separate library if +cc.find_library('lm', required : false).found()
+ # some libs depend on maths lib
+ add_project_link_arguments('-lm', language: 'c')
+ dpdk_extra_ldflags += '-lm'
+endif

 # for linux link against dl, for bsd execinfo  if host_machine.system() == 'linux'
 	link_lib = 'dl'
-else
+elif host_machine.system() == 'freebsd'
 	link_lib = 'execinfo'
+else
+	link_lib = ''
+endif
+
+# if link_lib is empty, do not add it to project properties if link_lib 
+!= ''
+	add_project_link_arguments('-l' + link_lib, language: 'c')
+	dpdk_extra_ldflags += '-l' + link_lib
 endif
-add_project_link_arguments('-l' + link_lib, language: 'c') -dpdk_extra_ldflags += '-l' + link_lib
 # check for libraries used in multiple places in DPDK  has_libnuma = 0 diff --git a/config/x86/meson.build b/config/x86/meson.build index 7504cb9e5..558edfda9 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -1,15 +1,17 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 # for checking defines we need to use the correct compiler flags  march_opt = ['-march=@0@'.format(machine)]
 # get binutils version for the workaround of Bug 97 -ldver = run_command('ld', '-v').stdout().strip() -if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
 	endif
 endif
lib/librte_eal/meson.build +5 -0
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # Custom EAL processing. EAL is complicated enough that it can't just  # have a straight list of headers and source files.
@@ -17,6 +17,10 @@ elif host_machine.system() == 'freebsd'
 	dpdk_conf.set('RTE_EXEC_ENV_FREEBSD', 1)
 	subdir('freebsd/eal')
 
+elif host_machine.system() == 'windows'
+	dpdk_conf.set('RTE_EXEC_ENV_WINDOWS', 1)
+	subdir('windows/eal')
+
 else
 	error('unsupported system type "@0@"'.format(host_machine.system()))
 endif
lib/librte_eal/windows/eal/eal.c new file +12 -0
new file mode 100644
index 000000000..37ed42233
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_common.h>
+
+ /* Launch threads, called at application init(). */ int 
+rte_eal_init(int argc __rte_unused, char **argv __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_debug.c new file +13 -0
new file mode 100644
index 000000000..a9705e257
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_common.h>
+
+ /* call abort(), it will generate a coredump if enabled */ void 
+__rte_panic(const char *funcname __rte_unused,
+		const char *format __rte_unused, ...) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	abort();
+}
lib/librte_eal/windows/eal/eal_lcore.c new file +28 -0
new file mode 100644
index 000000000..e4fcb2615
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_common.h>
+
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return lcore_id;
+}
+
+/* Check if a cpu is present by the presence of the cpu information for 
+it */ int eal_cpu_detected(unsigned int lcore_id __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 1;
+}
+
+/* Get CPU socket id (NUMA node) for a logical core */ unsigned int 
+eal_cpu_socket_id(unsigned int cpu_id __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_thread.c new file +17 -0
new file mode 100644
index 000000000..f701443c3
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <windows.h>
+
+#include <rte_common.h>
+
+typedef uintptr_t eal_thread_t;
+
+/* function to create threads */
+int
+eal_thread_create(eal_thread_t *thread __rte_unused) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/meson.build new file +10 -0
new file mode 100644
index 000000000..8b1735623
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel 
+Corporation
+
+env_objs = []
+env_headers = []
+env_sources = files('eal.c',
+	'eal_debug.c',
+	'eal_lcore.c',
+	'eal_thread.c',
+)

--
2.17.1.windows.2

#110 lore raw

PATCH v6 2/8 eal: add header files to support os specifics

In reply to Anand Rawat

Added rte_os.h files to support os specific functionality. Updated rte_common.h to include rte_os.h. Updated lib/meson.build to inject rte_os.h in every library.

---
 lib/librte_eal/common/include/rte_common.h    |  5 +++-
 .../common/include/rte_string_fns.h           |  4 ++-
 .../freebsd/eal/include/exec-env/rte_os.h     | 10 +++++++
 .../linux/eal/include/exec-env/rte_os.h       |  8 +++++
 .../windows/eal/include/exec-env/rte_os.h     | 30 +++++++++++++++++++
 lib/meson.build                               |  7 ++++-
 6 files changed, 61 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/rte_os.h
lib/librte_eal/common/include/rte_common.h +4 -1
index bcf8afd39..3e4768f4a 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_
@@ -24,6 +24,9 @@ extern "C" {
 
 #include <rte_config.h>
 
+/* os specific include */
+#include <rte_os.h>
+
 #ifndef typeof
 #define typeof __typeof__
 #endif
lib/librte_eal/common/include/rte_string_fns.h +3 -1
index 85bfe6c9a..8bac8243c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 /**
@@ -18,6 +18,8 @@ extern "C" {
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
+
 /**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like
lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h new file +10 -0
new file mode 100644
index 000000000..bda0c2d92
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/* stub file for os specific logic */
+
+#endif /* _RTE_OS_H_ */
lib/librte_eal/linux/eal/include/exec-env/rte_os.h new file +8 -0
new file mode 100644
index 000000000..c43ec6da5
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+#endif /* _RTE_OS_H_ */
lib/librte_eal/windows/eal/include/exec-env/rte_os.h new file +30 -0
new file mode 100644
index 000000000..65230cae9
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+/* macro substitution for windows supported strerror_r */
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* macro substitution for windows supported strdup */
+#define strdup(str)	_strdup(str)
+
+/* macro substitution for windows supported ssize_t type */
+typedef SSIZE_T ssize_t;
+
+/* macro substitution for windows supported strtok_r */
+#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_OS_H_ */
lib/meson.build +6 -1
index 99957ba7d..a81faf0ed 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible
@@ -64,6 +64,11 @@ foreach l:libraries
 	dir_name = 'librte_' + l
 	subdir(dir_name)
 
+	if host_machine.system() == 'windows'
+		# injecting rte_os.h in every library in windows
+		includes += include_directories('librte_eal/windows/eal/include/exec-env')
+	endif
+
 	if build
 		enabled_libs += name
 		dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
Signature · 1 line
2.17.1.windows.2
Acked-by Reviewed-by Jeff Shaw Reviewed-by Ranjit Menon on v6 2/8
#111 lore raw

Re: [PATCH v6 2/8] eal: add header files to support os specifics

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v6 2/8] eal: add header files to support os specifics

Added rte_os.h files to support os specific functionality.
Updated rte_common.h to include rte_os.h. Updated lib/meson.build to inject rte_os.h in every library.

---
 lib/librte_eal/common/include/rte_common.h    |  5 +++-
 .../common/include/rte_string_fns.h           |  4 ++-
 .../freebsd/eal/include/exec-env/rte_os.h     | 10 +++++++
 .../linux/eal/include/exec-env/rte_os.h       |  8 +++++
 .../windows/eal/include/exec-env/rte_os.h     | 30 +++++++++++++++++++
 lib/meson.build                               |  7 ++++-
 6 files changed, 61 insertions(+), 3 deletions(-)  create mode 100644 lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/rte_os.h
lib/librte_eal/common/include/rte_common.h +4 -1
index bcf8afd39..3e4768f4a 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_
@@ -24,6 +24,9 @@ extern "C" {
 
 #include <rte_config.h>
 
+/* os specific include */
+#include <rte_os.h>
+
 #ifndef typeof
 #define typeof __typeof__
 #endif
lib/librte_eal/common/include/rte_string_fns.h +3 -1
index 85bfe6c9a..8bac8243c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 /**
@@ -18,6 +18,8 @@ extern "C" {
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
+
 /**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like diff --git a/lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h b/lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h

new file mode 100644
index 000000000..bda0c2d92

lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h new file +10 -0
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/* stub file for os specific logic */
+
+#endif /* _RTE_OS_H_ */
lib/librte_eal/linux/eal/include/exec-env/rte_os.h new file +8 -0
new file mode 100644
index 000000000..c43ec6da5
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+#endif /* _RTE_OS_H_ */
lib/librte_eal/windows/eal/include/exec-env/rte_os.h new file +30 -0
new file mode 100644
index 000000000..65230cae9
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+/* macro substitution for windows supported strerror_r */ #define 
+strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* macro substitution for windows supported strdup */
+#define strdup(str)	_strdup(str)
+
+/* macro substitution for windows supported ssize_t type */ typedef 
+SSIZE_T ssize_t;
+
+/* macro substitution for windows supported strtok_r */ #define 
+strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_OS_H_ */
lib/meson.build +1 -0
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible @@ -64,6 +64,11 @@ foreach l:libraries

dir_name = 'librte_' + l
subdir(dir_name)

+ if host_machine.system() == 'windows'
+ # injecting rte_os.h in every library in windows
+ includes += include_directories('librte_eal/windows/eal/include/exec-env')
+ endif
+
if build
enabled_libs += name dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
--
2.17.1.windows.2

#112 lore raw

PATCH v6 3/8 build: add module definition file for windows

In reply to Anand Rawat

Updated lib/meson.build to create shared libraries on windows. Added DEF files to list the exports for the eal and kvargs libraries.

---
 lib/librte_eal/rte_eal_exports.def       |  9 +++++++++
 lib/librte_kvargs/rte_kvargs_exports.def |  7 +++++++
 lib/meson.build                          | 12 ++++++++++--
 3 files changed, 26 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
lib/librte_eal/rte_eal_exports.def new file +9 -0
new file mode 100644
index 000000000..12a6c79d6
@@ -0,0 +1,9 @@
+EXPORTS
+	__rte_panic
+	rte_eal_get_configuration
+	rte_eal_init
+	rte_eal_mp_remote_launch
+	rte_eal_mp_wait_lcore
+	rte_eal_remote_launch
+	rte_log
+	rte_vlog
lib/librte_kvargs/rte_kvargs_exports.def new file +7 -0
new file mode 100644
index 000000000..10e839e00
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
lib/meson.build +10 -2
index a81faf0ed..9cba4662e 100644
@@ -122,14 +122,22 @@ foreach l:libraries
 			objs += static_lib.extract_all_objects(recursive: false)
 			version_map = '@0@/@1@/rte_@2@_version.map'.format(
 					meson.current_source_dir(), dir_name, name)
+			exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				lk_args = ['-Wl,/def:' + exports, '-Wl,/implib:lib\\' + implib]
+			else
+				lk_args = ['-Wl,--version-script=' + version_map]
+			endif
 			shared_lib = shared_library(libname,
 					sources,
 					objects: objs,
 					c_args: cflags,
 					dependencies: shared_deps,
 					include_directories: includes,
-					link_args: '-Wl,--version-script=' + version_map,
-					link_depends: version_map,
+					link_args: lk_args,
+					link_depends: [version_map, exports],
 					version: lib_version,
 					soversion: so_version,
 					install: true)
Signature · 1 line
2.17.1.windows.2
Acked-by Reviewed-by Pallavi Kadam Reviewed-by Ranjit Menon on v6 3/8
#113 lore raw

Re: [PATCH v6 3/8] build: add module definition file for windows

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v6 3/8] build: add module definition file for windows

Updated lib/meson.build to create shared libraries on windows. Added DEF files to list the exports for the eal and kvargs libraries.

---
 lib/librte_eal/rte_eal_exports.def       |  9 +++++++++
 lib/librte_kvargs/rte_kvargs_exports.def |  7 +++++++
 lib/meson.build                          | 12 ++++++++++--
 3 files changed, 26 insertions(+), 2 deletions(-)  create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
lib/librte_eal/rte_eal_exports.def new file +9 -0
new file mode 100644
index 000000000..12a6c79d6
@@ -0,0 +1,9 @@
+EXPORTS
+	__rte_panic
+	rte_eal_get_configuration
+	rte_eal_init
+	rte_eal_mp_remote_launch
+	rte_eal_mp_wait_lcore
+	rte_eal_remote_launch
+	rte_log
+	rte_vlog
lib/librte_kvargs/rte_kvargs_exports.def new file +7 -0
new file mode 100644
index 000000000..10e839e00
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
lib/meson.build +10 -2
@@ -122,14 +122,22 @@ foreach l:libraries
 			objs += static_lib.extract_all_objects(recursive: false)
 			version_map = '@0@/@1@/rte_@2@_version.map'.format(
 					meson.current_source_dir(), dir_name, name)
+			exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				lk_args = ['-Wl,/def:' + exports, '-Wl,/implib:lib\\' + implib]
+			else
+				lk_args = ['-Wl,--version-script=' + version_map]
+			endif
 			shared_lib = shared_library(libname,
 					sources,
 					objects: objs,
 					c_args: cflags,
 					dependencies: shared_deps,
 					include_directories: includes,
-					link_args: '-Wl,--version-script=' + version_map,
-					link_depends: version_map,
+					link_args: lk_args,
+					link_depends: [version_map, exports],
 					version: lib_version,
 					soversion: so_version,
 					install: true)

--
2.17.1.windows.2

#114 lore raw

PATCH v6 4/8 eal: sys/queue.h implementation for windows

In reply to Anand Rawat

Adding sys/queue.h on windows for supporting common code. This is implementation has BSD-3-Clause licensing.

---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
lib/librte_eal/windows/eal/include/sys/queue.h new file +320 -0
new file mode 100644
index 000000000..5ee4916ad
@@ -0,0 +1,320 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+/*
+ * This file defines tail queues.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * Below is a summary of implemented functions where:
+ *  +  means the macro is available
+ *  -  means the macro is not available
+ *  s  means the macro is available but is slow (runs in O(n) time)
+ *
+ *				TAILQ
+ * _HEAD			+
+ * _CLASS_HEAD			+
+ * _HEAD_INITIALIZER		+
+ * _ENTRY			+
+ * _CLASS_ENTRY			+
+ * _INIT			+
+ * _EMPTY			+
+ * _FIRST			+
+ * _NEXT			+
+ * _PREV			+
+ * _LAST			+
+ * _LAST_FAST			+
+ * _FOREACH			+
+ * _FOREACH_FROM		+
+ * _FOREACH_SAFE		+
+ * _FOREACH_FROM_SAFE		+
+ * _FOREACH_REVERSE		+
+ * _FOREACH_REVERSE_FROM	+
+ * _FOREACH_REVERSE_SAFE	+
+ * _FOREACH_REVERSE_FROM_SAFE	+
+ * _INSERT_HEAD			+
+ * _INSERT_BEFORE		+
+ * _INSERT_AFTER		+
+ * _INSERT_TAIL			+
+ * _CONCAT			+
+ * _REMOVE_AFTER		-
+ * _REMOVE_HEAD			-
+ * _REMOVE			+
+ * _SWAP			+
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	QMD_TRACE_ELEM(elem)
+#define	QMD_TRACE_HEAD(head)
+#define	TRACEBUF
+#define	TRACEBUF_INITIALIZER
+
+#define	TRASHIT(x)
+#define	QMD_IS_TRASHED(x)	0
+
+#define	QMD_SAVELINK(name, link)
+
+#ifdef __cplusplus
+/*
+ * In C++ there can be structure lists and class lists:
+ */
+#define	QUEUE_TYPEOF(type) type
+#else
+#define	QUEUE_TYPEOF(type) struct type
+#endif
+
+/*
+ * Tail queue declarations.
+ */
+#define	TAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *tqh_first;	/* first element */			\
+	struct type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_HEAD(name, type)					\
+struct name {								\
+	class type *tqh_first;	/* first element */			\
+	class type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
+
+#define	TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_ENTRY(type)						\
+struct {								\
+	class type *tqe_next;	/* next element */			\
+	class type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+/*
+ * Tail queue functions.
+ */
+#define	QMD_TAILQ_CHECK_HEAD(head, field)
+#define	QMD_TAILQ_CHECK_TAIL(head, headname)
+#define	QMD_TAILQ_CHECK_NEXT(elm, field)
+#define	QMD_TAILQ_CHECK_PREV(elm, field)
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+		QMD_TRACE_HEAD(head1);					\
+		QMD_TRACE_HEAD(head2);					\
+	}								\
+} while (0)
+
+#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
+
+#define	TAILQ_FIRST(head)	((head)->tqh_first)
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_FROM(var, head, field)				\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)			\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field)		\
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_INIT(head) do {						\
+	TAILQ_FIRST((head)) = NULL;					\
+	(head)->tqh_last = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+} while (0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field);	\
+	if (TAILQ_NEXT((listelm), field) != NULL)			\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    &TAILQ_NEXT((elm), field);				\
+	else {								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	TAILQ_NEXT((listelm), field) = (elm);				\
+	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_TAILQ_CHECK_PREV(listelm, field);				\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	TAILQ_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_HEAD(head, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_FIRST((head));			\
+	if (TAILQ_FIRST((head)) != NULL)				\
+		TAILQ_FIRST((head))->field.tqe_prev =			\
+		    &TAILQ_NEXT((elm), field);				\
+	else								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+	TAILQ_FIRST((head)) = (elm);					\
+	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_TAIL(head, field);				\
+	TAILQ_NEXT((elm), field) = NULL;				\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_LAST(head, headname)					\
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+
+/*
+ * The FAST function is fast in that it causes no data access other
+ * then the access to the head. The standard LAST function above
+ * will cause a data access of both the element you want and
+ * the previous element. FAST is very useful for instances when
+ * you may want to prefetch the last data element.
+ */
+#define	TAILQ_LAST_FAST(head, type, field)			\
+	(TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last,	\
+	QUEUE_TYPEOF(type), field.tqe_next))
+
+#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define	TAILQ_PREV(elm, headname, field)				\
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
+	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
+	QMD_TAILQ_CHECK_NEXT(elm, field);				\
+	QMD_TAILQ_CHECK_PREV(elm, field);				\
+	if ((TAILQ_NEXT((elm), field)) != NULL)				\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    (elm)->field.tqe_prev;				\
+	else {								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
+	TRASHIT(*oldnext);						\
+	TRASHIT(*oldprev);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define TAILQ_SWAP(head1, head2, type, field) do {			\
+	QUEUE_TYPEOF(type) * swap_first = (head1)->tqh_first;		\
+	QUEUE_TYPEOF(type) * *swap_last = (head1)->tqh_last;		\
+	(head1)->tqh_first = (head2)->tqh_first;			\
+	(head1)->tqh_last = (head2)->tqh_last;				\
+	(head2)->tqh_first = swap_first;				\
+	(head2)->tqh_last = swap_last;					\
+	swap_first = (head1)->tqh_first;				\
+	if (swap_first != NULL)						\
+		swap_first->field.tqe_prev = &(head1)->tqh_first;	\
+	else								\
+		(head1)->tqh_last = &(head1)->tqh_first;		\
+	swap_first = (head2)->tqh_first;				\
+	if (swap_first != NULL)			\
+		swap_first->field.tqe_prev = &(head2)->tqh_first;	\
+	else								\
+		(head2)->tqh_last = &(head2)->tqh_first;		\
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_QUEUE_H_ */
Signature · 1 line
2.17.1.windows.2
#115 lore raw

Re: [PATCH v6 4/8] eal: sys/queue.h implementation for windows

Hi Anand,

snipped

Quoted 52 lines

Adding sys/queue.h on windows for supporting common code. This is implementation has BSD-3-Clause licensing.

---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
lib/librte_eal/windows/eal/include/sys/queue.h new file +19 -0
new file mode 100644
index 000000000..5ee4916ad
@@ -0,0 +1,320 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''

AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

Quoted 8 lines

CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */

Can you help me understand why this should not be

```
# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
```

snipped

#116 lore raw

Re: [PATCH v6 4/8] eal: sys/queue.h implementation for windows

Quoted 65 lines · Vipin

Hi Anand,

snipped

Quoted 52 lines

Adding sys/queue.h on windows for supporting common code. This is implementation has BSD-3-Clause licensing.

---
  .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
  1 file changed, 320 insertions(+)

create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

lib/librte_eal/windows/eal/include/sys/queue.h new file +19 -0
new file mode 100644
index 000000000..5ee4916ad
@@ -0,0 +1,320 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''

AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

Quoted 8 lines

CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */

Can you help me understand why this should not be

Quoted 7 lines
```
# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
```

snipped

From my understanding of licenses, this code did not originate or even modified at Intel to contain Intel copyright statement.

Signature · 1 line
Anand Rawat
#117 lore raw

Re: [PATCH v6 4/8] eal: sys/queue.h implementation for windows

Thanks Anand,

Quoted 87 lines

-----Original Message-----
From: Rawat, Anand
Sent: Thursday, March 28, 2019 8:10 AM
To: Varghese, Vipin <[email protected]>; [email protected]
Cc: Kadam, Pallavi <[email protected]>; Menon, Ranjit <[email protected]>; Shaw, Jeffrey B <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows

Quoted 35 lines · Vipin

Hi Anand,

snipped

Quoted 32 lines

Adding sys/queue.h on windows for supporting common code. This is implementation has BSD-3-Clause licensing.

---
  .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
  1 file changed, 320 insertions(+)

create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

lib/librte_eal/windows/eal/include/sys/queue.h new file +13 -0
new file mode 100644
index 000000000..5ee4916ad
@@ -0,0 +1,320 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+without
+ * modification, are permitted provided that the following
+conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
Quoted 8 lines

lib/librte_eal/windows/eal/include/sys/queue.h

Quoted 8 lines
lib/librte_eal/windows/eal/include/sys/queue.h new file +8 -0
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS

IS''

Quoted 2 lines
Quoted 2 lines

AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED

TO,

Quoted 4 lines
Quoted 4 lines

THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS

BE

Quoted 24 lines
Quoted 9 lines

LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT

Quoted 8 lines

+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY
OF
+ * SUCH DAMAGE.
+ *
+ */

Can you help me understand why this should not be ``` #
SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
```

Quoted 6 lines
Quoted 2 lines

snipped

From my understanding of licenses, this code did not originate or even modified
at Intel to contain Intel copyright statement.

As per the information shared, since the code base is used as it it and did not generate from 'Intel' we have ' The Regents of the University of California. Thanks for clarifying.

Quoted 2 lines

--
Anand Rawat

Acked-by Reviewed-by Jeff Shaw on v6 4/8
#118 lore raw

Re: [PATCH v6 4/8] eal: sys/queue.h implementation for windows

In reply to Anand Rawat

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows

Adding sys/queue.h on windows for supporting common code. This is implementation has BSD-3-Clause licensing.

---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
lib/librte_eal/windows/eal/include/sys/queue.h new file +320 -0
new file mode 100644
index 000000000..5ee4916ad
@@ -0,0 +1,320 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+/*
+ * This file defines tail queues.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * Below is a summary of implemented functions where:
+ *  +  means the macro is available
+ *  -  means the macro is not available
+ *  s  means the macro is available but is slow (runs in O(n) time)
+ *
+ *				TAILQ
+ * _HEAD			+
+ * _CLASS_HEAD			+
+ * _HEAD_INITIALIZER		+
+ * _ENTRY			+
+ * _CLASS_ENTRY			+
+ * _INIT			+
+ * _EMPTY			+
+ * _FIRST			+
+ * _NEXT			+
+ * _PREV			+
+ * _LAST			+
+ * _LAST_FAST			+
+ * _FOREACH			+
+ * _FOREACH_FROM		+
+ * _FOREACH_SAFE		+
+ * _FOREACH_FROM_SAFE		+
+ * _FOREACH_REVERSE		+
+ * _FOREACH_REVERSE_FROM	+
+ * _FOREACH_REVERSE_SAFE	+
+ * _FOREACH_REVERSE_FROM_SAFE	+
+ * _INSERT_HEAD			+
+ * _INSERT_BEFORE		+
+ * _INSERT_AFTER		+
+ * _INSERT_TAIL			+
+ * _CONCAT			+
+ * _REMOVE_AFTER		-
+ * _REMOVE_HEAD			-
+ * _REMOVE			+
+ * _SWAP			+
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	QMD_TRACE_ELEM(elem)
+#define	QMD_TRACE_HEAD(head)
+#define	TRACEBUF
+#define	TRACEBUF_INITIALIZER
+
+#define	TRASHIT(x)
+#define	QMD_IS_TRASHED(x)	0
+
+#define	QMD_SAVELINK(name, link)
+
+#ifdef __cplusplus
+/*
+ * In C++ there can be structure lists and class lists:
+ */
+#define	QUEUE_TYPEOF(type) type
+#else
+#define	QUEUE_TYPEOF(type) struct type
+#endif
+
+/*
+ * Tail queue declarations.
+ */
+#define	TAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *tqh_first;	/* first element */			\
+	struct type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_HEAD(name, type)					\
+struct name {								\
+	class type *tqh_first;	/* first element */			\
+	class type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
+
+#define	TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+#define	TAILQ_CLASS_ENTRY(type)						\
+struct {								\
+	class type *tqe_next;	/* next element */			\
+	class type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+/*
+ * Tail queue functions.
+ */
+#define	QMD_TAILQ_CHECK_HEAD(head, field)
+#define	QMD_TAILQ_CHECK_TAIL(head, headname)
+#define	QMD_TAILQ_CHECK_NEXT(elm, field)
+#define	QMD_TAILQ_CHECK_PREV(elm, field)
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+		QMD_TRACE_HEAD(head1);					\
+		QMD_TRACE_HEAD(head2);					\
+	}								\
+} while (0)
+
+#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
+
+#define	TAILQ_FIRST(head)	((head)->tqh_first)
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_FROM(var, head, field)				\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)			\
+	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field)		\
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
+	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_INIT(head) do {						\
+	TAILQ_FIRST((head)) = NULL;					\
+	(head)->tqh_last = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+} while (0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field);	\
+	if (TAILQ_NEXT((listelm), field) != NULL)			\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    &TAILQ_NEXT((elm), field);				\
+	else {								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	TAILQ_NEXT((listelm), field) = (elm);				\
+	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_TAILQ_CHECK_PREV(listelm, field);				\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	TAILQ_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&(listelm)->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_HEAD(head, field);				\
+	TAILQ_NEXT((elm), field) = TAILQ_FIRST((head));			\
+	if (TAILQ_FIRST((head)) != NULL)				\
+		TAILQ_FIRST((head))->field.tqe_prev =			\
+		    &TAILQ_NEXT((elm), field);				\
+	else								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+	TAILQ_FIRST((head)) = (elm);					\
+	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_TAIL(head, field);				\
+	TAILQ_NEXT((elm), field) = NULL;				\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_LAST(head, headname)					\
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+
+/*
+ * The FAST function is fast in that it causes no data access other
+ * then the access to the head. The standard LAST function above
+ * will cause a data access of both the element you want and
+ * the previous element. FAST is very useful for instances when
+ * you may want to prefetch the last data element.
+ */
+#define	TAILQ_LAST_FAST(head, type, field)			\
+	(TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last,	\
+	QUEUE_TYPEOF(type), field.tqe_next))
+
+#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define	TAILQ_PREV(elm, headname, field)				\
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
+	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
+	QMD_TAILQ_CHECK_NEXT(elm, field);				\
+	QMD_TAILQ_CHECK_PREV(elm, field);				\
+	if ((TAILQ_NEXT((elm), field)) != NULL)				\
+		TAILQ_NEXT((elm), field)->field.tqe_prev =		\
+		    (elm)->field.tqe_prev;				\
+	else {								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
+	TRASHIT(*oldnext);						\
+	TRASHIT(*oldprev);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define TAILQ_SWAP(head1, head2, type, field) do {			\
+	QUEUE_TYPEOF(type) * swap_first = (head1)->tqh_first;		\
+	QUEUE_TYPEOF(type) * *swap_last = (head1)->tqh_last;		\
+	(head1)->tqh_first = (head2)->tqh_first;			\
+	(head1)->tqh_last = (head2)->tqh_last;				\
+	(head2)->tqh_first = swap_first;				\
+	(head2)->tqh_last = swap_last;					\
+	swap_first = (head1)->tqh_first;				\
+	if (swap_first != NULL)						\
+		swap_first->field.tqe_prev = &(head1)->tqh_first;	\
+	else								\
+		(head1)->tqh_last = &(head1)->tqh_first;		\
+	swap_first = (head2)->tqh_first;				\
+	if (swap_first != NULL)			\
+		swap_first->field.tqe_prev = &(head2)->tqh_first;	\
+	else								\
+		(head2)->tqh_last = &(head2)->tqh_first;		\
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_QUEUE_H_ */
Signature · 1 line
2.17.1.windows.2