DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows
@ 2019-03-01  7:18 Anand Rawat
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support Anand Rawat
                   ` (6 more replies)
  0 siblings, 7 replies; 18+ messages in thread
From: Anand Rawat @ 2019-03-01  7:18 UTC (permalink / raw)
  To: dev

Helloworld example for Windows.
Includes Windows-specific EAL changes and meson
changes to build the code on Windows.

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

 config/meson.build                            |  28 +-
 config/rte_config.h                           |  15 +-
 config/x86/meson.build                        |  14 +-
 doc/guides/index.rst                          |   1 +
 doc/guides/windows_gsg/build_dpdk.rst         |  76 +++++
 doc/guides/windows_gsg/index.rst              |  14 +
 doc/guides/windows_gsg/intro.rst              |  20 ++
 examples/meson.build                          |   9 +-
 .../common/include/arch/x86/meson.build       |  48 +--
 .../include/arch/x86/winapp/rte_atomic.h      |  19 ++
 .../include/arch/x86/winapp/rte_pause.h       |  22 ++
 lib/librte_eal/common/meson.build             | 161 +++++----
 lib/librte_eal/meson.build                    |  10 +-
 lib/librte_eal/winapp/eal/eal.c               |  79 +++++
 lib/librte_eal/winapp/eal/eal_debug.c         |  18 +
 lib/librte_eal/winapp/eal/eal_lcore.c         |  90 +++++
 lib/librte_eal/winapp/eal/eal_thread.c        | 152 +++++++++
 .../winapp/eal/include/exec-env/fnmatch.h     |  26 ++
 .../winapp/eal/include/exec-env/pthread.h     |  19 ++
 .../winapp/eal/include/exec-env/regex.h       |  56 +++
 .../winapp/eal/include/exec-env/rte_windows.h |  44 +++
 .../winapp/eal/include/exec-env/sched.h       |  41 +++
 .../winapp/eal/include/exec-env/sys/queue.h   | 320 ++++++++++++++++++
 .../winapp/eal/include/exec-env/unistd.h      |   7 +
 lib/librte_eal/winapp/eal/meson.build         |  13 +
 lib/meson.build                               |   6 +-
 meson.build                                   |  34 +-
 27 files changed, 1212 insertions(+), 130 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/common/include/arch/x86/winapp/rte_atomic.h
 create mode 100644 lib/librte_eal/common/include/arch/x86/winapp/rte_pause.h
 create mode 100644 lib/librte_eal/winapp/eal/eal.c
 create mode 100644 lib/librte_eal/winapp/eal/eal_debug.c
 create mode 100644 lib/librte_eal/winapp/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/winapp/eal/eal_thread.c
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/fnmatch.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/pthread.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/regex.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/rte_windows.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/sched.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/sys/queue.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/unistd.h
 create mode 100644 lib/librte_eal/winapp/eal/meson.build

-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support
  2019-03-01  7:18 [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Anand Rawat
@ 2019-03-01  7:18 ` Anand Rawat
  2019-03-01 14:03   ` Thomas Monjalon
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 2/6] eal: Add header files to support windows Anand Rawat
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Anand Rawat @ 2019-03-01  7:18 UTC (permalink / raw)
  To: dev

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: Kadam, Pallavi <pallavi.kadam@intel.com>
Reviewed-by: Jeffrey B Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 config/meson.build                            |  28 +--
 config/x86/meson.build                        |  14 +-
 .../common/include/arch/x86/meson.build       |  41 +++--
 lib/librte_eal/common/meson.build             | 162 +++++++++---------
 lib/librte_eal/meson.build                    |  10 +-
 lib/librte_eal/winapp/eal/eal.c               |  11 ++
 lib/librte_eal/winapp/eal/eal_debug.c         |  11 ++
 lib/librte_eal/winapp/eal/eal_lcore.c         |  26 +++
 lib/librte_eal/winapp/eal/eal_thread.c        |  15 ++
 lib/librte_eal/winapp/eal/meson.build         |  10 ++
 lib/meson.build                               |   6 +-
 meson.build                                   |  34 ++--
 12 files changed, 239 insertions(+), 129 deletions(-)
 create mode 100644 lib/librte_eal/winapp/eal/eal.c
 create mode 100644 lib/librte_eal/winapp/eal/eal_debug.c
 create mode 100644 lib/librte_eal/winapp/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/winapp/eal/eal_thread.c
 create mode 100644 lib/librte_eal/winapp/eal/meson.build

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..b0356c6b5 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) 2019 Intel Corporation
 
 # set the machine type and cflags for it
 if meson.is_cross_build()
@@ -48,22 +48,30 @@ dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8)
 add_project_link_arguments('-Wl,--no-as-needed', language: 'c')
 dpdk_extra_ldflags += '-Wl,--no-as-needed'
 
-# use pthreads
-add_project_link_arguments('-pthread', language: 'c')
-dpdk_extra_ldflags += '-pthread'
+if host_machine.system() != 'windows'
+	# use pthreads
+	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'
+	# 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..93cc30afc 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) 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/include/arch/x86/meson.build b/lib/librte_eal/common/include/arch/x86/meson.build
index bc8ffea1e..25b73b8d6 100644
--- a/lib/librte_eal/common/include/arch/x86/meson.build
+++ b/lib/librte_eal/common/include/arch/x86/meson.build
@@ -1,21 +1,24 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2019 Intel Corporation
 
-install_headers(
-	'rte_atomic_32.h',
-	'rte_atomic_64.h',
-	'rte_atomic.h',
-	'rte_byteorder_32.h',
-	'rte_byteorder_64.h',
-	'rte_byteorder.h',
-	'rte_cpuflags.h',
-	'rte_cycles.h',
-	'rte_io.h',
-	'rte_memcpy.h',
-	'rte_prefetch.h',
-	'rte_pause.h',
-	'rte_rtm.h',
-	'rte_rwlock.h',
-	'rte_spinlock.h',
-	'rte_vect.h',
-	subdir: get_option('include_subdir_arch'))
+if host_machine.system() != 'windows'
+	install_headers(
+		'rte_atomic_32.h',
+		'rte_atomic_64.h',
+		'rte_atomic.h',
+		'rte_byteorder_32.h',
+		'rte_byteorder_64.h',
+		'rte_byteorder.h',
+		'rte_cpuflags.h',
+		'rte_cycles.h',
+		'rte_io.h',
+		'rte_memcpy.h',
+		'rte_prefetch.h',
+		'rte_pause.h',
+		'rte_rtm.h',
+		'rte_rwlock.h',
+		'rte_spinlock.h',
+		'rte_vect.h',
+		subdir: get_option('include_subdir_arch')
+	)
+endif
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 5ecae0b1f..68ce11222 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -1,91 +1,99 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 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_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_common.h')
+if host_machine.system() != 'windows'
+	subdir(join_paths('arch', arch_subdir))
+	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'
+	)
+endif
 
 # 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..6fa57ebe5 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) 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('winapp/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/winapp/eal/eal.c b/lib/librte_eal/winapp/eal/eal.c
new file mode 100644
index 000000000..134452a77
--- /dev/null
+++ b/lib/librte_eal/winapp/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/winapp/eal/eal_debug.c b/lib/librte_eal/winapp/eal/eal_debug.c
new file mode 100644
index 000000000..868808ca9
--- /dev/null
+++ b/lib/librte_eal/winapp/eal/eal_debug.c
@@ -0,0 +1,11 @@
+/* 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, ...)
+{
+}
diff --git a/lib/librte_eal/winapp/eal/eal_lcore.c b/lib/librte_eal/winapp/eal/eal_lcore.c
new file mode 100644
index 000000000..46418f38f
--- /dev/null
+++ b/lib/librte_eal/winapp/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
+eal_cpu_core_id(unsigned 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 lcore_id __rte_unused)
+{
+	return 1;
+}
+
+/* Get CPU socket id (NUMA node) for a logical core */
+unsigned
+eal_cpu_socket_id(unsigned cpu_id __rte_unused)
+{
+	return 0;
+}
diff --git a/lib/librte_eal/winapp/eal/eal_thread.c b/lib/librte_eal/winapp/eal/eal_thread.c
new file mode 100644
index 000000000..222bd8f4d
--- /dev/null
+++ b/lib/librte_eal/winapp/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/winapp/eal/meson.build b/lib/librte_eal/winapp/eal/meson.build
new file mode 100644
index 000000000..8b1735623
--- /dev/null
+++ b/lib/librte_eal/winapp/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..e434cfc96 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) 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..c75d551a5 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2019 Intel Corporation
 
 project('DPDK', 'C',
 	version: '19.05.0-rc0',
@@ -16,6 +16,7 @@ dpdk_static_libraries = []
 dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_app_link_libraries = []
+driver_classes = []
 
 # set the major version, which might be used by drivers and libraries
 # depending on the configuration options
@@ -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] 18+ messages in thread

* [dpdk-dev] [PATCH 2/6] eal: Add header files to support windows
  2019-03-01  7:18 [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Anand Rawat
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support Anand Rawat
@ 2019-03-01  7:18 ` Anand Rawat
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 3/6] eal: Add headers for compatibility with windows environment Anand Rawat
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 18+ messages in thread
From: Anand Rawat @ 2019-03-01  7:18 UTC (permalink / raw)
  To: dev

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: Kadam, Pallavi <pallavi.kadam@intel.com>
Reviewed-by: Jeffrey B Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 config/rte_config.h                           | 15 +++++++++++-
 .../common/include/arch/x86/meson.build       |  7 ++++++
 .../include/arch/x86/winapp/rte_atomic.h      | 19 +++++++++++++++
 .../include/arch/x86/winapp/rte_pause.h       | 22 ++++++++++++++++++
 .../winapp/eal/include/exec-env/rte_windows.h | 23 +++++++++++++++++++
 lib/librte_eal/winapp/eal/meson.build         |  5 +++-
 6 files changed, 89 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_eal/common/include/arch/x86/winapp/rte_atomic.h
 create mode 100644 lib/librte_eal/common/include/arch/x86/winapp/rte_pause.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/rte_windows.h

