DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows
@ 2019-03-06  4:16 Anand Rawat
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support Anand Rawat
                   ` (12 more replies)
  0 siblings, 13 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-06  4:16 UTC (permalink / raw)
  To: dev; +Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

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

-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
@ 2019-03-06  4:16 ` Anand Rawat
  2019-03-06 10:03   ` Thomas Monjalon
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows Anand Rawat
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-06  4:16 UTC (permalink / raw)
  To: dev; +Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

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

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..37adf5b03 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
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
 
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..c010e8737 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -1,58 +1,65 @@
 # 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_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'
-)
+common_sources = []
+common_headers = []
+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',
+		'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_common.h')
+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(
+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',
@@ -85,7 +92,8 @@ common_headers = files(
 	'include/rte_tailq.h',
 	'include/rte_time.h',
 	'include/rte_uuid.h',
-	'include/rte_version.h')
+	'include/rte_version.h'
+)
 
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index 98c1d1f31..61b654557 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..134452a77
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..012eeccfa
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..be7adeb18
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..222bd8f4d
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
+)
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..995c0e1ac 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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'
diff --git a/meson.build b/meson.build
index 69833de82..856e94c37 100644
--- a/meson.build
+++ b/meson.build
@@ -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,
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support Anand Rawat
@ 2019-03-06  4:16 ` Anand Rawat
  2019-03-06 11:31   ` Thomas Monjalon
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 3/6] eal: add headers for compatibility with windows environment Anand Rawat
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-06  4:16 UTC (permalink / raw)
  To: dev; +Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

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

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/rte_config.h b/config/rte_config.h
index 7606f5d7b..1ad7e1d30 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h b/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
new file mode 100644
index 000000000..8e4dc72bb
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..d6c540f82 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v2 3/6] eal: add headers for compatibility with windows environment
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support Anand Rawat
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows Anand Rawat
@ 2019-03-06  4:16 ` Anand Rawat
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 4/6] eal: add minimum viable code for eal on windows Anand Rawat
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-06  4:16 UTC (permalink / raw)
  To: dev; +Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 .../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

diff --git a/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
new file mode 100644
index 000000000..1422ba56a
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/pthread.h b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
new file mode 100644
index 000000000..431550577
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
new file mode 100644
index 000000000..efd3f1ecd
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+typedef void *regex_t;
+typedef void *regmatch_t;
+
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	return REG_ESPACE;
+}
+
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	return REG_NOMATCH;
+}
+
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+static inline void regfree(__rte_unused regex_t *preg)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/sched.h b/lib/librte_eal/windows/eal/include/exec-env/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/sys/queue.h b/lib/librte_eal/windows/eal/include/exec-env/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/sys/queue.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/unistd.h b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
new file mode 100644
index 000000000..4973fc793
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+#endif /* _UNISTD_H_ */
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v2 4/6] eal: add minimum viable code for eal on windows
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
                   ` (2 preceding siblings ...)
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 3/6] eal: add headers for compatibility with windows environment Anand Rawat
@ 2019-03-06  4:16 ` Anand Rawat
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 5/6] examples: add meson changes for windows Anand Rawat
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-06  4:16 UTC (permalink / raw)
  To: dev; +Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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(-)

diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index c010e8737..759516e2a 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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(
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 134452a77..1c6923e20 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -2,10 +2,78 @@
  * 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>
+
+static struct rte_config rte_config;
+struct lcore_config lcore_config[RTE_MAX_LCORE];
+
+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);
+}
 
 int
 rte_eal_init(int argc __rte_unused, char **argv __rte_unused)
 {
+	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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index 012eeccfa..72e5cb97e 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index be7adeb18..7d73c9358 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,25 +2,98 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdint.h>
+#include <rte_windows.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
 {
-	return 1;
+	return (lcore_id < wcpu_map.total_procs);
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
+{
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
+}
+
+/*
+ * Get the cpu core id value
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index 222bd8f4d..200ce0156 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -1,15 +1,151 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
+#include <rte_windows.h>
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
 
-#include "rte_common.h"
+#include "eal_thread.h"
 
-typedef uintptr_t eal_thread_t;
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
 
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
 {
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline eal_thread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	eal_thread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
+
+int
+eal_thread_create(eal_thread_t *thread)
+{
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
index efd3f1ecd..512e5723e 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/regex.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -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;
 
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h b/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
index 8e4dc72bb..9f1a9ad62 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
@@ -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
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v2 5/6] examples: add meson changes for windows
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
                   ` (3 preceding siblings ...)
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 4/6] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-06  4:16 ` Anand Rawat
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 6/6] doc: add documention " Anand Rawat
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-06  4:16 UTC (permalink / raw)
  To: dev; +Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

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

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 examples/meson.build | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..2e638399e 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
                   ` (4 preceding siblings ...)
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 5/6] examples: add meson changes for windows Anand Rawat
@ 2019-03-06  4:16 ` Anand Rawat
  2019-03-07 17:03   ` Kovacevic, Marko
  2019-03-11 12:45   ` Jerin Jacob Kollanukkaran
  2019-03-06  8:29 ` [dpdk-dev] [PATCH v2 0/6] HelloWorld example " Thomas Monjalon
                   ` (6 subsequent siblings)
  12 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-06  4:16 UTC (permalink / raw)
  To: dev; +Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

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

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 097cfb4f3..c1187da8c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..7cfb4856e
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,67 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and linker.
+The Meson* Build system is used to prepare the sources
+for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+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::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-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 system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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

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

* Re: [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
                   ` (5 preceding siblings ...)
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 6/6] doc: add documention " Anand Rawat
@ 2019-03-06  8:29 ` Thomas Monjalon
  2019-03-06 22:45   ` Anand Rawat
  2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-06  8:29 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw

Hi,

06/03/2019 05:16, Anand Rawat:
> 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.

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

* Re: [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support Anand Rawat
@ 2019-03-06 10:03   ` Thomas Monjalon
  2019-03-06 11:20     ` Bruce Richardson
  0 siblings, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-06 10:03 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw

Hi,

06/03/2019 05:16, Anand Rawat:
> -# 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?

>  # 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

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

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

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

> -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?

> -deps += 'kvargs'
> +if host_machine.system() != 'windows'
> +	deps += 'kvargs'
> +endif

Why kvargs is removed?

> --- /dev/null
> +++ b/lib/librte_eal/windows/eal/eal_lcore.c
> + /* 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.

> --- a/lib/meson.build
> +++ b/lib/meson.build
> +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.

> --- a/meson.build
> +++ b/meson.build
> -# 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

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

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

* Re: [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support
  2019-03-06 10:03   ` Thomas Monjalon
@ 2019-03-06 11:20     ` Bruce Richardson
  2019-03-06 11:36       ` Thomas Monjalon
  2019-03-07  1:19       ` Anand Rawat
  0 siblings, 2 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-06 11:20 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Anand Rawat, dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw

On Wed, Mar 06, 2019 at 11:03:24AM +0100, Thomas Monjalon wrote:
> Hi,
> 
> 06/03/2019 05:16, Anand Rawat:
> > -# 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.

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

> > +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?

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

> > --- /dev/null
> > +++ b/lib/librte_eal/windows/eal/eal_lcore.c
> > + /* 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.
> 
> > --- a/lib/meson.build
> > +++ b/lib/meson.build
> > +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.
> 
> > --- a/meson.build
> > +++ b/meson.build
> > -# 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
> 
> 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

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

* Re: [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows Anand Rawat
@ 2019-03-06 11:31   ` Thomas Monjalon
  2019-03-07  3:27     ` Anand Rawat
  0 siblings, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-06 11:31 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw

06/03/2019 05:16, Anand Rawat:
> Added header files to support windows on x86 platforms.
> Updated rte_config to include rte_windows.h for windows
> build.
[...]
> --- a/config/rte_config.h
> +++ b/config/rte_config.h
> +/* windows specific*/
> +#ifdef RTE_EXEC_ENV_WINDOWS
> +#include <rte_windows.h>
> +#endif

Include in the config file looks wrong.

> --- /dev/null
> +++ b/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h

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

> @@ -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_ */

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

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

* Re: [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support
  2019-03-06 11:20     ` Bruce Richardson
@ 2019-03-06 11:36       ` Thomas Monjalon
  2019-03-06 11:52         ` Richardson, Bruce
  2019-03-07  1:19       ` Anand Rawat
  1 sibling, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-06 11:36 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, Anand Rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw

06/03/2019 12:20, Bruce Richardson:
> On Wed, Mar 06, 2019 at 11:03:24AM +0100, Thomas Monjalon wrote:
> > Hi,
> > 
> > 06/03/2019 05:16, Anand Rawat:
> > > -# 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.

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

> > > +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?
> 
> > > -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.

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.

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

* Re: [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support
  2019-03-06 11:36       ` Thomas Monjalon
@ 2019-03-06 11:52         ` Richardson, Bruce
  2019-03-07  1:04           ` Anand Rawat
  0 siblings, 1 reply; 327+ messages in thread
From: Richardson, Bruce @ 2019-03-06 11:52 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Rawat, Anand, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Wednesday, March 6, 2019 11:36 AM
> To: Richardson, Bruce <bruce.richardson@intel.com>
> Cc: dev@dpdk.org; Rawat, Anand <anand.rawat@intel.com>; Kadam, Pallavi
> <pallavi.kadam@intel.com>; Menon, Ranjit <ranjit.menon@intel.com>; Shaw,
> Jeffrey B <jeffrey.b.shaw@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows
> support
> 
> 06/03/2019 12:20, Bruce Richardson:
> > On Wed, Mar 06, 2019 at 11:03:24AM +0100, Thomas Monjalon wrote:
> > > Hi,
> > >
> > > 06/03/2019 05:16, Anand Rawat:
> > > > -# 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.
> 
> 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.

> 
> > > > +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?
> >
> > > > -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.
> 
> 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.
> 

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

* Re: [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows
  2019-03-06  8:29 ` [dpdk-dev] [PATCH v2 0/6] HelloWorld example " Thomas Monjalon
@ 2019-03-06 22:45   ` Anand Rawat
  2019-03-06 23:03     ` Thomas Monjalon
  0 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-06 22:45 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B

On 3/6/2019 12:29 AM, Thomas Monjalon wrote:
> Hi,
> 
> 06/03/2019 05:16, Anand Rawat:
>> 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.
> 

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

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

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows
  2019-03-06 22:45   ` Anand Rawat
@ 2019-03-06 23:03     ` Thomas Monjalon
  0 siblings, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-06 23:03 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B

06/03/2019 23:45, Anand Rawat:
> > - 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.

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

* Re: [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support
  2019-03-06 11:52         ` Richardson, Bruce
@ 2019-03-07  1:04           ` Anand Rawat
  2019-03-07  8:59             ` Thomas Monjalon
  0 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-07  1:04 UTC (permalink / raw)
  To: Richardson, Bruce, Thomas Monjalon
  Cc: dev, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B

On 3/6/2019 3:52 AM, Richardson, Bruce wrote:
> 
> 
>> -----Original Message-----
>> From: Thomas Monjalon [mailto:thomas@monjalon.net]
>> Sent: Wednesday, March 6, 2019 11:36 AM
>> To: Richardson, Bruce <bruce.richardson@intel.com>
>> Cc: dev@dpdk.org; Rawat, Anand <anand.rawat@intel.com>; Kadam, Pallavi
>> <pallavi.kadam@intel.com>; Menon, Ranjit <ranjit.menon@intel.com>; Shaw,
>> Jeffrey B <jeffrey.b.shaw@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows
>> support
>>
>> 06/03/2019 12:20, Bruce Richardson:
>>> On Wed, Mar 06, 2019 at 11:03:24AM +0100, Thomas Monjalon wrote:
>>>> Hi,
>>>>
>>>> 06/03/2019 05:16, Anand Rawat:
>>>>> -# 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.
>>
>> 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.

> 
>>
>>>>> +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?
>>>
>>>>> -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.
>>
>> 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.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support
  2019-03-06 11:20     ` Bruce Richardson
  2019-03-06 11:36       ` Thomas Monjalon
@ 2019-03-07  1:19       ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-07  1:19 UTC (permalink / raw)
  To: Richardson, Bruce, Thomas Monjalon
  Cc: dev, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B

On 3/6/2019 3:20 AM, Richardson, Bruce wrote:
> On Wed, Mar 06, 2019 at 11:03:24AM +0100, Thomas Monjalon wrote:
> 
>>>   # 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
>>
>> 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.

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.

> 
>>> --- /dev/null
>>> +++ b/lib/librte_eal/windows/eal/eal_lcore.c
>>> + /* 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.
>>
>>> --- a/lib/meson.build
>>> +++ b/lib/meson.build
>>> +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.
>>
>>> --- a/meson.build
>>> +++ b/meson.build
>>> -# 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
>>
>> 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
> 

Will be done as a part of v3

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows
  2019-03-06 11:31   ` Thomas Monjalon
@ 2019-03-07  3:27     ` Anand Rawat
  2019-03-07  8:45       ` Thomas Monjalon
  0 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-07  3:27 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B

On 3/6/2019 3:31 AM, Thomas Monjalon wrote:
> 06/03/2019 05:16, Anand Rawat:
>> Added header files to support windows on x86 platforms.
>> Updated rte_config to include rte_windows.h for windows
>> build.
> [...]
>> --- a/config/rte_config.h
>> +++ b/config/rte_config.h
>> +/* windows specific*/
>> +#ifdef RTE_EXEC_ENV_WINDOWS
>> +#include <rte_windows.h>
>> +#endif
> 
> Include in the config file looks wrong. >
>> --- /dev/null
>> +++ b/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
> 
> 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.

> 
>> @@ -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_ */
> 
> It is missing comments to explain the need of each line.
> 
> 

Will be done in v3

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows
  2019-03-07  3:27     ` Anand Rawat
@ 2019-03-07  8:45       ` Thomas Monjalon
  2019-03-07 10:24         ` Bruce Richardson
  0 siblings, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-07  8:45 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B

07/03/2019 04:27, Anand Rawat:
> On 3/6/2019 3:31 AM, Thomas Monjalon wrote:
> > 06/03/2019 05:16, Anand Rawat:
> >> Added header files to support windows on x86 platforms.
> >> Updated rte_config to include rte_windows.h for windows
> >> build.
> > [...]
> >> --- a/config/rte_config.h
> >> +++ b/config/rte_config.h
> >> +/* windows specific*/
> >> +#ifdef RTE_EXEC_ENV_WINDOWS
> >> +#include <rte_windows.h>
> >> +#endif
> > 
> > Include in the config file looks wrong. >
> >> --- /dev/null
> >> +++ b/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
> > 
> > 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.

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

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

* Re: [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support
  2019-03-07  1:04           ` Anand Rawat
@ 2019-03-07  8:59             ` Thomas Monjalon
  0 siblings, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-07  8:59 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, Richardson, Bruce, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B

07/03/2019 02:04, Anand Rawat:
> On 3/6/2019 3:52 AM, Richardson, Bruce wrote:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> >> 06/03/2019 12:20, Bruce Richardson:
> >>> On Wed, Mar 06, 2019 at 11:03:24AM +0100, Thomas Monjalon wrote:
> >>>> 06/03/2019 05:16, Anand Rawat:
> >>>>> +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?
> >>>
> >>>>> -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.
> >>
> >> 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.

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.

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

* Re: [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows
  2019-03-07  8:45       ` Thomas Monjalon
@ 2019-03-07 10:24         ` Bruce Richardson
  2019-03-07 11:33           ` Thomas Monjalon
  0 siblings, 1 reply; 327+ messages in thread
From: Bruce Richardson @ 2019-03-07 10:24 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Anand Rawat, dev, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B

On Thu, Mar 07, 2019 at 09:45:57AM +0100, Thomas Monjalon wrote:
> 07/03/2019 04:27, Anand Rawat:
> > On 3/6/2019 3:31 AM, Thomas Monjalon wrote:
> > > 06/03/2019 05:16, Anand Rawat:
> > >> Added header files to support windows on x86 platforms.
> > >> Updated rte_config to include rte_windows.h for windows
> > >> build.
> > > [...]
> > >> --- a/config/rte_config.h
> > >> +++ b/config/rte_config.h
> > >> +/* windows specific*/
> > >> +#ifdef RTE_EXEC_ENV_WINDOWS
> > >> +#include <rte_windows.h>
> > >> +#endif
> > > 
> > > Include in the config file looks wrong. >
> > >> --- /dev/null
> > >> +++ b/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
> > > 
> > > 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.
> 
> 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

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

* Re: [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows
  2019-03-07 10:24         ` Bruce Richardson
@ 2019-03-07 11:33           ` Thomas Monjalon
  2019-03-07 11:53             ` Richardson, Bruce
  0 siblings, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-07 11:33 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Anand Rawat, dev, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B

07/03/2019 11:24, Bruce Richardson:
> On Thu, Mar 07, 2019 at 09:45:57AM +0100, Thomas Monjalon wrote:
> > 07/03/2019 04:27, Anand Rawat:
> > > On 3/6/2019 3:31 AM, Thomas Monjalon wrote:
> > > > 06/03/2019 05:16, Anand Rawat:
> > > >> Added header files to support windows on x86 platforms.
> > > >> Updated rte_config to include rte_windows.h for windows
> > > >> build.
> > > > [...]
> > > >> --- a/config/rte_config.h
> > > >> +++ b/config/rte_config.h
> > > >> +/* windows specific*/
> > > >> +#ifdef RTE_EXEC_ENV_WINDOWS
> > > >> +#include <rte_windows.h>
> > > >> +#endif
> > > > 
> > > > Include in the config file looks wrong. >
> > > >> --- /dev/null
> > > >> +++ b/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
> > > > 
> > > > 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.
> > 
> > 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.

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

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

* Re: [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows
  2019-03-07 11:33           ` Thomas Monjalon
@ 2019-03-07 11:53             ` Richardson, Bruce
  0 siblings, 0 replies; 327+ messages in thread
From: Richardson, Bruce @ 2019-03-07 11:53 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Rawat, Anand, dev, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Thursday, March 7, 2019 11:33 AM
> To: Richardson, Bruce <bruce.richardson@intel.com>
> Cc: Rawat, Anand <anand.rawat@intel.com>; dev@dpdk.org; Kadam, Pallavi
> <pallavi.kadam@intel.com>; Menon, Ranjit <ranjit.menon@intel.com>; Shaw,
> Jeffrey B <jeffrey.b.shaw@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 2/6] eal: add header files to support
> windows
> 
> 07/03/2019 11:24, Bruce Richardson:
> > On Thu, Mar 07, 2019 at 09:45:57AM +0100, Thomas Monjalon wrote:
> > > 07/03/2019 04:27, Anand Rawat:
> > > > On 3/6/2019 3:31 AM, Thomas Monjalon wrote:
> > > > > 06/03/2019 05:16, Anand Rawat:
> > > > >> Added header files to support windows on x86 platforms.
> > > > >> Updated rte_config to include rte_windows.h for windows build.
> > > > > [...]
> > > > >> --- a/config/rte_config.h
> > > > >> +++ b/config/rte_config.h
> > > > >> +/* windows specific*/
> > > > >> +#ifdef RTE_EXEC_ENV_WINDOWS
> > > > >> +#include <rte_windows.h>
> > > > >> +#endif
> > > > >
> > > > > Include in the config file looks wrong. >
> > > > >> --- /dev/null
> > > > >> +++ b/lib/librte_eal/windows/eal/include/exec-env/rte_windows.h
> > > > >
> > > > > 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.
> > >
> > > 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.
> 
> > 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.

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

* Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 6/6] doc: add documention " Anand Rawat
@ 2019-03-07 17:03   ` Kovacevic, Marko
  2019-03-07 18:46     ` Anand Rawat
  2019-03-11 12:45   ` Jerin Jacob Kollanukkaran
  1 sibling, 1 reply; 327+ messages in thread
From: Kovacevic, Marko @ 2019-03-07 17:03 UTC (permalink / raw)
  To: Rawat, Anand, dev; +Cc: Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B, thomas

> Added documentation to build helloworld example on windows using meson
> and clang. Updated the maintainers list to include windows maintainers.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  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
> 

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/>".


<...>

> +
> +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>`_.

> +
> +http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-
> wit
> +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
> 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

<...>

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

* Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows
  2019-03-07 17:03   ` Kovacevic, Marko
@ 2019-03-07 18:46     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-07 18:46 UTC (permalink / raw)
  To: Kovacevic, Marko, dev
  Cc: Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B, thomas

On 3/7/2019 9:03 AM, Kovacevic, Marko wrote:
>> Added documentation to build helloworld example on windows using meson
>> and clang. Updated the maintainers list to include windows maintainers.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>>   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
>>
> 
> 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/>".
> 
> 
> <...>
> 
>> +
>> +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>`_.
> 
>> +
>> +http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-
>> wit
>> +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
>> 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
> 
> <...>
> 

Thank You, will update in v3

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows
  2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 6/6] doc: add documention " Anand Rawat
  2019-03-07 17:03   ` Kovacevic, Marko
@ 2019-03-11 12:45   ` Jerin Jacob Kollanukkaran
  2019-03-11 13:51     ` Richardson, Bruce
  2019-03-14  0:04     ` Anand Rawat
  1 sibling, 2 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-11 12:45 UTC (permalink / raw)
  To: anand.rawat, dev; +Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw

On Tue, 2019-03-05 at 20:16 -0800, Anand Rawat wrote:
> Added documentation to build helloworld example
> on windows using meson and clang. Updated the
> maintainers list to include windows maintainers.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
> +
> +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>


> +    cd build
> +    ninja
> 

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

* Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows
  2019-03-11 12:45   ` Jerin Jacob Kollanukkaran
@ 2019-03-11 13:51     ` Richardson, Bruce
  2019-03-11 15:30       ` Raslan Darawsheh
  2019-03-11 15:46       ` Jerin Jacob Kollanukkaran
  2019-03-14  0:04     ` Anand Rawat
  1 sibling, 2 replies; 327+ messages in thread
From: Richardson, Bruce @ 2019-03-11 13:51 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran, Rawat, Anand, dev
  Cc: Kadam, Pallavi, thomas, Menon, Ranjit, Shaw, Jeffrey B



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob
> Kollanukkaran
> Sent: Monday, March 11, 2019 12:45 PM
> To: Rawat, Anand <anand.rawat@intel.com>; dev@dpdk.org
> Cc: Kadam, Pallavi <pallavi.kadam@intel.com>; thomas@monjalon.net; Menon,
> Ranjit <ranjit.menon@intel.com>; Shaw, Jeffrey B
> <jeffrey.b.shaw@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows
> 
> On Tue, 2019-03-05 at 20:16 -0800, Anand Rawat wrote:
> > Added documentation to build helloworld example on windows using meson
> > and clang. Updated the maintainers list to include windows
> > maintainers.
> >
> > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > ---
> > +
> > +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"? 

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

* Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows
  2019-03-11 13:51     ` Richardson, Bruce
@ 2019-03-11 15:30       ` Raslan Darawsheh
  2019-03-11 15:46       ` Jerin Jacob Kollanukkaran
  1 sibling, 0 replies; 327+ messages in thread
From: Raslan Darawsheh @ 2019-03-11 15:30 UTC (permalink / raw)
  To: Richardson, Bruce, Jerin Jacob Kollanukkaran, Rawat, Anand, dev
  Cc: Kadam, Pallavi, Thomas Monjalon, Menon, Ranjit, Shaw, Jeffrey B

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

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Richardson, Bruce
> Sent: Monday, March 11, 2019 3:51 PM
> To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Rawat, Anand
> <anand.rawat@intel.com>; dev@dpdk.org
> Cc: Kadam, Pallavi <pallavi.kadam@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; Menon, Ranjit <ranjit.menon@intel.com>; Shaw,
> Jeffrey B <jeffrey.b.shaw@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob
> > Kollanukkaran
> > Sent: Monday, March 11, 2019 12:45 PM
> > To: Rawat, Anand <anand.rawat@intel.com>; dev@dpdk.org
> > Cc: Kadam, Pallavi <pallavi.kadam@intel.com>; thomas@monjalon.net;
> > Menon, Ranjit <ranjit.menon@intel.com>; Shaw, Jeffrey B
> > <jeffrey.b.shaw@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for
> > windows
> >
> > On Tue, 2019-03-05 at 20:16 -0800, Anand Rawat wrote:
> > > Added documentation to build helloworld example on windows using
> > > meson and clang. Updated the maintainers list to include windows
> > > maintainers.
> > >
> > > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > > Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > > Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> > > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > > ---
> > > +
> > > +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"?

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

* Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows
  2019-03-11 13:51     ` Richardson, Bruce
  2019-03-11 15:30       ` Raslan Darawsheh
@ 2019-03-11 15:46       ` Jerin Jacob Kollanukkaran
  1 sibling, 0 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-11 15:46 UTC (permalink / raw)
  To: anand.rawat, bruce.richardson, dev
  Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw

On Mon, 2019-03-11 at 13:51 +0000, Richardson, Bruce wrote:
> -------------------------------------------------------------------
> ---
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob
> > Kollanukkaran
> > Sent: Monday, March 11, 2019 12:45 PM
> > To: Rawat, Anand <anand.rawat@intel.com>; dev@dpdk.org
> > Cc: Kadam, Pallavi <pallavi.kadam@intel.com>; thomas@monjalon.net;
> > Menon,
> > Ranjit <ranjit.menon@intel.com>; Shaw, Jeffrey B
> > <jeffrey.b.shaw@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for
> > windows
> > 
> > On Tue, 2019-03-05 at 20:16 -0800, Anand Rawat wrote:
> > > Added documentation to build helloworld example on windows using
> > > meson
> > > and clang. Updated the maintainers list to include windows
> > > maintainers.
> > > 
> > > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > > Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > > Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> > > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > > ---
> > > +
> > > +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"? 

Seen the same issue with above command.



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

* Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows
  2019-03-11 12:45   ` Jerin Jacob Kollanukkaran
  2019-03-11 13:51     ` Richardson, Bruce
@ 2019-03-14  0:04     ` Anand Rawat
  2019-03-14  0:04       ` Anand Rawat
  1 sibling, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-14  0:04 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran, dev
  Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw

On 3/11/2019 5:45 AM, Jerin Jacob Kollanukkaran wrote:
> On Tue, 2019-03-05 at 20:16 -0800, Anand Rawat wrote:
>> Added documentation to build helloworld example
>> on windows using meson and clang. Updated the
>> maintainers list to include windows maintainers.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>> +
>> +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.


-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v2 6/6] doc: add documention for windows
  2019-03-14  0:04     ` Anand Rawat
@ 2019-03-14  0:04       ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-14  0:04 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran, dev
  Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw

On 3/11/2019 5:45 AM, Jerin Jacob Kollanukkaran wrote:
> On Tue, 2019-03-05 at 20:16 -0800, Anand Rawat wrote:
>> Added documentation to build helloworld example
>> on windows using meson and clang. Updated the
>> maintainers list to include windows maintainers.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>> +
>> +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.


-- 
Anand Rawat

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

* [dpdk-dev] [PATCH v3 0/8] HelloWorld example for windows
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
                   ` (6 preceding siblings ...)
  2019-03-06  8:29 ` [dpdk-dev] [PATCH v2 0/6] HelloWorld example " Thomas Monjalon
@ 2019-03-20  0:40 ` Anand Rawat
  2019-03-20  0:40   ` Anand Rawat
                     ` (8 more replies)
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
                   ` (4 subsequent siblings)
  12 siblings, 9 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v3 0/8] HelloWorld example for windows
  2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
@ 2019-03-20  0:40   ` Anand Rawat
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 1/8] eal: eal stub to add windows support Anand Rawat
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v3 1/8] eal: eal stub to add windows support
  2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
  2019-03-20  0:40   ` Anand Rawat
@ 2019-03-20  0:40   ` Anand Rawat
  2019-03-20  0:40     ` Anand Rawat
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 2/8] eal: add header files to support windows Anand Rawat
                     ` (6 subsequent siblings)
  8 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..71a0120b6 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..13e41ea30
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..6e07fe10c
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..4ddf51aa8
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..e74f8893b
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
+)
diff --git a/meson.build b/meson.build
index 69833de82..797c86c44 100644
--- a/meson.build
+++ b/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v3 1/8] eal: eal stub to add windows support
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 1/8] eal: eal stub to add windows support Anand Rawat
@ 2019-03-20  0:40     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..71a0120b6 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..13e41ea30
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..6e07fe10c
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..4ddf51aa8
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..e74f8893b
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
+)
diff --git a/meson.build b/meson.build
index 69833de82..797c86c44 100644
--- a/meson.build
+++ b/meson.build
@@ -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


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

* [dpdk-dev] [PATCH v3 2/8] eal: add header files to support windows
  2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
  2019-03-20  0:40   ` Anand Rawat
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 1/8] eal: eal stub to add windows support Anand Rawat
@ 2019-03-20  0:40   ` Anand Rawat
  2019-03-20  0:40     ` Anand Rawat
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 3/8] kvargs: adding a module definition file Anand Rawat
                     ` (5 subsequent siblings)
  8 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 7178ba1e9..4775c84f5 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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..e20319ecf
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -0,0 +1,2 @@
+EXPORTS
+	__rte_panic
\ No newline at end of file
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
new file mode 100644
index 000000000..af24ef39f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..1fe1b4677 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v3 2/8] eal: add header files to support windows
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 2/8] eal: add header files to support windows Anand Rawat
@ 2019-03-20  0:40     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 7178ba1e9..4775c84f5 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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..e20319ecf
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -0,0 +1,2 @@
+EXPORTS
+	__rte_panic
\ No newline at end of file
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
new file mode 100644
index 000000000..af24ef39f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..1fe1b4677 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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


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

* [dpdk-dev] [PATCH v3 3/8] kvargs: adding a module definition file
  2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
                     ` (2 preceding siblings ...)
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 2/8] eal: add header files to support windows Anand Rawat
@ 2019-03-20  0:40   ` Anand Rawat
  2019-03-20  0:40     ` Anand Rawat
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 4/8] eal: sys/queue.h implementation for windows Anand Rawat
                     ` (4 subsequent siblings)
  8 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..265d3cc9a
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -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

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

* [dpdk-dev] [PATCH v3 3/8] kvargs: adding a module definition file
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 3/8] kvargs: adding a module definition file Anand Rawat
@ 2019-03-20  0:40     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..265d3cc9a
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -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


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

* [dpdk-dev] [PATCH v3 4/8] eal: sys/queue.h implementation for windows
  2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
                     ` (3 preceding siblings ...)
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 3/8] kvargs: adding a module definition file Anand Rawat
@ 2019-03-20  0:40   ` Anand Rawat
  2019-03-20  0:40     ` Anand Rawat
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 5/8] eal: add headers for compatibility with windows environment Anand Rawat
                     ` (3 subsequent siblings)
  8 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v3 4/8] eal: sys/queue.h implementation for windows
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 4/8] eal: sys/queue.h implementation for windows Anand Rawat
@ 2019-03-20  0:40     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v3 5/8] eal: add headers for compatibility with windows environment
  2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
                     ` (4 preceding siblings ...)
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 4/8] eal: sys/queue.h implementation for windows Anand Rawat
@ 2019-03-20  0:40   ` Anand Rawat
  2019-03-20  0:40     ` Anand Rawat
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 6/8] eal: add minimum viable code for eal on windows Anand Rawat
                     ` (2 subsequent siblings)
  8 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/unistd.h
@@ -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

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

* [dpdk-dev] [PATCH v3 5/8] eal: add headers for compatibility with windows environment
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 5/8] eal: add headers for compatibility with windows environment Anand Rawat
@ 2019-03-20  0:40     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/unistd.h
@@ -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


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

* [dpdk-dev] [PATCH v3 6/8] eal: add minimum viable code for eal on windows
  2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
                     ` (5 preceding siblings ...)
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 5/8] eal: add headers for compatibility with windows environment Anand Rawat
@ 2019-03-20  0:40   ` Anand Rawat
  2019-03-20  0:40     ` Anand Rawat
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 7/8] doc: add documention for windows Anand Rawat
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 8/8] build: meson changes to build on windows Anand Rawat
  8 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 13e41ea30..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index 6e07fe10c..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index 4ddf51aa8..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdint.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+#include <rte_common.h>
+
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index e74f8893b..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
-#include "rte_common.h"
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
+#include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/regex.h
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
index af24ef39f..46146e59b 100644
--- a/lib/librte_eal/windows/eal/include/rte_windows.h
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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

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

* [dpdk-dev] [PATCH v3 6/8] eal: add minimum viable code for eal on windows
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 6/8] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-20  0:40     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 13e41ea30..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index 6e07fe10c..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index 4ddf51aa8..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdint.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+#include <rte_common.h>
+
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index e74f8893b..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
-#include "rte_common.h"
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
+#include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/regex.h
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
index af24ef39f..46146e59b 100644
--- a/lib/librte_eal/windows/eal/include/rte_windows.h
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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


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

* [dpdk-dev] [PATCH v3 7/8] doc: add documention for windows
  2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
                     ` (6 preceding siblings ...)
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 6/8] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-20  0:40   ` Anand Rawat
  2019-03-20  0:40     ` Anand Rawat
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 8/8] build: meson changes to build on windows Anand Rawat
  8 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 452b8eb82..0080c8f4c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..06b148eca
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files
+on windwos, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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

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

* [dpdk-dev] [PATCH v3 7/8] doc: add documention for windows
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 7/8] doc: add documention for windows Anand Rawat
@ 2019-03-20  0:40     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 452b8eb82..0080c8f4c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..06b148eca
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files
+on windwos, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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


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

* [dpdk-dev] [PATCH v3 8/8] build: meson changes to build on windows
  2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
                     ` (7 preceding siblings ...)
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 7/8] doc: add documention for windows Anand Rawat
@ 2019-03-20  0:40   ` Anand Rawat
  2019-03-20  0:40     ` Anand Rawat
  8 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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(-)

diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..107e378e7 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..05ebd06b6 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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',
+		'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
 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(
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'
diff --git a/meson.build b/meson.build
index 797c86c44..856e94c37 100644
--- a/meson.build
+++ b/meson.build
@@ -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,
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v3 8/8] build: meson changes to build on windows
  2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 8/8] build: meson changes to build on windows Anand Rawat
@ 2019-03-20  0:40     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-20  0:40 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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(-)

diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..107e378e7 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..05ebd06b6 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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',
+		'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
 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(
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'
diff --git a/meson.build b/meson.build
index 797c86c44..856e94c37 100644
--- a/meson.build
+++ b/meson.build
@@ -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,
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
                   ` (7 preceding siblings ...)
  2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
@ 2019-03-22 22:54 ` Anand Rawat
  2019-03-22 22:54   ` Anand Rawat
                     ` (9 more replies)
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
                   ` (3 subsequent siblings)
  12 siblings, 10 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

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

* [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
@ 2019-03-22 22:54   ` Anand Rawat
  2019-03-22 22:54   ` [dpdk-dev] [PATCH v4 1/8] eal: eal stub to add windows support Anand Rawat
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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


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

* [dpdk-dev] [PATCH v4 1/8] eal: eal stub to add windows support
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
  2019-03-22 22:54   ` Anand Rawat
@ 2019-03-22 22:54   ` Anand Rawat
  2019-03-22 22:54     ` Anand Rawat
  2019-03-22 22:54   ` [dpdk-dev] [PATCH v4 2/8] eal: add header files to support windows Anand Rawat
                     ` (7 subsequent siblings)
  9 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..71a0120b6 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..13e41ea30
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..6e07fe10c
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..4ddf51aa8
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..e74f8893b
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
+)
diff --git a/meson.build b/meson.build
index 69833de82..9959dc54f 100644
--- a/meson.build
+++ b/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v4 1/8] eal: eal stub to add windows support
  2019-03-22 22:54   ` [dpdk-dev] [PATCH v4 1/8] eal: eal stub to add windows support Anand Rawat
@ 2019-03-22 22:54     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..71a0120b6 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..13e41ea30
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..6e07fe10c
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..4ddf51aa8
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..e74f8893b
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
+)
diff --git a/meson.build b/meson.build
index 69833de82..9959dc54f 100644
--- a/meson.build
+++ b/meson.build
@@ -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


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

* [dpdk-dev] [PATCH v4 2/8] eal: add header files to support windows
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
  2019-03-22 22:54   ` Anand Rawat
  2019-03-22 22:54   ` [dpdk-dev] [PATCH v4 1/8] eal: eal stub to add windows support Anand Rawat
@ 2019-03-22 22:54   ` Anand Rawat
  2019-03-22 22:54     ` Anand Rawat
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 3/8] kvargs: adding a module definition file Anand Rawat
                     ` (6 subsequent siblings)
  9 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 7178ba1e9..4775c84f5 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
new file mode 100644
index 000000000..af24ef39f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..1fe1b4677 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v4 2/8] eal: add header files to support windows
  2019-03-22 22:54   ` [dpdk-dev] [PATCH v4 2/8] eal: add header files to support windows Anand Rawat
@ 2019-03-22 22:54     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 7178ba1e9..4775c84f5 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
new file mode 100644
index 000000000..af24ef39f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..1fe1b4677 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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


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

* [dpdk-dev] [PATCH v4 3/8] kvargs: adding a module definition file
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
                     ` (2 preceding siblings ...)
  2019-03-22 22:54   ` [dpdk-dev] [PATCH v4 2/8] eal: add header files to support windows Anand Rawat
