DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anand Rawat <anand.rawat@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support
Date: Thu, 28 Feb 2019 23:18:42 -0800	[thread overview]
Message-ID: <20190301071847.13376-2-anand.rawat@intel.com> (raw)
In-Reply-To: <20190301071847.13376-1-anand.rawat@intel.com>

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

  reply	other threads:[~2019-03-01  7:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01  7:18 [dpdk-dev] [PATCH 0/6] HelloWorld example for Windows Anand Rawat
2019-03-01  7:18 ` Anand Rawat [this message]
2019-03-01 14:03   ` [dpdk-dev] [PATCH 1/6] eal: eal stub to add windows support 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190301071847.13376-2-anand.rawat@intel.com \
    --to=anand.rawat@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).