diff --git a/config/rte_config.h b/config/rte_config.h
index 7606f5d7b..af4d06878 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) 2019 Intel Corporation
  */
 
 /**
@@ -20,6 +20,10 @@
 
 /****** library defines ********/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* compat defines */
 #define RTE_BUILD_SHARED_LIB
 
@@ -118,4 +122,13 @@
 /* QEDE PMD defines */
 #define RTE_LIBRTE_QEDE_FW ""
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_CONFIG_H_ */
diff --git a/lib/librte_eal/common/include/arch/x86/meson.build b/lib/librte_eal/common/include/arch/x86/meson.build
index 25b73b8d6..7426d35a6 100644
--- a/lib/librte_eal/common/include/arch/x86/meson.build
+++ b/lib/librte_eal/common/include/arch/x86/meson.build
@@ -21,4 +21,11 @@ if host_machine.system() != 'windows'
 		'rte_vect.h',
 		subdir: get_option('include_subdir_arch')
 	)
+else
+	# get and install the architecture specific windows headers
+	windows_headers = files(
+		'winapp/rte_atomic.h',
+		'winapp/rte_pause.h'
+	)
+	install_headers(windows_headers, subdir: 'winapp')
 endif
diff --git a/lib/librte_eal/common/include/arch/x86/winapp/rte_atomic.h b/lib/librte_eal/common/include/arch/x86/winapp/rte_atomic.h
new file mode 100644
index 000000000..9ca630f71
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/x86/winapp/rte_atomic.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _ATOMIC_H_
+#define _ATOMIC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define rte_rmb() _mm_lfence()
+#define rte_wmb() _mm_sfence()
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ATOMIC_H_ */
diff --git a/lib/librte_eal/common/include/arch/x86/winapp/rte_pause.h b/lib/librte_eal/common/include/arch/x86/winapp/rte_pause.h
new file mode 100644
index 000000000..12762a5cd
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/x86/winapp/rte_pause.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PAUSE_H_
+#define _PAUSE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static inline void
+rte_pause(void)
+{
+	_mm_pause();
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PAUSE_H_ */
diff --git a/lib/librte_eal/winapp/eal/include/exec-env/rte_windows.h b/lib/librte_eal/winapp/eal/include/exec-env/rte_windows.h
new file mode 100644
index 000000000..8e4dc72bb
--- /dev/null
+++ b/lib/librte_eal/winapp/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/winapp/eal/meson.build b/lib/librte_eal/winapp/eal/meson.build
index 8b1735623..487055f80 100644
--- a/lib/librte_eal/winapp/eal/meson.build
+++ b/lib/librte_eal/winapp/eal/meson.build
@@ -1,10 +1,13 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include/exec-env')
+install_subdir('include/exec-env', install_dir: get_option('includedir'))
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
 	'eal_debug.c',
 	'eal_lcore.c',
 	'eal_thread.c',
-)
+)
\ No newline at end of file
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH 3/6] eal: Add headers for compatibility with windows environment
  2019-03-01  7:18 [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Anand Rawat
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support Anand Rawat
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 2/6] eal: Add header files to support windows Anand Rawat
@ 2019-03-01  7:18 ` Anand Rawat
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 4/6] eal: add minimum viable code for eal on windows Anand Rawat
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 18+ messages in thread
From: Anand Rawat @ 2019-03-01  7:18 UTC (permalink / raw)
  To: dev

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: Kadam, Pallavi <pallavi.kadam@intel.com>
Reviewed-by: Jeffrey B Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 .../winapp/eal/include/exec-env/fnmatch.h     |  26 ++
 .../winapp/eal/include/exec-env/pthread.h     |  19 ++
 .../winapp/eal/include/exec-env/regex.h       |  54 +++
 .../winapp/eal/include/exec-env/sched.h       |  41 +++
 .../winapp/eal/include/exec-env/sys/queue.h   | 320 ++++++++++++++++++
 .../winapp/eal/include/exec-env/unistd.h      |   7 +
 6 files changed, 467 insertions(+)
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/fnmatch.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/pthread.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/regex.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/sched.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/sys/queue.h
 create mode 100644 lib/librte_eal/winapp/eal/include/exec-env/unistd.h

diff --git a/lib/librte_eal/winapp/eal/include/exec-env/fnmatch.h b/lib/librte_eal/winapp/eal/include/exec-env/fnmatch.h
new file mode 100644
index 000000000..85a679aad
--- /dev/null
+++ b/lib/librte_eal/winapp/eal/include/exec-env/fnmatch.h
@@ -0,0 +1,26 @@
+/* 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(const char *pattern __rte_unused,
+		const char *string __rte_unused,
+		int flags __rte_unused)
+{
+	return FNM_NOMATCH;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FNMATCH_H_ */
diff --git a/lib/librte_eal/winapp/eal/include/exec-env/pthread.h b/lib/librte_eal/winapp/eal/include/exec-env/pthread.h
new file mode 100644
index 000000000..431550577
--- /dev/null
+++ b/lib/librte_eal/winapp/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/winapp/eal/include/exec-env/regex.h b/lib/librte_eal/winapp/eal/include/exec-env/regex.h
new file mode 100644
index 000000000..5a167833f
--- /dev/null
+++ b/lib/librte_eal/winapp/eal/include/exec-env/regex.h
@@ -0,0 +1,54 @@
+/* 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(regex_t *preg __rte_unused,
+		const char *regex __rte_unused, int cflags __rte_unused)
+{
+	return REG_ESPACE;
+}
+
+static inline int
+regexec(const regex_t *preg __rte_unused,
+		const char *string __rte_unused, size_t nmatch __rte_unused,
+		regmatch_t pmatch[] __rte_unused, int eflags __rte_unused)
+{
+	return REG_NOMATCH;
+}
+
+static inline size_t
+regerror(int errcode __rte_unused,
+		const regex_t *preg __rte_unused, char *errbuf,
+		size_t errbuf_size __rte_unused)
+{
+	if (errbuf) {
+		*errbuf = '\0';
+		return 1;
+	}
+	return 0;
+}
+
+static inline void
+regfree(regex_t *preg __rte_unused)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REGEX_H_ */
diff --git a/lib/librte_eal/winapp/eal/include/exec-env/sched.h b/lib/librte_eal/winapp/eal/include/exec-env/sched.h
new file mode 100644
index 000000000..b105c43c3
--- /dev/null
+++ b/lib/librte_eal/winapp/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/winapp/eal/include/exec-env/sys/queue.h b/lib/librte_eal/winapp/eal/include/exec-env/sys/queue.h
new file mode 100644
index 000000000..5ee4916ad
--- /dev/null
+++ b/lib/librte_eal/winapp/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/winapp/eal/include/exec-env/unistd.h b/lib/librte_eal/winapp/eal/include/exec-env/unistd.h
new file mode 100644
index 000000000..4973fc793
--- /dev/null
+++ b/lib/librte_eal/winapp/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] 18+ messages in thread

* [dpdk-dev] [PATCH 4/6] eal: add minimum viable code for eal on windows
  2019-03-01  7:18 [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Anand Rawat
                   ` (2 preceding siblings ...)
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 3/6] eal: Add headers for compatibility with windows environment Anand Rawat
@ 2019-03-01  7:18 ` Anand Rawat
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 5/6] examples: Add meson changes for windows Anand Rawat
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 18+ messages in thread
From: Anand Rawat @ 2019-03-01  7:18 UTC (permalink / raw)
  To: dev

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: Kadam, Pallavi <pallavi.kadam@intel.com>
Reviewed-by: Jeffrey B Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_eal/common/meson.build             |  43 ++---
 lib/librte_eal/winapp/eal/eal.c               |  70 ++++++++-
 lib/librte_eal/winapp/eal/eal_debug.c         |  13 +-
 lib/librte_eal/winapp/eal/eal_lcore.c         |  82 ++++++++--
 lib/librte_eal/winapp/eal/eal_thread.c        | 147 +++++++++++++++++-
 .../winapp/eal/include/exec-env/regex.h       |   2 +
 .../winapp/eal/include/exec-env/rte_windows.h |  21 +++
 lib/librte_eal/winapp/eal/meson.build         |   6 +-
 8 files changed, 343 insertions(+), 41 deletions(-)

diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 68ce11222..6ad5d2fb1 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -5,8 +5,13 @@ 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 +19,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 +48,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))
 	common_sources += eal_common_arch_sources
@@ -55,39 +71,26 @@ if host_machine.system() != 'windows'
 
 	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',
diff --git a/lib/librte_eal/winapp/eal/eal.c b/lib/librte_eal/winapp/eal/eal.c
index 134452a77..1c6923e20 100644
--- a/lib/librte_eal/winapp/eal/eal.c
+++ b/lib/librte_eal/winapp/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/winapp/eal/eal_debug.c b/lib/librte_eal/winapp/eal/eal_debug.c
index 868808ca9..72e5cb97e 100644
--- a/lib/librte_eal/winapp/eal/eal_debug.c
+++ b/lib/librte_eal/winapp/eal/eal_debug.c
@@ -2,10 +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/winapp/eal/eal_lcore.c b/lib/librte_eal/winapp/eal/eal_lcore.c
index 46418f38f..db9da6039 100644
--- a/lib/librte_eal/winapp/eal/eal_lcore.c
+++ b/lib/librte_eal/winapp/eal/eal_lcore.c
@@ -2,25 +2,89 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "rte_common.h"
+#include <stdint.h>
+#include <rte_windows.h>
 
- /* Get the cpu core id value */
-unsigned
-eal_cpu_core_id(unsigned lcore_id)
+/* global data structure that contains the CPU map */
+static struct _win_cpu_map {
+	unsigned numTotalProcessors;
+	unsigned numProcessorSockets;
+	unsigned numProcessorCores;
+	unsigned reserved;
+	struct _win_lcore_map {
+		uint8_t    socketid;
+		uint8_t    coreid;
+	} win_lcore_map[RTE_MAX_LCORE];
+} win_cpu_map = { 0 };
+
+
+void
+eal_create_cpu_map()
 {
-	return lcore_id;
+	win_cpu_map.numTotalProcessors =
+	GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
+
+	LOGICAL_PROCESSOR_RELATIONSHIP lprocRel;
+	DWORD  lprocInfoSize = 0;
+	BOOL bHyperThreadingEnabled = FALSE;
+
+	/* First get the processor package information */
+	lprocRel = RelationProcessorPackage;
+	/* Determine the size of buffer we need (pass NULL) */
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	win_cpu_map.numProcessorSockets = lprocInfoSize / 48;
+
+	lprocInfoSize = 0;
+	/* Next get the processor core information */
+	lprocRel = RelationProcessorCore;
+	GetLogicalProcessorInformationEx(lprocRel, NULL, &lprocInfoSize);
+	win_cpu_map.numProcessorCores = lprocInfoSize / 48;
+
+	if (win_cpu_map.numTotalProcessors > win_cpu_map.numProcessorCores)
+		bHyperThreadingEnabled = TRUE;
+
+	/* Distribute the socket and core ids appropriately
+	 * across the logical cores. For now, split the cores
+	 * equally across the sockets - might need to revisit this later
+	 */
+	unsigned lcore = 0;
+	for (unsigned socket = 0; socket <
+			win_cpu_map.numProcessorSockets; ++socket) {
+		for (unsigned core = 0; core < (win_cpu_map.numProcessorCores /
+				win_cpu_map.numProcessorSockets); ++core) {
+			win_cpu_map.win_lcore_map[lcore]
+					.socketid = socket;
+			win_cpu_map.win_lcore_map[lcore]
+					.coreid = core;
+			lcore++;
+			if (bHyperThreadingEnabled) {
+				win_cpu_map.win_lcore_map[lcore]
+					.socketid = socket;
+				win_cpu_map.win_lcore_map[lcore]
+					.coreid = core;
+				lcore++;
+			}
+		}
+	}
 }
 
 /* Check if a cpu is present by the presence of the cpu information for it */
 int
-eal_cpu_detected(unsigned lcore_id __rte_unused)
+eal_cpu_detected(unsigned lcore_id)
 {
-	return 1;
+	return (lcore_id < win_cpu_map.numTotalProcessors);
 }
 
 /* Get CPU socket id (NUMA node) for a logical core */
 unsigned
-eal_cpu_socket_id(unsigned cpu_id __rte_unused)
+eal_cpu_socket_id(unsigned lcore_id)
+{
+	return win_cpu_map.win_lcore_map[lcore_id].socketid;
+}
+
+/* Get the cpu core id value */
+unsigned
+eal_cpu_core_id(unsigned lcore_id)
 {
-	return 0;
+	return win_cpu_map.win_lcore_map[lcore_id].coreid;
 }
diff --git a/lib/librte_eal/winapp/eal/eal_thread.c b/lib/librte_eal/winapp/eal/eal_thread.c
index 222bd8f4d..27fd00705 100644
--- a/lib/librte_eal/winapp/eal/eal_thread.c
+++ b/lib/librte_eal/winapp/eal/eal_thread.c
@@ -1,15 +1,152 @@
 /* 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, _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 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 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 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 __rte_unused)
+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/winapp/eal/include/exec-env/regex.h b/lib/librte_eal/winapp/eal/include/exec-env/regex.h
index 5a167833f..482101b3c 100644
--- a/lib/librte_eal/winapp/eal/include/exec-env/regex.h
+++ b/lib/librte_eal/winapp/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/winapp/eal/include/exec-env/rte_windows.h b/lib/librte_eal/winapp/eal/include/exec-env/rte_windows.h
index 8e4dc72bb..b9831ee6f 100644
--- a/lib/librte_eal/winapp/eal/include/exec-env/rte_windows.h
+++ b/lib/librte_eal/winapp/eal/include/exec-env/rte_windows.h
@@ -9,13 +9,34 @@
 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);
+
+void
+eal_create_cpu_map();
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_eal/winapp/eal/meson.build b/lib/librte_eal/winapp/eal/meson.build
index 487055f80..10a8d034d 100644
--- a/lib/librte_eal/winapp/eal/meson.build
+++ b/lib/librte_eal/winapp/eal/meson.build
@@ -1,13 +1,13 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
-eal_inc += include_directories('include/exec-env')
+eal_inc += include_directories('include','include/exec-env')
 install_subdir('include/exec-env', install_dir: get_option('includedir'))
 
 env_objs = []
 env_headers = []
-env_sources = files('eal.c',
-	'eal_debug.c',
+env_sources = files('eal_debug.c',
 	'eal_lcore.c',
 	'eal_thread.c',
+	'eal.c'
 )
\ No newline at end of file
-- 
2.17.1.windows.2

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

* [dpdk-dev] [PATCH 5/6] examples: Add meson changes for windows
  2019-03-01  7:18 [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Anand Rawat
                   ` (3 preceding siblings ...)
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 4/6] eal: add minimum viable code for eal on windows Anand Rawat
@ 2019-03-01  7:18 ` Anand Rawat
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 6/6] doc: add documention " Anand Rawat
  2019-03-01 13:47 ` [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Bruce Richardson
  6 siblings, 0 replies; 18+ messages in thread
From: Anand Rawat @ 2019-03-01  7:18 UTC (permalink / raw)
  To: dev

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: Kadam, Pallavi <pallavi.kadam@intel.com>
Reviewed-by: Jeffrey B 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..3cec3d8bb 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) 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] 18+ messages in thread