@ 2019-03-22 22:55   ` Anand Rawat
  2019-03-22 22:55     ` Anand Rawat
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 4/8] eal: sys/queue.h implementation for windows Anand Rawat
                     ` (5 subsequent siblings)
  9 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..265d3cc9a
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -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

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

* [dpdk-dev] [PATCH v4 3/8] kvargs: adding a module definition file
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 3/8] kvargs: adding a module definition file Anand Rawat
@ 2019-03-22 22:55     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..265d3cc9a
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -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


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

* [dpdk-dev] [PATCH v4 4/8] eal: sys/queue.h implementation for windows
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
                     ` (3 preceding siblings ...)
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 3/8] kvargs: adding a module definition file Anand Rawat
@ 2019-03-22 22:55   ` Anand Rawat
  2019-03-22 22:55     ` Anand Rawat
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 5/8] eal: add headers for compatibility with windows environment Anand Rawat
                     ` (4 subsequent siblings)
  9 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v4 4/8] eal: sys/queue.h implementation for windows
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 4/8] eal: sys/queue.h implementation for windows Anand Rawat
@ 2019-03-22 22:55     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v4 5/8] eal: add headers for compatibility with windows environment
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
                     ` (4 preceding siblings ...)
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 4/8] eal: sys/queue.h implementation for windows Anand Rawat
@ 2019-03-22 22:55   ` Anand Rawat
  2019-03-22 22:55     ` Anand Rawat
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 6/8] eal: add minimum viable code for eal on windows Anand Rawat
                     ` (3 subsequent siblings)
  9 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/unistd.h
@@ -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

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

* [dpdk-dev] [PATCH v4 5/8] eal: add headers for compatibility with windows environment
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 5/8] eal: add headers for compatibility with windows environment Anand Rawat
@ 2019-03-22 22:55     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/unistd.h
@@ -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


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

* [dpdk-dev] [PATCH v4 6/8] eal: add minimum viable code for eal on windows
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
                     ` (5 preceding siblings ...)
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 5/8] eal: add headers for compatibility with windows environment Anand Rawat
@ 2019-03-22 22:55   ` Anand Rawat
  2019-03-22 22:55     ` Anand Rawat
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows Anand Rawat
                     ` (2 subsequent siblings)
  9 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 13e41ea30..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index 6e07fe10c..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index 4ddf51aa8..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdint.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+#include <rte_common.h>
+
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index e74f8893b..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
-#include "rte_common.h"
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
+#include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/regex.h
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
index af24ef39f..46146e59b 100644
--- a/lib/librte_eal/windows/eal/include/rte_windows.h
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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

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

* [dpdk-dev] [PATCH v4 6/8] eal: add minimum viable code for eal on windows
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 6/8] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-22 22:55     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 13e41ea30..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index 6e07fe10c..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index 4ddf51aa8..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdint.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+#include <rte_common.h>
+
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index e74f8893b..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
-#include "rte_common.h"
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
+#include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/regex.h
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
index af24ef39f..46146e59b 100644
--- a/lib/librte_eal/windows/eal/include/rte_windows.h
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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


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

* [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
                     ` (6 preceding siblings ...)
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 6/8] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-22 22:55   ` Anand Rawat
  2019-03-22 22:55     ` Anand Rawat
  2019-03-23 16:51     ` Jerin Jacob Kollanukkaran
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 8/8] build: meson changes to build on windows Anand Rawat
  2019-03-25 18:47   ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Harini Ramakrishnan
  9 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 452b8eb82..0080c8f4c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..06b148eca
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files
+on windwos, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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

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

* [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows Anand Rawat
@ 2019-03-22 22:55     ` Anand Rawat
  2019-03-23 16:51     ` Jerin Jacob Kollanukkaran
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 452b8eb82..0080c8f4c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..06b148eca
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files
+on windwos, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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


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

* [dpdk-dev] [PATCH v4 8/8] build: meson changes to build on windows
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
                     ` (7 preceding siblings ...)
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows Anand Rawat
@ 2019-03-22 22:55   ` Anand Rawat
  2019-03-22 22:55     ` Anand Rawat
  2019-03-25 10:32     ` Bruce Richardson
  2019-03-25 18:47   ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Harini Ramakrishnan
  9 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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(-)

diff --git a/app/meson.build b/app/meson.build
index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/doc/meson.build b/doc/meson.build
index c5410d85d..20c74ee36 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -1,5 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
+# Copyright(c) 2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 doc_targets = []
 doc_target_names = []
diff --git a/drivers/meson.build b/drivers/meson.build
index 69d0556d3..33d1503f3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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',
diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..107e378e7 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/kernel/meson.build b/kernel/meson.build
index 2c8fa76d0..a7ab219d2 100644
--- a/kernel/meson.build
+++ b/kernel/meson.build
@@ -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())
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..05ebd06b6 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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',
+		'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
 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(
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'
diff --git a/usertools/meson.build b/usertools/meson.build
index 149e788e3..a00fcaa6a 100644
--- a/usertools/meson.build
+++ b/usertools/meson.build
@@ -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')
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v4 8/8] build: meson changes to build on windows
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 8/8] build: meson changes to build on windows Anand Rawat
@ 2019-03-22 22:55     ` Anand Rawat
  2019-03-25 10:32     ` Bruce Richardson
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-22 22:55 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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(-)

diff --git a/app/meson.build b/app/meson.build
index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/doc/meson.build b/doc/meson.build
index c5410d85d..20c74ee36 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -1,5 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
+# Copyright(c) 2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 doc_targets = []
 doc_target_names = []
diff --git a/drivers/meson.build b/drivers/meson.build
index 69d0556d3..33d1503f3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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',
diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..107e378e7 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/kernel/meson.build b/kernel/meson.build
index 2c8fa76d0..a7ab219d2 100644
--- a/kernel/meson.build
+++ b/kernel/meson.build
@@ -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())
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..05ebd06b6 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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',
+		'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
 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(
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'
diff --git a/usertools/meson.build b/usertools/meson.build
index 149e788e3..a00fcaa6a 100644
--- a/usertools/meson.build
+++ b/usertools/meson.build
@@ -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')
-- 
2.17.1.windows.2


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

* Re: [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows Anand Rawat
  2019-03-22 22:55     ` Anand Rawat
@ 2019-03-23 16:51     ` Jerin Jacob Kollanukkaran
  2019-03-23 16:51       ` Jerin Jacob Kollanukkaran
  2019-03-25 10:24       ` Bruce Richardson
  1 sibling, 2 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-23 16:51 UTC (permalink / raw)
  To: anand.rawat, dev
  Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On Fri, 2019-03-22 at 15:55 -0700, Anand Rawat wrote:
> Added documentation to build helloworld example
> on windows using meson and clang. Updated the
> maintainers list to include windows maintainers.
> 
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
> 
> +Install the Linker
> +------------------
> +
> +Download and install the Build Tools for Visual Studio to link and
> 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

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

* Re: [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows
  2019-03-23 16:51     ` Jerin Jacob Kollanukkaran
@ 2019-03-23 16:51       ` Jerin Jacob Kollanukkaran
  2019-03-25 10:24       ` Bruce Richardson
  1 sibling, 0 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-23 16:51 UTC (permalink / raw)
  To: anand.rawat, dev
  Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On Fri, 2019-03-22 at 15:55 -0700, Anand Rawat wrote:
> Added documentation to build helloworld example
> on windows using meson and clang. Updated the
> maintainers list to include windows maintainers.
> 
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
> 
> +Install the Linker
> +------------------
> +
> +Download and install the Build Tools for Visual Studio to link and
> 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

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

* Re: [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows
  2019-03-23 16:51     ` Jerin Jacob Kollanukkaran
  2019-03-23 16:51       ` Jerin Jacob Kollanukkaran
@ 2019-03-25 10:24       ` Bruce Richardson
  2019-03-25 10:24         ` Bruce Richardson
  2019-03-25 17:43         ` Pallavi Kadam
  1 sibling, 2 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-25 10:24 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran
  Cc: anand.rawat, dev, pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw

On Sat, Mar 23, 2019 at 04:51:27PM +0000, Jerin Jacob Kollanukkaran wrote:
> On Fri, 2019-03-22 at 15:55 -0700, Anand Rawat wrote:
> > Added documentation to build helloworld example
> > on windows using meson and clang. Updated the
> > maintainers list to include windows maintainers.
> > 
> > Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > ---
> > 
> > +Install the Linker
> > +------------------
> > +
> > +Download and install the Build Tools for Visual Studio to link and
> > 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

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! :-)

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

* Re: [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows
  2019-03-25 10:24       ` Bruce Richardson
@ 2019-03-25 10:24         ` Bruce Richardson
  2019-03-25 17:43         ` Pallavi Kadam
  1 sibling, 0 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-25 10:24 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran
  Cc: anand.rawat, dev, pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw

On Sat, Mar 23, 2019 at 04:51:27PM +0000, Jerin Jacob Kollanukkaran wrote:
> On Fri, 2019-03-22 at 15:55 -0700, Anand Rawat wrote:
> > Added documentation to build helloworld example
> > on windows using meson and clang. Updated the
> > maintainers list to include windows maintainers.
> > 
> > Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > ---
> > 
> > +Install the Linker
> > +------------------
> > +
> > +Download and install the Build Tools for Visual Studio to link and
> > 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

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! :-)

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

* Re: [dpdk-dev] [PATCH v4 8/8] build: meson changes to build on windows
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 8/8] build: meson changes to build on windows Anand Rawat
  2019-03-22 22:55     ` Anand Rawat
@ 2019-03-25 10:32     ` Bruce Richardson
  2019-03-25 10:32       ` Bruce Richardson
  1 sibling, 1 reply; 327+ messages in thread
From: Bruce Richardson @ 2019-03-25 10:32 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

On Fri, Mar 22, 2019 at 03:55:05PM -0700, Anand Rawat wrote:
> 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.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---

Comments inline below.
/Bruce

>  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(-)
> 
> diff --git a/app/meson.build b/app/meson.build
> index aa353f657..e949624b7 100644
> --- a/app/meson.build
> +++ b/app/meson.build
> @@ -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',
> diff --git a/buildtools/meson.build b/buildtools/meson.build
> index cdd38ed24..0209bec8f 100644
> --- a/buildtools/meson.build
> +++ b/buildtools/meson.build
> @@ -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')
>  
> diff --git a/doc/meson.build b/doc/meson.build
> index c5410d85d..20c74ee36 100644
> --- a/doc/meson.build
> +++ b/doc/meson.build
> @@ -1,5 +1,10 @@
>  # SPDX-License-Identifier: BSD-3-Clause
>  # Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
> +# 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.

>  doc_targets = []
>  doc_target_names = []
> diff --git a/drivers/meson.build b/drivers/meson.build
> index 69d0556d3..33d1503f3 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -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',
> diff --git a/examples/meson.build b/examples/meson.build
> index af81c762e..107e378e7 100644
> --- a/examples/meson.build
> +++ b/examples/meson.build
> @@ -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
> diff --git a/kernel/meson.build b/kernel/meson.build
> index 2c8fa76d0..a7ab219d2 100644
> --- a/kernel/meson.build
> +++ b/kernel/meson.build
> @@ -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.

>  subdir(host_machine.system())
> diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
> index 5ecae0b1f..05ebd06b6 100644
> --- a/lib/librte_eal/common/meson.build
> +++ b/lib/librte_eal/common/meson.build
> @@ -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',
> +		'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.

> +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(
> 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'
> diff --git a/usertools/meson.build b/usertools/meson.build
> index 149e788e3..a00fcaa6a 100644
> --- a/usertools/meson.build
> +++ b/usertools/meson.build
> @@ -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.

>  install_data(['dpdk-devbind.py', 'dpdk-pmdinfo.py'], install_dir: 'bin')
> -- 
> 2.17.1.windows.2
>

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

* Re: [dpdk-dev] [PATCH v4 8/8] build: meson changes to build on windows
  2019-03-25 10:32     ` Bruce Richardson
@ 2019-03-25 10:32       ` Bruce Richardson
  0 siblings, 0 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-25 10:32 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

On Fri, Mar 22, 2019 at 03:55:05PM -0700, Anand Rawat wrote:
> 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.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---

Comments inline below.
/Bruce

>  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(-)
> 
> diff --git a/app/meson.build b/app/meson.build
> index aa353f657..e949624b7 100644
> --- a/app/meson.build
> +++ b/app/meson.build
> @@ -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',
> diff --git a/buildtools/meson.build b/buildtools/meson.build
> index cdd38ed24..0209bec8f 100644
> --- a/buildtools/meson.build
> +++ b/buildtools/meson.build
> @@ -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')
>  
> diff --git a/doc/meson.build b/doc/meson.build
> index c5410d85d..20c74ee36 100644
> --- a/doc/meson.build
> +++ b/doc/meson.build
> @@ -1,5 +1,10 @@
>  # SPDX-License-Identifier: BSD-3-Clause
>  # Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
> +# 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.

>  doc_targets = []
>  doc_target_names = []
> diff --git a/drivers/meson.build b/drivers/meson.build
> index 69d0556d3..33d1503f3 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -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',
> diff --git a/examples/meson.build b/examples/meson.build
> index af81c762e..107e378e7 100644
> --- a/examples/meson.build
> +++ b/examples/meson.build
> @@ -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
> diff --git a/kernel/meson.build b/kernel/meson.build
> index 2c8fa76d0..a7ab219d2 100644
> --- a/kernel/meson.build
> +++ b/kernel/meson.build
> @@ -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.

>  subdir(host_machine.system())
> diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
> index 5ecae0b1f..05ebd06b6 100644
> --- a/lib/librte_eal/common/meson.build
> +++ b/lib/librte_eal/common/meson.build
> @@ -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',
> +		'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.

> +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(
> 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'
> diff --git a/usertools/meson.build b/usertools/meson.build
> index 149e788e3..a00fcaa6a 100644
> --- a/usertools/meson.build
> +++ b/usertools/meson.build
> @@ -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.

>  install_data(['dpdk-devbind.py', 'dpdk-pmdinfo.py'], install_dir: 'bin')
> -- 
> 2.17.1.windows.2
>


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

* Re: [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows
  2019-03-25 10:24       ` Bruce Richardson
  2019-03-25 10:24         ` Bruce Richardson
@ 2019-03-25 17:43         ` Pallavi Kadam
  2019-03-25 17:43           ` Pallavi Kadam
  1 sibling, 1 reply; 327+ messages in thread
From: Pallavi Kadam @ 2019-03-25 17:43 UTC (permalink / raw)
  To: Bruce Richardson, Jerin Jacob Kollanukkaran
  Cc: anand.rawat, dev, thomas, ranjit.menon, jeffrey.b.shaw


On 3/25/2019 3:24 AM, Bruce Richardson wrote:
> On Sat, Mar 23, 2019 at 04:51:27PM +0000, Jerin Jacob Kollanukkaran wrote:
>> On Fri, 2019-03-22 at 15:55 -0700, Anand Rawat wrote:
>>> Added documentation to build helloworld example
>>> on windows using meson and clang. Updated the
>>> maintainers list to include windows maintainers.
>>>
>>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>>> ---
>>>
>>> +Install the Linker
>>> +------------------
>>> +
>>> +Download and install the Build Tools for Visual Studio to link and
>>> 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
> 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

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

* Re: [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows
  2019-03-25 17:43         ` Pallavi Kadam
@ 2019-03-25 17:43           ` Pallavi Kadam
  0 siblings, 0 replies; 327+ messages in thread
From: Pallavi Kadam @ 2019-03-25 17:43 UTC (permalink / raw)
  To: Bruce Richardson, Jerin Jacob Kollanukkaran
  Cc: anand.rawat, dev, thomas, ranjit.menon, jeffrey.b.shaw


On 3/25/2019 3:24 AM, Bruce Richardson wrote:
> On Sat, Mar 23, 2019 at 04:51:27PM +0000, Jerin Jacob Kollanukkaran wrote:
>> On Fri, 2019-03-22 at 15:55 -0700, Anand Rawat wrote:
>>> Added documentation to build helloworld example
>>> on windows using meson and clang. Updated the
>>> maintainers list to include windows maintainers.
>>>
>>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>>> ---
>>>
>>> +Install the Linker
>>> +------------------
>>> +
>>> +Download and install the Build Tools for Visual Studio to link and
>>> 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
> 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


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

* Re: [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
                     ` (8 preceding siblings ...)
  2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 8/8] build: meson changes to build on windows Anand Rawat
@ 2019-03-25 18:47   ` Harini Ramakrishnan
  2019-03-25 18:47     ` Harini Ramakrishnan
  9 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-25 18:47 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Friday, March 22, 2019 3:55 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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

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

* Re: [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows
  2019-03-25 18:47   ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Harini Ramakrishnan
@ 2019-03-25 18:47     ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-25 18:47 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Friday, March 22, 2019 3:55 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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


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

* [dpdk-dev] [PATCH v5 0/8]  HelloWorld example for windows
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
                   ` (8 preceding siblings ...)
  2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
@ 2019-03-26  6:02 ` Anand Rawat
  2019-03-26  6:02   ` Anand Rawat
                     ` (10 more replies)
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
                   ` (2 subsequent siblings)
  12 siblings, 11 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

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

* [dpdk-dev] [PATCH v5 0/8]  HelloWorld example for windows
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
@ 2019-03-26  6:02   ` Anand Rawat
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support Anand Rawat
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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


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

* [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
  2019-03-26  6:02   ` Anand Rawat
@ 2019-03-26  6:02   ` Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
                       ` (2 more replies)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows Anand Rawat
                     ` (8 subsequent siblings)
  10 siblings, 3 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..71a0120b6 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..13e41ea30
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..6e07fe10c
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..4ddf51aa8
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..e74f8893b
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
+)
diff --git a/meson.build b/meson.build
index 69833de82..9959dc54f 100644
--- a/meson.build
+++ b/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support Anand Rawat
@ 2019-03-26  6:02     ` Anand Rawat
  2019-03-26 16:29     ` Harini Ramakrishnan
       [not found]     ` <MWHPR21MB0638113CDE9F61F8EC3E63D0EF5F0@MWHPR21MB0638.namprd21.prod.outlook.com>
  2 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..71a0120b6 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..13e41ea30
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..6e07fe10c
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..4ddf51aa8
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..e74f8893b
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
+)
diff --git a/meson.build b/meson.build
index 69833de82..9959dc54f 100644
--- a/meson.build
+++ b/meson.build
@@ -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


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

* [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
  2019-03-26  6:02   ` Anand Rawat
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support Anand Rawat
@ 2019-03-26  6:02   ` Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
                       ` (2 more replies)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file Anand Rawat
                     ` (7 subsequent siblings)
  10 siblings, 3 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 7178ba1e9..4775c84f5 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
new file mode 100644
index 000000000..af24ef39f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..1fe1b4677 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows Anand Rawat
@ 2019-03-26  6:02     ` Anand Rawat
  2019-03-26 10:20     ` Jerin Jacob Kollanukkaran
  2019-03-26 16:30     ` Harini Ramakrishnan
  2 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 7178ba1e9..4775c84f5 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
new file mode 100644
index 000000000..af24ef39f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..1fe1b4677 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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


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

* [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
                     ` (2 preceding siblings ...)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows Anand Rawat
@ 2019-03-26  6:02   ` Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
                       ` (3 more replies)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows Anand Rawat
                     ` (6 subsequent siblings)
  10 siblings, 4 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..265d3cc9a
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -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

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

* [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file Anand Rawat
@ 2019-03-26  6:02     ` Anand Rawat
  2019-03-26 10:32     ` Jerin Jacob Kollanukkaran
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..265d3cc9a
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -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


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

* [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
                     ` (3 preceding siblings ...)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file Anand Rawat
@ 2019-03-26  6:02   ` Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
                       ` (2 more replies)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment Anand Rawat
                     ` (5 subsequent siblings)
  10 siblings, 3 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows Anand Rawat
@ 2019-03-26  6:02     ` Anand Rawat
  2019-03-26 16:31     ` Harini Ramakrishnan
  2019-03-26 19:06     ` Stephen Hemminger
  2 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
                     ` (4 preceding siblings ...)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows Anand Rawat
@ 2019-03-26  6:02   ` Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
  2019-03-26 16:33     ` Harini Ramakrishnan
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 6/8] eal: add minimum viable code for eal on windows Anand Rawat
                     ` (4 subsequent siblings)
  10 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/unistd.h
@@ -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

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

* [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment Anand Rawat
@ 2019-03-26  6:02     ` Anand Rawat
  2019-03-26 16:33     ` Harini Ramakrishnan
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/unistd.h
@@ -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


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

* [dpdk-dev] [PATCH v5 6/8] eal: add minimum viable code for eal on windows
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
                     ` (5 preceding siblings ...)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment Anand Rawat
@ 2019-03-26  6:02   ` Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
  2019-03-26 16:32     ` Harini Ramakrishnan
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows Anand Rawat
                     ` (3 subsequent siblings)
  10 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 13e41ea30..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index 6e07fe10c..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index 4ddf51aa8..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdint.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+#include <rte_common.h>
+
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index e74f8893b..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
-#include "rte_common.h"
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
+#include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/regex.h
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
index af24ef39f..46146e59b 100644
--- a/lib/librte_eal/windows/eal/include/rte_windows.h
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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

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

* [dpdk-dev] [PATCH v5 6/8] eal: add minimum viable code for eal on windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 6/8] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-26  6:02     ` Anand Rawat
  2019-03-26 16:32     ` Harini Ramakrishnan
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 13e41ea30..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index 6e07fe10c..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index 4ddf51aa8..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdint.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+#include <rte_common.h>
+
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index e74f8893b..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
-#include "rte_common.h"
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
+#include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/regex.h
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
index af24ef39f..46146e59b 100644
--- a/lib/librte_eal/windows/eal/include/rte_windows.h
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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


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

* [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
                     ` (6 preceding siblings ...)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 6/8] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-26  6:02   ` Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
                       ` (3 more replies)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 8/8] build: meson changes to build on windows Anand Rawat
                     ` (2 subsequent siblings)
  10 siblings, 4 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 452b8eb82..0080c8f4c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..b88eb76c9
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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

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

* [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows Anand Rawat
@ 2019-03-26  6:02     ` Anand Rawat
  2019-03-26 10:27     ` Jerin Jacob Kollanukkaran
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 452b8eb82..0080c8f4c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..b88eb76c9
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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


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

* [dpdk-dev] [PATCH v5 8/8] build: meson changes to build on windows
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
                     ` (7 preceding siblings ...)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows Anand Rawat
@ 2019-03-26  6:02   ` Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
  2019-03-26 16:34     ` Harini Ramakrishnan
  2019-03-26 16:28   ` [dpdk-dev] [PATCH v5 0/8] HelloWorld example for windows Harini Ramakrishnan
       [not found]   ` <MWHPR21MB06380D6FA7CF5513DDC3820AEF5F0@MWHPR21MB0638.namprd21.prod.outlook.com>
  10 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/app/meson.build b/app/meson.build
index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build
index 69d0556d3..33d1503f3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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',
diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..bc1430fa8 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build
new file mode 100644
index 000000000..c4a2a656a
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -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
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..e9021c00c 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v5 8/8] build: meson changes to build on windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 8/8] build: meson changes to build on windows Anand Rawat
@ 2019-03-26  6:02     ` Anand Rawat
  2019-03-26 16:34     ` Harini Ramakrishnan
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26  6:02 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/app/meson.build b/app/meson.build
index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build
index 69d0556d3..33d1503f3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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',
diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..bc1430fa8 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build
new file mode 100644
index 000000000..c4a2a656a
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -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
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..e9021c00c 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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


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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
@ 2019-03-26 10:20     ` Jerin Jacob Kollanukkaran
  2019-03-26 10:20       ` Jerin Jacob Kollanukkaran
  2019-03-27 21:23       ` Ranjit Menon
  2019-03-26 16:30     ` Harini Ramakrishnan
  2 siblings, 2 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-26 10:20 UTC (permalink / raw)
  To: anand.rawat, dev
  Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> 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.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  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
> 
> diff --git a/lib/librte_eal/common/include/rte_common.h
> b/lib/librte_eal/common/include/rte_common.h
> index 7178ba1e9..4775c84f5 100644
> --- a/lib/librte_eal/common/include/rte_common.h
> +++ b/lib/librte_eal/common/include/rte_common.h
> @@ -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
> +

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.


 

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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-26 10:20     ` Jerin Jacob Kollanukkaran
@ 2019-03-26 10:20       ` Jerin Jacob Kollanukkaran
  2019-03-27 21:23       ` Ranjit Menon
  1 sibling, 0 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-26 10:20 UTC (permalink / raw)
  To: anand.rawat, dev
  Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> 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.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  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
> 
> diff --git a/lib/librte_eal/common/include/rte_common.h
> b/lib/librte_eal/common/include/rte_common.h
> index 7178ba1e9..4775c84f5 100644
> --- a/lib/librte_eal/common/include/rte_common.h
> +++ b/lib/librte_eal/common/include/rte_common.h
> @@ -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
> +

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.


 

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

* Re: [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
@ 2019-03-26 10:27     ` Jerin Jacob Kollanukkaran
  2019-03-26 10:27       ` Jerin Jacob Kollanukkaran
  2019-03-26 10:37     ` David Marchand
  2019-03-26 16:33     ` Harini Ramakrishnan
  3 siblings, 1 reply; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-26 10:27 UTC (permalink / raw)
  To: anand.rawat, dev
  Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> Added documentation to build helloworld example
> on windows using meson and clang. Updated the
> maintainers list to include windows maintainers.
> 
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>

Verified the build steps.

Tested-by: Jerin Jacob <jerinj@marvell.com>

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

* Re: [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows
  2019-03-26 10:27     ` Jerin Jacob Kollanukkaran
@ 2019-03-26 10:27       ` Jerin Jacob Kollanukkaran
  0 siblings, 0 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-26 10:27 UTC (permalink / raw)
  To: anand.rawat, dev
  Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> Added documentation to build helloworld example
> on windows using meson and clang. Updated the
> maintainers list to include windows maintainers.
> 
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>

Verified the build steps.

Tested-by: Jerin Jacob <jerinj@marvell.com>

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

* Re: [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
@ 2019-03-26 10:32     ` Jerin Jacob Kollanukkaran
  2019-03-26 10:32       ` Jerin Jacob Kollanukkaran
  2019-03-26 10:58       ` Bruce Richardson
  2019-03-26 16:31     ` [dpdk-dev] " Harini Ramakrishnan
  2019-03-26 19:02     ` Stephen Hemminger
  3 siblings, 2 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-26 10:32 UTC (permalink / raw)
  To: anand.rawat, dev
  Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> adding a DEF file for kvargs to specify the exports
> for the creation of the shared library.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
>  1 file changed, 7 insertions(+)
>  create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
> 
> diff --git a/lib/librte_kvargs/rte_kvargs_exports.def
> b/lib/librte_kvargs/rte_kvargs_exports.def
> new file mode 100644
> index 000000000..265d3cc9a
> --- /dev/null
> +++ b/lib/librte_kvargs/rte_kvargs_exports.def

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



> @@ -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

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

* Re: [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 10:32     ` Jerin Jacob Kollanukkaran
@ 2019-03-26 10:32       ` Jerin Jacob Kollanukkaran
  2019-03-26 10:58       ` Bruce Richardson
  1 sibling, 0 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-26 10:32 UTC (permalink / raw)
  To: anand.rawat, dev
  Cc: pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> adding a DEF file for kvargs to specify the exports
> for the creation of the shared library.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
>  1 file changed, 7 insertions(+)
>  create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
> 
> diff --git a/lib/librte_kvargs/rte_kvargs_exports.def
> b/lib/librte_kvargs/rte_kvargs_exports.def
> new file mode 100644
> index 000000000..265d3cc9a
> --- /dev/null
> +++ b/lib/librte_kvargs/rte_kvargs_exports.def

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



> @@ -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

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

* Re: [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
  2019-03-26 10:27     ` Jerin Jacob Kollanukkaran
@ 2019-03-26 10:37     ` David Marchand
  2019-03-26 10:37       ` David Marchand
  2019-03-26 18:29       ` Anand Rawat
  2019-03-26 16:33     ` Harini Ramakrishnan
  3 siblings, 2 replies; 327+ messages in thread
From: David Marchand @ 2019-03-26 10:37 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	Bruce Richardson, Thomas Monjalon

On Tue, Mar 26, 2019 at 7:04 AM Anand Rawat <anand.rawat@intel.com> 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 ?

-- 
David Marchand

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

* Re: [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows
  2019-03-26 10:37     ` David Marchand
@ 2019-03-26 10:37       ` David Marchand
  2019-03-26 18:29       ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: David Marchand @ 2019-03-26 10:37 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	Bruce Richardson, Thomas Monjalon

On Tue, Mar 26, 2019 at 7:04 AM Anand Rawat <anand.rawat@intel.com> 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 ?

-- 
David Marchand

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

* Re: [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 10:32     ` Jerin Jacob Kollanukkaran
  2019-03-26 10:32       ` Jerin Jacob Kollanukkaran
@ 2019-03-26 10:58       ` Bruce Richardson
  2019-03-26 10:58         ` Bruce Richardson
  2019-03-26 13:37         ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
  1 sibling, 2 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-26 10:58 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran
  Cc: anand.rawat, dev, pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw

On Tue, Mar 26, 2019 at 10:32:34AM +0000, Jerin Jacob Kollanukkaran wrote:
> On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> > adding a DEF file for kvargs to specify the exports
> > for the creation of the shared library.
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > ---
> >  lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >  create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
> > 
> > diff --git a/lib/librte_kvargs/rte_kvargs_exports.def
> > b/lib/librte_kvargs/rte_kvargs_exports.def
> > new file mode 100644
> > index 000000000..265d3cc9a
> > --- /dev/null
> > +++ b/lib/librte_kvargs/rte_kvargs_exports.def
> 
> 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.

> # 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

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

* Re: [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 10:58       ` Bruce Richardson
@ 2019-03-26 10:58         ` Bruce Richardson
  2019-03-26 13:37         ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
  1 sibling, 0 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-26 10:58 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran
  Cc: anand.rawat, dev, pallavi.kadam, thomas, ranjit.menon, jeffrey.b.shaw

On Tue, Mar 26, 2019 at 10:32:34AM +0000, Jerin Jacob Kollanukkaran wrote:
> On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> > adding a DEF file for kvargs to specify the exports
> > for the creation of the shared library.
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > ---
> >  lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >  create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
> > 
> > diff --git a/lib/librte_kvargs/rte_kvargs_exports.def
> > b/lib/librte_kvargs/rte_kvargs_exports.def
> > new file mode 100644
> > index 000000000..265d3cc9a
> > --- /dev/null
> > +++ b/lib/librte_kvargs/rte_kvargs_exports.def
> 
> 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.

> # 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

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 10:58       ` Bruce Richardson
  2019-03-26 10:58         ` Bruce Richardson
@ 2019-03-26 13:37         ` Jerin Jacob Kollanukkaran
  2019-03-26 13:37           ` Jerin Jacob Kollanukkaran
                             ` (2 more replies)
  1 sibling, 3 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-26 13:37 UTC (permalink / raw)
  To: bruce.richardson
  Cc: pallavi.kadam, thomas, anand.rawat, dev, ranjit.menon, jeffrey.b.shaw

On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> -------------------------------------------------------------------
> ---
> On Tue, Mar 26, 2019 at 10:32:34AM +0000, Jerin Jacob Kollanukkaran
> wrote:
> > On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> > > adding a DEF file for kvargs to specify the exports
> > > for the creation of the shared library.
> > > 
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > > Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > > ---
> > >  lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > >  create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
> > > 
> > > diff --git a/lib/librte_kvargs/rte_kvargs_exports.def
> > > b/lib/librte_kvargs/rte_kvargs_exports.def
> > > new file mode 100644
> > > index 000000000..265d3cc9a
> > > --- /dev/null
> > > +++ b/lib/librte_kvargs/rte_kvargs_exports.def
> > 
> > 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

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.

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


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

Yes, Waiting for the comments from Wider audience.


> 
> /Bruce

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 13:37         ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
@ 2019-03-26 13:37           ` Jerin Jacob Kollanukkaran
  2019-03-26 13:55           ` Thomas Monjalon
  2019-03-26 14:40           ` Bruce Richardson
  2 siblings, 0 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-26 13:37 UTC (permalink / raw)
  To: bruce.richardson
  Cc: pallavi.kadam, thomas, anand.rawat, dev, ranjit.menon, jeffrey.b.shaw

On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> -------------------------------------------------------------------
> ---
> On Tue, Mar 26, 2019 at 10:32:34AM +0000, Jerin Jacob Kollanukkaran
> wrote:
> > On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> > > adding a DEF file for kvargs to specify the exports
> > > for the creation of the shared library.
> > > 
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > > Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > > ---
> > >  lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > >  create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
> > > 
> > > diff --git a/lib/librte_kvargs/rte_kvargs_exports.def
> > > b/lib/librte_kvargs/rte_kvargs_exports.def
> > > new file mode 100644
> > > index 000000000..265d3cc9a
> > > --- /dev/null
> > > +++ b/lib/librte_kvargs/rte_kvargs_exports.def
> > 
> > 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

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.

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


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

Yes, Waiting for the comments from Wider audience.


> 
> /Bruce

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 13:37         ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
  2019-03-26 13:37           ` Jerin Jacob Kollanukkaran
@ 2019-03-26 13:55           ` Thomas Monjalon
  2019-03-26 13:55             ` Thomas Monjalon
  2019-03-26 14:41             ` Bruce Richardson
  2019-03-26 14:40           ` Bruce Richardson
  2 siblings, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 13:55 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran
  Cc: bruce.richardson, pallavi.kadam, anand.rawat, dev, ranjit.menon,
	jeffrey.b.shaw

26/03/2019 14:37, Jerin Jacob Kollanukkaran:
> On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > 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.

I agree, shared library can be supported later.

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 13:55           ` Thomas Monjalon
@ 2019-03-26 13:55             ` Thomas Monjalon
  2019-03-26 14:41             ` Bruce Richardson
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 13:55 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran
  Cc: bruce.richardson, pallavi.kadam, anand.rawat, dev, ranjit.menon,
	jeffrey.b.shaw

26/03/2019 14:37, Jerin Jacob Kollanukkaran:
> On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > 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.

I agree, shared library can be supported later.



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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 13:37         ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
  2019-03-26 13:37           ` Jerin Jacob Kollanukkaran
  2019-03-26 13:55           ` Thomas Monjalon
@ 2019-03-26 14:40           ` Bruce Richardson
  2019-03-26 14:40             ` Bruce Richardson
  2019-03-26 15:35             ` Jerin Jacob Kollanukkaran
  2 siblings, 2 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-26 14:40 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran
  Cc: pallavi.kadam, thomas, anand.rawat, dev, ranjit.menon, jeffrey.b.shaw

On Tue, Mar 26, 2019 at 01:37:33PM +0000, Jerin Jacob Kollanukkaran wrote:
> On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > -------------------------------------------------------------------
> > ---
> > On Tue, Mar 26, 2019 at 10:32:34AM +0000, Jerin Jacob Kollanukkaran
> > wrote:
> > > On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> > > > adding a DEF file for kvargs to specify the exports
> > > > for the creation of the shared library.
> > > > 
> > > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > > > Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > > > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > > > ---
> > > >  lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
> > > >  1 file changed, 7 insertions(+)
> > > >  create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
> > > > 
> > > > diff --git a/lib/librte_kvargs/rte_kvargs_exports.def
> > > > b/lib/librte_kvargs/rte_kvargs_exports.def
> > > > new file mode 100644
> > > > index 000000000..265d3cc9a
> > > > --- /dev/null
> > > > +++ b/lib/librte_kvargs/rte_kvargs_exports.def
> > > 
> > > 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
> 
> 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.

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

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 14:40           ` Bruce Richardson
@ 2019-03-26 14:40             ` Bruce Richardson
  2019-03-26 15:35             ` Jerin Jacob Kollanukkaran
  1 sibling, 0 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-26 14:40 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran
  Cc: pallavi.kadam, thomas, anand.rawat, dev, ranjit.menon, jeffrey.b.shaw

On Tue, Mar 26, 2019 at 01:37:33PM +0000, Jerin Jacob Kollanukkaran wrote:
> On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > -------------------------------------------------------------------
> > ---
> > On Tue, Mar 26, 2019 at 10:32:34AM +0000, Jerin Jacob Kollanukkaran
> > wrote:
> > > On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> > > > adding a DEF file for kvargs to specify the exports
> > > > for the creation of the shared library.
> > > > 
> > > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > > > Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > > > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > > > ---
> > > >  lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
> > > >  1 file changed, 7 insertions(+)
> > > >  create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
> > > > 
> > > > diff --git a/lib/librte_kvargs/rte_kvargs_exports.def
> > > > b/lib/librte_kvargs/rte_kvargs_exports.def
> > > > new file mode 100644
> > > > index 000000000..265d3cc9a
> > > > --- /dev/null
> > > > +++ b/lib/librte_kvargs/rte_kvargs_exports.def
> > > 
> > > 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
> 
> 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.

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

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 13:55           ` Thomas Monjalon
  2019-03-26 13:55             ` Thomas Monjalon
@ 2019-03-26 14:41             ` Bruce Richardson
  2019-03-26 14:41               ` Bruce Richardson
  2019-03-26 15:07               ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-26 14:41 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Jerin Jacob Kollanukkaran, pallavi.kadam, anand.rawat, dev,
	ranjit.menon, jeffrey.b.shaw

On Tue, Mar 26, 2019 at 02:55:41PM +0100, Thomas Monjalon wrote:
> 26/03/2019 14:37, Jerin Jacob Kollanukkaran:
> > On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > > 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.
> 
> 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

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 14:41             ` Bruce Richardson
@ 2019-03-26 14:41               ` Bruce Richardson
  2019-03-26 15:07               ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-26 14:41 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Jerin Jacob Kollanukkaran, pallavi.kadam, anand.rawat, dev,
	ranjit.menon, jeffrey.b.shaw

On Tue, Mar 26, 2019 at 02:55:41PM +0100, Thomas Monjalon wrote:
> 26/03/2019 14:37, Jerin Jacob Kollanukkaran:
> > On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > > 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.
> 
> 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

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 14:41             ` Bruce Richardson
  2019-03-26 14:41               ` Bruce Richardson
@ 2019-03-26 15:07               ` Thomas Monjalon
  2019-03-26 15:07                 ` Thomas Monjalon
  2019-03-26 15:17                 ` Bruce Richardson
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 15:07 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Jerin Jacob Kollanukkaran, pallavi.kadam, anand.rawat, dev,
	ranjit.menon, jeffrey.b.shaw

26/03/2019 15:41, Bruce Richardson:
> On Tue, Mar 26, 2019 at 02:55:41PM +0100, Thomas Monjalon wrote:
> > 26/03/2019 14:37, Jerin Jacob Kollanukkaran:
> > > On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > > > 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.
> > 
> > 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?

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 15:07               ` Thomas Monjalon
@ 2019-03-26 15:07                 ` Thomas Monjalon
  2019-03-26 15:17                 ` Bruce Richardson
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 15:07 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Jerin Jacob Kollanukkaran, pallavi.kadam, anand.rawat, dev,
	ranjit.menon, jeffrey.b.shaw

26/03/2019 15:41, Bruce Richardson:
> On Tue, Mar 26, 2019 at 02:55:41PM +0100, Thomas Monjalon wrote:
> > 26/03/2019 14:37, Jerin Jacob Kollanukkaran:
> > > On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > > > 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.
> > 
> > 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?



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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 15:07               ` Thomas Monjalon
  2019-03-26 15:07                 ` Thomas Monjalon
@ 2019-03-26 15:17                 ` Bruce Richardson
  2019-03-26 15:17                   ` Bruce Richardson
  2019-03-26 15:22                   ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-26 15:17 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Jerin Jacob Kollanukkaran, pallavi.kadam, anand.rawat, dev,
	ranjit.menon, jeffrey.b.shaw

On Tue, Mar 26, 2019 at 04:07:26PM +0100, Thomas Monjalon wrote:
> 26/03/2019 15:41, Bruce Richardson:
> > On Tue, Mar 26, 2019 at 02:55:41PM +0100, Thomas Monjalon wrote:
> > > 26/03/2019 14:37, Jerin Jacob Kollanukkaran:
> > > > On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > > > > 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.
> > > 
> > > 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

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 15:17                 ` Bruce Richardson
@ 2019-03-26 15:17                   ` Bruce Richardson
  2019-03-26 15:22                   ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-26 15:17 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Jerin Jacob Kollanukkaran, pallavi.kadam, anand.rawat, dev,
	ranjit.menon, jeffrey.b.shaw

On Tue, Mar 26, 2019 at 04:07:26PM +0100, Thomas Monjalon wrote:
> 26/03/2019 15:41, Bruce Richardson:
> > On Tue, Mar 26, 2019 at 02:55:41PM +0100, Thomas Monjalon wrote:
> > > 26/03/2019 14:37, Jerin Jacob Kollanukkaran:
> > > > On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > > > > 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.
> > > 
> > > 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

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 15:17                 ` Bruce Richardson
  2019-03-26 15:17                   ` Bruce Richardson
@ 2019-03-26 15:22                   ` Thomas Monjalon
  2019-03-26 15:22                     ` Thomas Monjalon
  1 sibling, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 15:22 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Jerin Jacob Kollanukkaran, pallavi.kadam, anand.rawat, dev,
	ranjit.menon, jeffrey.b.shaw

26/03/2019 16:17, Bruce Richardson:
> On Tue, Mar 26, 2019 at 04:07:26PM +0100, Thomas Monjalon wrote:
> > 26/03/2019 15:41, Bruce Richardson:
> > > On Tue, Mar 26, 2019 at 02:55:41PM +0100, Thomas Monjalon wrote:
> > > > 26/03/2019 14:37, Jerin Jacob Kollanukkaran:
> > > > > On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > > > > > 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.
> > > > 
> > > > 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.

OK, thanks

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 15:22                   ` Thomas Monjalon
@ 2019-03-26 15:22                     ` Thomas Monjalon
  0 siblings, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 15:22 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Jerin Jacob Kollanukkaran, pallavi.kadam, anand.rawat, dev,
	ranjit.menon, jeffrey.b.shaw

26/03/2019 16:17, Bruce Richardson:
> On Tue, Mar 26, 2019 at 04:07:26PM +0100, Thomas Monjalon wrote:
> > 26/03/2019 15:41, Bruce Richardson:
> > > On Tue, Mar 26, 2019 at 02:55:41PM +0100, Thomas Monjalon wrote:
> > > > 26/03/2019 14:37, Jerin Jacob Kollanukkaran:
> > > > > On Tue, 2019-03-26 at 10:58 +0000, Bruce Richardson wrote:
> > > > > > 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.
> > > > 
> > > > 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.

OK, thanks



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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 14:40           ` Bruce Richardson
  2019-03-26 14:40             ` Bruce Richardson
@ 2019-03-26 15:35             ` Jerin Jacob Kollanukkaran
  2019-03-26 15:35               ` Jerin Jacob Kollanukkaran
  2019-03-26 16:46               ` Bruce Richardson
  1 sibling, 2 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-26 15:35 UTC (permalink / raw)
  To: bruce.richardson
  Cc: pallavi.kadam, thomas, anand.rawat, dev, ranjit.menon, jeffrey.b.shaw

On Tue, 2019-03-26 at 14:40 +0000, Bruce Richardson wrote:
> > 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.
> 
> > > 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.
> > 
> 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.



> 
> /Bruce

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 15:35             ` Jerin Jacob Kollanukkaran
@ 2019-03-26 15:35               ` Jerin Jacob Kollanukkaran
  2019-03-26 16:46               ` Bruce Richardson
  1 sibling, 0 replies; 327+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-26 15:35 UTC (permalink / raw)
  To: bruce.richardson
  Cc: pallavi.kadam, thomas, anand.rawat, dev, ranjit.menon, jeffrey.b.shaw

On Tue, 2019-03-26 at 14:40 +0000, Bruce Richardson wrote:
> > 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.
> 
> > > 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.
> > 
> 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.



> 
> /Bruce

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

* Re: [dpdk-dev] [PATCH v5 0/8]  HelloWorld example for windows
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
                     ` (8 preceding siblings ...)
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 8/8] build: meson changes to build on windows Anand Rawat
@ 2019-03-26 16:28   ` Harini Ramakrishnan
  2019-03-26 16:28     ` Harini Ramakrishnan
       [not found]   ` <MWHPR21MB06380D6FA7CF5513DDC3820AEF5F0@MWHPR21MB0638.namprd21.prod.outlook.com>
  10 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:28 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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

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

* Re: [dpdk-dev] [PATCH v5 0/8]  HelloWorld example for windows
  2019-03-26 16:28   ` [dpdk-dev] [PATCH v5 0/8] HelloWorld example for windows Harini Ramakrishnan
@ 2019-03-26 16:28     ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:28 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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


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

* Re: [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
@ 2019-03-26 16:29     ` Harini Ramakrishnan
  2019-03-26 16:29       ` Harini Ramakrishnan
       [not found]     ` <MWHPR21MB0638113CDE9F61F8EC3E63D0EF5F0@MWHPR21MB0638.namprd21.prod.outlook.com>
  2 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:29 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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

diff --git a/config/meson.build b/config/meson.build index 0419607d3..71a0120b6 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..13e41ea30
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..6e07fe10c
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..4ddf51aa8
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..e74f8893b
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
+)
diff --git a/meson.build b/meson.build
index 69833de82..9959dc54f 100644
--- a/meson.build
+++ b/meson.build
@@ -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

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

* Re: [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support
  2019-03-26 16:29     ` Harini Ramakrishnan
@ 2019-03-26 16:29       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:29 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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

diff --git a/config/meson.build b/config/meson.build index 0419607d3..71a0120b6 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..13e41ea30
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..6e07fe10c
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..4ddf51aa8
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..e74f8893b
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
+)
diff --git a/meson.build b/meson.build
index 69833de82..9959dc54f 100644
--- a/meson.build
+++ b/meson.build
@@ -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


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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
  2019-03-26 10:20     ` Jerin Jacob Kollanukkaran
@ 2019-03-26 16:30     ` Harini Ramakrishnan
  2019-03-26 16:30       ` Harini Ramakrishnan
  2 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:30 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 7178ba1e9..4775c84f5 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
new file mode 100644
index 000000000..af24ef39f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
diff --git a/lib/meson.build b/lib/meson.build index 99957ba7d..1fe1b4677 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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

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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-26 16:30     ` Harini Ramakrishnan
@ 2019-03-26 16:30       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:30 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 7178ba1e9..4775c84f5 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
new file mode 100644
index 000000000..af24ef39f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
diff --git a/lib/meson.build b/lib/meson.build index 99957ba7d..1fe1b4677 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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


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

* Re: [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
  2019-03-26 10:32     ` Jerin Jacob Kollanukkaran
@ 2019-03-26 16:31     ` Harini Ramakrishnan
  2019-03-26 16:31       ` Harini Ramakrishnan
  2019-03-26 19:02     ` Stephen Hemminger
  3 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:31 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@micosoft.com>
---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..265d3cc9a
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -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

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

* Re: [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 16:31     ` [dpdk-dev] " Harini Ramakrishnan
@ 2019-03-26 16:31       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:31 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@micosoft.com>
---
 lib/librte_kvargs/rte_kvargs_exports.def | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..265d3cc9a
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -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


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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
@ 2019-03-26 16:31     ` Harini Ramakrishnan
  2019-03-26 16:31       ` Harini Ramakrishnan
  2019-03-26 19:06     ` Stephen Hemminger
  2 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:31 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 16:31     ` Harini Ramakrishnan
@ 2019-03-26 16:31       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:31 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2


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

* Re: [dpdk-dev] [PATCH v5 6/8] eal: add minimum viable code for eal on windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 6/8] eal: add minimum viable code for eal on windows Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
@ 2019-03-26 16:32     ` Harini Ramakrishnan
  2019-03-26 16:32       ` Harini Ramakrishnan
  1 sibling, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:32 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 13e41ea30..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index 6e07fe10c..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index 4ddf51aa8..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdint.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+#include <rte_common.h>
+
+/* global data structure that contains the CPU map */ static struct 
+_wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system  
+*/ void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id) {
+	return (lcore_id < wcpu_map.total_procs); }
+
+/*
+ * Get CPU socket id for a logical core  */ unsigned 
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */ -unsigned int -eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core  */ unsigned 
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index e74f8893b..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
-#include "rte_common.h"
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
+#include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int 
+slave_id) {
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id) {
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused) {
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/regex.h
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
index af24ef39f..46146e59b 100644
--- a/lib/librte_eal/windows/eal/include/rte_windows.h
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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

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

* Re: [dpdk-dev] [PATCH v5 6/8] eal: add minimum viable code for eal on windows
  2019-03-26 16:32     ` Harini Ramakrishnan
@ 2019-03-26 16:32       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:32 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 13e41ea30..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index 6e07fe10c..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index 4ddf51aa8..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdint.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+#include <rte_common.h>
+
+/* global data structure that contains the CPU map */ static struct 
+_wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system  
+*/ void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id) {
+	return (lcore_id < wcpu_map.total_procs); }
+
+/*
+ * Get CPU socket id for a logical core  */ unsigned 
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */ -unsigned int -eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core  */ unsigned 
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index e74f8893b..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
-#include "rte_common.h"
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
+#include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int 
+slave_id) {
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id) {
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused) {
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/regex.h
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
index af24ef39f..46146e59b 100644
--- a/lib/librte_eal/windows/eal/include/rte_windows.h
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -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


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

* Re: [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
@ 2019-03-26 16:33     ` Harini Ramakrishnan
  2019-03-26 16:33       ` Harini Ramakrishnan
  1 sibling, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:33 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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

diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg) {
+	/* TODO */
+	/* This is a stub, not the expected result */ }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8) #define _BIT_SET_MASK 
+(_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET) #define 
+_WHICH_SET(b) ((b) / _BITS_PER_SET) #define _WHICH_BIT(b) ((b) & 
+(_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)]; } rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << 
+_WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/unistd.h
@@ -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

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

* Re: [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment
  2019-03-26 16:33     ` Harini Ramakrishnan
@ 2019-03-26 16:33       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:33 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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

diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg) {
+	/* TODO */
+	/* This is a stub, not the expected result */ }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8) #define _BIT_SET_MASK 
+(_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET) #define 
+_WHICH_SET(b) ((b) / _BITS_PER_SET) #define _WHICH_BIT(b) ((b) & 
+(_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)]; } rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << 
+_WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/unistd.h
@@ -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


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

* Re: [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows Anand Rawat
                       ` (2 preceding siblings ...)
  2019-03-26 10:37     ` David Marchand
@ 2019-03-26 16:33     ` Harini Ramakrishnan
  2019-03-26 16:33       ` Harini Ramakrishnan
  3 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:33 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 452b8eb82..0080c8f4c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..b88eb76c9
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Freleases.llvm.org%2Fdownload.html&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636891770331298978&amp;sdata=DlwCRrthiQFHfEUDRAvnNC6d3Id1XVlC6GtM4vYNFK8%3D&amp;reserved=0>`_.
+For example, Clang-LLVM direct download link::
+
+	
+https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Freleas
+es.llvm.org%2F7.0.1%2FLLVM-7.0.1-win64.exe&amp;data=02%7C01%7CHarini.Ra
+makrishnan%40microsoft.com%7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988b
+f86f141af91ab2d7cd011db47%7C1%7C0%7C636891770331298978&amp;sdata=JYeD4D
+hXDwjW7dIpJYGCNHFPbTKkKXY6IAzXtdI5%2BTk%3D&amp;reserved=0
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvisualstudio.microsoft.com%2Fdownloads&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636891770331298978&amp;sdata=YgjrsjgivAcQTEsNUfAUESSrrwsc7qJQx3E0hDm00rQ%3D&amp;reserved=0>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmesonbuild.com%2FGetting-meson.html&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636891770331298978&amp;sdata=aYcX660Y7M3frO7uQq%2BbvBc5egx5ij9c3Si7ZTC0df8%3D&amp;reserved=0>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	
+https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmesonb
+uild.com%2FGetting-meson.html%23installing-meson-and-ninja-with-the-msi
+-installer%2522&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%
+7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988bf86f141af91ab2d7cd011db47%7
+C1%7C0%7C636891770331298978&amp;sdata=CsFkIeLQM9XK4P1lWAAdo%2FeSXDP7WDe
+5BCdmhb8CMfA%3D&amp;reserved=0
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website 
+<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fninja-build.org%2F&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636891770331298978&amp;sdata=S5H8HQkxHWOCCzWzGUimF1ry1dDTVnohDDJD%2FRdjJ7E%3D&amp;reserved=0>`_ or install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld 
+example by default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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

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

* Re: [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows
  2019-03-26 16:33     ` Harini Ramakrishnan
@ 2019-03-26 16:33       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:33 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 452b8eb82..0080c8f4c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -272,6 +272,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..b88eb76c9
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Freleases.llvm.org%2Fdownload.html&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636891770331298978&amp;sdata=DlwCRrthiQFHfEUDRAvnNC6d3Id1XVlC6GtM4vYNFK8%3D&amp;reserved=0>`_.
+For example, Clang-LLVM direct download link::
+
+	
+https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Freleas
+es.llvm.org%2F7.0.1%2FLLVM-7.0.1-win64.exe&amp;data=02%7C01%7CHarini.Ra
+makrishnan%40microsoft.com%7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988b
+f86f141af91ab2d7cd011db47%7C1%7C0%7C636891770331298978&amp;sdata=JYeD4D
+hXDwjW7dIpJYGCNHFPbTKkKXY6IAzXtdI5%2BTk%3D&amp;reserved=0
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvisualstudio.microsoft.com%2Fdownloads&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636891770331298978&amp;sdata=YgjrsjgivAcQTEsNUfAUESSrrwsc7qJQx3E0hDm00rQ%3D&amp;reserved=0>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmesonbuild.com%2FGetting-meson.html&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636891770331298978&amp;sdata=aYcX660Y7M3frO7uQq%2BbvBc5egx5ij9c3Si7ZTC0df8%3D&amp;reserved=0>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	
+https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmesonb
+uild.com%2FGetting-meson.html%23installing-meson-and-ninja-with-the-msi
+-installer%2522&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%
+7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988bf86f141af91ab2d7cd011db47%7
+C1%7C0%7C636891770331298978&amp;sdata=CsFkIeLQM9XK4P1lWAAdo%2FeSXDP7WDe
+5BCdmhb8CMfA%3D&amp;reserved=0
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website 
+<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fninja-build.org%2F&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Cc15cbeeecc1444e67dd508d6b1b0d207%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636891770331298978&amp;sdata=S5H8HQkxHWOCCzWzGUimF1ry1dDTVnohDDJD%2FRdjJ7E%3D&amp;reserved=0>`_ or install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld 
+example by default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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


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

* Re: [dpdk-dev] [PATCH v5 8/8] build: meson changes to build on windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 8/8] build: meson changes to build on windows Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
@ 2019-03-26 16:34     ` Harini Ramakrishnan
  2019-03-26 16:34       ` Harini Ramakrishnan
  1 sibling, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:34 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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

diff --git a/app/meson.build b/app/meson.build index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build index 69d0556d3..33d1503f3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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',
diff --git a/examples/meson.build b/examples/meson.build index af81c762e..bc1430fa8 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build new file mode 100644 index 000000000..c4a2a656a
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -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
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..e9021c00c 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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

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

* Re: [dpdk-dev] [PATCH v5 8/8] build: meson changes to build on windows
  2019-03-26 16:34     ` Harini Ramakrishnan
@ 2019-03-26 16:34       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-26 16:34 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 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

diff --git a/app/meson.build b/app/meson.build index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build index 69d0556d3..33d1503f3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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',
diff --git a/examples/meson.build b/examples/meson.build index af81c762e..bc1430fa8 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build new file mode 100644 index 000000000..c4a2a656a
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -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
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..e9021c00c 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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


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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 15:35             ` Jerin Jacob Kollanukkaran
  2019-03-26 15:35               ` Jerin Jacob Kollanukkaran
@ 2019-03-26 16:46               ` Bruce Richardson
  2019-03-26 16:46                 ` Bruce Richardson
  2019-03-26 23:13                 ` Anand Rawat
  1 sibling, 2 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-26 16:46 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran
  Cc: pallavi.kadam, thomas, anand.rawat, dev, ranjit.menon, jeffrey.b.shaw

On Tue, Mar 26, 2019 at 03:35:36PM +0000, Jerin Jacob Kollanukkaran wrote:
> On Tue, 2019-03-26 at 14:40 +0000, Bruce Richardson wrote:
> > > 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.
> > 
> > > > 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.
> > > 
> > 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.
> 
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

diff --git a/buildtools/map_to_def.py b/buildtools/map_to_def.py
new file mode 100644
index 000000000..6c2f56c5d
--- /dev/null
+++ b/buildtools/map_to_def.py
@@ -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))
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..9ae2bc7c8 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -4,3 +4,4 @@
 subdir('pmdinfogen')
 
 pmdinfo = find_program('gen-pmdinfo-cfile.sh')
+map_to_def = files('map_to_def.py')
diff --git a/buildtools/pmdinfogen/meson.build b/buildtools/pmdinfogen/meson.build
index a219a8e96..938137300 100644
--- a/buildtools/pmdinfogen/meson.build
+++ b/buildtools/pmdinfogen/meson.build
@@ -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',
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..c4606e7f2 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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,
diff --git a/meson.build b/meson.build
index 69833de82..81a9e93f7 100644
--- a/meson.build
+++ b/meson.build
@@ -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

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 16:46               ` Bruce Richardson
@ 2019-03-26 16:46                 ` Bruce Richardson
  2019-03-26 23:13                 ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-03-26 16:46 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran
  Cc: pallavi.kadam, thomas, anand.rawat, dev, ranjit.menon, jeffrey.b.shaw

On Tue, Mar 26, 2019 at 03:35:36PM +0000, Jerin Jacob Kollanukkaran wrote:
> On Tue, 2019-03-26 at 14:40 +0000, Bruce Richardson wrote:
> > > 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.
> > 
> > > > 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.
> > > 
> > 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.
> 
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

diff --git a/buildtools/map_to_def.py b/buildtools/map_to_def.py
new file mode 100644
index 000000000..6c2f56c5d
--- /dev/null
+++ b/buildtools/map_to_def.py
@@ -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))
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..9ae2bc7c8 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -4,3 +4,4 @@
 subdir('pmdinfogen')
 
 pmdinfo = find_program('gen-pmdinfo-cfile.sh')
+map_to_def = files('map_to_def.py')
diff --git a/buildtools/pmdinfogen/meson.build b/buildtools/pmdinfogen/meson.build
index a219a8e96..938137300 100644
--- a/buildtools/pmdinfogen/meson.build
+++ b/buildtools/pmdinfogen/meson.build
@@ -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',
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..c4606e7f2 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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,
diff --git a/meson.build b/meson.build
index 69833de82..81a9e93f7 100644
--- a/meson.build
+++ b/meson.build
@@ -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


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

* Re: [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows
  2019-03-26 10:37     ` David Marchand
  2019-03-26 10:37       ` David Marchand
@ 2019-03-26 18:29       ` Anand Rawat
  2019-03-26 18:29         ` Anand Rawat
  1 sibling, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-26 18:29 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	Bruce Richardson, Thomas Monjalon

On 3/26/2019 3:37 AM, David Marchand wrote:
> On Tue, Mar 26, 2019 at 7:04 AM Anand Rawat <anand.rawat@intel.com 
> <mailto:anand.rawat@intel.com>> 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 ?
> 
> -- 
> David Marchand

Will correct in the next version, Thanks.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows
  2019-03-26 18:29       ` Anand Rawat
@ 2019-03-26 18:29         ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26 18:29 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	Bruce Richardson, Thomas Monjalon

On 3/26/2019 3:37 AM, David Marchand wrote:
> On Tue, Mar 26, 2019 at 7:04 AM Anand Rawat <anand.rawat@intel.com 
> <mailto:anand.rawat@intel.com>> 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 ?
> 
> -- 
> David Marchand

Will correct in the next version, Thanks.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file Anand Rawat
                       ` (2 preceding siblings ...)
  2019-03-26 16:31     ` [dpdk-dev] " Harini Ramakrishnan
@ 2019-03-26 19:02     ` Stephen Hemminger
  2019-03-26 19:02       ` Stephen Hemminger
  3 siblings, 1 reply; 327+ messages in thread
From: Stephen Hemminger @ 2019-03-26 19:02 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

On Mon, 25 Mar 2019 23:02:33 -0700
Anand Rawat <anand.rawat@intel.com> wrote:

> diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
> new file mode 100644
> index 000000000..265d3cc9a
> --- /dev/null
> +++ b/lib/librte_kvargs/rte_kvargs_exports.def
> @@ -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.

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

* Re: [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 19:02     ` Stephen Hemminger
@ 2019-03-26 19:02       ` Stephen Hemminger
  0 siblings, 0 replies; 327+ messages in thread
From: Stephen Hemminger @ 2019-03-26 19:02 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

On Mon, 25 Mar 2019 23:02:33 -0700
Anand Rawat <anand.rawat@intel.com> wrote:

> diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
> new file mode 100644
> index 000000000..265d3cc9a
> --- /dev/null
> +++ b/lib/librte_kvargs/rte_kvargs_exports.def
> @@ -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.

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows Anand Rawat
  2019-03-26  6:02     ` Anand Rawat
  2019-03-26 16:31     ` Harini Ramakrishnan
@ 2019-03-26 19:06     ` Stephen Hemminger
  2019-03-26 19:06       ` Stephen Hemminger
                         ` (2 more replies)
  2 siblings, 3 replies; 327+ messages in thread
From: Stephen Hemminger @ 2019-03-26 19:06 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

On Mon, 25 Mar 2019 23:02:34 -0700
Anand Rawat <anand.rawat@intel.com> 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
> + * 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.  

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 19:06     ` Stephen Hemminger
@ 2019-03-26 19:06       ` Stephen Hemminger
  2019-03-26 20:52       ` Thomas Monjalon
  2019-03-27 21:16       ` Anand Rawat
  2 siblings, 0 replies; 327+ messages in thread
From: Stephen Hemminger @ 2019-03-26 19:06 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

On Mon, 25 Mar 2019 23:02:34 -0700
Anand Rawat <anand.rawat@intel.com> 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
> + * 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.  

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 19:06     ` Stephen Hemminger
  2019-03-26 19:06       ` Stephen Hemminger
@ 2019-03-26 20:52       ` Thomas Monjalon
  2019-03-26 20:52         ` Thomas Monjalon
  2019-03-26 21:14         ` Jeff Shaw
  2019-03-27 21:16       ` Anand Rawat
  2 siblings, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 20:52 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Anand Rawat, dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson

26/03/2019 20:06, Stephen Hemminger:
> On Mon, 25 Mar 2019 23:02:34 -0700
> Anand Rawat <anand.rawat@intel.com> 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
> > + * 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.  

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?

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 20:52       ` Thomas Monjalon
@ 2019-03-26 20:52         ` Thomas Monjalon
  2019-03-26 21:14         ` Jeff Shaw
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 20:52 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Anand Rawat, dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson

26/03/2019 20:06, Stephen Hemminger:
> On Mon, 25 Mar 2019 23:02:34 -0700
> Anand Rawat <anand.rawat@intel.com> 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
> > + * 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.  

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?



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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 20:52       ` Thomas Monjalon
  2019-03-26 20:52         ` Thomas Monjalon
@ 2019-03-26 21:14         ` Jeff Shaw
  2019-03-26 21:14           ` Jeff Shaw
  2019-03-26 21:47           ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Jeff Shaw @ 2019-03-26 21:14 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Stephen Hemminger, Anand Rawat, dev, pallavi.kadam, ranjit.menon,
	jeffrey.b.shaw, bruce.richardson

On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> 26/03/2019 20:06, Stephen Hemminger:
> > On Mon, 25 Mar 2019 23:02:34 -0700
> > Anand Rawat <anand.rawat@intel.com> 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
> > > + * 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?

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

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 21:14         ` Jeff Shaw
@ 2019-03-26 21:14           ` Jeff Shaw
  2019-03-26 21:47           ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Jeff Shaw @ 2019-03-26 21:14 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Stephen Hemminger, Anand Rawat, dev, pallavi.kadam, ranjit.menon,
	jeffrey.b.shaw, bruce.richardson

On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> 26/03/2019 20:06, Stephen Hemminger:
> > On Mon, 25 Mar 2019 23:02:34 -0700
> > Anand Rawat <anand.rawat@intel.com> 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
> > > + * 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?

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

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 21:14         ` Jeff Shaw
  2019-03-26 21:14           ` Jeff Shaw
@ 2019-03-26 21:47           ` Thomas Monjalon
  2019-03-26 21:47             ` Thomas Monjalon
  2019-03-26 21:54             ` Jeff Shaw
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 21:47 UTC (permalink / raw)
  To: Jeff Shaw
  Cc: Stephen Hemminger, Anand Rawat, dev, pallavi.kadam, ranjit.menon,
	bruce.richardson

26/03/2019 22:14, Jeff Shaw:
> On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > 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.

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.

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 21:47           ` Thomas Monjalon
@ 2019-03-26 21:47             ` Thomas Monjalon
  2019-03-26 21:54             ` Jeff Shaw
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 21:47 UTC (permalink / raw)
  To: Jeff Shaw
  Cc: Stephen Hemminger, Anand Rawat, dev, pallavi.kadam, ranjit.menon,
	bruce.richardson

26/03/2019 22:14, Jeff Shaw:
> On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > 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.

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.




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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 21:47           ` Thomas Monjalon
  2019-03-26 21:47             ` Thomas Monjalon
@ 2019-03-26 21:54             ` Jeff Shaw
  2019-03-26 21:54               ` Jeff Shaw
  2019-03-26 22:23               ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Jeff Shaw @ 2019-03-26 21:54 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Jeff Shaw, Stephen Hemminger, Anand Rawat, dev, pallavi.kadam,
	ranjit.menon, bruce.richardson

On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> 26/03/2019 22:14, Jeff Shaw:
> > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > 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.
> 
> 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?

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 21:54             ` Jeff Shaw
@ 2019-03-26 21:54               ` Jeff Shaw
  2019-03-26 22:23               ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Jeff Shaw @ 2019-03-26 21:54 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Jeff Shaw, Stephen Hemminger, Anand Rawat, dev, pallavi.kadam,
	ranjit.menon, bruce.richardson

On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> 26/03/2019 22:14, Jeff Shaw:
> > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > 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.
> 
> 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?

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 21:54             ` Jeff Shaw
  2019-03-26 21:54               ` Jeff Shaw
@ 2019-03-26 22:23               ` Thomas Monjalon
  2019-03-26 22:23                 ` Thomas Monjalon
  2019-03-26 22:34                 ` Jeff Shaw
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 22:23 UTC (permalink / raw)
  To: Jeff Shaw
  Cc: Stephen Hemminger, Anand Rawat, dev, pallavi.kadam, ranjit.menon,
	bruce.richardson

26/03/2019 22:54, Jeff Shaw:
> On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> > 26/03/2019 22:14, Jeff Shaw:
> > > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > > 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.
> > 
> > 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?

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?

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 22:23               ` Thomas Monjalon
@ 2019-03-26 22:23                 ` Thomas Monjalon
  2019-03-26 22:34                 ` Jeff Shaw
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 22:23 UTC (permalink / raw)
  To: Jeff Shaw
  Cc: Stephen Hemminger, Anand Rawat, dev, pallavi.kadam, ranjit.menon,
	bruce.richardson

26/03/2019 22:54, Jeff Shaw:
> On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> > 26/03/2019 22:14, Jeff Shaw:
> > > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > > 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.
> > 
> > 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?

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?



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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 22:23               ` Thomas Monjalon
  2019-03-26 22:23                 ` Thomas Monjalon
@ 2019-03-26 22:34                 ` Jeff Shaw
  2019-03-26 22:34                   ` Jeff Shaw
  2019-03-26 23:00                   ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Jeff Shaw @ 2019-03-26 22:34 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Jeff Shaw, Stephen Hemminger, Anand Rawat, dev, pallavi.kadam,
	ranjit.menon, bruce.richardson

On Tue, Mar 26, 2019 at 11:23:50PM +0100, Thomas Monjalon wrote:
> 26/03/2019 22:54, Jeff Shaw:
> > On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> > > 26/03/2019 22:14, Jeff Shaw:
> > > > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > > > 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.
> > > 
> > > 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?
> 
> 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.

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 22:34                 ` Jeff Shaw
@ 2019-03-26 22:34                   ` Jeff Shaw
  2019-03-26 23:00                   ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Jeff Shaw @ 2019-03-26 22:34 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Jeff Shaw, Stephen Hemminger, Anand Rawat, dev, pallavi.kadam,
	ranjit.menon, bruce.richardson

On Tue, Mar 26, 2019 at 11:23:50PM +0100, Thomas Monjalon wrote:
> 26/03/2019 22:54, Jeff Shaw:
> > On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> > > 26/03/2019 22:14, Jeff Shaw:
> > > > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > > > 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.
> > > 
> > > 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?
> 
> 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.

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

* Re: [dpdk-dev] [PATCH v5 0/8]  HelloWorld example for windows
       [not found]   ` <MWHPR21MB06380D6FA7CF5513DDC3820AEF5F0@MWHPR21MB0638.namprd21.prod.outlook.com>
@ 2019-03-26 22:43     ` Omar Cardona
  2019-03-26 22:43       ` Omar Cardona
  0 siblings, 1 reply; 327+ messages in thread
From: Omar Cardona @ 2019-03-26 22:43 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas, Harini Ramakrishnan

Acked-by: Omar Cardona <ocardona@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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

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

* Re: [dpdk-dev] [PATCH v5 0/8]  HelloWorld example for windows
  2019-03-26 22:43     ` Omar Cardona
@ 2019-03-26 22:43       ` Omar Cardona
  0 siblings, 0 replies; 327+ messages in thread
From: Omar Cardona @ 2019-03-26 22:43 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas, Harini Ramakrishnan

Acked-by: Omar Cardona <ocardona@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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


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

* Re: [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support
       [not found]     ` <MWHPR21MB0638113CDE9F61F8EC3E63D0EF5F0@MWHPR21MB0638.namprd21.prod.outlook.com>
@ 2019-03-26 22:50       ` Omar Cardona
  2019-03-26 22:50         ` Omar Cardona
  0 siblings, 1 reply; 327+ messages in thread
From: Omar Cardona @ 2019-03-26 22:50 UTC (permalink / raw)
  To: dev
  Cc: Harini Ramakrishnan, anand.rawat, pallavi.kadam, ranjit.menon,
	jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Omar Cardona <ocardona@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build index 0419607d3..71a0120b6 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..13e41ea30
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..6e07fe10c
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..4ddf51aa8
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..e74f8893b
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
+)
diff --git a/meson.build b/meson.build
index 69833de82..9959dc54f 100644
--- a/meson.build
+++ b/meson.build
@@ -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

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

* Re: [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support
  2019-03-26 22:50       ` Omar Cardona
@ 2019-03-26 22:50         ` Omar Cardona
  0 siblings, 0 replies; 327+ messages in thread
From: Omar Cardona @ 2019-03-26 22:50 UTC (permalink / raw)
  To: dev
  Cc: Harini Ramakrishnan, anand.rawat, pallavi.kadam, ranjit.menon,
	jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Omar Cardona <ocardona@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build index 0419607d3..71a0120b6 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..13e41ea30
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..6e07fe10c
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..4ddf51aa8
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..e74f8893b
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
+)
diff --git a/meson.build b/meson.build
index 69833de82..9959dc54f 100644
--- a/meson.build
+++ b/meson.build
@@ -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


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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 22:34                 ` Jeff Shaw
  2019-03-26 22:34                   ` Jeff Shaw
@ 2019-03-26 23:00                   ` Thomas Monjalon
  2019-03-26 23:00                     ` Thomas Monjalon
  2019-03-26 23:43                     ` Jeff Shaw
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 23:00 UTC (permalink / raw)
  To: Jeff Shaw
  Cc: Stephen Hemminger, Anand Rawat, dev, pallavi.kadam, ranjit.menon,
	bruce.richardson

26/03/2019 23:34, Jeff Shaw:
> On Tue, Mar 26, 2019 at 11:23:50PM +0100, Thomas Monjalon wrote:
> > 26/03/2019 22:54, Jeff Shaw:
> > > On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> > > > 26/03/2019 22:14, Jeff Shaw:
> > > > > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > > > > 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.
> > > > 
> > > > 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?
> > 
> > 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.

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

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 23:00                   ` Thomas Monjalon
@ 2019-03-26 23:00                     ` Thomas Monjalon
  2019-03-26 23:43                     ` Jeff Shaw
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 23:00 UTC (permalink / raw)
  To: Jeff Shaw
  Cc: Stephen Hemminger, Anand Rawat, dev, pallavi.kadam, ranjit.menon,
	bruce.richardson

26/03/2019 23:34, Jeff Shaw:
> On Tue, Mar 26, 2019 at 11:23:50PM +0100, Thomas Monjalon wrote:
> > 26/03/2019 22:54, Jeff Shaw:
> > > On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> > > > 26/03/2019 22:14, Jeff Shaw:
> > > > > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > > > > 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.
> > > > 
> > > > 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?
> > 
> > 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.

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



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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 16:46               ` Bruce Richardson
  2019-03-26 16:46                 ` Bruce Richardson
@ 2019-03-26 23:13                 ` Anand Rawat
  2019-03-26 23:13                   ` Anand Rawat
  1 sibling, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-26 23:13 UTC (permalink / raw)
  To: Bruce Richardson, Jerin Jacob Kollanukkaran
  Cc: pallavi.kadam, thomas, dev, ranjit.menon, jeffrey.b.shaw

On 3/26/2019 9:46 AM, Bruce Richardson wrote:
> On Tue, Mar 26, 2019 at 03:35:36PM +0000, Jerin Jacob Kollanukkaran wrote:
>> On Tue, 2019-03-26 at 14:40 +0000, Bruce Richardson wrote:
>>>> 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.
>>>
>>>>> 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.
>>>>
>>> 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.
>>
> 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
> 

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.


-- 
Anand Rawat

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/8] kvargs: adding a module definition file
  2019-03-26 23:13                 ` Anand Rawat
@ 2019-03-26 23:13                   ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-26 23:13 UTC (permalink / raw)
  To: Bruce Richardson, Jerin Jacob Kollanukkaran
  Cc: pallavi.kadam, thomas, dev, ranjit.menon, jeffrey.b.shaw

On 3/26/2019 9:46 AM, Bruce Richardson wrote:
> On Tue, Mar 26, 2019 at 03:35:36PM +0000, Jerin Jacob Kollanukkaran wrote:
>> On Tue, 2019-03-26 at 14:40 +0000, Bruce Richardson wrote:
>>>> 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.
>>>
>>>>> 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.
>>>>
>>> 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.
>>
> 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
> 

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.


-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 23:00                   ` Thomas Monjalon
  2019-03-26 23:00                     ` Thomas Monjalon
@ 2019-03-26 23:43                     ` Jeff Shaw
  2019-03-26 23:43                       ` Jeff Shaw
  2019-03-26 23:54                       ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Jeff Shaw @ 2019-03-26 23:43 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Jeff Shaw, Stephen Hemminger, Anand Rawat, dev, pallavi.kadam,
	ranjit.menon, bruce.richardson

On Wed, Mar 27, 2019 at 12:00:49AM +0100, Thomas Monjalon wrote:
> 26/03/2019 23:34, Jeff Shaw:
> > On Tue, Mar 26, 2019 at 11:23:50PM +0100, Thomas Monjalon wrote:
> > > 26/03/2019 22:54, Jeff Shaw:
> > > > On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> > > > > 26/03/2019 22:14, Jeff Shaw:
> > > > > > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > > > > > 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.
> > > > > 
> > > > > 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?
> > > 
> > > 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.
> 
> 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.

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

> Is Cygwin a solution?

I think the goal is to be a native Windows application.

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 23:43                     ` Jeff Shaw
@ 2019-03-26 23:43                       ` Jeff Shaw
  2019-03-26 23:54                       ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Jeff Shaw @ 2019-03-26 23:43 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Jeff Shaw, Stephen Hemminger, Anand Rawat, dev, pallavi.kadam,
	ranjit.menon, bruce.richardson

On Wed, Mar 27, 2019 at 12:00:49AM +0100, Thomas Monjalon wrote:
> 26/03/2019 23:34, Jeff Shaw:
> > On Tue, Mar 26, 2019 at 11:23:50PM +0100, Thomas Monjalon wrote:
> > > 26/03/2019 22:54, Jeff Shaw:
> > > > On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> > > > > 26/03/2019 22:14, Jeff Shaw:
> > > > > > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > > > > > 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.
> > > > > 
> > > > > 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?
> > > 
> > > 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.
> 
> 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.

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

> Is Cygwin a solution?

I think the goal is to be a native Windows application.

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 23:43                     ` Jeff Shaw
  2019-03-26 23:43                       ` Jeff Shaw
@ 2019-03-26 23:54                       ` Thomas Monjalon
  2019-03-26 23:54                         ` Thomas Monjalon
  1 sibling, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 23:54 UTC (permalink / raw)
  To: Jeff Shaw
  Cc: Stephen Hemminger, Anand Rawat, dev, pallavi.kadam, ranjit.menon,
	bruce.richardson

27/03/2019 00:43, Jeff Shaw:
> On Wed, Mar 27, 2019 at 12:00:49AM +0100, Thomas Monjalon wrote:
> > 26/03/2019 23:34, Jeff Shaw:
> > > On Tue, Mar 26, 2019 at 11:23:50PM +0100, Thomas Monjalon wrote:
> > > > 26/03/2019 22:54, Jeff Shaw:
> > > > > On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> > > > > > 26/03/2019 22:14, Jeff Shaw:
> > > > > > > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > > > > > > 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.
> > > > > > 
> > > > > > 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?
> > > > 
> > > > 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.
> > 
> > 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.

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

> > Is Cygwin a solution?
> 
> I think the goal is to be a native Windows application.

Yes

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 23:54                       ` Thomas Monjalon
@ 2019-03-26 23:54                         ` Thomas Monjalon
  0 siblings, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-26 23:54 UTC (permalink / raw)
  To: Jeff Shaw
  Cc: Stephen Hemminger, Anand Rawat, dev, pallavi.kadam, ranjit.menon,
	bruce.richardson

27/03/2019 00:43, Jeff Shaw:
> On Wed, Mar 27, 2019 at 12:00:49AM +0100, Thomas Monjalon wrote:
> > 26/03/2019 23:34, Jeff Shaw:
> > > On Tue, Mar 26, 2019 at 11:23:50PM +0100, Thomas Monjalon wrote:
> > > > 26/03/2019 22:54, Jeff Shaw:
> > > > > On Tue, Mar 26, 2019 at 10:47:54PM +0100, Thomas Monjalon wrote:
> > > > > > 26/03/2019 22:14, Jeff Shaw:
> > > > > > > On Tue, Mar 26, 2019 at 09:52:57PM +0100, Thomas Monjalon wrote:
> > > > > > > > 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.
> > > > > > 
> > > > > > 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?
> > > > 
> > > > 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.
> > 
> > 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.

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

> > Is Cygwin a solution?
> 
> I think the goal is to be a native Windows application.

Yes



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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-26 19:06     ` Stephen Hemminger
  2019-03-26 19:06       ` Stephen Hemminger
  2019-03-26 20:52       ` Thomas Monjalon
@ 2019-03-27 21:16       ` Anand Rawat
  2019-03-27 21:16         ` Anand Rawat
  2 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-27 21:16 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

On 3/26/2019 12:06 PM, Stephen Hemminger wrote:
> On Mon, 25 Mar 2019 23:02:34 -0700
> Anand Rawat <anand.rawat@intel.com> 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
>> + * 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.
> 

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?

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows
  2019-03-27 21:16       ` Anand Rawat
@ 2019-03-27 21:16         ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-27 21:16 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

On 3/26/2019 12:06 PM, Stephen Hemminger wrote:
> On Mon, 25 Mar 2019 23:02:34 -0700
> Anand Rawat <anand.rawat@intel.com> 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
>> + * 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.
> 

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?

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-26 10:20     ` Jerin Jacob Kollanukkaran
  2019-03-26 10:20       ` Jerin Jacob Kollanukkaran
@ 2019-03-27 21:23       ` Ranjit Menon
  2019-03-27 21:23         ` Ranjit Menon
  2019-03-27 22:29         ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Ranjit Menon @ 2019-03-27 21:23 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran, anand.rawat, dev
  Cc: pallavi.kadam, thomas, jeffrey.b.shaw, bruce.richardson

On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
>> 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.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>>   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
>>
>> diff --git a/lib/librte_eal/common/include/rte_common.h
>> b/lib/librte_eal/common/include/rte_common.h
>> index 7178ba1e9..4775c84f5 100644
>> --- a/lib/librte_eal/common/include/rte_common.h
>> +++ b/lib/librte_eal/common/include/rte_common.h
>> @@ -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
>> +
> 
> 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.
> 
> 
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.

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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-27 21:23       ` Ranjit Menon
@ 2019-03-27 21:23         ` Ranjit Menon
  2019-03-27 22:29         ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Ranjit Menon @ 2019-03-27 21:23 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran, anand.rawat, dev
  Cc: pallavi.kadam, thomas, jeffrey.b.shaw, bruce.richardson

On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
>> 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.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>>   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
>>
>> diff --git a/lib/librte_eal/common/include/rte_common.h
>> b/lib/librte_eal/common/include/rte_common.h
>> index 7178ba1e9..4775c84f5 100644
>> --- a/lib/librte_eal/common/include/rte_common.h
>> +++ b/lib/librte_eal/common/include/rte_common.h
>> @@ -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
>> +
> 
> 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.
> 
> 
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.

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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-27 21:23       ` Ranjit Menon
  2019-03-27 21:23         ` Ranjit Menon
@ 2019-03-27 22:29         ` Thomas Monjalon
  2019-03-27 22:29           ` Thomas Monjalon
  2019-03-27 23:10           ` Anand Rawat
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-27 22:29 UTC (permalink / raw)
  To: Ranjit Menon, Jerin Jacob Kollanukkaran
  Cc: anand.rawat, dev, pallavi.kadam, jeffrey.b.shaw, bruce.richardson

27/03/2019 22:23, Ranjit Menon:
> On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> > On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> >> 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.
> >>
> >> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> >> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> >> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> >> ---
> >>   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
> >>
> >> diff --git a/lib/librte_eal/common/include/rte_common.h
> >> b/lib/librte_eal/common/include/rte_common.h
> >> index 7178ba1e9..4775c84f5 100644
> >> --- a/lib/librte_eal/common/include/rte_common.h
> >> +++ b/lib/librte_eal/common/include/rte_common.h
> >> @@ -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
> >> +
> > 
> > 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.
> > 
> > 
> 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

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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-27 22:29         ` Thomas Monjalon
@ 2019-03-27 22:29           ` Thomas Monjalon
  2019-03-27 23:10           ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-27 22:29 UTC (permalink / raw)
  To: Ranjit Menon, Jerin Jacob Kollanukkaran
  Cc: anand.rawat, dev, pallavi.kadam, jeffrey.b.shaw, bruce.richardson

27/03/2019 22:23, Ranjit Menon:
> On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> > On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> >> 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.
> >>
> >> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> >> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> >> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> >> ---
> >>   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
> >>
> >> diff --git a/lib/librte_eal/common/include/rte_common.h
> >> b/lib/librte_eal/common/include/rte_common.h
> >> index 7178ba1e9..4775c84f5 100644
> >> --- a/lib/librte_eal/common/include/rte_common.h
> >> +++ b/lib/librte_eal/common/include/rte_common.h
> >> @@ -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
> >> +
> > 
> > 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.
> > 
> > 
> 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



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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-27 22:29         ` Thomas Monjalon
  2019-03-27 22:29           ` Thomas Monjalon
@ 2019-03-27 23:10           ` Anand Rawat
  2019-03-27 23:10             ` Anand Rawat
  2019-03-27 23:27             ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-27 23:10 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, jeffrey.b.shaw, bruce.richardson,
	Ranjit Menon, Jerin Jacob Kollanukkaran

On 3/27/2019 3:29 PM, Thomas Monjalon wrote:
> 27/03/2019 22:23, Ranjit Menon:
> > On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> >> On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> >>> 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.
> >>>
> >>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> >>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> >>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> >>> ---
> >>>    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
> >>>
> >>> diff --git a/lib/librte_eal/common/include/rte_common.h
> >>> b/lib/librte_eal/common/include/rte_common.h
> >>> index 7178ba1e9..4775c84f5 100644
> >>> --- a/lib/librte_eal/common/include/rte_common.h
> >>> +++ b/lib/librte_eal/common/include/rte_common.h
> >>> @@ -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
> >>> +
> >>
> >> 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.
> >>
> >>
> > 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?

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-27 23:10           ` Anand Rawat
@ 2019-03-27 23:10             ` Anand Rawat
  2019-03-27 23:27             ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-27 23:10 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, jeffrey.b.shaw, bruce.richardson,
	Ranjit Menon, Jerin Jacob Kollanukkaran

On 3/27/2019 3:29 PM, Thomas Monjalon wrote:
> 27/03/2019 22:23, Ranjit Menon:
> > On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> >> On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> >>> 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.
> >>>
> >>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> >>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> >>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> >>> ---
> >>>    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
> >>>
> >>> diff --git a/lib/librte_eal/common/include/rte_common.h
> >>> b/lib/librte_eal/common/include/rte_common.h
> >>> index 7178ba1e9..4775c84f5 100644
> >>> --- a/lib/librte_eal/common/include/rte_common.h
> >>> +++ b/lib/librte_eal/common/include/rte_common.h
> >>> @@ -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
> >>> +
> >>
> >> 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.
> >>
> >>
> > 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?

-- 
Anand Rawat


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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-27 23:10           ` Anand Rawat
  2019-03-27 23:10             ` Anand Rawat
@ 2019-03-27 23:27             ` Thomas Monjalon
  2019-03-27 23:27               ` Thomas Monjalon
  1 sibling, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-27 23:27 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, jeffrey.b.shaw, bruce.richardson,
	Ranjit Menon, Jerin Jacob Kollanukkaran

28/03/2019 00:10, Anand Rawat:
> On 3/27/2019 3:29 PM, Thomas Monjalon wrote:
> > 27/03/2019 22:23, Ranjit Menon:
> > > On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> > >> On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> > >>> 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.
> > >>>
> > >>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > >>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > >>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > >>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> > >>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > >>> ---
> > >>>    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
> > >>>
> > >>> diff --git a/lib/librte_eal/common/include/rte_common.h
> > >>> b/lib/librte_eal/common/include/rte_common.h
> > >>> index 7178ba1e9..4775c84f5 100644
> > >>> --- a/lib/librte_eal/common/include/rte_common.h
> > >>> +++ b/lib/librte_eal/common/include/rte_common.h
> > >>> @@ -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
> > >>> +
> > >>
> > >> 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.
> > >>
> > >>
> > > 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?

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

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

* Re: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows
  2019-03-27 23:27             ` Thomas Monjalon
@ 2019-03-27 23:27               ` Thomas Monjalon
  0 siblings, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-27 23:27 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, jeffrey.b.shaw, bruce.richardson,
	Ranjit Menon, Jerin Jacob Kollanukkaran

28/03/2019 00:10, Anand Rawat:
> On 3/27/2019 3:29 PM, Thomas Monjalon wrote:
> > 27/03/2019 22:23, Ranjit Menon:
> > > On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> > >> On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> > >>> 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.
> > >>>
> > >>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > >>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > >>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > >>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> > >>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > >>> ---
> > >>>    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
> > >>>
> > >>> diff --git a/lib/librte_eal/common/include/rte_common.h
> > >>> b/lib/librte_eal/common/include/rte_common.h
> > >>> index 7178ba1e9..4775c84f5 100644
> > >>> --- a/lib/librte_eal/common/include/rte_common.h
> > >>> +++ b/lib/librte_eal/common/include/rte_common.h
> > >>> @@ -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
> > >>> +
> > >>
> > >> 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.
> > >>
> > >>
> > > 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?

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



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

* [dpdk-dev] [PATCH v6 0/8] HelloWorld example for windows
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
                   ` (9 preceding siblings ...)
  2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
@ 2019-03-28  2:21 ` Anand Rawat
  2019-03-28  2:21   ` Anand Rawat
                     ` (9 more replies)
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
  12 siblings, 10 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v6 0/8] HelloWorld example for windows
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
@ 2019-03-28  2:21   ` Anand Rawat
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 1/8] eal: eal stub to add windows support Anand Rawat
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v6 1/8] eal: eal stub to add windows support
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
  2019-03-28  2:21   ` Anand Rawat