* [dpdk-dev] [PATCH 6/6] doc: add documention for windows
  2019-03-01  7:18 [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Anand Rawat
                   ` (4 preceding siblings ...)
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 5/6] examples: Add meson changes for windows Anand Rawat
@ 2019-03-01  7:18 ` Anand Rawat
  2019-03-01 19:02   ` Stephen Hemminger
  2019-03-01 13:47 ` [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Bruce Richardson
  6 siblings, 1 reply; 18+ messages in thread
From: Anand Rawat @ 2019-03-01  7:18 UTC (permalink / raw)
  To: dev

Add documentation to build helloworld example
on windows using meson and clang.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
Reviewed-by: Jeffrey B Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 doc/guides/index.rst                  |  1 +
 doc/guides/windows_gsg/build_dpdk.rst | 76 +++++++++++++++++++++++++++
 doc/guides/windows_gsg/index.rst      | 14 +++++
 doc/guides/windows_gsg/intro.rst      | 20 +++++++
 4 files changed, 111 insertions(+)
 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/doc/guides/index.rst b/doc/guides/index.rst
index 8a9ed65c8..9dba6c80a 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -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..fc5bd6c5c
--- /dev/null
+++ b/doc/guides/windows_gsg/build_dpdk.rst
@@ -0,0 +1,76 @@
+..  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 either of the Ninja or Visual Studio 2017 backends.
+
+\*Other names and brands may be claimed as the property of others.
+
+Install the Compiler
+--------------------
+
+Download and install the compiler from LLVM* website.
+
+Install the Build System
+------------------------
+
+Download and install the build system from Meson's website.
+
+Install the Backend
+-------------------
+
+If using Ninja, download and install the backend from Ninja's website.
+If using Visual Studio 2017, download and install the backend from Microsoft's website.
+
+Build the code
+--------------
+
+The build environment is setup to build the EAL and the helloworld example by
+default.
+
+Using the vs2017 backend
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Open a "Developer Command Prompt" and navigate to the DPDK source directory. If
+using the vs2017 backend, with a build directory named `build`, type the
+following commands.
+
+.. code-block:: console
+
+    cd C:\Users\me\dpdk
+    meson build --backend=vs2017
+    cd build
+    msbuild DPDK.sln
+
+Alternatively, the DPDK.sln file can be compiled with a supported IDE.
+
+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 `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..87d7380b5
--- /dev/null
+++ b/doc/guides/windows_gsg/index.rst
@@ -0,0 +1,14 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2018 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] 18+ messages in thread

* Re: [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows
  2019-03-01  7:18 [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Anand Rawat
                   ` (5 preceding siblings ...)
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 6/6] doc: add documention " Anand Rawat
@ 2019-03-01 13:47 ` Bruce Richardson
  2019-03-04 10:13   ` David Marchand
  6 siblings, 1 reply; 18+ messages in thread
From: Bruce Richardson @ 2019-03-01 13:47 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev

On Thu, Feb 28, 2019 at 11:18:41PM -0800, Anand Rawat wrote:
> Helloworld example for Windows.
> Includes Windows-specific EAL changes and meson
> changes to build the code on Windows.
> 
> 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
> 
Thanks for this, it's good to see some progress here with small managable
patches.

I've just tried this on my laptop using clang + meson + ninja. I see some
warnings at the link phase due to unknown flags, but otherwise things
compile and link ok and I get helloworld app running and printing hello
from all cores. Specifying a coremask doesn't seem to work though - perhaps
something to look at for a V2.

Thanks,
/Bruce

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

* Re: [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support Anand Rawat
@ 2019-03-01 14:03   ` Thomas Monjalon
  2019-03-01 14:17     ` Bruce Richardson
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Monjalon @ 2019-03-01 14:03 UTC (permalink / raw)
  To: Anand Rawat
  Cc: dev, pallavi.kadam, jeffrey.b.shaw, ranjit.menon, bruce.richardson

01/03/2019 08:18, Anand Rawat:
> Added initial stub source files for windows support and meson
> changes to build them.

Thanks for sending some new patches based on meson.

Let's start review with some simple considerations.

> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>

Please avoid comma in names.
I think the right name is Pallavi Kadam?

> Reviewed-by: Jeffrey B Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>

Please make sure everybody involved here is in Cc of the emails.
Git should add them automatically.
Please add me as Cc of next versions. I'm interested in the start
of the Windows port. Thanks

[...]
> -# Copyright(c) 2017 Intel Corporation
> +# Copyright(c) 2019 Intel Corporation

I'm not sure you need to update the dates.
In case you need to, you should probably keep the original date.

> -# use pthreads
> -add_project_link_arguments('-pthread', language: 'c')
> -dpdk_extra_ldflags += '-pthread'
> +if host_machine.system() != 'windows'
> +	# use pthreads
> +	add_project_link_arguments('-pthread', language: 'c')
> +	dpdk_extra_ldflags += '-pthread'

Why pthreads is not used in Windows?

> -# some libs depend on maths lib
> -add_project_link_arguments('-lm', language: 'c')
> -dpdk_extra_ldflags += '-lm'
> +	# some libs depend on maths lib
> +	add_project_link_arguments('-lm', language: 'c')
> +	dpdk_extra_ldflags += '-lm'
> +endif

Why libmath is not used?

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

The real fix should be to check which linker is selected by meson.

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

[...]
> --- a/lib/librte_eal/common/include/arch/x86/meson.build
> +++ b/lib/librte_eal/common/include/arch/x86/meson.build
> -install_headers(
> -	'rte_atomic_32.h',
> -	'rte_atomic_64.h',
> -	'rte_atomic.h',
> -	'rte_byteorder_32.h',
> -	'rte_byteorder_64.h',
> -	'rte_byteorder.h',
> -	'rte_cpuflags.h',
> -	'rte_cycles.h',
> -	'rte_io.h',
> -	'rte_memcpy.h',
> -	'rte_prefetch.h',
> -	'rte_pause.h',
> -	'rte_rtm.h',
> -	'rte_rwlock.h',
> -	'rte_spinlock.h',
> -	'rte_vect.h',
> -	subdir: get_option('include_subdir_arch'))
> +if host_machine.system() != 'windows'
> +	install_headers(
> +		'rte_atomic_32.h',
> +		'rte_atomic_64.h',
> +		'rte_atomic.h',
> +		'rte_byteorder_32.h',
> +		'rte_byteorder_64.h',
> +		'rte_byteorder.h',
> +		'rte_cpuflags.h',
> +		'rte_cycles.h',
> +		'rte_io.h',
> +		'rte_memcpy.h',
> +		'rte_prefetch.h',
> +		'rte_pause.h',
> +		'rte_rtm.h',
> +		'rte_rwlock.h',
> +		'rte_spinlock.h',
> +		'rte_vect.h',
> +		subdir: get_option('include_subdir_arch')
> +	)
> +endif

The headers should not be different for Windows.
NACK for this part.

[...]
> @@ -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)

For consistency, it should RTE_EXEC_ENV_WINAPP.

> +	subdir('winapp/eal')
> +

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

* Re: [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support
  2019-03-01 14:03   ` Thomas Monjalon
@ 2019-03-01 14:17     ` Bruce Richardson
  2019-03-01 14:30       ` Thomas Monjalon
  2019-03-01 15:19       ` Luca Boccassi
  0 siblings, 2 replies; 18+ messages in thread
From: Bruce Richardson @ 2019-03-01 14:17 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Anand Rawat, dev, pallavi.kadam, jeffrey.b.shaw, ranjit.menon

On Fri, Mar 01, 2019 at 03:03:02PM +0100, Thomas Monjalon wrote:
> 01/03/2019 08:18, Anand Rawat:
> > Added initial stub source files for windows support and meson changes
> > to build them.
> 
> Thanks for sending some new patches based on meson.
> 
> Let's start review with some simple considerations.
> 
> > Signed-off-by: Anand Rawat <anand.rawat@intel.com> Signed-off-by:
> > Kadam, Pallavi <pallavi.kadam@intel.com>
> 
> Please avoid comma in names.  I think the right name is Pallavi Kadam?
> 
> > Reviewed-by: Jeffrey B Shaw <jeffrey.b.shaw@intel.com> Reviewed-by:
> > Ranjit Menon <ranjit.menon@intel.com>
> 
> Please make sure everybody involved here is in Cc of the emails.  Git
> should add them automatically.  Please add me as Cc of next versions. I'm
> interested in the start of the Windows port. Thanks
> 
> [...]
> > -# Copyright(c) 2017 Intel Corporation +# Copyright(c) 2019 Intel
> > Corporation
> 
> I'm not sure you need to update the dates.  In case you need to, you
> should probably keep the original date.
> 
> > -# use pthreads -add_project_link_arguments('-pthread', language: 'c')
> > -dpdk_extra_ldflags += '-pthread' +if host_machine.system() !=
> > 'windows' +	# use pthreads + add_project_link_arguments('-pthread',
> > language: 'c') + dpdk_extra_ldflags += '-pthread'
> 
> Why pthreads is not used in Windows?
> 
> > -# some libs depend on maths lib -add_project_link_arguments('-lm',
> > language: 'c') -dpdk_extra_ldflags += '-lm' +	# some libs depend
> > on maths lib +	add_project_link_arguments('-lm', language: 'c') +
> > dpdk_extra_ldflags += '-lm' +endif
> 
> Why libmath is not used?
> 
> >  # 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'
> 
> The real fix should be to check which linker is selected by meson.
> 
> > +	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
> 
> [...]
> > --- a/lib/librte_eal/common/include/arch/x86/meson.build +++
> > b/lib/librte_eal/common/include/arch/x86/meson.build -install_headers(
> > -	'rte_atomic_32.h', -	'rte_atomic_64.h', -	'rte_atomic.h', -
> > 'rte_byteorder_32.h', -	'rte_byteorder_64.h', -	'rte_byteorder.h',
> > -	'rte_cpuflags.h', -	'rte_cycles.h', -	'rte_io.h', -
> > 'rte_memcpy.h', -	'rte_prefetch.h', -	'rte_pause.h', -
> > 'rte_rtm.h', -	'rte_rwlock.h', -	'rte_spinlock.h', -
> > 'rte_vect.h', -	subdir: get_option('include_subdir_arch')) +if
> > host_machine.system() != 'windows' +	install_headers( +
> > 'rte_atomic_32.h', +		'rte_atomic_64.h', +
> > 'rte_atomic.h', +		'rte_byteorder_32.h', +
> > 'rte_byteorder_64.h', +		'rte_byteorder.h', +
> > 'rte_cpuflags.h', +		'rte_cycles.h', +		'rte_io.h',
> > +		'rte_memcpy.h', +		'rte_prefetch.h', +
> > 'rte_pause.h', +		'rte_rtm.h', +		'rte_rwlock.h', +
> > 'rte_spinlock.h', +		'rte_vect.h', +		subdir:
> > get_option('include_subdir_arch') +	) +endif
> 
> The headers should not be different for Windows.  NACK for this part.
> 
> [...]
> > @@ -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)
> 
> For consistency, it should RTE_EXEC_ENV_WINAPP.
> 
For this one you can partially blame me - early internal review suggested
changing to winapp, but I suggested holding off on the change for community
consensus. Personally, I  would prefer a little inconsistency and keep it
as windows for clarity. In future, I also think we should just rename
linxuapp to linux, and bsdapp to freebsd!