@ 2019-03-28  2:21   ` Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:27     ` Harini Ramakrishnan
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 2/8] eal: add header files to support os specifics Anand Rawat
                     ` (7 subsequent siblings)
  9 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build
index 30a7261a5..4bd73b1e9 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..37ed42233
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..a9705e257
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..e4fcb2615
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..f701443c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v6 1/8] eal: eal stub to add windows support
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 1/8] eal: eal stub to add windows support Anand Rawat
@ 2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:27     ` Harini Ramakrishnan
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build
index 30a7261a5..4bd73b1e9 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..37ed42233
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..a9705e257
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..e4fcb2615
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..f701443c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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


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

* [dpdk-dev] [PATCH v6 2/8] eal: add header files to support os specifics
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
  2019-03-28  2:21   ` Anand Rawat
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 1/8] eal: eal stub to add windows support Anand Rawat
@ 2019-03-28  2:21   ` Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:27     ` Harini Ramakrishnan
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 3/8] build: add module definition file for windows Anand Rawat
                     ` (6 subsequent siblings)
  9 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index bcf8afd39..3e4768f4a 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/linux/eal/include/exec-env/rte_os.h b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..c43ec6da5
--- /dev/null
+++ b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..65230cae9
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..a81faf0ed 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v6 2/8] eal: add header files to support os specifics
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 2/8] eal: add header files to support os specifics Anand Rawat
@ 2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:27     ` Harini Ramakrishnan
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index bcf8afd39..3e4768f4a 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/linux/eal/include/exec-env/rte_os.h b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..c43ec6da5
--- /dev/null
+++ b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..65230cae9
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..a81faf0ed 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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


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

* [dpdk-dev] [PATCH v6 3/8] build: add module definition file for windows
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
                     ` (2 preceding siblings ...)
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 2/8] eal: add header files to support os specifics Anand Rawat
@ 2019-03-28  2:21   ` Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:29     ` Harini Ramakrishnan
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation " Anand Rawat
                     ` (5 subsequent siblings)
  9 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Updated lib/meson.build to create shared libraries on windows.
Added DEF files to list the exports for the eal and kvargs libraries.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
new file mode 100644
index 000000000..12a6c79d6
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..10e839e00
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
diff --git a/lib/meson.build b/lib/meson.build
index a81faf0ed..9cba4662e 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v6 3/8] build: add module definition file for windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 3/8] build: add module definition file for windows Anand Rawat
@ 2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:29     ` Harini Ramakrishnan
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Updated lib/meson.build to create shared libraries on windows.
Added DEF files to list the exports for the eal and kvargs libraries.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
new file mode 100644
index 000000000..12a6c79d6
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..10e839e00
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
diff --git a/lib/meson.build b/lib/meson.build
index a81faf0ed..9cba4662e 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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


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

* [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
                     ` (3 preceding siblings ...)
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 3/8] build: add module definition file for windows Anand Rawat
@ 2019-03-28  2:21   ` Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
                       ` (2 more replies)
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows Anand Rawat
                     ` (4 subsequent siblings)
  9 siblings, 3 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation " Anand Rawat
@ 2019-03-28  2:21     ` Anand Rawat
  2019-03-28  2:30     ` Varghese, Vipin
  2019-03-28 19:30     ` Harini Ramakrishnan
  2 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
                     ` (4 preceding siblings ...)
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation " Anand Rawat
@ 2019-03-28  2:21   ` Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:29     ` Harini Ramakrishnan
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 6/8] eal: add minimum viable code for eal on windows Anand Rawat
                     ` (3 subsequent siblings)
  9 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 .../windows/eal/include/exec-env/fnmatch.h    | 43 ++++++++++
 .../windows/eal/include/exec-env/pthread.h    | 22 +++++
 .../windows/eal/include/exec-env/regex.h      | 83 +++++++++++++++++++
 .../windows/eal/include/exec-env/sched.h      | 41 +++++++++
 .../windows/eal/include/exec-env/unistd.h     |  8 ++
 5 files changed, 197 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/unistd.h

diff --git a/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/pthread.h b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/sched.h b/lib/librte_eal/windows/eal/include/exec-env/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/unistd.h b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
@@ -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

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

* [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows Anand Rawat
@ 2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:29     ` Harini Ramakrishnan
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 .../windows/eal/include/exec-env/fnmatch.h    | 43 ++++++++++
 .../windows/eal/include/exec-env/pthread.h    | 22 +++++
 .../windows/eal/include/exec-env/regex.h      | 83 +++++++++++++++++++
 .../windows/eal/include/exec-env/sched.h      | 41 +++++++++
 .../windows/eal/include/exec-env/unistd.h     |  8 ++
 5 files changed, 197 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/unistd.h

diff --git a/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/pthread.h b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/sched.h b/lib/librte_eal/windows/eal/include/exec-env/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/unistd.h b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
@@ -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


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

* [dpdk-dev] [PATCH v6 6/8] eal: add minimum viable code for eal on windows
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
                     ` (5 preceding siblings ...)
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows Anand Rawat
@ 2019-03-28  2:21   ` Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:32     ` Harini Ramakrishnan
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows Anand Rawat
                     ` (2 subsequent siblings)
  9 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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        | 102 ++++++++++--
 lib/librte_eal/windows/eal/eal_thread.c       | 145 +++++++++++++++++-
 .../windows/eal/include/exec-env/regex.h      |   2 +
 .../windows/eal/include/exec-env/rte_os.h     |  20 +++
 lib/librte_eal/windows/eal/meson.build        |   2 +
 7 files changed, 331 insertions(+), 30 deletions(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 37ed42233..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index a9705e257..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index e4fcb2615..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <stdint.h>
+
 #include <rte_common.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index f701443c3..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
 #include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/regex.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
index 65230cae9..98b9c37cc 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v6 6/8] eal: add minimum viable code for eal on windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 6/8] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:32     ` Harini Ramakrishnan
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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        | 102 ++++++++++--
 lib/librte_eal/windows/eal/eal_thread.c       | 145 +++++++++++++++++-
 .../windows/eal/include/exec-env/regex.h      |   2 +
 .../windows/eal/include/exec-env/rte_os.h     |  20 +++
 lib/librte_eal/windows/eal/meson.build        |   2 +
 7 files changed, 331 insertions(+), 30 deletions(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 37ed42233..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index a9705e257..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index e4fcb2615..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <stdint.h>
+
 #include <rte_common.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index f701443c3..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
 #include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/regex.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
index 65230cae9..98b9c37cc 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
                     ` (6 preceding siblings ...)
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 6/8] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-28  2:21   ` Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:31     ` Harini Ramakrishnan
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows Anand Rawat
  2019-03-28 19:28   ` [dpdk-dev] [PATCH v6 0/8] HelloWorld example for windows Harini Ramakrishnan
  9 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 21e164095..d64d7ceb8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -278,6 +278,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..b88eb76c9
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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

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

* [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows Anand Rawat
@ 2019-03-28  2:21     ` Anand Rawat
  2019-03-28 19:31     ` Harini Ramakrishnan
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 21e164095..d64d7ceb8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -278,6 +278,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..b88eb76c9
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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


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

* [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
                     ` (7 preceding siblings ...)
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows Anand Rawat
@ 2019-03-28  2:21   ` Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
                       ` (2 more replies)
  2019-03-28 19:28   ` [dpdk-dev] [PATCH v6 0/8] HelloWorld example for windows Harini Ramakrishnan
  9 siblings, 3 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/app/meson.build b/app/meson.build
index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build
index 8c76a5659..7520a16e3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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.
 dpdk_driver_classes = ['common',
diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..bc1430fa8 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build
new file mode 100644
index 000000000..c4a2a656a
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -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
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..e9021c00c 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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 9cba4662e..d3e556ae3 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

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

* [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows Anand Rawat
@ 2019-03-28  2:21     ` Anand Rawat
  2019-03-28 15:10     ` Thomas Monjalon
  2019-03-28 19:30     ` Harini Ramakrishnan
  2 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:21 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/app/meson.build b/app/meson.build
index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build
index 8c76a5659..7520a16e3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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.
 dpdk_driver_classes = ['common',
diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..bc1430fa8 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build
new file mode 100644
index 000000000..c4a2a656a
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -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
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..e9021c00c 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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 9cba4662e..d3e556ae3 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


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

* Re: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation " Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
@ 2019-03-28  2:30     ` Varghese, Vipin
  2019-03-28  2:30       ` Varghese, Vipin
  2019-03-28  2:39       ` Anand Rawat
  2019-03-28 19:30     ` Harini Ramakrishnan
  2 siblings, 2 replies; 327+ messages in thread
From: Varghese, Vipin @ 2019-03-28  2:30 UTC (permalink / raw)
  To: Rawat, Anand, dev
  Cc: Rawat, Anand, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B,
	Richardson, Bruce, thomas

Hi Anand,

snipped
> 
> Adding sys/queue.h on windows for supporting common code.
> This is implementation has BSD-3-Clause licensing.
> 
> Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> ---
>  .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
>  1 file changed, 320 insertions(+)
>  create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
> 
> diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h
> b/lib/librte_eal/windows/eal/include/sys/queue.h
> new file mode 100644
> index 000000000..5ee4916ad
> --- /dev/null
> +++ b/lib/librte_eal/windows/eal/include/sys/queue.h
> @@ -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.
> + *
> + */

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

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

* Re: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows
  2019-03-28  2:30     ` Varghese, Vipin
@ 2019-03-28  2:30       ` Varghese, Vipin
  2019-03-28  2:39       ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Varghese, Vipin @ 2019-03-28  2:30 UTC (permalink / raw)
  To: Rawat, Anand, dev
  Cc: Rawat, Anand, Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B,
	Richardson, Bruce, thomas

Hi Anand,

snipped
> 
> Adding sys/queue.h on windows for supporting common code.
> This is implementation has BSD-3-Clause licensing.
> 
> Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> ---
>  .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
>  1 file changed, 320 insertions(+)
>  create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
> 
> diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h
> b/lib/librte_eal/windows/eal/include/sys/queue.h
> new file mode 100644
> index 000000000..5ee4916ad
> --- /dev/null
> +++ b/lib/librte_eal/windows/eal/include/sys/queue.h
> @@ -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.
> + *
> + */

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


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

* Re: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows
  2019-03-28  2:30     ` Varghese, Vipin
  2019-03-28  2:30       ` Varghese, Vipin
@ 2019-03-28  2:39       ` Anand Rawat
  2019-03-28  2:39         ` Anand Rawat
  2019-03-28  3:29         ` Varghese, Vipin
  1 sibling, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:39 UTC (permalink / raw)
  To: Varghese, Vipin, dev
  Cc: Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B, Richardson,
	Bruce, thomas

On 3/27/2019 7:30 PM, Varghese, Vipin wrote:
> Hi Anand,
> 
> snipped
>>
>> Adding sys/queue.h on windows for supporting common code.
>> This is implementation has BSD-3-Clause licensing.
>>
>> Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> ---
>>   .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
>>   1 file changed, 320 insertions(+)
>>   create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
>>
>> diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h
>> b/lib/librte_eal/windows/eal/include/sys/queue.h
>> new file mode 100644
>> index 000000000..5ee4916ad
>> --- /dev/null
>> +++ b/lib/librte_eal/windows/eal/include/sys/queue.h
>> @@ -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.
>> + *
>> + */
> 
> 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
> 

 From my understanding of licenses, this code did not originate or even 
modified at Intel to contain Intel copyright statement.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows
  2019-03-28  2:39       ` Anand Rawat
@ 2019-03-28  2:39         ` Anand Rawat
  2019-03-28  3:29         ` Varghese, Vipin
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28  2:39 UTC (permalink / raw)
  To: Varghese, Vipin, dev
  Cc: Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B, Richardson,
	Bruce, thomas

On 3/27/2019 7:30 PM, Varghese, Vipin wrote:
> Hi Anand,
> 
> snipped
>>
>> Adding sys/queue.h on windows for supporting common code.
>> This is implementation has BSD-3-Clause licensing.
>>
>> Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> ---
>>   .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
>>   1 file changed, 320 insertions(+)
>>   create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
>>
>> diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h
>> b/lib/librte_eal/windows/eal/include/sys/queue.h
>> new file mode 100644
>> index 000000000..5ee4916ad
>> --- /dev/null
>> +++ b/lib/librte_eal/windows/eal/include/sys/queue.h
>> @@ -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.
>> + *
>> + */
> 
> 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
> 

 From my understanding of licenses, this code did not originate or even 
modified at Intel to contain Intel copyright statement.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows
  2019-03-28  2:39       ` Anand Rawat
  2019-03-28  2:39         ` Anand Rawat
@ 2019-03-28  3:29         ` Varghese, Vipin
  2019-03-28  3:29           ` Varghese, Vipin
  1 sibling, 1 reply; 327+ messages in thread
From: Varghese, Vipin @ 2019-03-28  3:29 UTC (permalink / raw)
  To: Rawat, Anand, dev
  Cc: Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B, Richardson,
	Bruce, thomas

Thanks Anand,


> -----Original Message-----
> From: Rawat, Anand
> Sent: Thursday, March 28, 2019 8:10 AM
> To: Varghese, Vipin <vipin.varghese@intel.com>; dev@dpdk.org
> Cc: Kadam, Pallavi <pallavi.kadam@intel.com>; Menon, Ranjit
> <ranjit.menon@intel.com>; Shaw, Jeffrey B <jeffrey.b.shaw@intel.com>;
> Richardson, Bruce <bruce.richardson@intel.com>; thomas@monjalon.net
> Subject: Re: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for
> windows
> 
> On 3/27/2019 7:30 PM, Varghese, Vipin wrote:
> > Hi Anand,
> >
> > snipped
> >>
> >> Adding sys/queue.h on windows for supporting common code.
> >> This is implementation has BSD-3-Clause licensing.
> >>
> >> Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
> >> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> >> ---
> >>   .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
> >>   1 file changed, 320 insertions(+)
> >>   create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
> >>
> >> diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h
> >> b/lib/librte_eal/windows/eal/include/sys/queue.h
> >> new file mode 100644
> >> index 000000000..5ee4916ad
> >> --- /dev/null
> >> +++ b/lib/librte_eal/windows/eal/include/sys/queue.h
> >> @@ -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.
> >> + *
> >> + */
> >
> > 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
> >
> 
>  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.

> --
> Anand Rawat

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

* Re: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows
  2019-03-28  3:29         ` Varghese, Vipin
@ 2019-03-28  3:29           ` Varghese, Vipin
  0 siblings, 0 replies; 327+ messages in thread
From: Varghese, Vipin @ 2019-03-28  3:29 UTC (permalink / raw)
  To: Rawat, Anand, dev
  Cc: Kadam, Pallavi, Menon, Ranjit, Shaw, Jeffrey B, Richardson,
	Bruce, thomas

Thanks Anand,


> -----Original Message-----
> From: Rawat, Anand
> Sent: Thursday, March 28, 2019 8:10 AM
> To: Varghese, Vipin <vipin.varghese@intel.com>; dev@dpdk.org
> Cc: Kadam, Pallavi <pallavi.kadam@intel.com>; Menon, Ranjit
> <ranjit.menon@intel.com>; Shaw, Jeffrey B <jeffrey.b.shaw@intel.com>;
> Richardson, Bruce <bruce.richardson@intel.com>; thomas@monjalon.net
> Subject: Re: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for
> windows
> 
> On 3/27/2019 7:30 PM, Varghese, Vipin wrote:
> > Hi Anand,
> >
> > snipped
> >>
> >> Adding sys/queue.h on windows for supporting common code.
> >> This is implementation has BSD-3-Clause licensing.
> >>
> >> Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
> >> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> >> ---
> >>   .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
> >>   1 file changed, 320 insertions(+)
> >>   create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
> >>
> >> diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h
> >> b/lib/librte_eal/windows/eal/include/sys/queue.h
> >> new file mode 100644
> >> index 000000000..5ee4916ad
> >> --- /dev/null
> >> +++ b/lib/librte_eal/windows/eal/include/sys/queue.h
> >> @@ -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.
> >> + *
> >> + */
> >
> > 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
> >
> 
>  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.

> --
> Anand Rawat

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

* Re: [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
@ 2019-03-28 15:10     ` Thomas Monjalon
  2019-03-28 15:10       ` Thomas Monjalon
  2019-03-28 19:30     ` Harini Ramakrishnan
  2 siblings, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-28 15:10 UTC (permalink / raw)
  To: Anand Rawat, pallavi.kadam, ranjit.menon, bruce.richardson
  Cc: dev, jeffrey.b.shaw

28/03/2019 03:21, 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.

It is OK to merge few limited workarounds in the master branch,
in order to start compiling something on Windows,
and regularly check that the work done is not broken
by other patches coming in.
It will be especially useful if we manage to have a CI for Windows.

> --- a/lib/librte_eal/common/meson.build
> +++ b/lib/librte_eal/common/meson.build
>  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

As discussed over the phone, it would be better to overwrite this list
and keep the original one as is.

Thanks

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

* Re: [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows
  2019-03-28 15:10     ` Thomas Monjalon
@ 2019-03-28 15:10       ` Thomas Monjalon
  0 siblings, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-03-28 15:10 UTC (permalink / raw)
  To: Anand Rawat, pallavi.kadam, ranjit.menon, bruce.richardson
  Cc: dev, jeffrey.b.shaw

28/03/2019 03:21, 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.

It is OK to merge few limited workarounds in the master branch,
in order to start compiling something on Windows,
and regularly check that the work done is not broken
by other patches coming in.
It will be especially useful if we manage to have a CI for Windows.

> --- a/lib/librte_eal/common/meson.build
> +++ b/lib/librte_eal/common/meson.build
>  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

As discussed over the phone, it would be better to overwrite this list
and keep the original one as is.

Thanks



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

* Re: [dpdk-dev] [PATCH v6 2/8] eal: add header files to support os specifics
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 2/8] eal: add header files to support os specifics Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
@ 2019-03-28 19:27     ` Harini Ramakrishnan
  2019-03-28 19:27       ` Harini Ramakrishnan
  1 sibling, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:27 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index bcf8afd39..3e4768f4a 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/linux/eal/include/exec-env/rte_os.h b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..c43ec6da5
--- /dev/null
+++ b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..65230cae9
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/meson.build b/lib/meson.build index 99957ba7d..a81faf0ed 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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

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

* Re: [dpdk-dev] [PATCH v6 2/8] eal: add header files to support os specifics
  2019-03-28 19:27     ` Harini Ramakrishnan
@ 2019-03-28 19:27       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:27 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index bcf8afd39..3e4768f4a 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/linux/eal/include/exec-env/rte_os.h b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..c43ec6da5
--- /dev/null
+++ b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..65230cae9
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/meson.build b/lib/meson.build index 99957ba7d..a81faf0ed 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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


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

* Re: [dpdk-dev] [PATCH v6 1/8] eal: eal stub to add windows support
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 1/8] eal: eal stub to add windows support Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
@ 2019-03-28 19:27     ` Harini Ramakrishnan
  2019-03-28 19:27       ` Harini Ramakrishnan
  1 sibling, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:27 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build index 30a7261a5..4bd73b1e9 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..37ed42233
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..a9705e257
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..e4fcb2615
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..f701443c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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

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

* Re: [dpdk-dev] [PATCH v6 1/8] eal: eal stub to add windows support
  2019-03-28 19:27     ` Harini Ramakrishnan
@ 2019-03-28 19:27       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:27 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build index 30a7261a5..4bd73b1e9 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build index c592c6747..c2249855a 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..37ed42233
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..a9705e257
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..e4fcb2615
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..f701443c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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


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

* Re: [dpdk-dev] [PATCH v6 0/8] HelloWorld example for windows
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
                     ` (8 preceding siblings ...)
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows Anand Rawat
@ 2019-03-28 19:28   ` Harini Ramakrishnan
  2019-03-28 19:28     ` Harini Ramakrishnan
  9 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:28 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v6 0/8] HelloWorld example for windows

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

--
2.17.1.windows.2

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

* Re: [dpdk-dev] [PATCH v6 0/8] HelloWorld example for windows
  2019-03-28 19:28   ` [dpdk-dev] [PATCH v6 0/8] HelloWorld example for windows Harini Ramakrishnan
@ 2019-03-28 19:28     ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:28 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v6 0/8] HelloWorld example for windows

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

--
2.17.1.windows.2


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

* Re: [dpdk-dev] [PATCH v6 3/8] build: add module definition file for windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 3/8] build: add module definition file for windows Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
@ 2019-03-28 19:29     ` Harini Ramakrishnan
  2019-03-28 19:29       ` Harini Ramakrishnan
  1 sibling, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:29 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
new file mode 100644
index 000000000..12a6c79d6
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..10e839e00
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
diff --git a/lib/meson.build b/lib/meson.build index a81faf0ed..9cba4662e 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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

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

* Re: [dpdk-dev] [PATCH v6 3/8] build: add module definition file for windows
  2019-03-28 19:29     ` Harini Ramakrishnan
@ 2019-03-28 19:29       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:29 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
new file mode 100644
index 000000000..12a6c79d6
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..10e839e00
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
diff --git a/lib/meson.build b/lib/meson.build index a81faf0ed..9cba4662e 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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


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

* Re: [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
@ 2019-03-28 19:29     ` Harini Ramakrishnan
  2019-03-28 19:29       ` Harini Ramakrishnan
  1 sibling, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:29 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 .../windows/eal/include/exec-env/fnmatch.h    | 43 ++++++++++
 .../windows/eal/include/exec-env/pthread.h    | 22 +++++
 .../windows/eal/include/exec-env/regex.h      | 83 +++++++++++++++++++
 .../windows/eal/include/exec-env/sched.h      | 41 +++++++++
 .../windows/eal/include/exec-env/unistd.h     |  8 ++
 5 files changed, 197 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/unistd.h

diff --git a/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/pthread.h b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg) {
+	/* TODO */
+	/* This is a stub, not the expected result */ }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/sched.h b/lib/librte_eal/windows/eal/include/exec-env/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8) #define _BIT_SET_MASK 
+(_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET) #define 
+_WHICH_SET(b) ((b) / _BITS_PER_SET) #define _WHICH_BIT(b) ((b) & 
+(_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)]; } rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << 
+_WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/unistd.h b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
@@ -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

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

* Re: [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows
  2019-03-28 19:29     ` Harini Ramakrishnan
@ 2019-03-28 19:29       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:29 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 .../windows/eal/include/exec-env/fnmatch.h    | 43 ++++++++++
 .../windows/eal/include/exec-env/pthread.h    | 22 +++++
 .../windows/eal/include/exec-env/regex.h      | 83 +++++++++++++++++++
 .../windows/eal/include/exec-env/sched.h      | 41 +++++++++
 .../windows/eal/include/exec-env/unistd.h     |  8 ++
 5 files changed, 197 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/unistd.h

diff --git a/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
new file mode 100644
index 000000000..c2e2131b1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/pthread.h b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
new file mode 100644
index 000000000..a62b25bf6
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
new file mode 100644
index 000000000..daa102f74
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags) {
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg) {
+	/* TODO */
+	/* This is a stub, not the expected result */ }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/sched.h b/lib/librte_eal/windows/eal/include/exec-env/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/sched.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8) #define _BIT_SET_MASK 
+(_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET) #define 
+_WHICH_SET(b) ((b) / _BITS_PER_SET) #define _WHICH_BIT(b) ((b) & 
+(_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)]; } rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << 
+_WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/unistd.h b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
new file mode 100644
index 000000000..fe3d9b579
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
@@ -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


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

* Re: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation " Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
  2019-03-28  2:30     ` Varghese, Vipin
@ 2019-03-28 19:30     ` Harini Ramakrishnan
  2019-03-28 19:30       ` Harini Ramakrishnan
  2 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:30 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2

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

* Re: [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation for windows
  2019-03-28 19:30     ` Harini Ramakrishnan
@ 2019-03-28 19:30       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:30 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
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.

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2


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

* Re: [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
  2019-03-28 15:10     ` Thomas Monjalon
@ 2019-03-28 19:30     ` Harini Ramakrishnan
  2019-03-28 19:30       ` Harini Ramakrishnan
  2 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:30 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v6 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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/app/meson.build b/app/meson.build index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build index 8c76a5659..7520a16e3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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.
 dpdk_driver_classes = ['common',
diff --git a/examples/meson.build b/examples/meson.build index af81c762e..bc1430fa8 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build new file mode 100644 index 000000000..c4a2a656a
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -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
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..e9021c00c 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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 9cba4662e..d3e556ae3 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

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

* Re: [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows
  2019-03-28 19:30     ` Harini Ramakrishnan
@ 2019-03-28 19:30       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:30 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v6 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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/app/meson.build b/app/meson.build index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build index 8c76a5659..7520a16e3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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.
 dpdk_driver_classes = ['common',
diff --git a/examples/meson.build b/examples/meson.build index af81c762e..bc1430fa8 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build new file mode 100644 index 000000000..c4a2a656a
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -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
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..e9021c00c 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -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 9cba4662e..d3e556ae3 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


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

* Re: [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
@ 2019-03-28 19:31     ` Harini Ramakrishnan
  2019-03-28 19:31       ` Harini Ramakrishnan
  1 sibling, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:31 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 21e164095..d64d7ceb8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -278,6 +278,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..b88eb76c9
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Freleases.llvm.org%2Fdownload.html&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Ce4ffece3a667422d599008d6b3243c0a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636893365548294922&amp;sdata=U66vvhVzKJkL1XHkKpdrqDwLC8l307lcrmhrS9Y5vsw%3D&amp;reserved=0>`_.
+For example, Clang-LLVM direct download link::
+
+	
+https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Freleas
+es.llvm.org%2F7.0.1%2FLLVM-7.0.1-win64.exe&amp;data=02%7C01%7CHarini.Ra
+makrishnan%40microsoft.com%7Ce4ffece3a667422d599008d6b3243c0a%7C72f988b
+f86f141af91ab2d7cd011db47%7C1%7C0%7C636893365548294922&amp;sdata=5v%2Bd
+Ne6R%2Fx%2FvDjPvTZdTnwb4ic6aHpyU%2Fg4404wfa3M%3D&amp;reserved=0
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvisualstudio.microsoft.com%2Fdownloads&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Ce4ffece3a667422d599008d6b3243c0a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636893365548294922&amp;sdata=hFZZLZtJ6hPg25SLgHn2HHCV9iRwmzCIseYbsKALgOE%3D&amp;reserved=0>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmesonbuild.com%2FGetting-meson.html&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Ce4ffece3a667422d599008d6b3243c0a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636893365548294922&amp;sdata=x40rheD8e7%2FXeniX9uDNLeiR%2FYvGAiN3uMTe0ogkVi0%3D&amp;reserved=0>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	
+https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmesonb
+uild.com%2FGetting-meson.html%23installing-meson-and-ninja-with-the-msi
+-installer%2522&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%
+7Ce4ffece3a667422d599008d6b3243c0a%7C72f988bf86f141af91ab2d7cd011db47%7
+C1%7C0%7C636893365548294922&amp;sdata=s%2Bth54SiyuA74wD7YQdPVjD3q92HJZS
+DO7SbOPJX4ow%3D&amp;reserved=0
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website 
+<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fninja-build.org%2F&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Ce4ffece3a667422d599008d6b3243c0a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636893365548294922&amp;sdata=VtGH%2BqKrthIWbfkseM%2BrSTK88JPE%2BASfxXkVEHUToA8%3D&amp;reserved=0>`_ or install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld 
+example by default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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

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

* Re: [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows
  2019-03-28 19:31     ` Harini Ramakrishnan
@ 2019-03-28 19:31       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:31 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 21e164095..d64d7ceb8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -278,6 +278,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..b88eb76c9
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Freleases.llvm.org%2Fdownload.html&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Ce4ffece3a667422d599008d6b3243c0a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636893365548294922&amp;sdata=U66vvhVzKJkL1XHkKpdrqDwLC8l307lcrmhrS9Y5vsw%3D&amp;reserved=0>`_.
+For example, Clang-LLVM direct download link::
+
+	
+https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Freleas
+es.llvm.org%2F7.0.1%2FLLVM-7.0.1-win64.exe&amp;data=02%7C01%7CHarini.Ra
+makrishnan%40microsoft.com%7Ce4ffece3a667422d599008d6b3243c0a%7C72f988b
+f86f141af91ab2d7cd011db47%7C1%7C0%7C636893365548294922&amp;sdata=5v%2Bd
+Ne6R%2Fx%2FvDjPvTZdTnwb4ic6aHpyU%2Fg4404wfa3M%3D&amp;reserved=0
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvisualstudio.microsoft.com%2Fdownloads&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Ce4ffece3a667422d599008d6b3243c0a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636893365548294922&amp;sdata=hFZZLZtJ6hPg25SLgHn2HHCV9iRwmzCIseYbsKALgOE%3D&amp;reserved=0>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmesonbuild.com%2FGetting-meson.html&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Ce4ffece3a667422d599008d6b3243c0a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636893365548294922&amp;sdata=x40rheD8e7%2FXeniX9uDNLeiR%2FYvGAiN3uMTe0ogkVi0%3D&amp;reserved=0>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	
+https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmesonb
+uild.com%2FGetting-meson.html%23installing-meson-and-ninja-with-the-msi
+-installer%2522&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%
+7Ce4ffece3a667422d599008d6b3243c0a%7C72f988bf86f141af91ab2d7cd011db47%7
+C1%7C0%7C636893365548294922&amp;sdata=s%2Bth54SiyuA74wD7YQdPVjD3q92HJZS
+DO7SbOPJX4ow%3D&amp;reserved=0
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website 
+<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fninja-build.org%2F&amp;data=02%7C01%7CHarini.Ramakrishnan%40microsoft.com%7Ce4ffece3a667422d599008d6b3243c0a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636893365548294922&amp;sdata=VtGH%2BqKrthIWbfkseM%2BrSTK88JPE%2BASfxXkVEHUToA8%3D&amp;reserved=0>`_ or install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld 
+example by default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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


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

* Re: [dpdk-dev] [PATCH v6 6/8] eal: add minimum viable code for eal on windows
  2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 6/8] eal: add minimum viable code for eal on windows Anand Rawat
  2019-03-28  2:21     ` Anand Rawat
@ 2019-03-28 19:32     ` Harini Ramakrishnan
  2019-03-28 19:32       ` Harini Ramakrishnan
  1 sibling, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:32 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v6 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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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        | 102 ++++++++++--
 lib/librte_eal/windows/eal/eal_thread.c       | 145 +++++++++++++++++-
 .../windows/eal/include/exec-env/regex.h      |   2 +
 .../windows/eal/include/exec-env/rte_os.h     |  20 +++
 lib/librte_eal/windows/eal/meson.build        |   2 +
 7 files changed, 331 insertions(+), 30 deletions(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 37ed42233..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index a9705e257..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index e4fcb2615..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <stdint.h>
+
 #include <rte_common.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+/* global data structure that contains the CPU map */ static struct 
+_wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system  
+*/ void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id) {
+	return (lcore_id < wcpu_map.total_procs); }
+
+/*
+ * Get CPU socket id for a logical core  */ unsigned 
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */ -unsigned int -eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core  */ unsigned 
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index f701443c3..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
 #include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int 
+slave_id) {
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id) {
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused) {
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/regex.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
index 65230cae9..98b9c37cc 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
--
2.17.1.windows.2

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

* Re: [dpdk-dev] [PATCH v6 6/8] eal: add minimum viable code for eal on windows
  2019-03-28 19:32     ` Harini Ramakrishnan
@ 2019-03-28 19:32       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-28 19:32 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v6 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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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        | 102 ++++++++++--
 lib/librte_eal/windows/eal/eal_thread.c       | 145 +++++++++++++++++-
 .../windows/eal/include/exec-env/regex.h      |   2 +
 .../windows/eal/include/exec-env/rte_os.h     |  20 +++
 lib/librte_eal/windows/eal/meson.build        |   2 +
 7 files changed, 331 insertions(+), 30 deletions(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 37ed42233..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index a9705e257..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index e4fcb2615..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <stdint.h>
+
 #include <rte_common.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+/* global data structure that contains the CPU map */ static struct 
+_wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system  
+*/ void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id) {
+	return (lcore_id < wcpu_map.total_procs); }
+
+/*
+ * Get CPU socket id for a logical core  */ unsigned 
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */ -unsigned int -eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core  */ unsigned 
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index f701443c3..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
 #include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int 
+slave_id) {
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id) {
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused) {
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
index daa102f74..412b4edc5 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/regex.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -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 */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
index 65230cae9..98b9c37cc 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
--
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v7 0/8] HelloWorld example for windows
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
                   ` (10 preceding siblings ...)
  2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
@ 2019-03-28 23:24 ` Anand Rawat
  2019-03-28 23:24   ` Anand Rawat
                     ` (9 more replies)
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
  12 siblings, 10 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

v7 Changes:
1. Fixed rte_os.h not found issue on linux and freebsd.
2. Fixed missing def issues on linux and freebsd.
3. Updated comments in header files to be more descriptive 

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                          |   8 +-
 kernel/windows/meson.build                    |   4 +
 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 +
 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    |  48 +++
 .../windows/eal/include/exec-env/pthread.h    |  27 ++
 .../windows/eal/include/exec-env/regex.h      |  90 +++++
 .../windows/eal/include/exec-env/rte_os.h     |  50 +++
 .../windows/eal/include/exec-env/sched.h      |  46 +++
 .../windows/eal/include/exec-env/unistd.h     |  12 +
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  18 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  19 +-
 meson.build                                   |   6 +-
 33 files changed, 1198 insertions(+), 27 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

-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v7 0/8] HelloWorld example for windows
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
@ 2019-03-28 23:24   ` Anand Rawat
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support Anand Rawat
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

v7 Changes:
1. Fixed rte_os.h not found issue on linux and freebsd.
2. Fixed missing def issues on linux and freebsd.
3. Updated comments in header files to be more descriptive 

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                          |   8 +-
 kernel/windows/meson.build                    |   4 +
 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 +
 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    |  48 +++
 .../windows/eal/include/exec-env/pthread.h    |  27 ++
 .../windows/eal/include/exec-env/regex.h      |  90 +++++
 .../windows/eal/include/exec-env/rte_os.h     |  50 +++
 .../windows/eal/include/exec-env/sched.h      |  46 +++
 .../windows/eal/include/exec-env/unistd.h     |  12 +
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  18 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  19 +-
 meson.build                                   |   6 +-
 33 files changed, 1198 insertions(+), 27 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

-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
  2019-03-28 23:24   ` Anand Rawat
@ 2019-03-28 23:24   ` Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
                       ` (2 more replies)
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics Anand Rawat
                     ` (7 subsequent siblings)
  9 siblings, 3 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build
index 30a7261a5..4bd73b1e9 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index d48c5e11d..1863622c0 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..37ed42233
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..a9705e257
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..e4fcb2615
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..f701443c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support Anand Rawat
@ 2019-03-28 23:24     ` Anand Rawat
  2019-04-01 16:17     ` Bruce Richardson
  2019-04-01 16:34     ` Bruce Richardson
  2 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/config/meson.build b/config/meson.build
index 30a7261a5..4bd73b1e9 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index d48c5e11d..1863622c0 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..37ed42233
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..a9705e257
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..e4fcb2615
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..f701443c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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


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

* [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
  2019-03-28 23:24   ` Anand Rawat
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support Anand Rawat
@ 2019-03-28 23:24   ` Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
  2019-04-01 23:09     ` Thomas Monjalon
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 3/8] build: add module definition file for windows Anand Rawat
                     ` (6 subsequent siblings)
  9 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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 +++++++++++++++++++
 meson.build                                   |  6 ++--
 6 files changed, 59 insertions(+), 4 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index bcf8afd39..3e4768f4a 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/linux/eal/include/exec-env/rte_os.h b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..c43ec6da5
--- /dev/null
+++ b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..65230cae9
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/meson.build b/meson.build
index fa6bf3d07..62eb6b8cf 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	# Get version number from file.
@@ -23,7 +23,9 @@ dpdk_app_link_libraries = []
 # configure the build, and make sure configs here and in config folder are
 # able to be included in any file. We also store a global array of include dirs
 # for passing to pmdinfogen scripts
-global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
+global_inc = include_directories('.', 'config',
+			'lib/librte_eal/common/include',
+			'lib/librte_eal/@0@/eal/include/exec-env'.format(host_machine.system()))
 subdir('config')
 
 # build libs and drivers
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics Anand Rawat
@ 2019-03-28 23:24     ` Anand Rawat
  2019-04-01 23:09     ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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 +++++++++++++++++++
 meson.build                                   |  6 ++--
 6 files changed, 59 insertions(+), 4 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

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index bcf8afd39..3e4768f4a 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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
--- /dev/null
+++ b/lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/linux/eal/include/exec-env/rte_os.h b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..c43ec6da5
--- /dev/null
+++ b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
new file mode 100644
index 000000000..65230cae9
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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_ */
diff --git a/meson.build b/meson.build
index fa6bf3d07..62eb6b8cf 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	# Get version number from file.
@@ -23,7 +23,9 @@ dpdk_app_link_libraries = []
 # configure the build, and make sure configs here and in config folder are
 # able to be included in any file. We also store a global array of include dirs
 # for passing to pmdinfogen scripts
-global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
+global_inc = include_directories('.', 'config',
+			'lib/librte_eal/common/include',
+			'lib/librte_eal/@0@/eal/include/exec-env'.format(host_machine.system()))
 subdir('config')
 
 # build libs and drivers
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v7 3/8] build: add module definition file for windows
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
                     ` (2 preceding siblings ...)
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics Anand Rawat
@ 2019-03-28 23:24   ` Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 4/8] eal: sys/queue.h implementation " Anand Rawat
                     ` (5 subsequent siblings)
  9 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Updated lib/meson.build to create shared libraries on windows.
Added DEF files to list the exports for the eal and kvargs libraries.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_eal/rte_eal_exports.def       |  9 +++++++++
 lib/librte_kvargs/rte_kvargs_exports.def |  7 +++++++
 lib/meson.build                          | 15 ++++++++++++---
 3 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
new file mode 100644
index 000000000..12a6c79d6
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..10e839e00
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..a7b5a9194 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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
@@ -117,14 +117,23 @@ 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 = []
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+				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

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

* [dpdk-dev] [PATCH v7 3/8] build: add module definition file for windows
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 3/8] build: add module definition file for windows Anand Rawat
@ 2019-03-28 23:24     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Updated lib/meson.build to create shared libraries on windows.
Added DEF files to list the exports for the eal and kvargs libraries.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_eal/rte_eal_exports.def       |  9 +++++++++
 lib/librte_kvargs/rte_kvargs_exports.def |  7 +++++++
 lib/meson.build                          | 15 ++++++++++++---
 3 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
new file mode 100644
index 000000000..12a6c79d6
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..10e839e00
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..a7b5a9194 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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
@@ -117,14 +117,23 @@ 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 = []
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+				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


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

* [dpdk-dev] [PATCH v7 4/8] eal: sys/queue.h implementation for windows
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
                     ` (3 preceding siblings ...)
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 3/8] build: add module definition file for windows Anand Rawat
@ 2019-03-28 23:24   ` Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 5/8] eal: add headers for compatibility with windows Anand Rawat
                     ` (4 subsequent siblings)
  9 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v7 4/8] eal: sys/queue.h implementation for windows
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 4/8] eal: sys/queue.h implementation " Anand Rawat
@ 2019-03-28 23:24     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v7 5/8] eal: add headers for compatibility with windows
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
                     ` (4 preceding siblings ...)
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 4/8] eal: sys/queue.h implementation " Anand Rawat
@ 2019-03-28 23:24   ` Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 6/8] eal: add minimum viable code for eal on windows Anand Rawat
                     ` (3 subsequent siblings)
  9 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 .../windows/eal/include/exec-env/fnmatch.h    | 48 ++++++++++
 .../windows/eal/include/exec-env/pthread.h    | 27 ++++++
 .../windows/eal/include/exec-env/regex.h      | 88 +++++++++++++++++++
 .../windows/eal/include/exec-env/sched.h      | 46 ++++++++++
 .../windows/eal/include/exec-env/unistd.h     | 12 +++
 5 files changed, 221 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/unistd.h

diff --git a/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
new file mode 100644
index 000000000..0a70c4c26
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+/**
+ * This file is required to support the common code in eal_common_log.c
+ * as windows C lib does not contain fnmatch.h. This may be removed in
+ * future releases.
+ */
+#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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/pthread.h b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
new file mode 100644
index 000000000..63054ffb2
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+/**
+ * This file is required to support the common code in eal_common_proc.c,
+ * eal_common_thread.c and common\include\rte_per_lcore.h as windows C lib
+ * does not contain pthread.h. This may be removed in future releases.
+ */
+#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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
new file mode 100644
index 000000000..df05af56f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+/**
+ * This file is required to support the common code in eal_common_log.c
+ * as windows C lib does not contain regex.h. This may be removed in
+ * future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/sched.h b/lib/librte_eal/windows/eal/include/exec-env/sched.h
new file mode 100644
index 000000000..1851857cf
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/sched.h
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+/**
+ * This file is added to support the common code in eal_common_thread.c
+ * as windows C lib does not contain sched.h. This may be removed
+ * in future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/unistd.h b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
new file mode 100644
index 000000000..546e70b56
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+/**
+ * This file is added to support common code in eal_common_lcore.c
+ * as windows C lib does not contain unistd.h. This may be removed
+ * in future releases.
+ */
+#endif /* _UNISTD_H_ */
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v7 5/8] eal: add headers for compatibility with windows
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 5/8] eal: add headers for compatibility with windows Anand Rawat
@ 2019-03-28 23:24     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 .../windows/eal/include/exec-env/fnmatch.h    | 48 ++++++++++
 .../windows/eal/include/exec-env/pthread.h    | 27 ++++++
 .../windows/eal/include/exec-env/regex.h      | 88 +++++++++++++++++++
 .../windows/eal/include/exec-env/sched.h      | 46 ++++++++++
 .../windows/eal/include/exec-env/unistd.h     | 12 +++
 5 files changed, 221 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/unistd.h

diff --git a/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
new file mode 100644
index 000000000..0a70c4c26
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+/**
+ * This file is required to support the common code in eal_common_log.c
+ * as windows C lib does not contain fnmatch.h. This may be removed in
+ * future releases.
+ */
+#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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/pthread.h b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
new file mode 100644
index 000000000..63054ffb2
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/pthread.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+/**
+ * This file is required to support the common code in eal_common_proc.c,
+ * eal_common_thread.c and common\include\rte_per_lcore.h as windows C lib
+ * does not contain pthread.h. This may be removed in future releases.
+ */
+#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_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
new file mode 100644
index 000000000..df05af56f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+/**
+ * This file is required to support the common code in eal_common_log.c
+ * as windows C lib does not contain regex.h. This may be removed in
+ * future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for windows */
+typedef void *regex_t;
+/* defining regmatch_t for windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/sched.h b/lib/librte_eal/windows/eal/include/exec-env/sched.h
new file mode 100644
index 000000000..1851857cf
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/sched.h
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+/**
+ * This file is added to support the common code in eal_common_thread.c
+ * as windows C lib does not contain sched.h. This may be removed
+ * in future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/unistd.h b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
new file mode 100644
index 000000000..546e70b56
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/exec-env/unistd.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+/**
+ * This file is added to support common code in eal_common_lcore.c
+ * as windows C lib does not contain unistd.h. This may be removed
+ * in future releases.
+ */
+#endif /* _UNISTD_H_ */
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v7 6/8] eal: add minimum viable code for eal on windows
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
                     ` (5 preceding siblings ...)
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 5/8] eal: add headers for compatibility with windows Anand Rawat
@ 2019-03-28 23:24   ` Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows Anand Rawat
                     ` (2 subsequent siblings)
  9 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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        | 102 ++++++++++--
 lib/librte_eal/windows/eal/eal_thread.c       | 145 +++++++++++++++++-
 .../windows/eal/include/exec-env/regex.h      |   2 +
 .../windows/eal/include/exec-env/rte_os.h     |  20 +++
 lib/librte_eal/windows/eal/meson.build        |   2 +
 7 files changed, 331 insertions(+), 30 deletions(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 37ed42233..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index a9705e257..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index e4fcb2615..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <stdint.h>
+
 #include <rte_common.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index f701443c3..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
 #include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
index df05af56f..914cdf08e 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/regex.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -17,6 +17,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 */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
index 65230cae9..98b9c37cc 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v7 6/8] eal: add minimum viable code for eal on windows
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 6/8] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-28 23:24     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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        | 102 ++++++++++--
 lib/librte_eal/windows/eal/eal_thread.c       | 145 +++++++++++++++++-
 .../windows/eal/include/exec-env/regex.h      |   2 +
 .../windows/eal/include/exec-env/rte_os.h     |  20 +++
 lib/librte_eal/windows/eal/meson.build        |   2 +
 7 files changed, 331 insertions(+), 30 deletions(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 37ed42233..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index a9705e257..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index e4fcb2615..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <stdint.h>
+
 #include <rte_common.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index f701443c3..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
 #include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/exec-env/regex.h b/lib/librte_eal/windows/eal/include/exec-env/regex.h
index df05af56f..914cdf08e 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/regex.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/regex.h
@@ -17,6 +17,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 */
diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
index 65230cae9..98b9c37cc 100644
--- a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
+++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h
@@ -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
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
                     ` (6 preceding siblings ...)
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 6/8] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-28 23:24   ` Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
                       ` (2 more replies)
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 8/8] build: meson changes to build on windows Anand Rawat
  2019-03-29  0:12   ` [dpdk-dev] [PATCH v7 0/8] HelloWorld example for windows Harini Ramakrishnan
  9 siblings, 3 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index e9ff2b4c2..ab00771d2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -283,6 +283,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..b88eb76c9
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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

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

* [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows Anand Rawat
@ 2019-03-28 23:24     ` Anand Rawat
  2019-03-29  0:06     ` Harini Ramakrishnan
  2019-04-01 23:22     ` Thomas Monjalon
  2 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index e9ff2b4c2..ab00771d2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -283,6 +283,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..b88eb76c9
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from `Meson* website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from `Ninja* website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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


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

* [dpdk-dev] [PATCH v7 8/8] build: meson changes to build on windows
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
                     ` (7 preceding siblings ...)
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows Anand Rawat
@ 2019-03-28 23:24   ` Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
  2019-04-01 23:25     ` Thomas Monjalon
  2019-03-29  0:12   ` [dpdk-dev] [PATCH v7 0/8] HelloWorld example for windows Harini Ramakrishnan
  9 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 app/meson.build                        | 6 +++++-
 buildtools/meson.build                 | 6 +++++-
 drivers/meson.build                    | 6 +++++-
 examples/meson.build                   | 8 ++++++--
 kernel/windows/meson.build             | 4 ++++
 lib/librte_eal/windows/eal/meson.build | 6 ++++++
 lib/meson.build                        | 4 ++++
 7 files changed, 35 insertions(+), 5 deletions(-)
 create mode 100644 kernel/windows/meson.build

diff --git a/app/meson.build b/app/meson.build
index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build
index 8c76a5659..7520a16e3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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.
 dpdk_driver_classes = ['common',
diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..015b26f73 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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,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
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build
new file mode 100644
index 000000000..45adcd138
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+# stub file for supporting windows logic in future release
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 6bc577e5c..e9b7138c5 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -5,6 +5,12 @@ eal_inc += include_directories('include')
 
 env_objs = []
 env_headers = []
+common_sources = files(
+	'../../common/eal_common_errno.c',
+	'../../common/eal_common_launch.c',
+	'../../common/eal_common_lcore.c',
+	'../../common/eal_common_log.c'
+)
 env_sources = files('eal.c',
 	'eal_debug.c',
 	'eal_lcore.c',
diff --git a/lib/meson.build b/lib/meson.build
index a7b5a9194..c3289f885 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'] # only supported 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

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

* [dpdk-dev] [PATCH v7 8/8] build: meson changes to build on windows
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 8/8] build: meson changes to build on windows Anand Rawat
@ 2019-03-28 23:24     ` Anand Rawat
  2019-04-01 23:25     ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-03-28 23:24 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 app/meson.build                        | 6 +++++-
 buildtools/meson.build                 | 6 +++++-
 drivers/meson.build                    | 6 +++++-
 examples/meson.build                   | 8 ++++++--
 kernel/windows/meson.build             | 4 ++++
 lib/librte_eal/windows/eal/meson.build | 6 ++++++
 lib/meson.build                        | 4 ++++
 7 files changed, 35 insertions(+), 5 deletions(-)
 create mode 100644 kernel/windows/meson.build

diff --git a/app/meson.build b/app/meson.build
index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build
index 8c76a5659..7520a16e3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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.
 dpdk_driver_classes = ['common',
diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..015b26f73 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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,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
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build
new file mode 100644
index 000000000..45adcd138
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+# stub file for supporting windows logic in future release
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 6bc577e5c..e9b7138c5 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -5,6 +5,12 @@ eal_inc += include_directories('include')
 
 env_objs = []
 env_headers = []
+common_sources = files(
+	'../../common/eal_common_errno.c',
+	'../../common/eal_common_launch.c',
+	'../../common/eal_common_lcore.c',
+	'../../common/eal_common_log.c'
+)
 env_sources = files('eal.c',
 	'eal_debug.c',
 	'eal_lcore.c',
diff --git a/lib/meson.build b/lib/meson.build
index a7b5a9194..c3289f885 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'] # only supported 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


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

* Re: [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
@ 2019-03-29  0:06     ` Harini Ramakrishnan
  2019-03-29  0:06       ` Harini Ramakrishnan
  2019-04-01 23:22     ` Thomas Monjalon
  2 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-29  0:06 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>

Verified build on Windows 
Tested-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

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

* Re: [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows
  2019-03-29  0:06     ` Harini Ramakrishnan
@ 2019-03-29  0:06       ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-29  0:06 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>

Verified build on Windows 
Tested-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

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

* Re: [dpdk-dev] [PATCH v7 0/8] HelloWorld example for windows
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
                     ` (8 preceding siblings ...)
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 8/8] build: meson changes to build on windows Anand Rawat
@ 2019-03-29  0:12   ` Harini Ramakrishnan
  2019-03-29  0:12     ` Harini Ramakrishnan
  9 siblings, 1 reply; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-29  0:12 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

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

v7 Changes:
1. Fixed rte_os.h not found issue on linux and freebsd.
2. Fixed missing def issues on linux and freebsd.
3. Updated comments in header files to be more descriptive 

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

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

* Re: [dpdk-dev] [PATCH v7 0/8] HelloWorld example for windows
  2019-03-29  0:12   ` [dpdk-dev] [PATCH v7 0/8] HelloWorld example for windows Harini Ramakrishnan
@ 2019-03-29  0:12     ` Harini Ramakrishnan
  0 siblings, 0 replies; 327+ messages in thread
From: Harini Ramakrishnan @ 2019-03-29  0:12 UTC (permalink / raw)
  To: Anand Rawat, dev
  Cc: pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson, thomas

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

v7 Changes:
1. Fixed rte_os.h not found issue on linux and freebsd.
2. Fixed missing def issues on linux and freebsd.
3. Updated comments in header files to be more descriptive 

Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>

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

* Re: [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
@ 2019-04-01 16:17     ` Bruce Richardson
  2019-04-01 16:17       ` Bruce Richardson
  2019-04-01 16:34     ` Bruce Richardson
  2 siblings, 1 reply; 327+ messages in thread
From: Bruce Richardson @ 2019-04-01 16:17 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

On Thu, Mar 28, 2019 at 04:24:44PM -0700, Anand Rawat wrote:
> Added initial stub source files for windows support
> and only the required meson changes for windows.
> 
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  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
> 
> diff --git a/config/meson.build b/config/meson.build
> index 30a7261a5..4bd73b1e9 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -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()

The library is "libm", not "liblm" so this breaks the linux builds as there
is not found an "lm" library. Instead use "cc.find_library('m',..."

/Bruce

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

* Re: [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support
  2019-04-01 16:17     ` Bruce Richardson
@ 2019-04-01 16:17       ` Bruce Richardson
  0 siblings, 0 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-04-01 16:17 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

On Thu, Mar 28, 2019 at 04:24:44PM -0700, Anand Rawat wrote:
> Added initial stub source files for windows support
> and only the required meson changes for windows.
> 
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  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
> 
> diff --git a/config/meson.build b/config/meson.build
> index 30a7261a5..4bd73b1e9 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -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()

The library is "libm", not "liblm" so this breaks the linux builds as there
is not found an "lm" library. Instead use "cc.find_library('m',..."

/Bruce

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

* Re: [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
  2019-04-01 16:17     ` Bruce Richardson
@ 2019-04-01 16:34     ` Bruce Richardson
  2019-04-01 16:34       ` Bruce Richardson
  2019-04-01 17:06       ` Anand Rawat
  2 siblings, 2 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-04-01 16:34 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

On Thu, Mar 28, 2019 at 04:24:44PM -0700, Anand Rawat wrote:
> Added initial stub source files for windows support
> and only the required meson changes for windows.
> 
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  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
> 

I'm a little uncertain behind putting the stub files and the meson.build
changes in the one patch, since the result doesn't build anyway. However,
you can get meson to successfully configure the project on windows by
adding in an empty file called meson.build to the kernel/windows directory.

/Bruce

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

* Re: [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support
  2019-04-01 16:34     ` Bruce Richardson
@ 2019-04-01 16:34       ` Bruce Richardson
  2019-04-01 17:06       ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-04-01 16:34 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

On Thu, Mar 28, 2019 at 04:24:44PM -0700, Anand Rawat wrote:
> Added initial stub source files for windows support
> and only the required meson changes for windows.
> 
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  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
> 

I'm a little uncertain behind putting the stub files and the meson.build
changes in the one patch, since the result doesn't build anyway. However,
you can get meson to successfully configure the project on windows by
adding in an empty file called meson.build to the kernel/windows directory.

/Bruce

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

* Re: [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support
  2019-04-01 16:34     ` Bruce Richardson
  2019-04-01 16:34       ` Bruce Richardson
@ 2019-04-01 17:06       ` Anand Rawat
  2019-04-01 17:06         ` Anand Rawat
  2019-04-01 20:10         ` Bruce Richardson
  1 sibling, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-01 17:06 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

On 4/1/2019 9:34 AM, Bruce Richardson wrote:
> On Thu, Mar 28, 2019 at 04:24:44PM -0700, Anand Rawat wrote:
>>   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 ++++++++
> 
> I'm a little uncertain behind putting the stub files and the meson.build
> changes in the one patch, since the result doesn't build anyway. However,
> you can get meson to successfully configure the project on windows by
> adding in an empty file called meson.build to the kernel/windows directory.
> 
> /Bruce
> 

Thanks Bruce, libm is a part of V8 fixes.
kernel/windows directory is the patch 8/8 as I thought of it as a 
temporary workaround. I'll move it to another patch along with meson 
changes here.
-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support
  2019-04-01 17:06       ` Anand Rawat
@ 2019-04-01 17:06         ` Anand Rawat
  2019-04-01 20:10         ` Bruce Richardson
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-01 17:06 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

On 4/1/2019 9:34 AM, Bruce Richardson wrote:
> On Thu, Mar 28, 2019 at 04:24:44PM -0700, Anand Rawat wrote:
>>   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 ++++++++
> 
> I'm a little uncertain behind putting the stub files and the meson.build
> changes in the one patch, since the result doesn't build anyway. However,
> you can get meson to successfully configure the project on windows by
> adding in an empty file called meson.build to the kernel/windows directory.
> 
> /Bruce
> 

Thanks Bruce, libm is a part of V8 fixes.
kernel/windows directory is the patch 8/8 as I thought of it as a 
temporary workaround. I'll move it to another patch along with meson 
changes here.
-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support
  2019-04-01 17:06       ` Anand Rawat
  2019-04-01 17:06         ` Anand Rawat
@ 2019-04-01 20:10         ` Bruce Richardson
  2019-04-01 20:10           ` Bruce Richardson
  1 sibling, 1 reply; 327+ messages in thread
From: Bruce Richardson @ 2019-04-01 20:10 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

On Mon, Apr 01, 2019 at 10:06:18AM -0700, Anand Rawat wrote:
> On 4/1/2019 9:34 AM, Bruce Richardson wrote:
> > On Thu, Mar 28, 2019 at 04:24:44PM -0700, Anand Rawat wrote:
> > >   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 ++++++++
> > 
> > I'm a little uncertain behind putting the stub files and the meson.build
> > changes in the one patch, since the result doesn't build anyway. However,
> > you can get meson to successfully configure the project on windows by
> > adding in an empty file called meson.build to the kernel/windows directory.
> > 
> > /Bruce
> > 
> 
> Thanks Bruce, libm is a part of V8 fixes.
> kernel/windows directory is the patch 8/8 as I thought of it as a temporary
> workaround. I'll move it to another patch along with meson changes here.

Oh, I wasn't thinking of it being temporary, as I assumed you had kernel
modules for uio on windows. However, if they are not being hosted on DPDK,
I still think having a directory with a meson.build file with just a
comment in it e.g. "No kernel drivers for this OS",  is probably tidier
than having if conditions in the higher level build files.

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

* Re: [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support
  2019-04-01 20:10         ` Bruce Richardson
@ 2019-04-01 20:10           ` Bruce Richardson
  0 siblings, 0 replies; 327+ messages in thread
From: Bruce Richardson @ 2019-04-01 20:10 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, thomas

On Mon, Apr 01, 2019 at 10:06:18AM -0700, Anand Rawat wrote:
> On 4/1/2019 9:34 AM, Bruce Richardson wrote:
> > On Thu, Mar 28, 2019 at 04:24:44PM -0700, Anand Rawat wrote:
> > >   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 ++++++++
> > 
> > I'm a little uncertain behind putting the stub files and the meson.build
> > changes in the one patch, since the result doesn't build anyway. However,
> > you can get meson to successfully configure the project on windows by
> > adding in an empty file called meson.build to the kernel/windows directory.
> > 
> > /Bruce
> > 
> 
> Thanks Bruce, libm is a part of V8 fixes.
> kernel/windows directory is the patch 8/8 as I thought of it as a temporary
> workaround. I'll move it to another patch along with meson changes here.

Oh, I wasn't thinking of it being temporary, as I assumed you had kernel
modules for uio on windows. However, if they are not being hosted on DPDK,
I still think having a directory with a meson.build file with just a
comment in it e.g. "No kernel drivers for this OS",  is probably tidier
than having if conditions in the higher level build files.

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

* Re: [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
@ 2019-04-01 23:09     ` Thomas Monjalon
  2019-04-01 23:09       ` Thomas Monjalon
  2019-04-02  3:52       ` Anand Rawat
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-01 23:09 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan, david.marchand

Hi,

29/03/2019 00:24, 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.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  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 +++++++++++++++++++
>  meson.build                                   |  6 ++--

An update of the legacy Makefiles is missing.
It should be something like that:

--- a/lib/librte_eal/freebsd/eal/Makefile
+++ b/lib/librte_eal/freebsd/eal/Makefile
@@ -86,7 +86,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
 CFLAGS_eal_hpet.o += -Wno-return-type
 endif
 
-INC :=  # no bsd specific headers
+INC := rte_os.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_FREEBSD)-include := $(addprefix include/,$(INC))
 
--- a/lib/librte_eal/linux/eal/Makefile
+++ b/lib/librte_eal/linux/eal/Makefile
@@ -93,7 +93,8 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
 CFLAGS_eal_thread.o += -Wno-return-type
 endif
 
-INC := rte_kni_common.h
+INC := rte_os.h
+INC += rte_kni_common.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUX)-include := $(addprefix include/,$(INC))


>  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
[...]
> +/* os specific include */

Please write OS (uppercase) in this comment and others,
so we can understand it is an acronym.

> +#include <rte_os.h>

You don't prefix with exec-env/ sub-directory, unlike what is done
for rte_kni_common.h, and I think it is a good idea.
However it will require one more patch to make it work with
the make-based system which currently installs the include in exec-env/.
I have just submitted such a patch to remove the exec-env/ directory
both from installed and source hierarchy:
	https://patches.dpdk.org/patch/52031/
Please rebase on top of my patch and move rte_os.h one level upper.
Thanks


One more nit:
> --- /dev/null
> +++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.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)

Please write Windows with first letter uppercase.
In this file, the comments looks superfluous and can be removed.
Or you can replace by something like "There is no strdup in Microsoft libc."

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

* Re: [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics
  2019-04-01 23:09     ` Thomas Monjalon
@ 2019-04-01 23:09       ` Thomas Monjalon
  2019-04-02  3:52       ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-01 23:09 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan, david.marchand

Hi,

29/03/2019 00:24, 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.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  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 +++++++++++++++++++
>  meson.build                                   |  6 ++--

An update of the legacy Makefiles is missing.
It should be something like that:

--- a/lib/librte_eal/freebsd/eal/Makefile
+++ b/lib/librte_eal/freebsd/eal/Makefile
@@ -86,7 +86,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
 CFLAGS_eal_hpet.o += -Wno-return-type
 endif
 
-INC :=  # no bsd specific headers
+INC := rte_os.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_FREEBSD)-include := $(addprefix include/,$(INC))
 
--- a/lib/librte_eal/linux/eal/Makefile
+++ b/lib/librte_eal/linux/eal/Makefile
@@ -93,7 +93,8 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
 CFLAGS_eal_thread.o += -Wno-return-type
 endif
 
-INC := rte_kni_common.h
+INC := rte_os.h
+INC += rte_kni_common.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUX)-include := $(addprefix include/,$(INC))


>  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
[...]
> +/* os specific include */

Please write OS (uppercase) in this comment and others,
so we can understand it is an acronym.

> +#include <rte_os.h>

You don't prefix with exec-env/ sub-directory, unlike what is done
for rte_kni_common.h, and I think it is a good idea.
However it will require one more patch to make it work with
the make-based system which currently installs the include in exec-env/.
I have just submitted such a patch to remove the exec-env/ directory
both from installed and source hierarchy:
	https://patches.dpdk.org/patch/52031/
Please rebase on top of my patch and move rte_os.h one level upper.
Thanks


One more nit:
> --- /dev/null
> +++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.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)

Please write Windows with first letter uppercase.
In this file, the comments looks superfluous and can be removed.
Or you can replace by something like "There is no strdup in Microsoft libc."



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