However, for now, if the majority prefer winapp, I'm ok with it. [Though I
can't help reading it as winamp half the time! No llamas involved here
though!]

/Bruce

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

* Re: [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support
  2019-03-01 14:17     ` Bruce Richardson
@ 2019-03-01 14:30       ` Thomas Monjalon
  2019-03-01 15:19       ` Luca Boccassi
  1 sibling, 0 replies; 18+ messages in thread
From: Thomas Monjalon @ 2019-03-01 14:30 UTC (permalink / raw)
  To: Bruce Richardson, Anand Rawat
  Cc: dev, pallavi.kadam, jeffrey.b.shaw, ranjit.menon

01/03/2019 15:17, Bruce Richardson:
> On Fri, Mar 01, 2019 at 03:03:02PM +0100, Thomas Monjalon wrote:
> > 01/03/2019 08:18, Anand Rawat:
> > > +elif host_machine.system() == 'windows' +
> > > dpdk_conf.set('RTE_EXEC_ENV_WINDOWS', 1)
> > 
> > For consistency, it should RTE_EXEC_ENV_WINAPP.
> > 
> For this one you can partially blame me - early internal review suggested
> changing to winapp, but I suggested holding off on the change for community
> consensus. Personally, I  would prefer a little inconsistency and keep it
> as windows for clarity. In future, I also think we should just rename
> linxuapp to linux, and bsdapp to freebsd!

OK I agree to remove APP suffixes.

> However, for now, if the majority prefer winapp, I'm ok with it. [Though I
> can't help reading it as winamp half the time! No llamas involved here
> though!]

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

* Re: [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support
  2019-03-01 14:17     ` Bruce Richardson
  2019-03-01 14:30       ` Thomas Monjalon
@ 2019-03-01 15:19       ` Luca Boccassi
  1 sibling, 0 replies; 18+ messages in thread
From: Luca Boccassi @ 2019-03-01 15:19 UTC (permalink / raw)
  To: Bruce Richardson, Thomas Monjalon
  Cc: Anand Rawat, dev, pallavi.kadam, jeffrey.b.shaw, ranjit.menon

On Fri, 2019-03-01 at 14:17 +0000, Bruce Richardson wrote:
> On Fri, Mar 01, 2019 at 03:03:02PM +0100, Thomas Monjalon wrote:
> > 01/03/2019 08:18, Anand Rawat:
> > > 
> > [...]
> > > @@ -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)
> > 
> > For consistency, it should RTE_EXEC_ENV_WINAPP.
> > 
> For this one you can partially blame me - early internal review
> suggested
> changing to winapp, but I suggested holding off on the change for
> community
> consensus. Personally, I  would prefer a little inconsistency and
> keep it
> as windows for clarity. In future, I also think we should just rename
> linxuapp to linux, and bsdapp to freebsd!
> 
> However, for now, if the majority prefer winapp, I'm ok with it.
> [Though I
> can't help reading it as winamp half the time! No llamas involved
> here
> though!]
> 
> /Bruce