* Re: [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
  2019-03-29  0:06     ` Harini Ramakrishnan
@ 2019-04-01 23:22     ` Thomas Monjalon
  2019-04-01 23:22       ` Thomas Monjalon
  2019-04-02  1:01       ` Pallavi Kadam
  2 siblings, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-01 23:22 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

29/03/2019 00:24, Anand Rawat:
> Added documentation to build helloworld example
> on windows using meson and clang. Updated the
> maintainers list to include windows maintainers.
[...]
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> +Windows support
> +M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
> +M: Omar Cardona <ocardona@microsoft.com>
> +M: Anand Rawat <anand.rawat@intel.com>
> +M: Ranjit Menon <ranjit.menon@intel.com>
> +F: lib/librte_eal/windows/

This change should be in the first patch (when introducing eal/windows).
In this doc patch, you should add
	F: doc/guides/windows_gsg/

[...]
> +The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
> +The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
> +
> +\*Other names and brands may be claimed as the property of others.

This sentence looks weird. What does it mean?

[...]
> +Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.

Why is there an asterisk after LLVM?

[...]
> +Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
> +When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.

Please try to limit the line length.
We are supposed to not exceed 80-chars if possible.
The best is to wrap lines logically (as in code)
after a comma or a point, etc.

[...]
> +    cd C:\Users\me\dpdk\build
> +    helloworld.exe
> +    hello from core 1
> +    hello from core 3
> +    hello from core 0
> +    hello from core 2

That's definitely a good goal for release 19.05!

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

Yes

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

* Re: [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows
  2019-04-01 23:22     ` Thomas Monjalon
@ 2019-04-01 23:22       ` Thomas Monjalon
  2019-04-02  1:01       ` Pallavi Kadam
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-01 23:22 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

29/03/2019 00:24, Anand Rawat:
> Added documentation to build helloworld example
> on windows using meson and clang. Updated the
> maintainers list to include windows maintainers.
[...]
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> +Windows support
> +M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
> +M: Omar Cardona <ocardona@microsoft.com>
> +M: Anand Rawat <anand.rawat@intel.com>
> +M: Ranjit Menon <ranjit.menon@intel.com>
> +F: lib/librte_eal/windows/

This change should be in the first patch (when introducing eal/windows).
In this doc patch, you should add
	F: doc/guides/windows_gsg/

[...]
> +The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
> +The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
> +
> +\*Other names and brands may be claimed as the property of others.

This sentence looks weird. What does it mean?

[...]
> +Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.

Why is there an asterisk after LLVM?

[...]
> +Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
> +When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.

Please try to limit the line length.
We are supposed to not exceed 80-chars if possible.
The best is to wrap lines logically (as in code)
after a comma or a point, etc.

[...]
> +    cd C:\Users\me\dpdk\build
> +    helloworld.exe
> +    hello from core 1
> +    hello from core 3
> +    hello from core 0
> +    hello from core 2

That's definitely a good goal for release 19.05!

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

Yes



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

* Re: [dpdk-dev] [PATCH v7 8/8] build: meson changes to build on windows
  2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 8/8] build: meson changes to build on windows Anand Rawat
  2019-03-28 23:24     ` Anand Rawat
@ 2019-04-01 23:25     ` Thomas Monjalon
  2019-04-01 23:25       ` Thomas Monjalon
  2019-04-02  3:47       ` Anand Rawat
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-01 23:25 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

29/03/2019 00:24, 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.
[...]
> --- a/app/meson.build
> +++ b/app/meson.build
> @@ -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

Not sure this change deserves a copyright update :)

> --- a/examples/meson.build
> +++ b/examples/meson.build
> -	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']

Please keep this line intact.

> +	if host_machine.system() != 'windows'
> +		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
> +	else
> +		deps = ['eal'] # only supported lib on windows currently
> +	endif

You could override deps for Windows only.

Other workarounds look reasonnable. Thanks

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

* Re: [dpdk-dev] [PATCH v7 8/8] build: meson changes to build on windows
  2019-04-01 23:25     ` Thomas Monjalon
@ 2019-04-01 23:25       ` Thomas Monjalon
  2019-04-02  3:47       ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-01 23:25 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

29/03/2019 00:24, 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.
[...]
> --- a/app/meson.build
> +++ b/app/meson.build
> @@ -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

Not sure this change deserves a copyright update :)

> --- a/examples/meson.build
> +++ b/examples/meson.build
> -	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']

Please keep this line intact.

> +	if host_machine.system() != 'windows'
> +		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
> +	else
> +		deps = ['eal'] # only supported lib on windows currently
> +	endif

You could override deps for Windows only.

Other workarounds look reasonnable. Thanks



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

* Re: [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows
  2019-04-01 23:22     ` Thomas Monjalon
  2019-04-01 23:22       ` Thomas Monjalon
@ 2019-04-02  1:01       ` Pallavi Kadam
  2019-04-02  1:01         ` Pallavi Kadam
  2019-04-02  7:15         ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Pallavi Kadam @ 2019-04-02  1:01 UTC (permalink / raw)
  To: Thomas Monjalon, Anand Rawat
  Cc: dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson, harini.ramakrishnan


On 4/1/2019 4:22 PM, Thomas Monjalon wrote:
> 29/03/2019 00:24, Anand Rawat:
>> Added documentation to build helloworld example
>> on windows using meson and clang. Updated the
>> maintainers list to include windows maintainers.
> [...]
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> +Windows support
>> +M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
>> +M: Omar Cardona <ocardona@microsoft.com>
>> +M: Anand Rawat <anand.rawat@intel.com>
>> +M: Ranjit Menon <ranjit.menon@intel.com>
>> +F: lib/librte_eal/windows/
> This change should be in the first patch (when introducing eal/windows).
> In this doc patch, you should add
> 	F: doc/guides/windows_gsg/
Ok, will be done in the coming patch v8.
>
> [...]
>> +The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
>> +The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
>> +
>> +\*Other names and brands may be claimed as the property of others.
> This sentence looks weird. What does it mean?

Thought of adding asterisk in front of names and brands

those are claimed from other websites/ organizations

for instance, MSFT, LLVM.

Can be removed, if not required.

>
> [...]
>> +Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
> Why is there an asterisk after LLVM?

As the link has been copied from LLVM website (other property).

Can be removed, if not required.

>
> [...]
>> +Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
>> +When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
> Please try to limit the line length.
> We are supposed to not exceed 80-chars if possible.
> The best is to wrap lines logically (as in code)
> after a comma or a point, etc.

Will limit the line length in v8.

>
> [...]
>> +    cd C:\Users\me\dpdk\build
>> +    helloworld.exe
>> +    hello from core 1
>> +    hello from core 3
>> +    hello from core 0
>> +    hello from core 2
> That's definitely a good goal for release 19.05!
>
>> +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.
> Yes
>
>

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

* Re: [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows
  2019-04-02  1:01       ` Pallavi Kadam
@ 2019-04-02  1:01         ` Pallavi Kadam
  2019-04-02  7:15         ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Pallavi Kadam @ 2019-04-02  1:01 UTC (permalink / raw)
  To: Thomas Monjalon, Anand Rawat
  Cc: dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson, harini.ramakrishnan


On 4/1/2019 4:22 PM, Thomas Monjalon wrote:
> 29/03/2019 00:24, Anand Rawat:
>> Added documentation to build helloworld example
>> on windows using meson and clang. Updated the
>> maintainers list to include windows maintainers.
> [...]
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> +Windows support
>> +M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
>> +M: Omar Cardona <ocardona@microsoft.com>
>> +M: Anand Rawat <anand.rawat@intel.com>
>> +M: Ranjit Menon <ranjit.menon@intel.com>
>> +F: lib/librte_eal/windows/
> This change should be in the first patch (when introducing eal/windows).
> In this doc patch, you should add
> 	F: doc/guides/windows_gsg/
Ok, will be done in the coming patch v8.
>
> [...]
>> +The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
>> +The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
>> +
>> +\*Other names and brands may be claimed as the property of others.
> This sentence looks weird. What does it mean?

Thought of adding asterisk in front of names and brands

those are claimed from other websites/ organizations

for instance, MSFT, LLVM.

Can be removed, if not required.

>
> [...]
>> +Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
> Why is there an asterisk after LLVM?

As the link has been copied from LLVM website (other property).

Can be removed, if not required.

>
> [...]
>> +Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
>> +When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.
> Please try to limit the line length.
> We are supposed to not exceed 80-chars if possible.
> The best is to wrap lines logically (as in code)
> after a comma or a point, etc.

Will limit the line length in v8.

>
> [...]
>> +    cd C:\Users\me\dpdk\build
>> +    helloworld.exe
>> +    hello from core 1
>> +    hello from core 3
>> +    hello from core 0
>> +    hello from core 2
> That's definitely a good goal for release 19.05!
>
>> +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.
> Yes
>
>

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

* Re: [dpdk-dev] [PATCH v7 8/8] build: meson changes to build on windows
  2019-04-01 23:25     ` Thomas Monjalon
  2019-04-01 23:25       ` Thomas Monjalon
@ 2019-04-02  3:47       ` Anand Rawat
  2019-04-02  3:47         ` Anand Rawat
  1 sibling, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:47 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

On 4/1/2019 4:25 PM, Thomas Monjalon wrote:
> 29/03/2019 00:24, 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.
> [...]
>> --- a/app/meson.build
>> +++ b/app/meson.build
>> @@ -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
> 
> Not sure this change deserves a copyright update :)

I am not sure either, basic principle that I am following
is if any file is touched with some code/logic the license
should be updated. Do correct me if I am wrong. I can make
the changes accordingly in the future releases.

> 
>> --- a/examples/meson.build
>> +++ b/examples/meson.build
>> -	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
> 
> Please keep this line intact.
> 
>> +	if host_machine.system() != 'windows'
>> +		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
>> +	else
>> +		deps = ['eal'] # only supported lib on windows currently
>> +	endif
> 
> You could override deps for Windows only.
> 

Will be updated in v8

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v7 8/8] build: meson changes to build on windows
  2019-04-02  3:47       ` Anand Rawat
@ 2019-04-02  3:47         ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:47 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

On 4/1/2019 4:25 PM, Thomas Monjalon wrote:
> 29/03/2019 00:24, 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.
> [...]
>> --- a/app/meson.build
>> +++ b/app/meson.build
>> @@ -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
> 
> Not sure this change deserves a copyright update :)

I am not sure either, basic principle that I am following
is if any file is touched with some code/logic the license
should be updated. Do correct me if I am wrong. I can make
the changes accordingly in the future releases.

> 
>> --- a/examples/meson.build
>> +++ b/examples/meson.build
>> -	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
> 
> Please keep this line intact.
> 
>> +	if host_machine.system() != 'windows'
>> +		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
>> +	else
>> +		deps = ['eal'] # only supported lib on windows currently
>> +	endif
> 
> You could override deps for Windows only.
> 

Will be updated in v8

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics
  2019-04-01 23:09     ` Thomas Monjalon
  2019-04-01 23:09       ` Thomas Monjalon
@ 2019-04-02  3:52       ` Anand Rawat
  2019-04-02  3:52         ` Anand Rawat
  1 sibling, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:52 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan, david.marchand

On 4/1/2019 4:09 PM, Thomas Monjalon wrote:
> Hi,
> 
> An update of the legacy Makefiles is missing.
> It should be something like that:
> 
> --- a/lib/librte_eal/freebsd/eal/Makefile
> +++ b/lib/librte_eal/freebsd/eal/Makefile
> @@ -86,7 +86,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
>   CFLAGS_eal_hpet.o += -Wno-return-type
>   endif
>   
> -INC :=  # no bsd specific headers
> +INC := rte_os.h
>   
>   SYMLINK-$(CONFIG_RTE_EXEC_ENV_FREEBSD)-include := $(addprefix include/,$(INC))
>   
> --- a/lib/librte_eal/linux/eal/Makefile
> +++ b/lib/librte_eal/linux/eal/Makefile
> @@ -93,7 +93,8 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
>   CFLAGS_eal_thread.o += -Wno-return-type
>   endif
>   
> -INC := rte_kni_common.h
> +INC := rte_os.h
> +INC += rte_kni_common.h
>   
>   SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUX)-include := $(addprefix include/,$(INC))
> 

Adding the change to v8 along with a change in 
mk/target/<os>/rte.vars.mk to include path 'librte_eal/<OS>/eal/include'
for rte_os.h. This is done to make it available during the build process.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics
  2019-04-02  3:52       ` Anand Rawat
@ 2019-04-02  3:52         ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:52 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan, david.marchand

On 4/1/2019 4:09 PM, Thomas Monjalon wrote:
> Hi,
> 
> An update of the legacy Makefiles is missing.
> It should be something like that:
> 
> --- a/lib/librte_eal/freebsd/eal/Makefile
> +++ b/lib/librte_eal/freebsd/eal/Makefile
> @@ -86,7 +86,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
>   CFLAGS_eal_hpet.o += -Wno-return-type
>   endif
>   
> -INC :=  # no bsd specific headers
> +INC := rte_os.h
>   
>   SYMLINK-$(CONFIG_RTE_EXEC_ENV_FREEBSD)-include := $(addprefix include/,$(INC))
>   
> --- a/lib/librte_eal/linux/eal/Makefile
> +++ b/lib/librte_eal/linux/eal/Makefile
> @@ -93,7 +93,8 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
>   CFLAGS_eal_thread.o += -Wno-return-type
>   endif
>   
> -INC := rte_kni_common.h
> +INC := rte_os.h
> +INC += rte_kni_common.h
>   
>   SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUX)-include := $(addprefix include/,$(INC))
> 

Adding the change to v8 along with a change in 
mk/target/<os>/rte.vars.mk to include path 'librte_eal/<OS>/eal/include'
for rte_os.h. This is done to make it available during the build process.

-- 
Anand Rawat

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

* [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows
  2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
                   ` (11 preceding siblings ...)
  2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
@ 2019-04-02  3:54 ` Anand Rawat
  2019-04-02  3:54   ` Anand Rawat
                     ` (11 more replies)
  12 siblings, 12 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

v8 Changes:
1. Fixed rte_os.h not found issue on linux and freebsd.
2. Updated make build system to include path for rte_os.h.
3. Fixed math lib error on linux.
4. Separated eal logic and build changes.

v7 Changes:
1. Fixed missing def issues on linux and freebsd.
2. Updated comments in header files to be more descriptive 

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:
*This patch is based on https://patches.dpdk.org/patch/52031/
and it is required to cleanly apply patch 3/10

*patch 5/10 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 10/10 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 (10):
  eal: eal stub to add windows support
  meson: required changes for windows
  eal: add new rte_os.h header to build system
  eal: update common headers to use rte_os.h
  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                                   |   8 +
 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         |  81 +++++
 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/freebsd/eal/Makefile           |   4 +-
 lib/librte_eal/freebsd/eal/include/rte_os.h   |  14 +
 lib/librte_eal/linux/eal/Makefile             |   3 +-
 lib/librte_eal/linux/eal/include/rte_os.h     |  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  |  48 +++
 lib/librte_eal/windows/eal/include/pthread.h  |  27 ++
 lib/librte_eal/windows/eal/include/regex.h    |  90 +++++
 lib/librte_eal/windows/eal/include/rte_os.h   |  53 +++
 lib/librte_eal/windows/eal/include/sched.h    |  46 +++
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/include/unistd.h   |  12 +
 lib/librte_eal/windows/eal/meson.build        |  18 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  19 +-
 meson.build                                   |   6 +-
 mk/exec-env/freebsd/rte.vars.mk               |   5 +-
 mk/exec-env/linux/rte.vars.mk                 |   5 +-
 37 files changed, 1230 insertions(+), 32 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/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/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/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_os.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

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

* [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
@ 2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 01/10] eal: eal stub to add windows support Anand Rawat
                     ` (10 subsequent siblings)
  11 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

v8 Changes:
1. Fixed rte_os.h not found issue on linux and freebsd.
2. Updated make build system to include path for rte_os.h.
3. Fixed math lib error on linux.
4. Separated eal logic and build changes.

v7 Changes:
1. Fixed missing def issues on linux and freebsd.
2. Updated comments in header files to be more descriptive 

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:
*This patch is based on https://patches.dpdk.org/patch/52031/
and it is required to cleanly apply patch 3/10

*patch 5/10 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 10/10 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 (10):
  eal: eal stub to add windows support
  meson: required changes for windows
  eal: add new rte_os.h header to build system
  eal: update common headers to use rte_os.h
  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                                   |   8 +
 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         |  81 +++++
 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/freebsd/eal/Makefile           |   4 +-
 lib/librte_eal/freebsd/eal/include/rte_os.h   |  14 +
 lib/librte_eal/linux/eal/Makefile             |   3 +-
 lib/librte_eal/linux/eal/include/rte_os.h     |  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  |  48 +++
 lib/librte_eal/windows/eal/include/pthread.h  |  27 ++
 lib/librte_eal/windows/eal/include/regex.h    |  90 +++++
 lib/librte_eal/windows/eal/include/rte_os.h   |  53 +++
 lib/librte_eal/windows/eal/include/sched.h    |  46 +++
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/include/unistd.h   |  12 +
 lib/librte_eal/windows/eal/meson.build        |  18 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  19 +-
 meson.build                                   |   6 +-
 mk/exec-env/freebsd/rte.vars.mk               |   5 +-
 mk/exec-env/linux/rte.vars.mk                 |   5 +-
 37 files changed, 1230 insertions(+), 32 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/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/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/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_os.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


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

* [dpdk-dev] [PATCH v8 01/10] eal: eal stub to add windows support
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
  2019-04-02  3:54   ` Anand Rawat
@ 2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 02/10] meson: required changes for windows Anand Rawat
                     ` (9 subsequent siblings)
  11 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Added initial stub source files for windows support.
Updated the MAINTAINERS list for windows support.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 MAINTAINERS                             |  7 ++++++
 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 ++++++++++++++
 5 files changed, 86 insertions(+)
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 9f34f905f..5d70fba9b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -283,6 +283,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..37ed42233
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..a9705e257
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..e4fcb2615
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..f701443c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v8 01/10] eal: eal stub to add windows support
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 01/10] eal: eal stub to add windows support Anand Rawat
@ 2019-04-02  3:54     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Added initial stub source files for windows support.
Updated the MAINTAINERS list for windows support.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 MAINTAINERS                             |  7 ++++++
 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 ++++++++++++++
 5 files changed, 86 insertions(+)
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 9f34f905f..5d70fba9b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -283,6 +283,13 @@ FreeBSD UIO
 M: Bruce Richardson <bruce.richardson@intel.com>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
+M: Omar Cardona <ocardona@microsoft.com>
+M: Anand Rawat <anand.rawat@intel.com>
+M: Ranjit Menon <ranjit.menon@intel.com>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
new file mode 100644
index 000000000..37ed42233
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
new file mode 100644
index 000000000..a9705e257
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
+}
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
new file mode 100644
index 000000000..e4fcb2615
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -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;
+}
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
new file mode 100644
index 000000000..f701443c3
--- /dev/null
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -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;
+}
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v8 02/10] meson: required changes for windows
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
  2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 01/10] eal: eal stub to add windows support Anand Rawat
@ 2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
  2019-04-02 23:04     ` Thomas Monjalon
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system Anand Rawat
                     ` (8 subsequent siblings)
  11 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

These are the required meson changes for Windows.
kernel/windows/meson is a stub file added to support
Windows specific source in future releases.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 config/meson.build                     | 23 ++++++++++++++++-------
 config/x86/meson.build                 | 14 ++++++++------
 kernel/windows/meson.build             |  4 ++++
 lib/librte_eal/meson.build             |  6 +++++-
 lib/librte_eal/windows/eal/meson.build | 10 ++++++++++
 5 files changed, 43 insertions(+), 14 deletions(-)
 create mode 100644 kernel/windows/meson.build
 create mode 100644 lib/librte_eal/windows/eal/meson.build

diff --git a/config/meson.build b/config/meson.build
index 30a7261a5..483139b10 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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('libm', 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
 
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build
new file mode 100644
index 000000000..94c47682d
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+# stub file for supporting Windows logic in future release
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index d48c5e11d..1863622c0 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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

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

* [dpdk-dev] [PATCH v8 02/10] meson: required changes for windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 02/10] meson: required changes for windows Anand Rawat
@ 2019-04-02  3:54     ` Anand Rawat
  2019-04-02 23:04     ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

These are the required meson changes for Windows.
kernel/windows/meson is a stub file added to support
Windows specific source in future releases.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 config/meson.build                     | 23 ++++++++++++++++-------
 config/x86/meson.build                 | 14 ++++++++------
 kernel/windows/meson.build             |  4 ++++
 lib/librte_eal/meson.build             |  6 +++++-
 lib/librte_eal/windows/eal/meson.build | 10 ++++++++++
 5 files changed, 43 insertions(+), 14 deletions(-)
 create mode 100644 kernel/windows/meson.build
 create mode 100644 lib/librte_eal/windows/eal/meson.build

diff --git a/config/meson.build b/config/meson.build
index 30a7261a5..483139b10 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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('libm', 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
 
diff --git a/kernel/windows/meson.build b/kernel/windows/meson.build
new file mode 100644
index 000000000..94c47682d
--- /dev/null
+++ b/kernel/windows/meson.build
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+# stub file for supporting Windows logic in future release
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index d48c5e11d..1863622c0 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -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
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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


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

* [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
                     ` (2 preceding siblings ...)
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 02/10] meson: required changes for windows Anand Rawat
@ 2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
  2019-04-02 19:56     ` Thomas Monjalon
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 04/10] eal: update common headers to use rte_os.h Anand Rawat
                     ` (7 subsequent siblings)
  11 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Added rte_os.h files to support OS specific functionality.
Updated build system to contain OS headers in the include
path.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
---
 lib/librte_eal/freebsd/eal/Makefile         |  4 ++--
 lib/librte_eal/freebsd/eal/include/rte_os.h | 14 ++++++++++++++
 lib/librte_eal/linux/eal/Makefile           |  3 ++-
 lib/librte_eal/linux/eal/include/rte_os.h   | 14 ++++++++++++++
 lib/librte_eal/windows/eal/include/rte_os.h | 14 ++++++++++++++
 meson.build                                 |  6 ++++--
 mk/exec-env/freebsd/rte.vars.mk             |  5 ++++-
 mk/exec-env/linux/rte.vars.mk               |  5 ++++-
 8 files changed, 58 insertions(+), 7 deletions(-)
 create mode 100644 lib/librte_eal/freebsd/eal/include/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/rte_os.h
 create mode 100644 lib/librte_eal/windows/eal/include/rte_os.h

diff --git a/lib/librte_eal/freebsd/eal/Makefile b/lib/librte_eal/freebsd/eal/Makefile
index 55d476e5b..19854ee2c 100644
--- a/lib/librte_eal/freebsd/eal/Makefile
+++ b/lib/librte_eal/freebsd/eal/Makefile
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2015 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
@@ -86,7 +86,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
 CFLAGS_eal_hpet.o += -Wno-return-type
 endif
 
-INC :=  # no bsd specific headers
+INC := rte_os.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_FREEBSD)-include := $(addprefix include/,$(INC))
 
diff --git a/lib/librte_eal/freebsd/eal/include/rte_os.h b/lib/librte_eal/freebsd/eal/include/rte_os.h
new file mode 100644
index 000000000..49cd4d4d9
--- /dev/null
+++ b/lib/librte_eal/freebsd/eal/include/rte_os.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/**
+ * This is header should contain any function/macro definition
+ * which are not supported natively or named differently in the
+ * freebsd OS. Functions will be added in future releases.
+ */
+
+#endif /* _RTE_OS_H_ */
diff --git a/lib/librte_eal/linux/eal/Makefile b/lib/librte_eal/linux/eal/Makefile
index 2aa6e8c6a..6e5261152 100644
--- a/lib/librte_eal/linux/eal/Makefile
+++ b/lib/librte_eal/linux/eal/Makefile
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2016 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
@@ -94,6 +94,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
 endif
 
 INC := rte_kni_common.h
+INC += rte_os.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUX)-include := $(addprefix include/,$(INC))
 
diff --git a/lib/librte_eal/linux/eal/include/rte_os.h b/lib/librte_eal/linux/eal/include/rte_os.h
new file mode 100644
index 000000000..bc6ad14d2
--- /dev/null
+++ b/lib/librte_eal/linux/eal/include/rte_os.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/**
+ * This is header should contain any function/macro definition
+ * which are not supported natively or named differently in the
+ * linux OS. Functions will be added in future releases.
+ */
+
+#endif /* _RTE_OS_H_ */
diff --git a/lib/librte_eal/windows/eal/include/rte_os.h b/lib/librte_eal/windows/eal/include/rte_os.h
new file mode 100644
index 000000000..421ed8e7f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_os.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/**
+ * This is header should contain any function/macro definition
+ * which are not supported natively or named differently in the
+ * Windows OS. Functions will be added in future releases.
+ */
+
+#endif /* _RTE_OS_H_ */
diff --git a/meson.build b/meson.build
index 6061c4b1e..5a93c1f1a 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	# Get version number from file.
@@ -24,7 +24,9 @@ dpdk_app_link_libraries = []
 # configure the build, and make sure configs here and in config folder are
 # able to be included in any file. We also store a global array of include dirs
 # for passing to pmdinfogen scripts
-global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
+global_inc = include_directories('.', 'config',
+						'lib/librte_eal/common/include',
+						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))
 subdir('config')
 
 # build libs and drivers
diff --git a/mk/exec-env/freebsd/rte.vars.mk b/mk/exec-env/freebsd/rte.vars.mk
index c6be560b3..3608530d3 100644
--- a/mk/exec-env/freebsd/rte.vars.mk
+++ b/mk/exec-env/freebsd/rte.vars.mk
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2014 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 #
 # exec-env:
@@ -17,6 +17,9 @@ else
 EXECENV_CFLAGS  = -pthread
 endif
 
+# include in every library to build
+EXECENV_CFLAGS += -I$(RTE_SDK)/lib/librte_eal/freebsd/eal/include
+
 EXECENV_LDFLAGS =
 EXECENV_LDLIBS  = -lexecinfo
 EXECENV_ASFLAGS =
diff --git a/mk/exec-env/linux/rte.vars.mk b/mk/exec-env/linux/rte.vars.mk
index d04d0e29c..bea3f7657 100644
--- a/mk/exec-env/linux/rte.vars.mk
+++ b/mk/exec-env/linux/rte.vars.mk
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2014 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 #
 # exec-env:
@@ -17,6 +17,9 @@ else
 EXECENV_CFLAGS  = -pthread
 endif
 
+# include in every library to build
+EXECENV_CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linux/eal/include
+
 EXECENV_LDLIBS  =
 EXECENV_ASFLAGS =
 
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system Anand Rawat
@ 2019-04-02  3:54     ` Anand Rawat
  2019-04-02 19:56     ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Added rte_os.h files to support OS specific functionality.
Updated build system to contain OS headers in the include
path.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
---
 lib/librte_eal/freebsd/eal/Makefile         |  4 ++--
 lib/librte_eal/freebsd/eal/include/rte_os.h | 14 ++++++++++++++
 lib/librte_eal/linux/eal/Makefile           |  3 ++-
 lib/librte_eal/linux/eal/include/rte_os.h   | 14 ++++++++++++++
 lib/librte_eal/windows/eal/include/rte_os.h | 14 ++++++++++++++
 meson.build                                 |  6 ++++--
 mk/exec-env/freebsd/rte.vars.mk             |  5 ++++-
 mk/exec-env/linux/rte.vars.mk               |  5 ++++-
 8 files changed, 58 insertions(+), 7 deletions(-)
 create mode 100644 lib/librte_eal/freebsd/eal/include/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/rte_os.h
 create mode 100644 lib/librte_eal/windows/eal/include/rte_os.h

diff --git a/lib/librte_eal/freebsd/eal/Makefile b/lib/librte_eal/freebsd/eal/Makefile
index 55d476e5b..19854ee2c 100644
--- a/lib/librte_eal/freebsd/eal/Makefile
+++ b/lib/librte_eal/freebsd/eal/Makefile
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2015 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
@@ -86,7 +86,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
 CFLAGS_eal_hpet.o += -Wno-return-type
 endif
 
-INC :=  # no bsd specific headers
+INC := rte_os.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_FREEBSD)-include := $(addprefix include/,$(INC))
 
diff --git a/lib/librte_eal/freebsd/eal/include/rte_os.h b/lib/librte_eal/freebsd/eal/include/rte_os.h
new file mode 100644
index 000000000..49cd4d4d9
--- /dev/null
+++ b/lib/librte_eal/freebsd/eal/include/rte_os.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/**
+ * This is header should contain any function/macro definition
+ * which are not supported natively or named differently in the
+ * freebsd OS. Functions will be added in future releases.
+ */
+
+#endif /* _RTE_OS_H_ */
diff --git a/lib/librte_eal/linux/eal/Makefile b/lib/librte_eal/linux/eal/Makefile
index 2aa6e8c6a..6e5261152 100644
--- a/lib/librte_eal/linux/eal/Makefile
+++ b/lib/librte_eal/linux/eal/Makefile
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2016 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
@@ -94,6 +94,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
 endif
 
 INC := rte_kni_common.h
+INC += rte_os.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUX)-include := $(addprefix include/,$(INC))
 
diff --git a/lib/librte_eal/linux/eal/include/rte_os.h b/lib/librte_eal/linux/eal/include/rte_os.h
new file mode 100644
index 000000000..bc6ad14d2
--- /dev/null
+++ b/lib/librte_eal/linux/eal/include/rte_os.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/**
+ * This is header should contain any function/macro definition
+ * which are not supported natively or named differently in the
+ * linux OS. Functions will be added in future releases.
+ */
+
+#endif /* _RTE_OS_H_ */
diff --git a/lib/librte_eal/windows/eal/include/rte_os.h b/lib/librte_eal/windows/eal/include/rte_os.h
new file mode 100644
index 000000000..421ed8e7f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_os.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/**
+ * This is header should contain any function/macro definition
+ * which are not supported natively or named differently in the
+ * Windows OS. Functions will be added in future releases.
+ */
+
+#endif /* _RTE_OS_H_ */
diff --git a/meson.build b/meson.build
index 6061c4b1e..5a93c1f1a 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	# Get version number from file.
@@ -24,7 +24,9 @@ dpdk_app_link_libraries = []
 # configure the build, and make sure configs here and in config folder are
 # able to be included in any file. We also store a global array of include dirs
 # for passing to pmdinfogen scripts
-global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
+global_inc = include_directories('.', 'config',
+						'lib/librte_eal/common/include',
+						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))
 subdir('config')
 
 # build libs and drivers
diff --git a/mk/exec-env/freebsd/rte.vars.mk b/mk/exec-env/freebsd/rte.vars.mk
index c6be560b3..3608530d3 100644
--- a/mk/exec-env/freebsd/rte.vars.mk
+++ b/mk/exec-env/freebsd/rte.vars.mk
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2014 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 #
 # exec-env:
@@ -17,6 +17,9 @@ else
 EXECENV_CFLAGS  = -pthread
 endif
 
+# include in every library to build
+EXECENV_CFLAGS += -I$(RTE_SDK)/lib/librte_eal/freebsd/eal/include
+
 EXECENV_LDFLAGS =
 EXECENV_LDLIBS  = -lexecinfo
 EXECENV_ASFLAGS =
diff --git a/mk/exec-env/linux/rte.vars.mk b/mk/exec-env/linux/rte.vars.mk
index d04d0e29c..bea3f7657 100644
--- a/mk/exec-env/linux/rte.vars.mk
+++ b/mk/exec-env/linux/rte.vars.mk
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2014 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 #
 # exec-env:
@@ -17,6 +17,9 @@ else
 EXECENV_CFLAGS  = -pthread
 endif
 
+# include in every library to build
+EXECENV_CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linux/eal/include
+
 EXECENV_LDLIBS  =
 EXECENV_ASFLAGS =
 
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v8 04/10] eal: update common headers to use rte_os.h
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
                     ` (3 preceding siblings ...)
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system Anand Rawat
@ 2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 05/10] build: add module definition file for windows Anand Rawat
                     ` (6 subsequent siblings)
  11 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Updated rte_common.h to include rte_os.h to contain
OS specific macros and functions. Updated rte_string_fns.h
to include rte_common.h for rte_os.h

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_eal/common/include/rte_common.h    |  5 ++++-
 .../common/include/rte_string_fns.h           |  4 +++-
 lib/librte_eal/windows/eal/include/rte_os.h   | 19 +++++++++++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index bcf8afd39..3e4768f4a 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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/windows/eal/include/rte_os.h b/lib/librte_eal/windows/eal/include/rte_os.h
index 421ed8e7f..8da1e235f 100644
--- a/lib/librte_eal/windows/eal/include/rte_os.h
+++ b/lib/librte_eal/windows/eal/include/rte_os.h
@@ -11,4 +11,23 @@
  * Windows OS. Functions will be added in future releases.
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* strdup is deprecated in Microsoft libc and _strdup is preferred */
+#define strdup(str) _strdup(str)
+
+typedef SSIZE_T ssize_t;
+
+#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_OS_H_ */
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v8 04/10] eal: update common headers to use rte_os.h
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 04/10] eal: update common headers to use rte_os.h Anand Rawat
@ 2019-04-02  3:54     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Updated rte_common.h to include rte_os.h to contain
OS specific macros and functions. Updated rte_string_fns.h
to include rte_common.h for rte_os.h

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_eal/common/include/rte_common.h    |  5 ++++-
 .../common/include/rte_string_fns.h           |  4 +++-
 lib/librte_eal/windows/eal/include/rte_os.h   | 19 +++++++++++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index bcf8afd39..3e4768f4a 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -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/windows/eal/include/rte_os.h b/lib/librte_eal/windows/eal/include/rte_os.h
index 421ed8e7f..8da1e235f 100644
--- a/lib/librte_eal/windows/eal/include/rte_os.h
+++ b/lib/librte_eal/windows/eal/include/rte_os.h
@@ -11,4 +11,23 @@
  * Windows OS. Functions will be added in future releases.
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* strdup is deprecated in Microsoft libc and _strdup is preferred */
+#define strdup(str) _strdup(str)
+
+typedef SSIZE_T ssize_t;
+
+#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_OS_H_ */
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v8 05/10] build: add module definition file for windows
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
                     ` (4 preceding siblings ...)
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 04/10] eal: update common headers to use rte_os.h Anand Rawat
@ 2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
  2019-04-02 23:03     ` Thomas Monjalon
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 06/10] eal: sys/queue.h implementation " Anand Rawat
                     ` (5 subsequent siblings)
  11 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Updated lib/meson.build to create shared libraries on Windows.
Added DEF files to list the exports for the eal and kvargs libraries.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_eal/rte_eal_exports.def       |  9 +++++++++
 lib/librte_kvargs/rte_kvargs_exports.def |  7 +++++++
 lib/meson.build                          | 15 ++++++++++++---
 3 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
new file mode 100644
index 000000000..12a6c79d6
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..10e839e00
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..a7b5a9194 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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
@@ -117,14 +117,23 @@ 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 = []
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+				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

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