We already have many utility libs and tools in DPDK, surely it's fine
to add userspace-accelerated MP3 playback too!

-- 
Kind regards,
Luca Boccassi

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

* Re: [dpdk-dev] [PATCH 6/6] doc: add documention for windows
  2019-03-01  7:18 ` [dpdk-dev] [PATCH 6/6] doc: add documention " Anand Rawat
@ 2019-03-01 19:02   ` Stephen Hemminger
  2019-03-02  2:41     ` Ranjit Menon
  0 siblings, 1 reply; 18+ messages in thread
From: Stephen Hemminger @ 2019-03-01 19:02 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev

On Thu, 28 Feb 2019 23:18:47 -0800
Anand Rawat <anand.rawat@intel.com> wrote:

> Add documentation to build helloworld example
> on windows using meson and clang.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
> Reviewed-by: Jeffrey B Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>

Please add an entry to the MAINTAINERS file for the Windows code.
Also, it might be good to have a git tree that can be used for merging and staging
like DPDK already has for Next-Net, Next-virtio, Next-Crypto, Next-Eventdev, ...

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

* Re: [dpdk-dev] [PATCH 6/6] doc: add documention for windows
  2019-03-01 19:02   ` Stephen Hemminger
@ 2019-03-02  2:41     ` Ranjit Menon
  2019-03-06  8:33       ` Thomas Monjalon
  0 siblings, 1 reply; 18+ messages in thread