* [dpdk-dev] [PATCH v8 05/10] build: add module definition file for windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 05/10] build: add module definition file for windows Anand Rawat
@ 2019-04-02  3:54     ` Anand Rawat
  2019-04-02 23:03     ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Updated lib/meson.build to create shared libraries on Windows.
Added DEF files to list the exports for the eal and kvargs libraries.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_eal/rte_eal_exports.def       |  9 +++++++++
 lib/librte_kvargs/rte_kvargs_exports.def |  7 +++++++
 lib/meson.build                          | 15 ++++++++++++---
 3 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def

diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
new file mode 100644
index 000000000..12a6c79d6
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_kvargs/rte_kvargs_exports.def b/lib/librte_kvargs/rte_kvargs_exports.def
new file mode 100644
index 000000000..10e839e00
--- /dev/null
+++ b/lib/librte_kvargs/rte_kvargs_exports.def
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..a7b5a9194 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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
@@ -117,14 +117,23 @@ 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 = []
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+				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


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

* [dpdk-dev] [PATCH v8 06/10] eal: sys/queue.h implementation for windows
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
                     ` (5 preceding siblings ...)
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 05/10] build: add module definition file for windows Anand Rawat
@ 2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 07/10] eal: add headers for compatibility with windows Anand Rawat
                     ` (4 subsequent siblings)
  11 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v8 06/10] eal: sys/queue.h implementation for windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 06/10] eal: sys/queue.h implementation " Anand Rawat
@ 2019-04-02  3:54     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 1 file changed, 320 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h

diff --git a/lib/librte_eal/windows/eal/include/sys/queue.h b/lib/librte_eal/windows/eal/include/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sys/queue.h
@@ -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_ */
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v8 07/10] eal: add headers for compatibility with windows
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
                     ` (6 preceding siblings ...)
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 06/10] eal: sys/queue.h implementation " Anand Rawat
@ 2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows Anand Rawat
                     ` (3 subsequent siblings)
  11 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_eal/windows/eal/include/fnmatch.h | 48 +++++++++++
 lib/librte_eal/windows/eal/include/pthread.h | 27 ++++++
 lib/librte_eal/windows/eal/include/regex.h   | 88 ++++++++++++++++++++
 lib/librte_eal/windows/eal/include/sched.h   | 46 ++++++++++
 lib/librte_eal/windows/eal/include/unistd.h  | 12 +++
 5 files changed, 221 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

diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h
new file mode 100644
index 000000000..41b574312
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/fnmatch.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+/**
+ * This file is required to support the common code in eal_common_log.c
+ * as Microsoft libc does not contain fnmatch.h. This may be removed in
+ * future releases.
+ */
+#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_ */
diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h
new file mode 100644
index 000000000..503329266
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/pthread.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+/**
+ * This file is required to support the common code in eal_common_proc.c,
+ * eal_common_thread.c and common\include\rte_per_lcore.h as Microsoft libc
+ * does not contain pthread.h. This may be removed in future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* defining pthread_t type on Windows since there is no in Microsoft libc*/
+typedef uintptr_t pthread_t;
+
+/* defining pthread_attr_t type on Windows since there is no in Microsoft libc*/
+typedef void *pthread_attr_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PTHREAD_H_ */
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
new file mode 100644
index 000000000..c335120e1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+/**
+ * This file is required to support the common code in eal_common_log.c
+ * as Microsoft libc does not contain regex.h. This may be removed in
+ * future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for Windows */
+typedef void *regex_t;
+/* defining regmatch_t for Windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h
new file mode 100644
index 000000000..257060594
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sched.h
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+/**
+ * This file is added to support the common code in eal_common_thread.c
+ * as Microsoft libc does not contain sched.h. This may be removed
+ * in future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h
new file mode 100644
index 000000000..757b7f3c5
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/unistd.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+/**
+ * This file is added to support common code in eal_common_lcore.c
+ * as Microsoft libc does not contain unistd.h. This may be removed
+ * in future releases.
+ */
+#endif /* _UNISTD_H_ */
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v8 07/10] eal: add headers for compatibility with windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 07/10] eal: add headers for compatibility with windows Anand Rawat
@ 2019-04-02  3:54     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_eal/windows/eal/include/fnmatch.h | 48 +++++++++++
 lib/librte_eal/windows/eal/include/pthread.h | 27 ++++++
 lib/librte_eal/windows/eal/include/regex.h   | 88 ++++++++++++++++++++
 lib/librte_eal/windows/eal/include/sched.h   | 46 ++++++++++
 lib/librte_eal/windows/eal/include/unistd.h  | 12 +++
 5 files changed, 221 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

diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h
new file mode 100644
index 000000000..41b574312
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/fnmatch.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+/**
+ * This file is required to support the common code in eal_common_log.c
+ * as Microsoft libc does not contain fnmatch.h. This may be removed in
+ * future releases.
+ */
+#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_ */
diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h
new file mode 100644
index 000000000..503329266
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/pthread.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+/**
+ * This file is required to support the common code in eal_common_proc.c,
+ * eal_common_thread.c and common\include\rte_per_lcore.h as Microsoft libc
+ * does not contain pthread.h. This may be removed in future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* defining pthread_t type on Windows since there is no in Microsoft libc*/
+typedef uintptr_t pthread_t;
+
+/* defining pthread_attr_t type on Windows since there is no in Microsoft libc*/
+typedef void *pthread_attr_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PTHREAD_H_ */
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
new file mode 100644
index 000000000..c335120e1
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _REGEX_H_
+#define _REGEX_H_
+
+/**
+ * This file is required to support the common code in eal_common_log.c
+ * as Microsoft libc does not contain regex.h. This may be removed in
+ * future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define REG_NOMATCH 1
+#define REG_ESPACE 12
+
+/* defining regex_t for Windows */
+typedef void *regex_t;
+/* defining regmatch_t for Windows */
+typedef void *regmatch_t;
+
+/**
+ * The regcomp() function will compile the regular expression
+ * contained in the string pointed to by the pattern argument
+ * and place the results in the structure pointed to by preg.
+ * The cflags argument is the bitwise inclusive OR of zero or
+ * more of the flags
+ */
+static inline int regcomp(__rte_unused regex_t *preg,
+		__rte_unused const char *regex, __rte_unused int cflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_ESPACE;
+}
+
+/**
+ * The regexec() function compares the null-terminated string
+ * specified by string with the compiled regular expression
+ * preg initialised by a previous call to regcomp(). If it finds
+ * a match, regexec() returns 0; otherwise it returns non-zero
+ * indicating either no match or an error. The eflags argument
+ * is the bitwise inclusive OR of zero or more of the flags.
+ */
+static inline int regexec(__rte_unused const regex_t *preg,
+		__rte_unused const char *string, __rte_unused size_t nmatch,
+		__rte_unused regmatch_t pmatch[], __rte_unused int eflags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return REG_NOMATCH;
+}
+
+/**
+ * The regerror() function provides a mapping from error codes
+ * returned by regcomp() and regexec() to unspecified printable strings.
+ */
+static inline size_t regerror(__rte_unused int errcode,
+		__rte_unused const regex_t *preg, char *errbuf,
+		__rte_unused size_t errbuf_size)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+/**
+ * The regfree() function frees any memory allocated by regcomp()
+ * associated with preg.
+ */
+static inline void regfree(__rte_unused regex_t *preg)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h
new file mode 100644
index 000000000..257060594
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/sched.h
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+/**
+ * This file is added to support the common code in eal_common_thread.c
+ * as Microsoft libc does not contain sched.h. This may be removed
+ * in future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CPU_SET_SIZE
+#define CPU_SET_SIZE RTE_MAX_LCORE
+#endif
+
+#define _BITS_PER_SET (sizeof(long long) * 8)
+#define _BIT_SET_MASK (_BITS_PER_SET - 1)
+
+#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET)
+#define _WHICH_SET(b) ((b) / _BITS_PER_SET)
+#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1))
+
+typedef struct _rte_cpuset_s {
+	long long _bits[_NUM_SETS(CPU_SET_SIZE)];
+} rte_cpuset_t;
+
+#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
+
+#define CPU_ZERO(s)							\
+	do {								\
+		unsigned int _i;					\
+									\
+		for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++)	\
+			(s)->_bits[_i] = 0LL;				\
+	} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SCHED_H_ */
diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h
new file mode 100644
index 000000000..757b7f3c5
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/unistd.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+/**
+ * This file is added to support common code in eal_common_lcore.c
+ * as Microsoft libc does not contain unistd.h. This may be removed
+ * in future releases.
+ */
+#endif /* _UNISTD_H_ */
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
                     ` (7 preceding siblings ...)
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 07/10] eal: add headers for compatibility with windows Anand Rawat
@ 2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
                       ` (2 more replies)
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 09/10] doc: add documentation for windows Anand Rawat
                     ` (2 subsequent siblings)
  11 siblings, 3 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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      | 102 +++++++++++---
 lib/librte_eal/windows/eal/eal_thread.c     | 145 +++++++++++++++++++-
 lib/librte_eal/windows/eal/include/regex.h  |   2 +
 lib/librte_eal/windows/eal/include/rte_os.h |  20 +++
 lib/librte_eal/windows/eal/meson.build      |   2 +
 7 files changed, 331 insertions(+), 30 deletions(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 37ed42233..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index a9705e257..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index e4fcb2615..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <stdint.h>
+
 #include <rte_common.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index f701443c3..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
 #include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
index c335120e1..827f93841 100644
--- a/lib/librte_eal/windows/eal/include/regex.h
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -17,6 +17,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 */
diff --git a/lib/librte_eal/windows/eal/include/rte_os.h b/lib/librte_eal/windows/eal/include/rte_os.h
index 8da1e235f..4946af041 100644
--- a/lib/librte_eal/windows/eal/include/rte_os.h
+++ b/lib/librte_eal/windows/eal/include/rte_os.h
@@ -15,7 +15,9 @@
 extern "C" {
 #endif
 
+#include <Windows.h>
 #include <BaseTsd.h>
+#include <pthread.h>
 
 #define strerror_r(a, b, c) strerror_s(b, c, a)
 
@@ -26,6 +28,24 @@ typedef SSIZE_T ssize_t;
 
 #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
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-04-02  3:54     ` Anand Rawat
  2019-04-02 20:06     ` Thomas Monjalon
  2019-04-02 22:39     ` Thomas Monjalon
  2 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 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      | 102 +++++++++++---
 lib/librte_eal/windows/eal/eal_thread.c     | 145 +++++++++++++++++++-
 lib/librte_eal/windows/eal/include/regex.h  |   2 +
 lib/librte_eal/windows/eal/include/rte_os.h |  20 +++
 lib/librte_eal/windows/eal/meson.build      |   2 +
 7 files changed, 331 insertions(+), 30 deletions(-)

diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 37ed42233..ce460481f 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -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;
 }
diff --git a/lib/librte_eal/windows/eal/eal_debug.c b/lib/librte_eal/windows/eal/eal_debug.c
index a9705e257..edcf257cc 100644
--- a/lib/librte_eal/windows/eal/eal_debug.c
+++ b/lib/librte_eal/windows/eal/eal_debug.c
@@ -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();
 }
diff --git a/lib/librte_eal/windows/eal/eal_lcore.c b/lib/librte_eal/windows/eal/eal_lcore.c
index e4fcb2615..d39f348a3 100644
--- a/lib/librte_eal/windows/eal/eal_lcore.c
+++ b/lib/librte_eal/windows/eal/eal_lcore.c
@@ -2,31 +2,99 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <stdint.h>
+
 #include <rte_common.h>
 
- /* Get the cpu core id value */
-unsigned int
-eal_cpu_core_id(unsigned int lcore_id)
+/* global data structure that contains the CPU map */
+static struct _wcpu_map {
+	unsigned int total_procs;
+	unsigned int proc_sockets;
+	unsigned int proc_cores;
+	unsigned int reserved;
+	struct _win_lcore_map {
+		uint8_t socket_id;
+		uint8_t core_id;
+	} wlcore_map[RTE_MAX_LCORE];
+} wcpu_map = { 0 };
+
+/*
+ * Create a map of all processors and associated cores on the system
+ */
+void
+eal_create_cpu_map()
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return lcore_id;
+	wcpu_map.total_procs =
+		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD lprocInfoSize = 0;
+	BOOL ht_enabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_sockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	wcpu_map.proc_cores = lprocInfoSize / 48;
+
+	if (wcpu_map.total_procs > wcpu_map.proc_cores)
+		ht_enabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets.
+	 */
+	unsigned int lcore = 0;
+	for (unsigned int socket = 0; socket <
+			wcpu_map.proc_sockets; ++socket) {
+		for (unsigned int core = 0;
+			core < (wcpu_map.proc_cores / wcpu_map.proc_sockets);
+			++core) {
+			wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+			wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+			lcore++;
+			if (ht_enabled) {
+				wcpu_map.wlcore_map[lcore]
+					.socket_id = socket;
+				wcpu_map.wlcore_map[lcore]
+					.core_id = core;
+				lcore++;
+			}
+		}
+	}
 }
 
-/* Check if a cpu is present by the presence of the cpu information for it */
+/*
+ * 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)
+eal_cpu_detected(unsigned int lcore_id)
+{
+	return (lcore_id < wcpu_map.total_procs);
+}
+
+/*
+ * Get CPU socket id for a logical core
+ */
+unsigned
+eal_cpu_socket_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 1;
+	return wcpu_map.wlcore_map[lcore_id].socket_id;
 }
 
-/* Get CPU socket id (NUMA node) for a logical core */
-unsigned int
-eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+/*
+ * Get CPU socket id (NUMA node) for a logical core
+ */
+unsigned
+eal_cpu_core_id(unsigned int lcore_id)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
-	return 0;
+	return wcpu_map.wlcore_map[lcore_id].core_id;
 }
diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c
index f701443c3..906502f90 100644
--- a/lib/librte_eal/windows/eal/eal_thread.c
+++ b/lib/librte_eal/windows/eal/eal_thread.c
@@ -2,17 +2,152 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <windows.h>
+#include <io.h>
 
+#include <rte_atomic.h>
+#include <rte_debug.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
 #include <rte_common.h>
+#include <eal_thread.h>
 
-typedef uintptr_t eal_thread_t;
+
+RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
+
+/*
+ * Send a message to a slave lcore identified by slave_id to call a
+ * function f with argument arg. Once the execution is done, the
+ * remote lcore switch in FINISHED state.
+ */
+int
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id)
+{
+	int n;
+	char c = 0;
+	int m2s = lcore_config[slave_id].pipe_master2slave[1];
+	int s2m = lcore_config[slave_id].pipe_slave2master[0];
+
+	if (lcore_config[slave_id].state != WAIT)
+		return -EBUSY;
+
+	lcore_config[slave_id].f = f;
+	lcore_config[slave_id].arg = arg;
+
+	/* send message */
+	n = 0;
+	while (n == 0 || (n < 0 && errno == EINTR))
+		n = _write(m2s, &c, 1);
+	if (n < 0)
+		rte_panic("cannot write on configuration pipe\n");
+
+	/* wait ack */
+	do {
+		n = _read(s2m, &c, 1);
+	} while (n < 0 && errno == EINTR);
+
+	if (n <= 0)
+		rte_panic("cannot read on configuration pipe\n");
+
+	return 0;
+}
+
+void
+eal_thread_init_master(unsigned int lcore_id)
+{
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+}
+
+static inline pthread_t
+eal_thread_self(void)
+{
+	return GetCurrentThreadId();
+}
+
+/* main loop of threads */
+void *
+eal_thread_loop(void *arg __rte_unused)
+{
+	char c;
+	int n, ret;
+	unsigned int lcore_id;
+	pthread_t thread_id;
+	int m2s, s2m;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+
+	thread_id = eal_thread_self();
+
+	/* retrieve our lcore_id from the configuration structure */
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+		if (thread_id == lcore_config[lcore_id].thread_id)
+			break;
+	}
+	if (lcore_id == RTE_MAX_LCORE)
+		rte_panic("cannot retrieve lcore id\n");
+
+	m2s = lcore_config[lcore_id].pipe_master2slave[0];
+	s2m = lcore_config[lcore_id].pipe_slave2master[1];
+
+	/* set the lcore ID in per-lcore memory area */
+	RTE_PER_LCORE(_lcore_id) = lcore_id;
+
+	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s])\n",
+		lcore_id, (uintptr_t)thread_id, cpuset);
+
+	/* read on our pipe to get commands */
+	while (1) {
+		void *fct_arg;
+
+		/* wait command */
+		do {
+			n = _read(m2s, &c, 1);
+		} while (n < 0 && errno == EINTR);
+
+		if (n <= 0)
+			rte_panic("cannot read on configuration pipe\n");
+
+		lcore_config[lcore_id].state = RUNNING;
+
+		/* send ack */
+		n = 0;
+		while (n == 0 || (n < 0 && errno == EINTR))
+			n = _write(s2m, &c, 1);
+		if (n < 0)
+			rte_panic("cannot write on configuration pipe\n");
+
+		if (lcore_config[lcore_id].f == NULL)
+			rte_panic("NULL function pointer\n");
+
+		/* call the function and store the return value */
+		fct_arg = lcore_config[lcore_id].arg;
+		ret = lcore_config[lcore_id].f(fct_arg);
+		lcore_config[lcore_id].ret = ret;
+		rte_wmb();
+
+		/* when a service core returns, it should go directly to WAIT
+		 * state, because the application will not lcore_wait() for it.
+		 */
+		if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+			lcore_config[lcore_id].state = WAIT;
+		else
+			lcore_config[lcore_id].state = FINISHED;
+	}
+}
 
 /* function to create threads */
 int
-eal_thread_create(eal_thread_t *thread __rte_unused)
+eal_thread_create(pthread_t *thread)
 {
-	/* TODO */
-	/* This is a stub, not the expected result */
+	HANDLE th;
+
+	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+						NULL, 0, (LPDWORD)thread);
+	if (!th)
+		return -1;
+
+	SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+	SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
+
 	return 0;
 }
diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h
index c335120e1..827f93841 100644
--- a/lib/librte_eal/windows/eal/include/regex.h
+++ b/lib/librte_eal/windows/eal/include/regex.h
@@ -17,6 +17,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 */
diff --git a/lib/librte_eal/windows/eal/include/rte_os.h b/lib/librte_eal/windows/eal/include/rte_os.h
index 8da1e235f..4946af041 100644
--- a/lib/librte_eal/windows/eal/include/rte_os.h
+++ b/lib/librte_eal/windows/eal/include/rte_os.h
@@ -15,7 +15,9 @@
 extern "C" {
 #endif
 
+#include <Windows.h>
 #include <BaseTsd.h>
+#include <pthread.h>
 
 #define strerror_r(a, b, c) strerror_s(b, c, a)
 
@@ -26,6 +28,24 @@ typedef SSIZE_T ssize_t;
 
 #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
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -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',
-- 
2.17.1.windows.2


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

* [dpdk-dev] [PATCH v8 09/10] doc: add documentation for windows
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
                     ` (8 preceding siblings ...)
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 10/10] build: meson changes to build on windows Anand Rawat
  2019-04-02 23:25   ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Thomas Monjalon
  11 siblings, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Added documentation to build helloworld example
on windows using meson and clang.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 MAINTAINERS                           |  1 +
 doc/guides/index.rst                  |  3 +-
 doc/guides/windows_gsg/build_dpdk.rst | 81 +++++++++++++++++++++++++++
 doc/guides/windows_gsg/index.rst      | 14 +++++
 doc/guides/windows_gsg/intro.rst      | 20 +++++++
 5 files changed, 118 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 5d70fba9b..5273639f4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -289,6 +289,7 @@ M: Omar Cardona <ocardona@microsoft.com>
 M: Anand Rawat <anand.rawat@intel.com>
 M: Ranjit Menon <ranjit.menon@intel.com>
 F: lib/librte_eal/windows/
+F: doc/guides/windows_gsg/
 
 
 Core Libraries
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..f48805236
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,81 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM C compiler
+and Microsoft MSVC linker.
+The Meson Build system is used to prepare the sources for compilation
+with the Ninja backend.
+The installation of these tools is covered in this section.
+
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from
+`LLVM website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the
+files on windows,
+from `Microsoft website <https://visualstudio.microsoft.com/downloads>`_.
+When installing build tools, select the "Visual C++ build tools" option
+and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from
+`Meson website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from
+`Ninja website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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

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

* [dpdk-dev] [PATCH v8 09/10] doc: add documentation for windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 09/10] doc: add documentation for windows Anand Rawat
@ 2019-04-02  3:54     ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

Added documentation to build helloworld example
on windows using meson and clang.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 MAINTAINERS                           |  1 +
 doc/guides/index.rst                  |  3 +-
 doc/guides/windows_gsg/build_dpdk.rst | 81 +++++++++++++++++++++++++++
 doc/guides/windows_gsg/index.rst      | 14 +++++
 doc/guides/windows_gsg/intro.rst      | 20 +++++++
 5 files changed, 118 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 5d70fba9b..5273639f4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -289,6 +289,7 @@ M: Omar Cardona <ocardona@microsoft.com>
 M: Anand Rawat <anand.rawat@intel.com>
 M: Ranjit Menon <ranjit.menon@intel.com>
 F: lib/librte_eal/windows/
+F: doc/guides/windows_gsg/
 
 
 Core Libraries
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..8a1601b27 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst
new file mode 100644
index 000000000..f48805236
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,81 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+Compiling the DPDK Target from Source
+=====================================
+
+System Requirements
+-------------------
+
+The DPDK and its applications require the Clang-LLVM C compiler
+and Microsoft MSVC linker.
+The Meson Build system is used to prepare the sources for compilation
+with the Ninja backend.
+The installation of these tools is covered in this section.
+
+
+Install the Compiler
+--------------------
+
+Download and install the clang compiler from
+`LLVM website <http://releases.llvm.org/download.html>`_.
+For example, Clang-LLVM direct download link::
+
+	http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe
+
+
+Install the Linker
+------------------
+
+Download and install the Build Tools for Visual Studio to link and build the
+files on windows,
+from `Microsoft website <https://visualstudio.microsoft.com/downloads>`_.
+When installing build tools, select the "Visual C++ build tools" option
+and ensure the Windows SDK is selected.
+
+
+Install the Build System
+------------------------
+
+Download and install the build system from
+`Meson website <http://mesonbuild.com/Getting-meson.html>`_.
+A good option to choose is the MSI installer for both meson and ninja together::
+
+	http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from
+`Ninja website <https://ninja-build.org/>`_ or
+install along with the meson build system.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the ninja backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build
+    cd build
+    ninja
+
+Run the helloworld example
+==========================
+
+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
diff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst
new file mode 100644
index 000000000..d9b7990a8
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -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
diff --git a/doc/guides/windows_gsg/intro.rst b/doc/guides/windows_gsg/intro.rst
new file mode 100644
index 000000000..a0285732d
--- /dev/null
+++ b/doc/guides/windows_gsg/intro.rst
@@ -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


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

* [dpdk-dev] [PATCH v8 10/10] build: meson changes to build on windows
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
                     ` (9 preceding siblings ...)
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 09/10] doc: add documentation for windows Anand Rawat
@ 2019-04-02  3:54   ` Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
  2019-04-02 22:51     ` Thomas Monjalon
  2019-04-02 23:25   ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Thomas Monjalon
  11 siblings, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 app/meson.build                        | 6 +++++-
 buildtools/meson.build                 | 6 +++++-
 drivers/meson.build                    | 6 +++++-
 examples/meson.build                   | 6 ++++--
 lib/librte_eal/windows/eal/meson.build | 6 ++++++
 lib/meson.build                        | 4 ++++
 6 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/app/meson.build b/app/meson.build
index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build
index 8c76a5659..7520a16e3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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.
 dpdk_driver_classes = ['common',
diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..3bf1c2db8 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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,9 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() == 'windows'
+		deps = ['eal'] # only supported lib on Windows currently
+	endif
 	subdir(example)
 
 	if build
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 6bc577e5c..e9b7138c5 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -5,6 +5,12 @@ eal_inc += include_directories('include')
 
 env_objs = []
 env_headers = []
+common_sources = files(
+	'../../common/eal_common_errno.c',
+	'../../common/eal_common_launch.c',
+	'../../common/eal_common_lcore.c',
+	'../../common/eal_common_log.c'
+)
 env_sources = files('eal.c',
 	'eal_debug.c',
 	'eal_lcore.c',
diff --git a/lib/meson.build b/lib/meson.build
index a7b5a9194..c3289f885 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'] # only supported 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

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

* [dpdk-dev] [PATCH v8 10/10] build: meson changes to build on windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 10/10] build: meson changes to build on windows Anand Rawat
@ 2019-04-02  3:54     ` Anand Rawat
  2019-04-02 22:51     ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02  3:54 UTC (permalink / raw)
  To: dev
  Cc: anand.rawat, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, thomas

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.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 app/meson.build                        | 6 +++++-
 buildtools/meson.build                 | 6 +++++-
 drivers/meson.build                    | 6 +++++-
 examples/meson.build                   | 6 ++++--
 lib/librte_eal/windows/eal/meson.build | 6 ++++++
 lib/meson.build                        | 4 ++++
 6 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/app/meson.build b/app/meson.build
index aa353f657..e949624b7 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -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',
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24..0209bec8f 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
 