From: Ranjit Menon @ 2019-03-02  2:41 UTC (permalink / raw)
  To: Stephen Hemminger, Anand Rawat; +Cc: dev

On 3/1/2019 11:02 AM, Stephen Hemminger wrote:
> On Thu, 28 Feb 2019 23:18:47 -0800
> Anand Rawat <anand.rawat@intel.com> wrote:
> 
>> Add documentation to build helloworld example
>> on windows using meson and clang.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
>> Reviewed-by: Jeffrey B Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> 
> Please add an entry to the MAINTAINERS file for the Windows code.
> Also, it might be good to have a git tree that can be used for merging and staging
> like DPDK already has for Next-Net, Next-virtio, Next-Crypto, Next-Eventdev, ...
> 
We don't have a next-* tree for Windows development, but we do have a 
draft repo. Thomas' plan was for these patches to be applied on a 
specific branch on the draft repo. Would that suffice?

ranjit m.

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

* Re: [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows
  2019-03-01 13:47 ` [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Bruce Richardson
@ 2019-03-04 10:13   ` David Marchand
  2019-03-04 10:14     ` David Marchand
  2019-03-05 23:43     ` Anand Rawat
  0 siblings, 2 replies; 18+ messages in thread
From: David Marchand @ 2019-03-04 10:13 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Anand Rawat, dev

On Fri, Mar 1, 2019 at 2:48 PM Bruce Richardson <bruce.richardson@intel.com>
wrote:

> On Thu, Feb 28, 2019 at 11:18:41PM -0800, Anand Rawat wrote:
> > Helloworld example for Windows.
> > Includes Windows-specific EAL changes and meson
> > changes to build the code on Windows.
> >
> > 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
> >
> Thanks for this, it's good to see some progress here with small managable
> patches.
>
> I've just tried this on my laptop using clang + meson + ninja. I see some
> warnings at the link phase due to unknown flags, but otherwise things
> compile and link ok and I get helloworld app running and printing hello
> from all cores. Specifying a coremask doesn't seem to work though - perhaps
> something to look at for a V2.
>

Some easy warnings to fix:

[dmarchan@dmarchan dpdk]$ ./devtools/checkpatches.sh

### eal: eal stub to add windows support

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#402: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:9:
+eal_cpu_core_id(unsigned lcore_id)

total: 0 errors, 1 warnings, 461 lines checked
Warning in /lib/librte_eal/winapp/eal/eal_debug.c:
Using rte_panic/rte_exit

### eal: add minimum viable code for eal on windows

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#239: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:10:
+    unsigned numTotalProcessors;

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#240: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:11:
+    unsigned numProcessorSockets;

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#241: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:12:
+    unsigned numProcessorCores;

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#242: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:13:
+    unsigned reserved;

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#280: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:50:
+    unsigned lcore = 0;

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#281: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:51:
+    for (unsigned socket = 0; socket <

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#283: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:53:
+        for (unsigned core = 0; core < (win_cpu_map.numProcessorCores /

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#304: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:73:
+eal_cpu_detected(unsigned lcore_id)

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#313: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:80:
+eal_cpu_socket_id(unsigned lcore_id)

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#320: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:87:
+eal_cpu_core_id(unsigned lcore_id)

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#348: FILE: lib/librte_eal/winapp/eal/eal_thread.c:15:
+RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#356: FILE: lib/librte_eal/winapp/eal/eal_thread.c:23:
+rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned slave_id)

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#388: FILE: lib/librte_eal/winapp/eal/eal_thread.c:55:
+eal_thread_init_master(unsigned lcore_id)

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#406: FILE: lib/librte_eal/winapp/eal/eal_thread.c:73:
+    unsigned lcore_id;

total: 0 errors, 14 warnings, 502 lines checked
Warning in /lib/librte_eal/winapp/eal/eal.c:
Using rte_panic/rte_exit

4/6 valid patches

[dmarchan@dmarchan dpdk]$ ./devtools/check-git-log.sh
Wrong headline uppercase:
    eal: Add header files to support windows
    eal: Add headers for compatibility with windows environment
    examples: Add meson changes for windows
Wrong tag:
    Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
    Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
    Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
    Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
    Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
    Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>


-- 
David Marchand

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

* Re: [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows
  2019-03-04 10:13   ` David Marchand
@ 2019-03-04 10:14     ` David Marchand
  2019-03-05 23:43     ` Anand Rawat
  1 sibling, 0 replies; 18+ messages in thread
From: David Marchand @ 2019-03-04 10:14 UTC (permalink / raw)
  To: Anand Rawat; +Cc: dev, Bruce Richardson

Sorry Bruce, wrong dest :-)


-- 
David Marchand

On Mon, Mar 4, 2019 at 11:13 AM David Marchand <david.marchand@redhat.com>
wrote:

>
>
> On Fri, Mar 1, 2019 at 2:48 PM Bruce Richardson <
> bruce.richardson@intel.com> wrote:
>
>> On Thu, Feb 28, 2019 at 11:18:41PM -0800, Anand Rawat wrote:
>> > Helloworld example for Windows.
>> > Includes Windows-specific EAL changes and meson
>> > changes to build the code on Windows.
>> >
>> > 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
>> >
>> Thanks for this, it's good to see some progress here with small managable
>> patches.
>>
>> I've just tried this on my laptop using clang + meson + ninja. I see some
>> warnings at the link phase due to unknown flags, but otherwise things
>> compile and link ok and I get helloworld app running and printing hello
>> from all cores. Specifying a coremask doesn't seem to work though -
>> perhaps
>> something to look at for a V2.
>>
>
> Some easy warnings to fix:
>
> [dmarchan@dmarchan dpdk]$ ./devtools/checkpatches.sh
>
> ### eal: eal stub to add windows support
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #402: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:9:
> +eal_cpu_core_id(unsigned lcore_id)
>
> total: 0 errors, 1 warnings, 461 lines checked
> Warning in /lib/librte_eal/winapp/eal/eal_debug.c:
> Using rte_panic/rte_exit
>
> ### eal: add minimum viable code for eal on windows
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #239: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:10:
> +    unsigned numTotalProcessors;
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #240: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:11:
> +    unsigned numProcessorSockets;
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #241: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:12:
> +    unsigned numProcessorCores;
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #242: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:13:
> +    unsigned reserved;
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #280: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:50:
> +    unsigned lcore = 0;
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #281: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:51:
> +    for (unsigned socket = 0; socket <
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #283: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:53:
> +        for (unsigned core = 0; core < (win_cpu_map.numProcessorCores /
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #304: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:73:
> +eal_cpu_detected(unsigned lcore_id)
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #313: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:80:
> +eal_cpu_socket_id(unsigned lcore_id)
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #320: FILE: lib/librte_eal/winapp/eal/eal_lcore.c:87:
> +eal_cpu_core_id(unsigned lcore_id)
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #348: FILE: lib/librte_eal/winapp/eal/eal_thread.c:15:
> +RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #356: FILE: lib/librte_eal/winapp/eal/eal_thread.c:23:
> +rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned slave_id)
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #388: FILE: lib/librte_eal/winapp/eal/eal_thread.c:55:
> +eal_thread_init_master(unsigned lcore_id)
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #406: FILE: lib/librte_eal/winapp/eal/eal_thread.c:73:
> +    unsigned lcore_id;
>
> total: 0 errors, 14 warnings, 502 lines checked
> Warning in /lib/librte_eal/winapp/eal/eal.c:
> Using rte_panic/rte_exit
>
> 4/6 valid patches
>
> [dmarchan@dmarchan dpdk]$ ./devtools/check-git-log.sh
> Wrong headline uppercase:
>     eal: Add header files to support windows
>     eal: Add headers for compatibility with windows environment
>     examples: Add meson changes for windows
> Wrong tag:
>     Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
>     Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
>     Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
>     Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
>     Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
>     Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
>
>
> --
> David Marchand
>

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

* Re: [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows
  2019-03-04 10:13   ` David Marchand
  2019-03-04 10:14     ` David Marchand
@ 2019-03-05 23:43     ` Anand Rawat
  1 sibling, 0 replies; 18+ messages in thread
From: Anand Rawat @ 2019-03-05 23:43 UTC (permalink / raw)
  To: David Marchand, Richardson, Bruce; +Cc: dev

On 3/4/2019 2:13 AM, David Marchand wrote:
> 
> 
> On Fri, Mar 1, 2019 at 2:48 PM Bruce Richardson 
> <bruce.richardson@intel.com <mailto:bruce.richardson@intel.com>> wrote:
> 
>     On Thu, Feb 28, 2019 at 11:18:41PM -0800, Anand Rawat wrote:
>      > Helloworld example for Windows.
>      > Includes Windows-specific EAL changes and meson
>      > changes to build the code on Windows.
>      >
>      > 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
>      >
>     Thanks for this, it's good to see some progress here with small
>     managable
>     patches.
> 
>     I've just tried this on my laptop using clang + meson + ninja. I see
>     some
>     warnings at the link phase due to unknown flags, but otherwise things
>     compile and link ok and I get helloworld app running and printing hello
>     from all cores. Specifying a coremask doesn't seem to work though -
>     perhaps
>     something to look at for a V2.
> 
> 
> Some easy warnings to fix:

This will be fixed in v2.
-- 
Anand Rawat

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

* Re: [dpdk-dev] [PATCH 6/6] doc: add documention for windows
  2019-03-02  2:41     ` Ranjit Menon
@ 2019-03-06  8:33       ` Thomas Monjalon
  0 siblings, 0 replies; 18+ messages in thread
From: Thomas Monjalon @ 2019-03-06  8:33 UTC (permalink / raw)
  To: Ranjit Menon, Stephen Hemminger; +Cc: dev, Anand Rawat

02/03/2019 03:41, Ranjit Menon:
> On 3/1/2019 11:02 AM, Stephen Hemminger wrote:
> > On Thu, 28 Feb 2019 23:18:47 -0800
> > Anand Rawat <anand.rawat@intel.com> wrote:
> > 
> >> Add documentation to build helloworld example
> >> on windows using meson and clang.
> >>
> >> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >> Signed-off-by: Kadam, Pallavi <pallavi.kadam@intel.com>
> >> Reviewed-by: Jeffrey B Shaw <jeffrey.b.shaw@intel.com>
> >> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > 
> > Please add an entry to the MAINTAINERS file for the Windows code.
> > Also, it might be good to have a git tree that can be used for merging and staging
> > like DPDK already has for Next-Net, Next-virtio, Next-Crypto, Next-Eventdev, ...
> > 
> We don't have a next-* tree for Windows development, but we do have a 
> draft repo. Thomas' plan was for these patches to be applied on a 
> specific branch on the draft repo. Would that suffice?

Yes, it's enough.
Please update your branch accordingly to help other contributors
work on top of the latest changes.

About next- branches, it is used for areas which have an identified
experienced maintainer. It is too early for Windows support.
I will take care of integrating the first patches in master when
the quality level will be sufficient.

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

end of thread, other threads:[~2019-03-06  8:33 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-01  7:18 [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Anand Rawat
2019-03-01  7:18 ` [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support Anand Rawat
2019-03-01 14:03   ` Thomas Monjalon
2019-03-01 14:17     ` Bruce Richardson
2019-03-01 14:30       ` Thomas Monjalon
2019-03-01 15:19       ` Luca Boccassi
2019-03-01  7:18 ` [dpdk-dev] [PATCH 2/6] eal: Add header files to support windows Anand Rawat
2019-03-01  7:18 ` [dpdk-dev] [PATCH 3/6] eal: Add headers for compatibility with windows environment Anand Rawat
2019-03-01  7:18 ` [dpdk-dev] [PATCH 4/6] eal: add minimum viable code for eal on windows Anand Rawat
2019-03-01  7:18 ` [dpdk-dev] [PATCH 5/6] examples: Add meson changes for windows Anand Rawat
2019-03-01  7:18 ` [dpdk-dev] [PATCH 6/6] doc: add documention " Anand Rawat
2019-03-01 19:02   ` Stephen Hemminger
2019-03-02  2:41     ` Ranjit Menon
2019-03-06  8:33       ` Thomas Monjalon
2019-03-01 13:47 ` [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Bruce Richardson
2019-03-04 10:13   ` David Marchand
2019-03-04 10:14     ` David Marchand
2019-03-05 23:43     ` 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).