diff --git a/drivers/meson.build b/drivers/meson.build
index 8c76a5659..7520a16e3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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.
 dpdk_driver_classes = ['common',
diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..3bf1c2db8 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -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,9 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() == 'windows'
+		deps = ['eal'] # only supported lib on Windows currently
+	endif
 	subdir(example)
 
 	if build
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 6bc577e5c..e9b7138c5 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -5,6 +5,12 @@ eal_inc += include_directories('include')
 
 env_objs = []
 env_headers = []
+common_sources = files(
+	'../../common/eal_common_errno.c',
+	'../../common/eal_common_launch.c',
+	'../../common/eal_common_lcore.c',
+	'../../common/eal_common_log.c'
+)
 env_sources = files('eal.c',
 	'eal_debug.c',
 	'eal_lcore.c',
diff --git a/lib/meson.build b/lib/meson.build
index a7b5a9194..c3289f885 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'] # only supported 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


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

* Re: [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows
  2019-04-02  1:01       ` Pallavi Kadam
  2019-04-02  1:01         ` Pallavi Kadam
@ 2019-04-02  7:15         ` Thomas Monjalon
  2019-04-02  7:15           ` Thomas Monjalon
  1 sibling, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02  7:15 UTC (permalink / raw)
  To: Pallavi Kadam
  Cc: Anand Rawat, dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson,
	harini.ramakrishnan

02/04/2019 03:01, Pallavi Kadam:
> 
> On 4/1/2019 4:22 PM, Thomas Monjalon wrote:
> > 29/03/2019 00:24, Anand Rawat:
> >> +The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
> >> +The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
> >> +
> >> +\*Other names and brands may be claimed as the property of others.
> > This sentence looks weird. What does it mean?
> 
> Thought of adding asterisk in front of names and brands
> 
> those are claimed from other websites/ organizations
> 
> for instance, MSFT, LLVM.
> 
> Can be removed, if not required.
> 
> >
> > [...]
> >> +Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
> > Why is there an asterisk after LLVM?
> 
> As the link has been copied from LLVM website (other property).
> 
> Can be removed, if not required.

Usually, we do not consider such "legal text". It looks weird.

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

* Re: [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows
  2019-04-02  7:15         ` Thomas Monjalon
@ 2019-04-02  7:15           ` Thomas Monjalon
  0 siblings, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02  7:15 UTC (permalink / raw)
  To: Pallavi Kadam
  Cc: Anand Rawat, dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson,
	harini.ramakrishnan

02/04/2019 03:01, Pallavi Kadam:
> 
> On 4/1/2019 4:22 PM, Thomas Monjalon wrote:
> > 29/03/2019 00:24, Anand Rawat:
> >> +The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
> >> +The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
> >> +
> >> +\*Other names and brands may be claimed as the property of others.
> > This sentence looks weird. What does it mean?
> 
> Thought of adding asterisk in front of names and brands
> 
> those are claimed from other websites/ organizations
> 
> for instance, MSFT, LLVM.
> 
> Can be removed, if not required.
> 
> >
> > [...]
> >> +Download and install the clang compiler from `LLVM* website <http://releases.llvm.org/download.html>`_.
> > Why is there an asterisk after LLVM?
> 
> As the link has been copied from LLVM website (other property).
> 
> Can be removed, if not required.

Usually, we do not consider such "legal text". It looks weird.




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

* Re: [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
@ 2019-04-02 19:56     ` Thomas Monjalon
  2019-04-02 19:56       ` Thomas Monjalon
  2019-04-02 20:47       ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 19:56 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 05:54, Anand Rawat:
> Added rte_os.h files to support OS specific functionality.
> Updated build system to contain OS headers in the include
> path.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> ---
> --- a/meson.build
> +++ b/meson.build
> -global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
> +global_inc = include_directories('.', 'config',
> +						'lib/librte_eal/common/include',
> +						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))

After having worked on rte_kni_common.h which is only in Linux,
I think we should add rte_os.h in meson file of each OS:
	- lib/librte_eal/linux/eal/meson.build
	- lib/librte_eal/freebsd/eal/meson.build
	- lib/librte_eal/windows/eal/meson.build

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

* Re: [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02 19:56     ` Thomas Monjalon
@ 2019-04-02 19:56       ` Thomas Monjalon
  2019-04-02 20:47       ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 19:56 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 05:54, Anand Rawat:
> Added rte_os.h files to support OS specific functionality.
> Updated build system to contain OS headers in the include
> path.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> ---
> --- a/meson.build
> +++ b/meson.build
> -global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
> +global_inc = include_directories('.', 'config',
> +						'lib/librte_eal/common/include',
> +						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))

After having worked on rte_kni_common.h which is only in Linux,
I think we should add rte_os.h in meson file of each OS:
	- lib/librte_eal/linux/eal/meson.build
	- lib/librte_eal/freebsd/eal/meson.build
	- lib/librte_eal/windows/eal/meson.build



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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
@ 2019-04-02 20:06     ` Thomas Monjalon
  2019-04-02 20:06       ` Thomas Monjalon
  2019-04-02 21:21       ` Pallavi Kadam
  2019-04-02 22:39     ` Thomas Monjalon
  2 siblings, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 20:06 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 05:54, 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.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
[...]
> +		/*
> +		 * 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");

rte_panic should be used only in applications, not in libraries.
The application can do something in case of DPDK failure.
Please remove all calls to rte_panic() during next weeks, thanks.

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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02 20:06     ` Thomas Monjalon
@ 2019-04-02 20:06       ` Thomas Monjalon
  2019-04-02 21:21       ` Pallavi Kadam
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 20:06 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 05:54, 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.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
[...]
> +		/*
> +		 * 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");

rte_panic should be used only in applications, not in libraries.
The application can do something in case of DPDK failure.
Please remove all calls to rte_panic() during next weeks, thanks.



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

* Re: [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02 19:56     ` Thomas Monjalon
  2019-04-02 19:56       ` Thomas Monjalon
@ 2019-04-02 20:47       ` Thomas Monjalon
  2019-04-02 20:47         ` Thomas Monjalon
  2019-04-02 22:11         ` Anand Rawat
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 20:47 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 21:56, Thomas Monjalon:
> 02/04/2019 05:54, Anand Rawat:
> > Added rte_os.h files to support OS specific functionality.
> > Updated build system to contain OS headers in the include
> > path.
> > 
> > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > ---
> > --- a/meson.build
> > +++ b/meson.build
> > -global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
> > +global_inc = include_directories('.', 'config',
> > +						'lib/librte_eal/common/include',
> > +						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))
> 
> After having worked on rte_kni_common.h which is only in Linux,
> I think we should add rte_os.h in meson file of each OS:
> 	- lib/librte_eal/linux/eal/meson.build
> 	- lib/librte_eal/freebsd/eal/meson.build
> 	- lib/librte_eal/windows/eal/meson.build

I confirm:
"global_inc" is used in "includes" variable but not in "headers" variable,
so rte_os.h is not installed as other files in "headers".
We must fill "env_headers" which is pulled by:
	headers = common_headers + env_headers

I will fix it before merging in master if you agree.

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

* Re: [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02 20:47       ` Thomas Monjalon
@ 2019-04-02 20:47         ` Thomas Monjalon
  2019-04-02 22:11         ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 20:47 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 21:56, Thomas Monjalon:
> 02/04/2019 05:54, Anand Rawat:
> > Added rte_os.h files to support OS specific functionality.
> > Updated build system to contain OS headers in the include
> > path.
> > 
> > Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > ---
> > --- a/meson.build
> > +++ b/meson.build
> > -global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
> > +global_inc = include_directories('.', 'config',
> > +						'lib/librte_eal/common/include',
> > +						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))
> 
> After having worked on rte_kni_common.h which is only in Linux,
> I think we should add rte_os.h in meson file of each OS:
> 	- lib/librte_eal/linux/eal/meson.build
> 	- lib/librte_eal/freebsd/eal/meson.build
> 	- lib/librte_eal/windows/eal/meson.build

I confirm:
"global_inc" is used in "includes" variable but not in "headers" variable,
so rte_os.h is not installed as other files in "headers".
We must fill "env_headers" which is pulled by:
	headers = common_headers + env_headers

I will fix it before merging in master if you agree.



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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02 20:06     ` Thomas Monjalon
  2019-04-02 20:06       ` Thomas Monjalon
@ 2019-04-02 21:21       ` Pallavi Kadam
  2019-04-02 21:21         ` Pallavi Kadam
  2019-04-02 21:38         ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Pallavi Kadam @ 2019-04-02 21:21 UTC (permalink / raw)
  To: Thomas Monjalon, Anand Rawat
  Cc: dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson


On 4/2/2019 1:06 PM, Thomas Monjalon wrote:
> 02/04/2019 05:54, 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.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
> [...]
>> +		/*
>> +		 * 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");
> rte_panic should be used only in applications, not in libraries.
> The application can do something in case of DPDK failure.
> Please remove all calls to rte_panic() during next weeks, thanks.

Ok, will try to incorporate in v9. Just curious, is this the major issue?

Calls to rte_panic() can be seen in linux/eal and freebsd/eal.

>
>

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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02 21:21       ` Pallavi Kadam
@ 2019-04-02 21:21         ` Pallavi Kadam
  2019-04-02 21:38         ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Pallavi Kadam @ 2019-04-02 21:21 UTC (permalink / raw)
  To: Thomas Monjalon, Anand Rawat
  Cc: dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson


On 4/2/2019 1:06 PM, Thomas Monjalon wrote:
> 02/04/2019 05:54, 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.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
> [...]
>> +		/*
>> +		 * 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");
> rte_panic should be used only in applications, not in libraries.
> The application can do something in case of DPDK failure.
> Please remove all calls to rte_panic() during next weeks, thanks.

Ok, will try to incorporate in v9. Just curious, is this the major issue?

Calls to rte_panic() can be seen in linux/eal and freebsd/eal.

>
>

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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02 21:21       ` Pallavi Kadam
  2019-04-02 21:21         ` Pallavi Kadam
@ 2019-04-02 21:38         ` Thomas Monjalon
  2019-04-02 21:38           ` Thomas Monjalon
  2019-04-02 21:46           ` Pallavi Kadam
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 21:38 UTC (permalink / raw)
  To: Pallavi Kadam
  Cc: Anand Rawat, dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 23:21, Pallavi Kadam:
> 
> On 4/2/2019 1:06 PM, Thomas Monjalon wrote:
> > 02/04/2019 05:54, 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.
> >>
> >> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> >> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> >> ---
> > [...]
> >> +		/*
> >> +		 * 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");
> > rte_panic should be used only in applications, not in libraries.
> > The application can do something in case of DPDK failure.
> > Please remove all calls to rte_panic() during next weeks, thanks.
> 
> Ok, will try to incorporate in v9. Just curious, is this the major issue?
> 
> Calls to rte_panic() can be seen in linux/eal and freebsd/eal.

No, there is a misunderstanding.
I am merging v8 and I am asking for a new patch to remove these calls.

By the way, I am fixing patch 3, please check my comment on this patch.

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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02 21:38         ` Thomas Monjalon
@ 2019-04-02 21:38           ` Thomas Monjalon
  2019-04-02 21:46           ` Pallavi Kadam
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 21:38 UTC (permalink / raw)
  To: Pallavi Kadam
  Cc: Anand Rawat, dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 23:21, Pallavi Kadam:
> 
> On 4/2/2019 1:06 PM, Thomas Monjalon wrote:
> > 02/04/2019 05:54, 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.
> >>
> >> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> >> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> >> ---
> > [...]
> >> +		/*
> >> +		 * 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");
> > rte_panic should be used only in applications, not in libraries.
> > The application can do something in case of DPDK failure.
> > Please remove all calls to rte_panic() during next weeks, thanks.
> 
> Ok, will try to incorporate in v9. Just curious, is this the major issue?
> 
> Calls to rte_panic() can be seen in linux/eal and freebsd/eal.

No, there is a misunderstanding.
I am merging v8 and I am asking for a new patch to remove these calls.

By the way, I am fixing patch 3, please check my comment on this patch.




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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02 21:38         ` Thomas Monjalon
  2019-04-02 21:38           ` Thomas Monjalon
@ 2019-04-02 21:46           ` Pallavi Kadam
  2019-04-02 21:46             ` Pallavi Kadam
  1 sibling, 1 reply; 327+ messages in thread
From: Pallavi Kadam @ 2019-04-02 21:46 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Anand Rawat, dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson


On 4/2/2019 2:38 PM, Thomas Monjalon wrote:
> 02/04/2019 23:21, Pallavi Kadam:
>> On 4/2/2019 1:06 PM, Thomas Monjalon wrote:
>>> 02/04/2019 05:54, 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.
>>>>
>>>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>>>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>>>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>>>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>>>> ---
>>> [...]
>>>> +		/*
>>>> +		 * 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");
>>> rte_panic should be used only in applications, not in libraries.
>>> The application can do something in case of DPDK failure.
>>> Please remove all calls to rte_panic() during next weeks, thanks.
>> Ok, will try to incorporate in v9. Just curious, is this the major issue?
>>
>> Calls to rte_panic() can be seen in linux/eal and freebsd/eal.
> No, there is a misunderstanding.
> I am merging v8 and I am asking for a new patch to remove these calls.
>
> By the way, I am fixing patch 3, please check my comment on this patch.
Got it. Thanks.
>
>
>

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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02 21:46           ` Pallavi Kadam
@ 2019-04-02 21:46             ` Pallavi Kadam
  0 siblings, 0 replies; 327+ messages in thread
From: Pallavi Kadam @ 2019-04-02 21:46 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Anand Rawat, dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson


On 4/2/2019 2:38 PM, Thomas Monjalon wrote:
> 02/04/2019 23:21, Pallavi Kadam:
>> On 4/2/2019 1:06 PM, Thomas Monjalon wrote:
>>> 02/04/2019 05:54, 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.
>>>>
>>>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>>>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>>>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>>>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>>>> ---
>>> [...]
>>>> +		/*
>>>> +		 * 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");
>>> rte_panic should be used only in applications, not in libraries.
>>> The application can do something in case of DPDK failure.
>>> Please remove all calls to rte_panic() during next weeks, thanks.
>> Ok, will try to incorporate in v9. Just curious, is this the major issue?
>>
>> Calls to rte_panic() can be seen in linux/eal and freebsd/eal.
> No, there is a misunderstanding.
> I am merging v8 and I am asking for a new patch to remove these calls.
>
> By the way, I am fixing patch 3, please check my comment on this patch.
Got it. Thanks.
>
>
>

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

* Re: [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02 20:47       ` Thomas Monjalon
  2019-04-02 20:47         ` Thomas Monjalon
@ 2019-04-02 22:11         ` Anand Rawat
  2019-04-02 22:11           ` Anand Rawat
  2019-04-02 22:32           ` Thomas Monjalon
  1 sibling, 2 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02 22:11 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On 4/2/2019 1:47 PM, Thomas Monjalon wrote:
> 02/04/2019 21:56, Thomas Monjalon:
>> 02/04/2019 05:54, Anand Rawat:
>>> Added rte_os.h files to support OS specific functionality.
>>> Updated build system to contain OS headers in the include
>>> path.
>>>
>>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>>> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
>>> ---
>>> --- a/meson.build
>>> +++ b/meson.build
>>> -global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
>>> +global_inc = include_directories('.', 'config',
>>> +						'lib/librte_eal/common/include',
>>> +						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))
>>
>> After having worked on rte_kni_common.h which is only in Linux,
>> I think we should add rte_os.h in meson file of each OS:
>> 	- lib/librte_eal/linux/eal/meson.build
>> 	- lib/librte_eal/freebsd/eal/meson.build
>> 	- lib/librte_eal/windows/eal/meson.build
> 
> I confirm:
> "global_inc" is used in "includes" variable but not in "headers" variable,
> so rte_os.h is not installed as other files in "headers".
> We must fill "env_headers" which is pulled by:
> 	headers = common_headers + env_headers
> 
> I will fix it before merging in master if you agree.
> 
> 
Agreed, env_headers need to be updated for rte_os.h.
I have tested the same and will incorporating the changes in v9.
Please update this patch with your fix.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02 22:11         ` Anand Rawat
@ 2019-04-02 22:11           ` Anand Rawat
  2019-04-02 22:32           ` Thomas Monjalon
  1 sibling, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02 22:11 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On 4/2/2019 1:47 PM, Thomas Monjalon wrote:
> 02/04/2019 21:56, Thomas Monjalon:
>> 02/04/2019 05:54, Anand Rawat:
>>> Added rte_os.h files to support OS specific functionality.
>>> Updated build system to contain OS headers in the include
>>> path.
>>>
>>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>>> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
>>> ---
>>> --- a/meson.build
>>> +++ b/meson.build
>>> -global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
>>> +global_inc = include_directories('.', 'config',
>>> +						'lib/librte_eal/common/include',
>>> +						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))
>>
>> After having worked on rte_kni_common.h which is only in Linux,
>> I think we should add rte_os.h in meson file of each OS:
>> 	- lib/librte_eal/linux/eal/meson.build
>> 	- lib/librte_eal/freebsd/eal/meson.build
>> 	- lib/librte_eal/windows/eal/meson.build
> 
> I confirm:
> "global_inc" is used in "includes" variable but not in "headers" variable,
> so rte_os.h is not installed as other files in "headers".
> We must fill "env_headers" which is pulled by:
> 	headers = common_headers + env_headers
> 
> I will fix it before merging in master if you agree.
> 
> 
Agreed, env_headers need to be updated for rte_os.h.
I have tested the same and will incorporating the changes in v9.
Please update this patch with your fix.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02 22:11         ` Anand Rawat
  2019-04-02 22:11           ` Anand Rawat
@ 2019-04-02 22:32           ` Thomas Monjalon
  2019-04-02 22:32             ` Thomas Monjalon
  2019-04-02 22:34             ` Anand Rawat
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 22:32 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

03/04/2019 00:11, Anand Rawat:
> On 4/2/2019 1:47 PM, Thomas Monjalon wrote:
> > 02/04/2019 21:56, Thomas Monjalon:
> >> 02/04/2019 05:54, Anand Rawat:
> >>> Added rte_os.h files to support OS specific functionality.
> >>> Updated build system to contain OS headers in the include
> >>> path.
> >>>
> >>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >>> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >>> ---
> >>> --- a/meson.build
> >>> +++ b/meson.build
> >>> -global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
> >>> +global_inc = include_directories('.', 'config',
> >>> +						'lib/librte_eal/common/include',
> >>> +						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))
> >>
> >> After having worked on rte_kni_common.h which is only in Linux,
> >> I think we should add rte_os.h in meson file of each OS:
> >> 	- lib/librte_eal/linux/eal/meson.build
> >> 	- lib/librte_eal/freebsd/eal/meson.build
> >> 	- lib/librte_eal/windows/eal/meson.build
> > 
> > I confirm:
> > "global_inc" is used in "includes" variable but not in "headers" variable,
> > so rte_os.h is not installed as other files in "headers".
> > We must fill "env_headers" which is pulled by:
> > 	headers = common_headers + env_headers
> > 
> > I will fix it before merging in master if you agree.
> > 
> Agreed, env_headers need to be updated for rte_os.h.
> I have tested the same and will incorporating the changes in v9.
> Please update this patch with your fix.

No need for a v9. Once it will be in master, new changes must be
submitted in a separate patch.

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

* Re: [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02 22:32           ` Thomas Monjalon
@ 2019-04-02 22:32             ` Thomas Monjalon
  2019-04-02 22:34             ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 22:32 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

03/04/2019 00:11, Anand Rawat:
> On 4/2/2019 1:47 PM, Thomas Monjalon wrote:
> > 02/04/2019 21:56, Thomas Monjalon:
> >> 02/04/2019 05:54, Anand Rawat:
> >>> Added rte_os.h files to support OS specific functionality.
> >>> Updated build system to contain OS headers in the include
> >>> path.
> >>>
> >>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >>> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >>> ---
> >>> --- a/meson.build
> >>> +++ b/meson.build
> >>> -global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
> >>> +global_inc = include_directories('.', 'config',
> >>> +						'lib/librte_eal/common/include',
> >>> +						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))
> >>
> >> After having worked on rte_kni_common.h which is only in Linux,
> >> I think we should add rte_os.h in meson file of each OS:
> >> 	- lib/librte_eal/linux/eal/meson.build
> >> 	- lib/librte_eal/freebsd/eal/meson.build
> >> 	- lib/librte_eal/windows/eal/meson.build
> > 
> > I confirm:
> > "global_inc" is used in "includes" variable but not in "headers" variable,
> > so rte_os.h is not installed as other files in "headers".
> > We must fill "env_headers" which is pulled by:
> > 	headers = common_headers + env_headers
> > 
> > I will fix it before merging in master if you agree.
> > 
> Agreed, env_headers need to be updated for rte_os.h.
> I have tested the same and will incorporating the changes in v9.
> Please update this patch with your fix.

No need for a v9. Once it will be in master, new changes must be
submitted in a separate patch.




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

* Re: [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02 22:32           ` Thomas Monjalon
  2019-04-02 22:32             ` Thomas Monjalon
@ 2019-04-02 22:34             ` Anand Rawat
  2019-04-02 22:34               ` Anand Rawat
  1 sibling, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-04-02 22:34 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On 4/2/2019 3:32 PM, Thomas Monjalon wrote:
> 03/04/2019 00:11, Anand Rawat:
> > On 4/2/2019 1:47 PM, Thomas Monjalon wrote:
> >> 02/04/2019 21:56, Thomas Monjalon:
> >>> 02/04/2019 05:54, Anand Rawat:
> >>>> Added rte_os.h files to support OS specific functionality.
> >>>> Updated build system to contain OS headers in the include
> >>>> path.
> >>>>
> >>>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >>>> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >>>> ---
> >>>> --- a/meson.build
> >>>> +++ b/meson.build
> >>>> -global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
> >>>> +global_inc = include_directories('.', 'config',
> >>>> +                        'lib/librte_eal/common/include',
> >>>> +                        'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))
> >>>
> >>> After having worked on rte_kni_common.h which is only in Linux,
> >>> I think we should add rte_os.h in meson file of each OS:
> >>>     - lib/librte_eal/linux/eal/meson.build
> >>>     - lib/librte_eal/freebsd/eal/meson.build
> >>>     - lib/librte_eal/windows/eal/meson.build
> >>
> >> I confirm:
> >> "global_inc" is used in "includes" variable but not in "headers" variable,
> >> so rte_os.h is not installed as other files in "headers".
> >> We must fill "env_headers" which is pulled by:
> >>     headers = common_headers + env_headers
> >>
> >> I will fix it before merging in master if you agree.
> >>
> > Agreed, env_headers need to be updated for rte_os.h.
> > I have tested the same and will incorporating the changes in v9.
> > Please update this patch with your fix.
>
> No need for a v9. Once it will be in master, new changes must be
> submitted in a separate patch.
>
>
>

Understood. Thanks :)

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system
  2019-04-02 22:34             ` Anand Rawat
@ 2019-04-02 22:34               ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02 22:34 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On 4/2/2019 3:32 PM, Thomas Monjalon wrote:
> 03/04/2019 00:11, Anand Rawat:
> > On 4/2/2019 1:47 PM, Thomas Monjalon wrote:
> >> 02/04/2019 21:56, Thomas Monjalon:
> >>> 02/04/2019 05:54, Anand Rawat:
> >>>> Added rte_os.h files to support OS specific functionality.
> >>>> Updated build system to contain OS headers in the include
> >>>> path.
> >>>>
> >>>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >>>> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >>>> ---
> >>>> --- a/meson.build
> >>>> +++ b/meson.build
> >>>> -global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
> >>>> +global_inc = include_directories('.', 'config',
> >>>> +                        'lib/librte_eal/common/include',
> >>>> +                        'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))
> >>>
> >>> After having worked on rte_kni_common.h which is only in Linux,
> >>> I think we should add rte_os.h in meson file of each OS:
> >>>     - lib/librte_eal/linux/eal/meson.build
> >>>     - lib/librte_eal/freebsd/eal/meson.build
> >>>     - lib/librte_eal/windows/eal/meson.build
> >>
> >> I confirm:
> >> "global_inc" is used in "includes" variable but not in "headers" variable,
> >> so rte_os.h is not installed as other files in "headers".
> >> We must fill "env_headers" which is pulled by:
> >>     headers = common_headers + env_headers
> >>
> >> I will fix it before merging in master if you agree.
> >>
> > Agreed, env_headers need to be updated for rte_os.h.
> > I have tested the same and will incorporating the changes in v9.
> > Please update this patch with your fix.
>
> No need for a v9. Once it will be in master, new changes must be
> submitted in a separate patch.
>
>
>

Understood. Thanks :)

-- 
Anand Rawat


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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
  2019-04-02 20:06     ` Thomas Monjalon
@ 2019-04-02 22:39     ` Thomas Monjalon
  2019-04-02 22:39       ` Thomas Monjalon
  2019-04-02 22:57       ` Anand Rawat
  2 siblings, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 22:39 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, david.marchand

I think the change below is bad because it is exposing an internal
function in a header file which may be included by apps.
I know you are still looking for pthread integration solutions,
so we can discuss how to fix it later.

Note that there is already an EAL function to create normal threads:
	rte_ctrl_thread_create()
You may want a similar function for dataplane threads perhaps.


02/04/2019 05:54, Anand Rawat:
> --- a/lib/librte_eal/windows/eal/include/rte_os.h
> +++ b/lib/librte_eal/windows/eal/include/rte_os.h
> @@ -15,7 +15,9 @@
>  extern "C" {
>  #endif
>  
> +#include <Windows.h>
>  #include <BaseTsd.h>
> +#include <pthread.h>
>  
>  #define strerror_r(a, b, c) strerror_s(b, c, a)
>  
> @@ -26,6 +28,24 @@ typedef SSIZE_T ssize_t;
>  
>  #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);

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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02 22:39     ` Thomas Monjalon
@ 2019-04-02 22:39       ` Thomas Monjalon
  2019-04-02 22:57       ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 22:39 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, david.marchand

I think the change below is bad because it is exposing an internal
function in a header file which may be included by apps.
I know you are still looking for pthread integration solutions,
so we can discuss how to fix it later.

Note that there is already an EAL function to create normal threads:
	rte_ctrl_thread_create()
You may want a similar function for dataplane threads perhaps.


02/04/2019 05:54, Anand Rawat:
> --- a/lib/librte_eal/windows/eal/include/rte_os.h
> +++ b/lib/librte_eal/windows/eal/include/rte_os.h
> @@ -15,7 +15,9 @@
>  extern "C" {
>  #endif
>  
> +#include <Windows.h>
>  #include <BaseTsd.h>
> +#include <pthread.h>
>  
>  #define strerror_r(a, b, c) strerror_s(b, c, a)
>  
> @@ -26,6 +28,24 @@ typedef SSIZE_T ssize_t;
>  
>  #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);




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

* Re: [dpdk-dev] [PATCH v8 10/10] build: meson changes to build on windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 10/10] build: meson changes to build on windows Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
@ 2019-04-02 22:51     ` Thomas Monjalon
  2019-04-02 22:51       ` Thomas Monjalon
  2019-04-02 23:01       ` Anand Rawat
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 22:51 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 05:54, 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.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
> --- a/examples/meson.build
> +++ b/examples/meson.build
> @@ -35,7 +35,9 @@ foreach example: examples
>  
>  	ext_deps = [execinfo]
>  	includes = [include_directories(example)]
> -	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
> +	if host_machine.system() == 'windows'
> +		deps = ['eal'] # only supported lib on Windows currently
> +	endif
>  	subdir(example)

This is not what I call keeping build intact for Linux/BSD :)

I did not catch it before because test-meson-builds.sh is not testing
compilation of the examples with meson. Bruce, may we add it?

I will add back the original deps line in master branch.

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

* Re: [dpdk-dev] [PATCH v8 10/10] build: meson changes to build on windows
  2019-04-02 22:51     ` Thomas Monjalon
@ 2019-04-02 22:51       ` Thomas Monjalon
  2019-04-02 23:01       ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 22:51 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 05:54, 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.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
> --- a/examples/meson.build
> +++ b/examples/meson.build
> @@ -35,7 +35,9 @@ foreach example: examples
>  
>  	ext_deps = [execinfo]
>  	includes = [include_directories(example)]
> -	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
> +	if host_machine.system() == 'windows'
> +		deps = ['eal'] # only supported lib on Windows currently
> +	endif
>  	subdir(example)

This is not what I call keeping build intact for Linux/BSD :)

I did not catch it before because test-meson-builds.sh is not testing
compilation of the examples with meson. Bruce, may we add it?

I will add back the original deps line in master branch.



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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02 22:39     ` Thomas Monjalon
  2019-04-02 22:39       ` Thomas Monjalon
@ 2019-04-02 22:57       ` Anand Rawat
  2019-04-02 22:57         ` Anand Rawat
  1 sibling, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-04-02 22:57 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, david.marchand

On 4/2/2019 3:39 PM, Thomas Monjalon wrote:
> I think the change below is bad because it is exposing an internal
> function in a header file which may be included by apps.
> I know you are still looking for pthread integration solutions,
> so we can discuss how to fix it later.
> 
> Note that there is already an EAL function to create normal threads:
> 	rte_ctrl_thread_create()
> You may want a similar function for dataplane threads perhaps.
> 
> 

Yes, we can work on removing eal_thread_create and substituting it
with rte_ctrl_thread_create. We have been able to macro substitute
quite a lot of pthread lib functionality with Microsoft libc. I can 
start looking into porting those functionalities for 
rte_ctrl_thread_create() on Windows.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows
  2019-04-02 22:57       ` Anand Rawat
@ 2019-04-02 22:57         ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02 22:57 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, david.marchand

On 4/2/2019 3:39 PM, Thomas Monjalon wrote:
> I think the change below is bad because it is exposing an internal
> function in a header file which may be included by apps.
> I know you are still looking for pthread integration solutions,
> so we can discuss how to fix it later.
> 
> Note that there is already an EAL function to create normal threads:
> 	rte_ctrl_thread_create()
> You may want a similar function for dataplane threads perhaps.
> 
> 

Yes, we can work on removing eal_thread_create and substituting it
with rte_ctrl_thread_create. We have been able to macro substitute
quite a lot of pthread lib functionality with Microsoft libc. I can 
start looking into porting those functionalities for 
rte_ctrl_thread_create() on Windows.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v8 10/10] build: meson changes to build on windows
  2019-04-02 22:51     ` Thomas Monjalon
  2019-04-02 22:51       ` Thomas Monjalon
@ 2019-04-02 23:01       ` Anand Rawat
  2019-04-02 23:01         ` Anand Rawat
  1 sibling, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-04-02 23:01 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On 4/2/2019 3:51 PM, Thomas Monjalon wrote:
> 02/04/2019 05:54, 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.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>> --- a/examples/meson.build
>> +++ b/examples/meson.build
>> @@ -35,7 +35,9 @@ foreach example: examples
>>   
>>   	ext_deps = [execinfo]
>>   	includes = [include_directories(example)]
>> -	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
>> +	if host_machine.system() == 'windows'
>> +		deps = ['eal'] # only supported lib on Windows currently
>> +	endif
>>   	subdir(example)
> 
> This is not what I call keeping build intact for Linux/BSD :)
> 
> I did not catch it before because test-meson-builds.sh is not testing
> compilation of the examples with meson. Bruce, may we add it?
> 
> I will add back the original deps line in master branch.
> 
> 

That is correct,
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
should have not been removed from this file. Please add the line
back.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v8 10/10] build: meson changes to build on windows
  2019-04-02 23:01       ` Anand Rawat
@ 2019-04-02 23:01         ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02 23:01 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

On 4/2/2019 3:51 PM, Thomas Monjalon wrote:
> 02/04/2019 05:54, 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.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>> --- a/examples/meson.build
>> +++ b/examples/meson.build
>> @@ -35,7 +35,9 @@ foreach example: examples
>>   
>>   	ext_deps = [execinfo]
>>   	includes = [include_directories(example)]
>> -	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
>> +	if host_machine.system() == 'windows'
>> +		deps = ['eal'] # only supported lib on Windows currently
>> +	endif
>>   	subdir(example)
> 
> This is not what I call keeping build intact for Linux/BSD :)
> 
> I did not catch it before because test-meson-builds.sh is not testing
> compilation of the examples with meson. Bruce, may we add it?
> 
> I will add back the original deps line in master branch.
> 
> 

That is correct,
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
should have not been removed from this file. Please add the line
back.

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v8 05/10] build: add module definition file for windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 05/10] build: add module definition file for windows Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
@ 2019-04-02 23:03     ` Thomas Monjalon
  2019-04-02 23:03       ` Thomas Monjalon
  1 sibling, 1 reply; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 23:03 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 05:54, 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.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  lib/librte_eal/rte_eal_exports.def       |  9 +++++++++

For info, this file is not listed in MAINTAINERS. Will add it.

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

* Re: [dpdk-dev] [PATCH v8 05/10] build: add module definition file for windows
  2019-04-02 23:03     ` Thomas Monjalon
@ 2019-04-02 23:03       ` Thomas Monjalon
  0 siblings, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 23:03 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw, bruce.richardson

02/04/2019 05:54, 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.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Reviewed-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  lib/librte_eal/rte_eal_exports.def       |  9 +++++++++

For info, this file is not listed in MAINTAINERS. Will add it.




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

* Re: [dpdk-dev] [PATCH v8 02/10] meson: required changes for windows
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 02/10] meson: required changes for windows Anand Rawat
  2019-04-02  3:54     ` Anand Rawat
@ 2019-04-02 23:04     ` Thomas Monjalon
  2019-04-02 23:04       ` Thomas Monjalon
  2019-04-02 23:23       ` Pallavi Kadam
  1 sibling, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 23:04 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

02/04/2019 05:54, Anand Rawat:
> These are the required meson changes for Windows.
> kernel/windows/meson is a stub file added to support
> Windows specific source in future releases.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  config/meson.build                     | 23 ++++++++++++++++-------
>  config/x86/meson.build                 | 14 ++++++++------
>  kernel/windows/meson.build             |  4 ++++

For info, kernel/windows/ is not listed in MAINTAINERS. Will add it.
If there is a different maintainer for the kernel part,
you may create a new section in MAINTAINERS file later.

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

* Re: [dpdk-dev] [PATCH v8 02/10] meson: required changes for windows
  2019-04-02 23:04     ` Thomas Monjalon
@ 2019-04-02 23:04       ` Thomas Monjalon
  2019-04-02 23:23       ` Pallavi Kadam
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 23:04 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

02/04/2019 05:54, Anand Rawat:
> These are the required meson changes for Windows.
> kernel/windows/meson is a stub file added to support
> Windows specific source in future releases.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  config/meson.build                     | 23 ++++++++++++++++-------
>  config/x86/meson.build                 | 14 ++++++++------
>  kernel/windows/meson.build             |  4 ++++

For info, kernel/windows/ is not listed in MAINTAINERS. Will add it.
If there is a different maintainer for the kernel part,
you may create a new section in MAINTAINERS file later.




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

* Re: [dpdk-dev] [PATCH v8 02/10] meson: required changes for windows
  2019-04-02 23:04     ` Thomas Monjalon
  2019-04-02 23:04       ` Thomas Monjalon
@ 2019-04-02 23:23       ` Pallavi Kadam
  2019-04-02 23:23         ` Pallavi Kadam
  1 sibling, 1 reply; 327+ messages in thread
From: Pallavi Kadam @ 2019-04-02 23:23 UTC (permalink / raw)
  To: Thomas Monjalon, Anand Rawat
  Cc: dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson, harini.ramakrishnan


On 4/2/2019 4:04 PM, Thomas Monjalon wrote:
> 02/04/2019 05:54, Anand Rawat:
>> These are the required meson changes for Windows.
>> kernel/windows/meson is a stub file added to support
>> Windows specific source in future releases.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>>   config/meson.build                     | 23 ++++++++++++++++-------
>>   config/x86/meson.build                 | 14 ++++++++------
>>   kernel/windows/meson.build             |  4 ++++
> For info, kernel/windows/ is not listed in MAINTAINERS. Will add it.
> If there is a different maintainer for the kernel part,
> you may create a new section in MAINTAINERS file later.

Ok. Thanks, Thomas.

We will update the Maintainers list moving forward.

We can discuss more about it in the Bi-weekly meeting.

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

* Re: [dpdk-dev] [PATCH v8 02/10] meson: required changes for windows
  2019-04-02 23:23       ` Pallavi Kadam
@ 2019-04-02 23:23         ` Pallavi Kadam
  0 siblings, 0 replies; 327+ messages in thread
From: Pallavi Kadam @ 2019-04-02 23:23 UTC (permalink / raw)
  To: Thomas Monjalon, Anand Rawat
  Cc: dev, ranjit.menon, jeffrey.b.shaw, bruce.richardson, harini.ramakrishnan


On 4/2/2019 4:04 PM, Thomas Monjalon wrote:
> 02/04/2019 05:54, Anand Rawat:
>> These are the required meson changes for Windows.
>> kernel/windows/meson is a stub file added to support
>> Windows specific source in future releases.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>>   config/meson.build                     | 23 ++++++++++++++++-------
>>   config/x86/meson.build                 | 14 ++++++++------
>>   kernel/windows/meson.build             |  4 ++++
> For info, kernel/windows/ is not listed in MAINTAINERS. Will add it.
> If there is a different maintainer for the kernel part,
> you may create a new section in MAINTAINERS file later.

Ok. Thanks, Thomas.

We will update the Maintainers list moving forward.

We can discuss more about it in the Bi-weekly meeting.


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

* Re: [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows
  2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
                     ` (10 preceding siblings ...)
  2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 10/10] build: meson changes to build on windows Anand Rawat
@ 2019-04-02 23:25   ` Thomas Monjalon
  2019-04-02 23:25     ` Thomas Monjalon
  2019-04-02 23:49     ` Anand Rawat
  11 siblings, 2 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 23:25 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

02/04/2019 05:54, Anand Rawat:
> Includes Windows-specific EAL changes and meson changes
> to build the code on Windows.
[...] 
> Anand Rawat (10):
>   eal: eal stub to add windows support
>   meson: required changes for windows
>   eal: add new rte_os.h header to build system
>   eal: update common headers to use rte_os.h
>   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

Applied, with few changes as discussed, thanks.

First step is done, welcome to Windows world!

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

* Re: [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows
  2019-04-02 23:25   ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Thomas Monjalon
@ 2019-04-02 23:25     ` Thomas Monjalon
  2019-04-02 23:49     ` Anand Rawat
  1 sibling, 0 replies; 327+ messages in thread
From: Thomas Monjalon @ 2019-04-02 23:25 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

02/04/2019 05:54, Anand Rawat:
> Includes Windows-specific EAL changes and meson changes
> to build the code on Windows.
[...] 
> Anand Rawat (10):
>   eal: eal stub to add windows support
>   meson: required changes for windows
>   eal: add new rte_os.h header to build system
>   eal: update common headers to use rte_os.h
>   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

Applied, with few changes as discussed, thanks.

First step is done, welcome to Windows world!



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

* Re: [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows
  2019-04-02 23:25   ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Thomas Monjalon
  2019-04-02 23:25     ` Thomas Monjalon
@ 2019-04-02 23:49     ` Anand Rawat
  2019-04-02 23:49       ` Anand Rawat
  1 sibling, 1 reply; 327+ messages in thread
From: Anand Rawat @ 2019-04-02 23:49 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

On 4/2/2019 4:25 PM, Thomas Monjalon wrote:
> 02/04/2019 05:54, Anand Rawat:
>> Includes Windows-specific EAL changes and meson changes
>> to build the code on Windows.
> [...]
>> Anand Rawat (10):
>>    eal: eal stub to add windows support
>>    meson: required changes for windows
>>    eal: add new rte_os.h header to build system
>>    eal: update common headers to use rte_os.h
>>    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
> 
> Applied, with few changes as discussed, thanks.
> 
> First step is done, welcome to Windows world!
> 
> 

Thanks Thomas :)

-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows
  2019-04-02 23:49     ` Anand Rawat
@ 2019-04-02 23:49       ` Anand Rawat
  0 siblings, 0 replies; 327+ messages in thread
From: Anand Rawat @ 2019-04-02 23:49 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, pallavi.kadam, ranjit.menon, jeffrey.b.shaw,
	bruce.richardson, harini.ramakrishnan

On 4/2/2019 4:25 PM, Thomas Monjalon wrote:
> 02/04/2019 05:54, Anand Rawat:
>> Includes Windows-specific EAL changes and meson changes
>> to build the code on Windows.
> [...]
>> Anand Rawat (10):
>>    eal: eal stub to add windows support
>>    meson: required changes for windows
>>    eal: add new rte_os.h header to build system
>>    eal: update common headers to use rte_os.h
>>    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
> 
> Applied, with few changes as discussed, thanks.
> 
> First step is done, welcome to Windows world!
> 
> 

Thanks Thomas :)

-- 
Anand Rawat

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

end of thread, other threads:[~2019-04-02 23:49 UTC | newest]

Thread overview: 327+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06  4:16 [dpdk-dev] [PATCH v2 0/6] HelloWorld example for windows Anand Rawat
2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 1/6] eal: eal stub to add windows support Anand Rawat
2019-03-06 10:03   ` Thomas Monjalon
2019-03-06 11:20     ` Bruce Richardson
2019-03-06 11:36       ` Thomas Monjalon
2019-03-06 11:52         ` Richardson, Bruce
2019-03-07  1:04           ` Anand Rawat
2019-03-07  8:59             ` Thomas Monjalon
2019-03-07  1:19       ` Anand Rawat
2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 2/6] eal: add header files to support windows Anand Rawat
2019-03-06 11:31   ` Thomas Monjalon
2019-03-07  3:27     ` Anand Rawat
2019-03-07  8:45       ` Thomas Monjalon
2019-03-07 10:24         ` Bruce Richardson
2019-03-07 11:33           ` Thomas Monjalon
2019-03-07 11:53             ` Richardson, Bruce
2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 3/6] eal: add headers for compatibility with windows environment Anand Rawat
2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 4/6] eal: add minimum viable code for eal on windows Anand Rawat
2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 5/6] examples: add meson changes for windows Anand Rawat
2019-03-06  4:16 ` [dpdk-dev] [PATCH v2 6/6] doc: add documention " Anand Rawat
2019-03-07 17:03   ` Kovacevic, Marko
2019-03-07 18:46     ` Anand Rawat
2019-03-11 12:45   ` Jerin Jacob Kollanukkaran
2019-03-11 13:51     ` Richardson, Bruce
2019-03-11 15:30       ` Raslan Darawsheh
2019-03-11 15:46       ` Jerin Jacob Kollanukkaran
2019-03-14  0:04     ` Anand Rawat
2019-03-14  0:04       ` Anand Rawat
2019-03-06  8:29 ` [dpdk-dev] [PATCH v2 0/6] HelloWorld example " Thomas Monjalon
2019-03-06 22:45   ` Anand Rawat
2019-03-06 23:03     ` Thomas Monjalon
2019-03-20  0:40 ` [dpdk-dev] [PATCH v3 0/8] " Anand Rawat
2019-03-20  0:40   ` Anand Rawat
2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 1/8] eal: eal stub to add windows support Anand Rawat
2019-03-20  0:40     ` Anand Rawat
2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 2/8] eal: add header files to support windows Anand Rawat
2019-03-20  0:40     ` Anand Rawat
2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 3/8] kvargs: adding a module definition file Anand Rawat
2019-03-20  0:40     ` Anand Rawat
2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 4/8] eal: sys/queue.h implementation for windows Anand Rawat
2019-03-20  0:40     ` Anand Rawat
2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 5/8] eal: add headers for compatibility with windows environment Anand Rawat
2019-03-20  0:40     ` Anand Rawat
2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 6/8] eal: add minimum viable code for eal on windows Anand Rawat
2019-03-20  0:40     ` Anand Rawat
2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 7/8] doc: add documention for windows Anand Rawat
2019-03-20  0:40     ` Anand Rawat
2019-03-20  0:40   ` [dpdk-dev] [PATCH v3 8/8] build: meson changes to build on windows Anand Rawat
2019-03-20  0:40     ` Anand Rawat
2019-03-22 22:54 ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Anand Rawat
2019-03-22 22:54   ` Anand Rawat
2019-03-22 22:54   ` [dpdk-dev] [PATCH v4 1/8] eal: eal stub to add windows support Anand Rawat
2019-03-22 22:54     ` Anand Rawat
2019-03-22 22:54   ` [dpdk-dev] [PATCH v4 2/8] eal: add header files to support windows Anand Rawat
2019-03-22 22:54     ` Anand Rawat
2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 3/8] kvargs: adding a module definition file Anand Rawat
2019-03-22 22:55     ` Anand Rawat
2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 4/8] eal: sys/queue.h implementation for windows Anand Rawat
2019-03-22 22:55     ` Anand Rawat
2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 5/8] eal: add headers for compatibility with windows environment Anand Rawat
2019-03-22 22:55     ` Anand Rawat
2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 6/8] eal: add minimum viable code for eal on windows Anand Rawat
2019-03-22 22:55     ` Anand Rawat
2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 7/8] doc: add documention for windows Anand Rawat
2019-03-22 22:55     ` Anand Rawat
2019-03-23 16:51     ` Jerin Jacob Kollanukkaran
2019-03-23 16:51       ` Jerin Jacob Kollanukkaran
2019-03-25 10:24       ` Bruce Richardson
2019-03-25 10:24         ` Bruce Richardson
2019-03-25 17:43         ` Pallavi Kadam
2019-03-25 17:43           ` Pallavi Kadam
2019-03-22 22:55   ` [dpdk-dev] [PATCH v4 8/8] build: meson changes to build on windows Anand Rawat
2019-03-22 22:55     ` Anand Rawat
2019-03-25 10:32     ` Bruce Richardson
2019-03-25 10:32       ` Bruce Richardson
2019-03-25 18:47   ` [dpdk-dev] [PATCH v4 0/8] HelloWorld example for windows Harini Ramakrishnan
2019-03-25 18:47     ` Harini Ramakrishnan
2019-03-26  6:02 ` [dpdk-dev] [PATCH v5 " Anand Rawat
2019-03-26  6:02   ` Anand Rawat
2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 1/8] eal: eal stub to add windows support Anand Rawat
2019-03-26  6:02     ` Anand Rawat
2019-03-26 16:29     ` Harini Ramakrishnan
2019-03-26 16:29       ` Harini Ramakrishnan
     [not found]     ` <MWHPR21MB0638113CDE9F61F8EC3E63D0EF5F0@MWHPR21MB0638.namprd21.prod.outlook.com>
2019-03-26 22:50       ` Omar Cardona
2019-03-26 22:50         ` Omar Cardona
2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows Anand Rawat
2019-03-26  6:02     ` Anand Rawat
2019-03-26 10:20     ` Jerin Jacob Kollanukkaran
2019-03-26 10:20       ` Jerin Jacob Kollanukkaran
2019-03-27 21:23       ` Ranjit Menon
2019-03-27 21:23         ` Ranjit Menon
2019-03-27 22:29         ` Thomas Monjalon
2019-03-27 22:29           ` Thomas Monjalon
2019-03-27 23:10           ` Anand Rawat
2019-03-27 23:10             ` Anand Rawat
2019-03-27 23:27             ` Thomas Monjalon
2019-03-27 23:27               ` Thomas Monjalon
2019-03-26 16:30     ` Harini Ramakrishnan
2019-03-26 16:30       ` Harini Ramakrishnan
2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 3/8] kvargs: adding a module definition file Anand Rawat
2019-03-26  6:02     ` Anand Rawat
2019-03-26 10:32     ` Jerin Jacob Kollanukkaran
2019-03-26 10:32       ` Jerin Jacob Kollanukkaran
2019-03-26 10:58       ` Bruce Richardson
2019-03-26 10:58         ` Bruce Richardson
2019-03-26 13:37         ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
2019-03-26 13:37           ` Jerin Jacob Kollanukkaran
2019-03-26 13:55           ` Thomas Monjalon
2019-03-26 13:55             ` Thomas Monjalon
2019-03-26 14:41             ` Bruce Richardson
2019-03-26 14:41               ` Bruce Richardson
2019-03-26 15:07               ` Thomas Monjalon
2019-03-26 15:07                 ` Thomas Monjalon
2019-03-26 15:17                 ` Bruce Richardson
2019-03-26 15:17                   ` Bruce Richardson
2019-03-26 15:22                   ` Thomas Monjalon
2019-03-26 15:22                     ` Thomas Monjalon
2019-03-26 14:40           ` Bruce Richardson
2019-03-26 14:40             ` Bruce Richardson
2019-03-26 15:35             ` Jerin Jacob Kollanukkaran
2019-03-26 15:35               ` Jerin Jacob Kollanukkaran
2019-03-26 16:46               ` Bruce Richardson
2019-03-26 16:46                 ` Bruce Richardson
2019-03-26 23:13                 ` Anand Rawat
2019-03-26 23:13                   ` Anand Rawat
2019-03-26 16:31     ` [dpdk-dev] " Harini Ramakrishnan
2019-03-26 16:31       ` Harini Ramakrishnan
2019-03-26 19:02     ` Stephen Hemminger
2019-03-26 19:02       ` Stephen Hemminger
2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 4/8] eal: sys/queue.h implementation for windows Anand Rawat
2019-03-26  6:02     ` Anand Rawat
2019-03-26 16:31     ` Harini Ramakrishnan
2019-03-26 16:31       ` Harini Ramakrishnan
2019-03-26 19:06     ` Stephen Hemminger
2019-03-26 19:06       ` Stephen Hemminger
2019-03-26 20:52       ` Thomas Monjalon
2019-03-26 20:52         ` Thomas Monjalon
2019-03-26 21:14         ` Jeff Shaw
2019-03-26 21:14           ` Jeff Shaw
2019-03-26 21:47           ` Thomas Monjalon
2019-03-26 21:47             ` Thomas Monjalon
2019-03-26 21:54             ` Jeff Shaw
2019-03-26 21:54               ` Jeff Shaw
2019-03-26 22:23               ` Thomas Monjalon
2019-03-26 22:23                 ` Thomas Monjalon
2019-03-26 22:34                 ` Jeff Shaw
2019-03-26 22:34                   ` Jeff Shaw
2019-03-26 23:00                   ` Thomas Monjalon
2019-03-26 23:00                     ` Thomas Monjalon
2019-03-26 23:43                     ` Jeff Shaw
2019-03-26 23:43                       ` Jeff Shaw
2019-03-26 23:54                       ` Thomas Monjalon
2019-03-26 23:54                         ` Thomas Monjalon
2019-03-27 21:16       ` Anand Rawat
2019-03-27 21:16         ` Anand Rawat
2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment Anand Rawat
2019-03-26  6:02     ` Anand Rawat
2019-03-26 16:33     ` Harini Ramakrishnan
2019-03-26 16:33       ` Harini Ramakrishnan
2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 6/8] eal: add minimum viable code for eal on windows Anand Rawat
2019-03-26  6:02     ` Anand Rawat
2019-03-26 16:32     ` Harini Ramakrishnan
2019-03-26 16:32       ` Harini Ramakrishnan
2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 7/8] doc: add documention for windows Anand Rawat
2019-03-26  6:02     ` Anand Rawat
2019-03-26 10:27     ` Jerin Jacob Kollanukkaran
2019-03-26 10:27       ` Jerin Jacob Kollanukkaran
2019-03-26 10:37     ` David Marchand
2019-03-26 10:37       ` David Marchand
2019-03-26 18:29       ` Anand Rawat
2019-03-26 18:29         ` Anand Rawat
2019-03-26 16:33     ` Harini Ramakrishnan
2019-03-26 16:33       ` Harini Ramakrishnan
2019-03-26  6:02   ` [dpdk-dev] [PATCH v5 8/8] build: meson changes to build on windows Anand Rawat
2019-03-26  6:02     ` Anand Rawat
2019-03-26 16:34     ` Harini Ramakrishnan
2019-03-26 16:34       ` Harini Ramakrishnan
2019-03-26 16:28   ` [dpdk-dev] [PATCH v5 0/8] HelloWorld example for windows Harini Ramakrishnan
2019-03-26 16:28     ` Harini Ramakrishnan
     [not found]   ` <MWHPR21MB06380D6FA7CF5513DDC3820AEF5F0@MWHPR21MB0638.namprd21.prod.outlook.com>
2019-03-26 22:43     ` Omar Cardona
2019-03-26 22:43       ` Omar Cardona
2019-03-28  2:21 ` [dpdk-dev] [PATCH v6 " Anand Rawat
2019-03-28  2:21   ` Anand Rawat
2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 1/8] eal: eal stub to add windows support Anand Rawat
2019-03-28  2:21     ` Anand Rawat
2019-03-28 19:27     ` Harini Ramakrishnan
2019-03-28 19:27       ` Harini Ramakrishnan
2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 2/8] eal: add header files to support os specifics Anand Rawat
2019-03-28  2:21     ` Anand Rawat
2019-03-28 19:27     ` Harini Ramakrishnan
2019-03-28 19:27       ` Harini Ramakrishnan
2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 3/8] build: add module definition file for windows Anand Rawat
2019-03-28  2:21     ` Anand Rawat
2019-03-28 19:29     ` Harini Ramakrishnan
2019-03-28 19:29       ` Harini Ramakrishnan
2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 4/8] eal: sys/queue.h implementation " Anand Rawat
2019-03-28  2:21     ` Anand Rawat
2019-03-28  2:30     ` Varghese, Vipin
2019-03-28  2:30       ` Varghese, Vipin
2019-03-28  2:39       ` Anand Rawat
2019-03-28  2:39         ` Anand Rawat
2019-03-28  3:29         ` Varghese, Vipin
2019-03-28  3:29           ` Varghese, Vipin
2019-03-28 19:30     ` Harini Ramakrishnan
2019-03-28 19:30       ` Harini Ramakrishnan
2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows Anand Rawat
2019-03-28  2:21     ` Anand Rawat
2019-03-28 19:29     ` Harini Ramakrishnan
2019-03-28 19:29       ` Harini Ramakrishnan
2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 6/8] eal: add minimum viable code for eal on windows Anand Rawat
2019-03-28  2:21     ` Anand Rawat
2019-03-28 19:32     ` Harini Ramakrishnan
2019-03-28 19:32       ` Harini Ramakrishnan
2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows Anand Rawat
2019-03-28  2:21     ` Anand Rawat
2019-03-28 19:31     ` Harini Ramakrishnan
2019-03-28 19:31       ` Harini Ramakrishnan
2019-03-28  2:21   ` [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows Anand Rawat
2019-03-28  2:21     ` Anand Rawat
2019-03-28 15:10     ` Thomas Monjalon
2019-03-28 15:10       ` Thomas Monjalon
2019-03-28 19:30     ` Harini Ramakrishnan
2019-03-28 19:30       ` Harini Ramakrishnan
2019-03-28 19:28   ` [dpdk-dev] [PATCH v6 0/8] HelloWorld example for windows Harini Ramakrishnan
2019-03-28 19:28     ` Harini Ramakrishnan
2019-03-28 23:24 ` [dpdk-dev] [PATCH v7 " Anand Rawat
2019-03-28 23:24   ` Anand Rawat
2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 1/8] eal: eal stub to add windows support Anand Rawat
2019-03-28 23:24     ` Anand Rawat
2019-04-01 16:17     ` Bruce Richardson
2019-04-01 16:17       ` Bruce Richardson
2019-04-01 16:34     ` Bruce Richardson
2019-04-01 16:34       ` Bruce Richardson
2019-04-01 17:06       ` Anand Rawat
2019-04-01 17:06         ` Anand Rawat
2019-04-01 20:10         ` Bruce Richardson
2019-04-01 20:10           ` Bruce Richardson
2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics Anand Rawat
2019-03-28 23:24     ` Anand Rawat
2019-04-01 23:09     ` Thomas Monjalon
2019-04-01 23:09       ` Thomas Monjalon
2019-04-02  3:52       ` Anand Rawat
2019-04-02  3:52         ` Anand Rawat
2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 3/8] build: add module definition file for windows Anand Rawat
2019-03-28 23:24     ` Anand Rawat
2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 4/8] eal: sys/queue.h implementation " Anand Rawat
2019-03-28 23:24     ` Anand Rawat
2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 5/8] eal: add headers for compatibility with windows Anand Rawat
2019-03-28 23:24     ` Anand Rawat
2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 6/8] eal: add minimum viable code for eal on windows Anand Rawat
2019-03-28 23:24     ` Anand Rawat
2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 7/8] doc: add documentation for windows Anand Rawat
2019-03-28 23:24     ` Anand Rawat
2019-03-29  0:06     ` Harini Ramakrishnan
2019-03-29  0:06       ` Harini Ramakrishnan
2019-04-01 23:22     ` Thomas Monjalon
2019-04-01 23:22       ` Thomas Monjalon
2019-04-02  1:01       ` Pallavi Kadam
2019-04-02  1:01         ` Pallavi Kadam
2019-04-02  7:15         ` Thomas Monjalon
2019-04-02  7:15           ` Thomas Monjalon
2019-03-28 23:24   ` [dpdk-dev] [PATCH v7 8/8] build: meson changes to build on windows Anand Rawat
2019-03-28 23:24     ` Anand Rawat
2019-04-01 23:25     ` Thomas Monjalon
2019-04-01 23:25       ` Thomas Monjalon
2019-04-02  3:47       ` Anand Rawat
2019-04-02  3:47         ` Anand Rawat
2019-03-29  0:12   ` [dpdk-dev] [PATCH v7 0/8] HelloWorld example for windows Harini Ramakrishnan
2019-03-29  0:12     ` Harini Ramakrishnan
2019-04-02  3:54 ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Anand Rawat
2019-04-02  3:54   ` Anand Rawat
2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 01/10] eal: eal stub to add windows support Anand Rawat
2019-04-02  3:54     ` Anand Rawat
2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 02/10] meson: required changes for windows Anand Rawat
2019-04-02  3:54     ` Anand Rawat
2019-04-02 23:04     ` Thomas Monjalon
2019-04-02 23:04       ` Thomas Monjalon
2019-04-02 23:23       ` Pallavi Kadam
2019-04-02 23:23         ` Pallavi Kadam
2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 03/10] eal: add new rte_os.h header to build system Anand Rawat
2019-04-02  3:54     ` Anand Rawat
2019-04-02 19:56     ` Thomas Monjalon
2019-04-02 19:56       ` Thomas Monjalon
2019-04-02 20:47       ` Thomas Monjalon
2019-04-02 20:47         ` Thomas Monjalon
2019-04-02 22:11         ` Anand Rawat
2019-04-02 22:11           ` Anand Rawat
2019-04-02 22:32           ` Thomas Monjalon
2019-04-02 22:32             ` Thomas Monjalon
2019-04-02 22:34             ` Anand Rawat
2019-04-02 22:34               ` Anand Rawat
2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 04/10] eal: update common headers to use rte_os.h Anand Rawat
2019-04-02  3:54     ` Anand Rawat
2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 05/10] build: add module definition file for windows Anand Rawat
2019-04-02  3:54     ` Anand Rawat
2019-04-02 23:03     ` Thomas Monjalon
2019-04-02 23:03       ` Thomas Monjalon
2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 06/10] eal: sys/queue.h implementation " Anand Rawat
2019-04-02  3:54     ` Anand Rawat
2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 07/10] eal: add headers for compatibility with windows Anand Rawat
2019-04-02  3:54     ` Anand Rawat
2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 08/10] eal: add minimum viable code for eal on windows Anand Rawat
2019-04-02  3:54     ` Anand Rawat
2019-04-02 20:06     ` Thomas Monjalon
2019-04-02 20:06       ` Thomas Monjalon
2019-04-02 21:21       ` Pallavi Kadam
2019-04-02 21:21         ` Pallavi Kadam
2019-04-02 21:38         ` Thomas Monjalon
2019-04-02 21:38           ` Thomas Monjalon
2019-04-02 21:46           ` Pallavi Kadam
2019-04-02 21:46             ` Pallavi Kadam
2019-04-02 22:39     ` Thomas Monjalon
2019-04-02 22:39       ` Thomas Monjalon
2019-04-02 22:57       ` Anand Rawat
2019-04-02 22:57         ` Anand Rawat
2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 09/10] doc: add documentation for windows Anand Rawat
2019-04-02  3:54     ` Anand Rawat
2019-04-02  3:54   ` [dpdk-dev] [PATCH v8 10/10] build: meson changes to build on windows Anand Rawat
2019-04-02  3:54     ` Anand Rawat
2019-04-02 22:51     ` Thomas Monjalon
2019-04-02 22:51       ` Thomas Monjalon
2019-04-02 23:01       ` Anand Rawat
2019-04-02 23:01         ` Anand Rawat
2019-04-02 23:25   ` [dpdk-dev] [PATCH v8 00/10] HelloWorld example for Windows Thomas Monjalon
2019-04-02 23:25     ` Thomas Monjalon
2019-04-02 23:49     ` Anand Rawat
2019-04-02 23:49       ` Anand Rawat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).