Skip to contentSkip to conversation

HelloWorld example for windows

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

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

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

In reply to Anand Rawat

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

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

83 lines not on this page · raw message

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

41 lines not on this page · raw message

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

Re: [PATCH v6 5/8] eal: add headers for compatibility with windows

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v6 5/8] eal: add headers for compatibility with windows

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

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

79 lines not on this page · raw message

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

41 lines not on this page · raw message

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

--
2.17.1.windows.2

#121 lore raw

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

In reply to Anand Rawat

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

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

116 lines not on this page · raw message

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

157 lines not on this page · raw message

lib/librte_eal/windows/eal/include/exec-env/regex.h +2 -0
index daa102f74..412b4edc5 100644
@@ -12,6 +12,8 @@ extern "C" {
 #define REG_NOMATCH 1
 #define REG_ESPACE 12
 
+#include <rte_common.h>
+
 /* defining regex_t for windows */
 typedef void *regex_t;
 /* defining regmatch_t for windows */
lib/librte_eal/windows/eal/include/exec-env/rte_os.h +20 -0
index 65230cae9..98b9c37cc 100644
@@ -9,7 +9,9 @@
 extern "C" {
 #endif
 
+#include <Windows.h>
 #include <BaseTsd.h>
+#include <pthread.h>
 
 /* macro substitution for windows supported strerror_r */
 #define strerror_r(a, b, c) strerror_s(b, c, a)
@@ -23,6 +25,24 @@ typedef SSIZE_T ssize_t;
 /* macro substitution for windows supported strtok_r */
 #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
 
+/**
+ * Create a thread.
+ * This function is private to EAL.
+ *
+ * @param thread
+ *   The location to store the thread id if successful.
+ * @return
+ *   0 for success, -1 if the thread is not created.
+ */
+int eal_thread_create(pthread_t *thread);
+
+/**
+ * Create a map of processors and cores on the system.
+ * This function is private to EAL.
+ *
+ */
+void eal_create_cpu_map(void);
+
 #ifdef __cplusplus
 }
 #endif
lib/librte_eal/windows/eal/meson.build +2 -0
index 8b1735623..6bc577e5c 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
Signature · 1 line
2.17.1.windows.2
Acked-by Reviewed-by Jeff Shaw Reviewed-by Ranjit Menon on v6 6/8
#122 lore raw

Re: [PATCH v6 6/8] eal: add minimum viable code for eal on windows

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v6 6/8] eal: add minimum viable code for eal on windows

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

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

107 lines not on this page · raw message

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

155 lines not on this page · raw message

lib/librte_eal/windows/eal/include/exec-env/regex.h +2 -0
index daa102f74..412b4edc5 100644
@@ -12,6 +12,8 @@ extern "C" {
 #define REG_NOMATCH 1
 #define REG_ESPACE 12
 
+#include <rte_common.h>
+
 /* defining regex_t for windows */
 typedef void *regex_t;
 /* defining regmatch_t for windows */
lib/librte_eal/windows/eal/include/exec-env/rte_os.h +2 -0
index 65230cae9..98b9c37cc 100644
@@ -9,7 +9,9 @@
 extern "C" {
 #endif
 
+#include <Windows.h>
 #include <BaseTsd.h>
+#include <pthread.h>
 
 /* macro substitution for windows supported strerror_r */  #define strerror_r(a, b, c) strerror_s(b, c, a) @@ -23,6 +25,24 @@ typedef SSIZE_T ssize_t;
 /* macro substitution for windows supported strtok_r */  #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)

+/**
+ * Create a thread.
+ * This function is private to EAL.
+ *
+ * @param thread
+ * The location to store the thread id if successful.
+ * @return
+ * 0 for success, -1 if the thread is not created.
+ */
+int eal_thread_create(pthread_t *thread);
+
+/**
+ * Create a map of processors and cores on the system.
+ * This function is private to EAL.
+ *
+ */
+void eal_create_cpu_map(void);
+
#ifdef __cplusplus
}
#endif

lib/librte_eal/windows/eal/meson.build +2 -1
index 8b1735623..6bc577e5c 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
--

2.17.1.windows.2

#123 lore raw

PATCH v6 7/8 doc: add documentation for windows

In reply to Anand Rawat

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

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

73 lines not on this page · raw message

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

Re: [PATCH v6 7/8] doc: add documentation for windows

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v6 7/8] doc: add documentation for windows

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

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

73 lines not on this page · raw message

+
+Navigate to the build directory and run dpdk-helloworld.exe. +
+.. code-block:: console
+

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

--
2.17.1.windows.2

#125 lore raw

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

In reply to Anand Rawat

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

---
 app/meson.build                   |  6 +++++-
 buildtools/meson.build            |  6 +++++-
 drivers/meson.build               |  6 +++++-
 examples/meson.build              |  6 +++++-
 kernel/windows/meson.build        |  4 ++++
 lib/librte_eal/common/meson.build | 14 +++++++++-----
 lib/meson.build                   |  4 ++++
 7 files changed, 37 insertions(+), 9 deletions(-)
 create mode 100644 kernel/windows/meson.build
app/meson.build +5 -1
index aa353f657..e949624b7 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 apps = [
 	'pdump',
buildtools/meson.build +5 -1
index cdd38ed24..0209bec8f 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 subdir('pmdinfogen')
 
drivers/meson.build +5 -1
index 8c76a5659..7520a16e3 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 # Defines the order in which the drivers are buit.
 dpdk_driver_classes = ['common',
examples/meson.build +5 -1
index af81c762e..bc1430fa8 100644
@@ -35,7 +35,11 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() != 'windows'
+		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	else
+		deps = ['eal'] # only supported lib on windows currently
+	endif
 	subdir(example)
 
 	if build
kernel/windows/meson.build new file +4 -0
new file mode 100644
index 000000000..c4a2a656a
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+# stub file for supporting windows logic in future release
\ No newline at end of file
lib/librte_eal/common/meson.build +9 -5
index 5ecae0b1f..e9021c00c 100644
@@ -1,23 +1,26 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 eal_inc += include_directories('.', 'include',
 		join_paths('include/arch', arch_subdir))
 
 common_objs = []
+common_sources = files(
+		'eal_common_errno.c',
+		'eal_common_launch.c',
+		'eal_common_lcore.c',
+		'eal_common_log.c'
+	)
+if host_machine.system() != 'windows'
 common_sources = files(
 	'eal_common_bus.c',
 	'eal_common_cpuflags.c',
 	'eal_common_class.c',
 	'eal_common_devargs.c',
 	'eal_common_dev.c',
-	'eal_common_errno.c',
 	'eal_common_fbarray.c',
 	'eal_common_hexdump.c',
 	'eal_common_hypervisor.c',
-	'eal_common_launch.c',
-	'eal_common_lcore.c',
-	'eal_common_log.c',
 	'eal_common_memalloc.c',
 	'eal_common_memory.c',
 	'eal_common_memzone.c',
@@ -38,6 +41,7 @@ common_sources = files(
 	'rte_reciprocal.c',
 	'rte_service.c'
 )
+endif
 
 # get architecture specific sources and objs
 eal_common_arch_sources = []
lib/meson.build +4 -0
index 9cba4662e..d3e556ae3 100644
@@ -30,6 +30,10 @@ libraries = [
 	# flow_classify lib depends on pkt framework table lib
 	'flow_classify', 'bpf', 'telemetry']
 
+if host_machine.system() == 'windows'
+	libraries = ['kvargs','eal'] # override libraries for windows
+endif
+
 default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
Signature · 1 line
2.17.1.windows.2
#126 lore raw

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

28/03/2019 03:21, Anand Rawat:

Quoted 4 lines

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

It is OK to merge few limited workarounds in the master branch, in order to start compiling something on Windows,
and regularly check that the work done is not broken
by other patches coming in.
It will be especially useful if we manage to have a CI for Windows.

Quoted 27 lines
lib/librte_eal/common/meson.build +7 -4
 common_objs = []
+common_sources = files(
+		'eal_common_errno.c',
+		'eal_common_launch.c',
+		'eal_common_lcore.c',
+		'eal_common_log.c'
+	)
+if host_machine.system() != 'windows'
 common_sources = files(
 	'eal_common_bus.c',
 	'eal_common_cpuflags.c',
 	'eal_common_class.c',
 	'eal_common_devargs.c',
 	'eal_common_dev.c',
-	'eal_common_errno.c',
 	'eal_common_fbarray.c',
 	'eal_common_hexdump.c',
 	'eal_common_hypervisor.c',
-	'eal_common_launch.c',
-	'eal_common_lcore.c',
-	'eal_common_log.c',
 	'eal_common_memalloc.c',
 	'eal_common_memory.c',
 	'eal_common_memzone.c',

lib/librte_eal/common/meson.build common_sources = files( · line 44

Quoted 4 lines
lib/librte_eal/common/meson.build +1 -0
@@ -38,6 +41,7 @@ common_sources = files(
 	'rte_reciprocal.c',
 	'rte_service.c'
 )
+endif

As discussed over the phone, it would be better to overwrite this list and keep the original one as is.

Thanks

Acked-by Reviewed-by Jeff Shaw Reviewed-by Ranjit Menon on v6 8/8
#127 lore raw

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

In reply to Anand Rawat

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v6 8/8] build: meson changes to build on windows

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

---
 app/meson.build                   |  6 +++++-
 buildtools/meson.build            |  6 +++++-
 drivers/meson.build               |  6 +++++-
 examples/meson.build              |  6 +++++-
 kernel/windows/meson.build        |  4 ++++
 lib/librte_eal/common/meson.build | 14 +++++++++-----
 lib/meson.build                   |  4 ++++
 7 files changed, 37 insertions(+), 9 deletions(-)  create mode 100644 kernel/windows/meson.build
app/meson.build +5 -0
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 apps = [
 	'pdump',
buildtools/meson.build +5 -0
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 subdir('pmdinfogen')
 
drivers/meson.build +5 -0
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 # Defines the order in which the drivers are buit.
 dpdk_driver_classes = ['common',
examples/meson.build +5 -1
@@ -35,7 +35,11 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() != 'windows'
+		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	else
+		deps = ['eal'] # only supported lib on windows currently
+	endif
 	subdir(example)
 
 	if build
kernel/windows/meson.build new file +4 -0
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel 
+Corporation
+
+# stub file for supporting windows logic in future release
\ No newline at end of file
lib/librte_eal/common/meson.build +13 -5
index 5ecae0b1f..e9021c00c 100644
@@ -1,23 +1,26 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 eal_inc += include_directories('.', 'include',
 		join_paths('include/arch', arch_subdir))
 
 common_objs = []
+common_sources = files(
+		'eal_common_errno.c',
+		'eal_common_launch.c',
+		'eal_common_lcore.c',
+		'eal_common_log.c'
+	)
+if host_machine.system() != 'windows'
 common_sources = files(
 	'eal_common_bus.c',
 	'eal_common_cpuflags.c',
 	'eal_common_class.c',
 	'eal_common_devargs.c',
 	'eal_common_dev.c',
-	'eal_common_errno.c',
 	'eal_common_fbarray.c',
 	'eal_common_hexdump.c',
 	'eal_common_hypervisor.c',
-	'eal_common_launch.c',
-	'eal_common_lcore.c',
-	'eal_common_log.c',
 	'eal_common_memalloc.c',
 	'eal_common_memory.c',
 	'eal_common_memzone.c',
@@ -38,6 +41,7 @@ common_sources = files(
 	'rte_reciprocal.c',
 	'rte_service.c'
 )
+endif
 
 # get architecture specific sources and objs  eal_common_arch_sources = [] diff --git a/lib/meson.build b/lib/meson.build index 9cba4662e..d3e556ae3 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -30,6 +30,10 @@ libraries = [
 	# flow_classify lib depends on pkt framework table lib
 	'flow_classify', 'bpf', 'telemetry']
 
+if host_machine.system() == 'windows'
+	libraries = ['kvargs','eal'] # override libraries for windows endif
+
 default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'

--
2.17.1.windows.2

Acked-by on the v6 series
#128 lore raw
In reply to Anand Rawat

-----Original Message-----
From: dev <[email protected]> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v6 0/8] HelloWorld example for windows

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

v6 Changes:
1. Introduced rte_os.h for esstential os specific macros and typedefs.
2. Fixed commit typos and 'new line required at eof' issues.

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

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

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

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

notes:
*patch 3/8 contains module definition files and meson changes required to build shared libraries on windows. These may be removed in the future releases to be generated from the existing .map files.

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

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

*kernel modules and documentation can not be built on windows currently and should not be enabled. Anand Rawat (8):
eal: eal stub to add windows support
eal: add header files to support os specifics
build: add module definition file for windows
eal: sys/queue.h implementation for windows
eal: add headers for compatibility with windows
eal: add minimum viable code for eal on windows
doc: add documentation for windows
build: meson changes to build on windows

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

--
2.17.1.windows.2

#129 lore raw

v7 cover HelloWorld example for windows

In reply to Anand Rawat

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

v7 Changes:
1. Fixed rte_os.h not found issue on linux and freebsd.
2. Fixed missing def issues on linux and freebsd.
3. Updated comments in header files to be more descriptive

v6 Changes:
1. Introduced rte_os.h for esstential os specific macros and typedefs.
2. Fixed commit typos and 'new line required at eof' issues.

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

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

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

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

notes:
*patch 3/8 contains module definition files and meson changes required to build shared libraries on windows. These may be removed in the future releases to be generated from the existing .map files.

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

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

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

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

 MAINTAINERS                                   |   7 +
 app/meson.build                               |   6 +-
 buildtools/meson.build                        |   6 +-
 config/meson.build                            |  23 +-
 config/x86/meson.build                        |  14 +-
 doc/guides/index.rst                          |   3 +-
 doc/guides/windows_gsg/build_dpdk.rst         |  73 ++++
 doc/guides/windows_gsg/index.rst              |  14 +
 doc/guides/windows_gsg/intro.rst              |  20 ++
 drivers/meson.build                           |   6 +-
 examples/meson.build                          |   8 +-
 kernel/windows/meson.build                    |   4 +
 lib/librte_eal/common/include/rte_common.h    |   5 +-
 .../common/include/rte_string_fns.h           |   4 +-
 .../freebsd/eal/include/exec-env/rte_os.h     |  10 +
 .../linux/eal/include/exec-env/rte_os.h       |   8 +
 lib/librte_eal/meson.build                    |   6 +-
 lib/librte_eal/rte_eal_exports.def            |   9 +
 lib/librte_eal/windows/eal/eal.c              |  84 +++++
 lib/librte_eal/windows/eal/eal_debug.c        |  19 ++
 lib/librte_eal/windows/eal/eal_lcore.c        | 100 ++++++
 lib/librte_eal/windows/eal/eal_thread.c       | 153 +++++++++
 .../windows/eal/include/exec-env/fnmatch.h    |  48 +++
 .../windows/eal/include/exec-env/pthread.h    |  27 ++
 .../windows/eal/include/exec-env/regex.h      |  90 +++++
 .../windows/eal/include/exec-env/rte_os.h     |  50 +++
 .../windows/eal/include/exec-env/sched.h      |  46 +++
 .../windows/eal/include/exec-env/unistd.h     |  12 +
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  18 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  19 +-
 meson.build                                   |   6 +-
 33 files changed, 1198 insertions(+), 27 deletions(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
 create mode 100644 kernel/windows/meson.build
 create mode 100644 lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/unistd.h
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
 create mode 100644 lib/librte_eal/windows/eal/meson.build
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
Signature · 1 line
2.17.1.windows.2
#130 lore raw

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

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

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

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

Quoted 35 lines · Anand Rawat

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

---
 config/meson.build                      | 23 ++++++++++++------
 config/x86/meson.build                  | 14 ++++++-----
 lib/librte_eal/meson.build              |  6 ++++-
 lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
 lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++
 lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++
 lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++
 lib/librte_eal/windows/eal/meson.build  | 10 ++++++++
 8 files changed, 118 insertions(+), 14 deletions(-)
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/meson.build
config/meson.build +1 -1
index 30a7261a5..4bd73b1e9 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # set the major version, which might be used by drivers and libraries
 # depending on the configuration options

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

Quoted 8 lines
config/meson.build +2 -3
@@ -80,18 +80,27 @@ dpdk_extra_ldflags += '-Wl,--no-as-needed'
 add_project_link_arguments('-pthread', language: 'c')
 dpdk_extra_ldflags += '-pthread'
 
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+# on some OS, maths functions are in a separate library
+if cc.find_library('lm', required : false).found()

The library is "libm", not "liblm" so this breaks the linux builds as there is not found an "lm" library. Instead use "cc.find_library('m',..."

/Bruce

#132 lore raw

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

In reply to Anand Rawat
Quoted 7 lines · Anand Rawat

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

Quoted 16 lines
---
 config/meson.build                      | 23 ++++++++++++------
 config/x86/meson.build                  | 14 ++++++-----
 lib/librte_eal/meson.build              |  6 ++++-
 lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
 lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++
 lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++
 lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++
 lib/librte_eal/windows/eal/meson.build  | 10 ++++++++
 8 files changed, 118 insertions(+), 14 deletions(-)
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/meson.build

I'm a little uncertain behind putting the stub files and the meson.build changes in the one patch, since the result doesn't build anyway. However, you can get meson to successfully configure the project on windows by adding in an empty file called meson.build to the kernel/windows directory.

/Bruce

#133 lore raw

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

Quoted 10 lines · Bruce Richardson
Quoted 8 lines · Anand Rawat
  config/meson.build                      | 23 ++++++++++++------
  config/x86/meson.build                  | 14 ++++++-----
  lib/librte_eal/meson.build              |  6 ++++-
  lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
  lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++
  lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++
  lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++
  lib/librte_eal/windows/eal/meson.build  | 10 ++++++++
Quoted 7 lines

I'm a little uncertain behind putting the stub files and the meson.build changes in the one patch, since the result doesn't build anyway. However, you can get meson to successfully configure the project on windows by adding in an empty file called meson.build to the kernel/windows directory.

/Bruce

Thanks Bruce, libm is a part of V8 fixes.
kernel/windows directory is the patch 8/8 as I thought of it as a temporary workaround. I'll move it to another patch along with meson changes here.

Signature · 1 line
Anand Rawat
#134 lore raw

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

Quoted 16 lines · Anand Rawat
Quoted 15 lines · Bruce Richardson
Quoted 8 lines · Anand Rawat
  config/meson.build                      | 23 ++++++++++++------
  config/x86/meson.build                  | 14 ++++++-----
  lib/librte_eal/meson.build              |  6 ++++-
  lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
  lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++
  lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++
  lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++
  lib/librte_eal/windows/eal/meson.build  | 10 ++++++++

I'm a little uncertain behind putting the stub files and the meson.build changes in the one patch, since the result doesn't build anyway. However, you can get meson to successfully configure the project on windows by adding in an empty file called meson.build to the kernel/windows directory.

Quoted 6 lines
Quoted 2 lines

/Bruce

Thanks Bruce, libm is a part of V8 fixes.
kernel/windows directory is the patch 8/8 as I thought of it as a temporary workaround. I'll move it to another patch along with meson changes here.

Oh, I wasn't thinking of it being temporary, as I assumed you had kernel modules for uio on windows. However, if they are not being hosted on DPDK, I still think having a directory with a meson.build file with just a comment in it e.g. "No kernel drivers for this OS", is probably tidier than having if conditions in the higher level build files.

#135 lore raw

PATCH v7 2/8 eal: add header files to support os specifics

In reply to Anand Rawat

Added rte_os.h files to support os specific functionality. Updated rte_common.h to include rte_os.h. Updated lib/meson.build to inject rte_os.h in every library.

---
 lib/librte_eal/common/include/rte_common.h    |  5 +++-
 .../common/include/rte_string_fns.h           |  4 ++-
 .../freebsd/eal/include/exec-env/rte_os.h     | 10 +++++++
 .../linux/eal/include/exec-env/rte_os.h       |  8 +++++
 .../windows/eal/include/exec-env/rte_os.h     | 30 +++++++++++++++++++
 meson.build                                   |  6 ++--
 6 files changed, 59 insertions(+), 4 deletions(-)
 create mode 100644 lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/rte_os.h
lib/librte_eal/common/include/rte_common.h +4 -1
index bcf8afd39..3e4768f4a 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_
@@ -24,6 +24,9 @@ extern "C" {
 
 #include <rte_config.h>
 
+/* os specific include */
+#include <rte_os.h>
+
 #ifndef typeof
 #define typeof __typeof__
 #endif
lib/librte_eal/common/include/rte_string_fns.h +3 -1
index 85bfe6c9a..8bac8243c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 /**
@@ -18,6 +18,8 @@ extern "C" {
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
+
 /**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like
lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h new file +10 -0
new file mode 100644
index 000000000..bda0c2d92
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/* stub file for os specific logic */
+
+#endif /* _RTE_OS_H_ */
lib/librte_eal/linux/eal/include/exec-env/rte_os.h new file +8 -0
new file mode 100644
index 000000000..c43ec6da5
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+#endif /* _RTE_OS_H_ */
lib/librte_eal/windows/eal/include/exec-env/rte_os.h new file +30 -0
new file mode 100644
index 000000000..65230cae9
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+/* macro substitution for windows supported strerror_r */
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* macro substitution for windows supported strdup */
+#define strdup(str)	_strdup(str)
+
+/* macro substitution for windows supported ssize_t type */
+typedef SSIZE_T ssize_t;
+
+/* macro substitution for windows supported strtok_r */
+#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_OS_H_ */
meson.build +4 -2
index fa6bf3d07..62eb6b8cf 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	# Get version number from file.
@@ -23,7 +23,9 @@ dpdk_app_link_libraries = []
 # configure the build, and make sure configs here and in config folder are
 # able to be included in any file. We also store a global array of include dirs
 # for passing to pmdinfogen scripts
-global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
+global_inc = include_directories('.', 'config',
+			'lib/librte_eal/common/include',
+			'lib/librte_eal/@0@/eal/include/exec-env'.format(host_machine.system()))
 subdir('config')
 
 # build libs and drivers
Signature · 1 line
2.17.1.windows.2
#136 lore raw

Re: [PATCH v7 2/8] eal: add header files to support os specifics

Hi,

29/03/2019 00:24, Anand Rawat:

Quoted 8 lines

Added rte_os.h files to support os specific functionality. Updated rte_common.h to include rte_os.h. Updated lib/meson.build to inject rte_os.h in every library.

Quoted 7 lines
---
 lib/librte_eal/common/include/rte_common.h    |  5 +++-
 .../common/include/rte_string_fns.h           |  4 ++-
 .../freebsd/eal/include/exec-env/rte_os.h     | 10 +++++++
 .../linux/eal/include/exec-env/rte_os.h       |  8 +++++
 .../windows/eal/include/exec-env/rte_os.h     | 30 +++++++++++++++++++
 meson.build                                   |  6 ++--

An update of the legacy Makefiles is missing.
It should be something like that:

lib/librte_eal/freebsd/eal/Makefile +1 -1
@@ -86,7 +86,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
 CFLAGS_eal_hpet.o += -Wno-return-type
 endif
 
-INC :=  # no bsd specific headers
+INC := rte_os.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_FREEBSD)-include := $(addprefix include/,$(INC))
 
lib/librte_eal/linux/eal/Makefile +2 -1
@@ -93,7 +93,8 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
 CFLAGS_eal_thread.o += -Wno-return-type
 endif
 
-INC := rte_kni_common.h
+INC := rte_os.h
+INC += rte_kni_common.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUX)-include := $(addprefix include/,$(INC))
 
Quoted 3 lines
 create mode 100644 lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/exec-env/rte_os.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/rte_os.h

[...]

Quoted 1 line

+/* os specific include */

Please write OS (uppercase) in this comment and others, so we can understand it is an acronym.

Quoted 1 line

+#include <rte_os.h>

You don't prefix with exec-env/ sub-directory, unlike what is done for rte_kni_common.h, and I think it is a good idea.
However it will require one more patch to make it work with the make-based system which currently installs the include in exec-env/. I have just submitted such a patch to remove the exec-env/ directory both from installed and source hierarchy:

	https://patches.dpdk.org/patch/52031/

Please rebase on top of my patch and move rte_os.h one level upper. Thanks

One more nit:

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

Quoted 13 lines
lib/librte_eal/windows/eal/include/exec-env/rte_os.h new file +11 -0
+/* macro substitution for windows supported strerror_r */
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* macro substitution for windows supported strdup */
+#define strdup(str)	_strdup(str)
+
+/* macro substitution for windows supported ssize_t type */
+typedef SSIZE_T ssize_t;
+
+/* macro substitution for windows supported strtok_r */
+#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)

Please write Windows with first letter uppercase.
In this file, the comments looks superfluous and can be removed. Or you can replace by something like "There is no strdup in Microsoft libc."

#137 lore raw

Re: [PATCH v7 2/8] eal: add header files to support os specifics

Quoted 19 lines · Thomas Monjalon

Hi,

An update of the legacy Makefiles is missing.
It should be something like that:

lib/librte_eal/freebsd/eal/Makefile +1 -1
@@ -86,7 +86,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
  CFLAGS_eal_hpet.o += -Wno-return-type
  endif
 
-INC :=  # no bsd specific headers
+INC := rte_os.h
 
  SYMLINK-$(CONFIG_RTE_EXEC_ENV_FREEBSD)-include := $(addprefix include/,$(INC))
 

lib/librte_eal/linux/eal/Makefile ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) · line 100

Quoted 9 lines
lib/librte_eal/linux/eal/Makefile +2 -1
@@ -93,7 +93,8 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
  CFLAGS_eal_thread.o += -Wno-return-type
  endif
 
-INC := rte_kni_common.h
+INC := rte_os.h
+INC += rte_kni_common.h
 
  SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUX)-include := $(addprefix include/,$(INC))
 

Adding the change to v8 along with a change in mk/target/<os>/rte.vars.mk to include path 'librte_eal/<OS>/eal/include' for rte_os.h. This is done to make it available during the build process.

Signature · 1 line
Anand Rawat
#138 lore raw

PATCH v7 3/8 build: add module definition file for windows

In reply to Anand Rawat

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

---
 lib/librte_eal/rte_eal_exports.def       |  9 +++++++++
 lib/librte_kvargs/rte_kvargs_exports.def |  7 +++++++
 lib/meson.build                          | 15 ++++++++++++---
 3 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
lib/librte_eal/rte_eal_exports.def new file +9 -0
new file mode 100644
index 000000000..12a6c79d6
@@ -0,0 +1,9 @@
+EXPORTS
+	__rte_panic
+	rte_eal_get_configuration
+	rte_eal_init
+	rte_eal_mp_remote_launch
+	rte_eal_mp_wait_lcore
+	rte_eal_remote_launch
+	rte_log
+	rte_vlog
lib/librte_kvargs/rte_kvargs_exports.def new file +7 -0
new file mode 100644
index 000000000..10e839e00
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
lib/meson.build +12 -3
index 99957ba7d..a7b5a9194 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible
@@ -117,14 +117,23 @@ foreach l:libraries
 			objs += static_lib.extract_all_objects(recursive: false)
 			version_map = '@0@/@1@/rte_@2@_version.map'.format(
 					meson.current_source_dir(), dir_name, name)
+			exports = []
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+				lk_args = ['-Wl,/def:' + exports, '-Wl,/implib:lib\\' + implib]
+			else
+				lk_args = ['-Wl,--version-script=' + version_map]
+			endif
 			shared_lib = shared_library(libname,
 					sources,
 					objects: objs,
 					c_args: cflags,
 					dependencies: shared_deps,
 					include_directories: includes,
-					link_args: '-Wl,--version-script=' + version_map,
-					link_depends: version_map,
+					link_args: lk_args,
+					link_depends: [version_map, exports],
 					version: lib_version,
 					soversion: so_version,
 					install: true)
Signature · 1 line
2.17.1.windows.2
#139 lore raw

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

In reply to Anand Rawat

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

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

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

In reply to Anand Rawat

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

---
 .../windows/eal/include/exec-env/fnmatch.h    | 48 ++++++++++
 .../windows/eal/include/exec-env/pthread.h    | 27 ++++++
 .../windows/eal/include/exec-env/regex.h      | 88 +++++++++++++++++++
 .../windows/eal/include/exec-env/sched.h      | 46 ++++++++++
 .../windows/eal/include/exec-env/unistd.h     | 12 +++
 5 files changed, 221 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/exec-env/unistd.h
lib/librte_eal/windows/eal/include/exec-env/fnmatch.h new file +48 -0
new file mode 100644
index 000000000..0a70c4c26
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+/**
+ * This file is required to support the common code in eal_common_log.c
+ * as windows C lib does not contain fnmatch.h. This may be removed in
+ * future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FNM_NOMATCH 1
+
+/**
+ * This function is used for searhing a given string source
+ * with the given regular expression pattern.
+ *
+ * @param pattern
+ *	regular expression notation decribing the pattern to match
+ *
+ * @param string
+ *	source string to searcg for the pattern
+ *
+ * @param flag
+ *	containing information about the pattern
+ *
+ * @return
+ *	if the pattern is found then return 0 or else FNM_NOMATCH
+ */
+static inline int fnmatch(__rte_unused const char *pattern,
+		__rte_unused const char *string,
+		__rte_unused int flags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return FNM_NOMATCH;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FNMATCH_H_ */
lib/librte_eal/windows/eal/include/exec-env/pthread.h new file +27 -0
new file mode 100644
index 000000000..63054ffb2
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+/**
+ * This file is required to support the common code in eal_common_proc.c,
+ * eal_common_thread.c and common\include\rte_per_lcore.h as windows C lib
+ * does not contain pthread.h. This may be removed in future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* defining pthread_t type on windows */
+typedef uintptr_t pthread_t;
+
+/* defining pthread_attr_t type on windows */
+typedef void *pthread_attr_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PTHREAD_H_ */
lib/librte_eal/windows/eal/include/exec-env/regex.h new file +88 -0

88 lines not on this page · raw message

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

46 lines not on this page · raw message

lib/librte_eal/windows/eal/include/exec-env/unistd.h new file +12 -0
new file mode 100644
index 000000000..546e70b56
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+/**
+ * This file is added to support common code in eal_common_lcore.c
+ * as windows C lib does not contain unistd.h. This may be removed
+ * in future releases.
+ */
+#endif /* _UNISTD_H_ */
Signature · 1 line
2.17.1.windows.2
#141 lore raw

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

In reply to Anand Rawat

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

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

116 lines not on this page · raw message

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

157 lines not on this page · raw message

lib/librte_eal/windows/eal/include/exec-env/regex.h +2 -0
index df05af56f..914cdf08e 100644
@@ -17,6 +17,8 @@ extern "C" {
 #define REG_NOMATCH 1
 #define REG_ESPACE 12
 
+#include <rte_common.h>
+
 /* defining regex_t for windows */
 typedef void *regex_t;
 /* defining regmatch_t for windows */
lib/librte_eal/windows/eal/include/exec-env/rte_os.h +20 -0
index 65230cae9..98b9c37cc 100644
@@ -9,7 +9,9 @@
 extern "C" {
 #endif
 
+#include <Windows.h>
 #include <BaseTsd.h>
+#include <pthread.h>
 
 /* macro substitution for windows supported strerror_r */
 #define strerror_r(a, b, c) strerror_s(b, c, a)
@@ -23,6 +25,24 @@ typedef SSIZE_T ssize_t;
 /* macro substitution for windows supported strtok_r */
 #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
 
+/**
+ * Create a thread.
+ * This function is private to EAL.
+ *
+ * @param thread
+ *   The location to store the thread id if successful.
+ * @return
+ *   0 for success, -1 if the thread is not created.
+ */
+int eal_thread_create(pthread_t *thread);
+
+/**
+ * Create a map of processors and cores on the system.
+ * This function is private to EAL.
+ *
+ */
+void eal_create_cpu_map(void);
+
 #ifdef __cplusplus
 }
 #endif
lib/librte_eal/windows/eal/meson.build +2 -0
index 8b1735623..6bc577e5c 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
Signature · 1 line
2.17.1.windows.2
#142 lore raw

PATCH v7 7/8 doc: add documentation for windows

In reply to Anand Rawat

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

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

73 lines not on this page · raw message

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

Re: [PATCH v7 7/8] doc: add documentation for windows

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

Verified build on Windows

#144 lore raw

Re: [PATCH v7 7/8] doc: add documentation for windows

In reply to Anand Rawat

29/03/2019 00:24, Anand Rawat:

Quoted 3 lines

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

[...]

MAINTAINERS FreeBSD UIO · line 291

Quoted 8 lines
MAINTAINERS +6 -0
+Windows support
+M: Harini Ramakrishnan <[email protected]>
+M: Omar Cardona <[email protected]>
+M: Anand Rawat <[email protected]>
+M: Ranjit Menon <[email protected]>
+F: lib/librte_eal/windows/

This change should be in the first patch (when introducing eal/windows). In this doc patch, you should add
F: doc/guides/windows_gsg/

[...]

MAINTAINERS

Quoted 4 lines
MAINTAINERS +4 -0
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.

This sentence looks weird. What does it mean?

[...]

Quoted 1 line

+Download and install the clang compiler from LLVM* website <http://releases.llvm.org/download.html>_.

Why is there an asterisk after LLVM?

[...]

MAINTAINERS

Quoted 2 lines
MAINTAINERS +2 -0
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.

Please try to limit the line length.
We are supposed to not exceed 80-chars if possible. The best is to wrap lines logically (as in code) after a comma or a point, etc.

[...]

MAINTAINERS

Quoted 6 lines
MAINTAINERS +6 -0
+    cd C:\Users\me\dpdk\build
+    helloworld.exe
+    hello from core 1
+    hello from core 3
+    hello from core 0
+    hello from core 2

That's definitely a good goal for release 19.05!

MAINTAINERS

Quoted 7 lines
MAINTAINERS +7 -0
+Limitations
+===========
+
+DPDK for Windows is currently a work in progress. Not all DPDK source files
+compile. Support is being added in pieces so as to limit the overall scope
+of any individual patch series. The goal is to be able to run any DPDK
+application natively on Windows.

Yes

#145 lore raw

Re: [PATCH v7 7/8] doc: add documentation for windows

Quoted 5 lines · Thomas Monjalon

29/03/2019 00:24, Anand Rawat:

Quoted 3 lines

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

[...]

Quoted 11 lines

MAINTAINERS FreeBSD UIO · line 291

Quoted 8 lines
MAINTAINERS +6 -0
+Windows support
+M: Harini Ramakrishnan <[email protected]>
+M: Omar Cardona <[email protected]>
+M: Anand Rawat <[email protected]>
+M: Ranjit Menon <[email protected]>
+F: lib/librte_eal/windows/

This change should be in the first patch (when introducing eal/windows). In this doc patch, you should add
F: doc/guides/windows_gsg/

Ok, will be done in the coming patch v8.

Quoted 7 lines

[...]

MAINTAINERS

Quoted 4 lines
MAINTAINERS +4 -0
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.

This sentence looks weird. What does it mean?

Thought of adding asterisk in front of names and brands

those are claimed from other websites/ organizations

for instance, MSFT, LLVM.

Can be removed, if not required.

Quoted 4 lines

[...]

Quoted 1 line

+Download and install the clang compiler from LLVM* website <http://releases.llvm.org/download.html>_.

Why is there an asterisk after LLVM?

As the link has been copied from LLVM website (other property).

Can be removed, if not required.

Quoted 8 lines

[...]

MAINTAINERS

Quoted 2 lines
MAINTAINERS +2 -0
+Download and install the Build Tools for Visual Studio to link and build the files on windows, from `Microsoft* website <https://visualstudio.microsoft.com/downloads>`_.
+When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected.

Please try to limit the line length.
We are supposed to not exceed 80-chars if possible. The best is to wrap lines logically (as in code) after a comma or a point, etc.

Will limit the line length in v8.

Quoted 20 lines

[...]

MAINTAINERS

Quoted 6 lines
MAINTAINERS +6 -0
+    cd C:\Users\me\dpdk\build
+    helloworld.exe
+    hello from core 1
+    hello from core 3
+    hello from core 0
+    hello from core 2

That's definitely a good goal for release 19.05!

MAINTAINERS

Quoted 7 lines
MAINTAINERS +7 -0
+Limitations
+===========
+
+DPDK for Windows is currently a work in progress. Not all DPDK source files
+compile. Support is being added in pieces so as to limit the overall scope
+of any individual patch series. The goal is to be able to run any DPDK
+application natively on Windows.

Yes

#146 lore raw

Re: [PATCH v7 7/8] doc: add documentation for windows

02/04/2019 03:01, Pallavi Kadam:

Quoted 18 lines · Thomas Monjalon
Quoted 6 lines

29/03/2019 00:24, Anand Rawat:

doc/guides/windows_gsg/build_dpdk.rst line 13

Quoted 4 lines
doc/guides/windows_gsg/build_dpdk.rst new file +4 -0
+The DPDK and its applications require the Clang-LLVM* C compiler and MSVC* linker.
+The Meson* Build system is used to prepare the sources for compilation with the Ninja backend.
+
+\*Other names and brands may be claimed as the property of others.

This sentence looks weird. What does it mean?

Thought of adding asterisk in front of names and brands

those are claimed from other websites/ organizations

for instance, MSFT, LLVM.

Can be removed, if not required.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

[...]

Quoted 1 line

+Download and install the clang compiler from LLVM* website <http://releases.llvm.org/download.html>_.

Why is there an asterisk after LLVM?

As the link has been copied from LLVM website (other property).

Can be removed, if not required.

Usually, we do not consider such "legal text". It looks weird.

#147 lore raw

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

In reply to Anand Rawat

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

---
 app/meson.build                        | 6 +++++-
 buildtools/meson.build                 | 6 +++++-
 drivers/meson.build                    | 6 +++++-
 examples/meson.build                   | 8 ++++++--
 kernel/windows/meson.build             | 4 ++++
 lib/librte_eal/windows/eal/meson.build | 6 ++++++
 lib/meson.build                        | 4 ++++
 7 files changed, 35 insertions(+), 5 deletions(-)
 create mode 100644 kernel/windows/meson.build
app/meson.build +5 -1
index aa353f657..e949624b7 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 apps = [
 	'pdump',
buildtools/meson.build +5 -1
index cdd38ed24..0209bec8f 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 subdir('pmdinfogen')
 
drivers/meson.build +5 -1
index 8c76a5659..7520a16e3 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 # Defines the order in which the drivers are buit.
 dpdk_driver_classes = ['common',
examples/meson.build +6 -2
index af81c762e..015b26f73 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 driver_libs = []
 if get_option('default_library') == 'static'
@@ -35,7 +35,11 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() != 'windows'
+		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	else
+		deps = ['eal'] # only supported lib on windows currently
+	endif
 	subdir(example)
 
 	if build
kernel/windows/meson.build new file +4 -0
new file mode 100644
index 000000000..45adcd138
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+# stub file for supporting windows logic in future release
lib/librte_eal/windows/eal/meson.build +6 -0
index 6bc577e5c..e9b7138c5 100644
@@ -5,6 +5,12 @@ eal_inc += include_directories('include')
 
 env_objs = []
 env_headers = []
+common_sources = files(
+	'../../common/eal_common_errno.c',
+	'../../common/eal_common_launch.c',
+	'../../common/eal_common_lcore.c',
+	'../../common/eal_common_log.c'
+)
 env_sources = files('eal.c',
 	'eal_debug.c',
 	'eal_lcore.c',
lib/meson.build +4 -0
index a7b5a9194..c3289f885 100644
@@ -30,6 +30,10 @@ libraries = [
 	# flow_classify lib depends on pkt framework table lib
 	'flow_classify', 'bpf', 'telemetry']
 
+if host_machine.system() == 'windows'
+	libraries = ['kvargs','eal'] # only supported libraries for windows
+endif
+
 default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
Signature · 1 line
2.17.1.windows.2
#148 lore raw

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

29/03/2019 00:24, Anand Rawat:

Quoted 4 lines

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

[...]

app/meson.build line 6

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

Not sure this change deserves a copyright update :)

examples/meson.build foreach example: examples · line 38

Quoted 3 lines
examples/meson.build +0 -1
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']

Please keep this line intact.

examples/meson.build foreach example: examples · line 42

Quoted 5 lines
examples/meson.build +5 -0
+	if host_machine.system() != 'windows'
+		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	else
+		deps = ['eal'] # only supported lib on windows currently
+	endif

You could override deps for Windows only.

Other workarounds look reasonnable. Thanks

#149 lore raw

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

Quoted 6 lines · Thomas Monjalon

29/03/2019 00:24, Anand Rawat:

Quoted 4 lines

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

[...]

Quoted 12 lines

app/meson.build line 6

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

Not sure this change deserves a copyright update :)

I am not sure either, basic principle that I am following is if any file is touched with some code/logic the license should be updated. Do correct me if I am wrong. I can make the changes accordingly in the future releases.

Quoted 7 lines

examples/meson.build foreach example: examples · line 38

Quoted 4 lines
examples/meson.build +0 -1
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']

Please keep this line intact.

Quoted 8 lines

examples/meson.build foreach example: examples · line 42

Quoted 5 lines
examples/meson.build +5 -0
+	if host_machine.system() != 'windows'
+		deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	else
+		deps = ['eal'] # only supported lib on windows currently
+	endif

You could override deps for Windows only.

Will be updated in v8

Signature · 1 line
Anand Rawat
#151 lore raw

v8 cover HelloWorld example for Windows

In reply to Anand Rawat

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

v8 Changes:
1. Fixed rte_os.h not found issue on linux and freebsd.
2. Updated make build system to include path for rte_os.h.
3. Fixed math lib error on linux.
4. Separated eal logic and build changes.

v7 Changes:
1. Fixed missing def issues on linux and freebsd.
2. Updated comments in header files to be more descriptive

v6 Changes:
1. Introduced rte_os.h for esstential os specific macros and typedefs.
2. Fixed commit typos and 'new line required at eof' issues.

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

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

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

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

notes:
*This patch is based on https://patches.dpdk.org/patch/52031/
and it is required to cleanly apply patch 3/10

*patch 5/10 contains module definition files and meson changes required to build shared libraries on windows. These may be removed in the future releases to be generated from the existing .map files.

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

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

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

Anand Rawat (10):
eal: eal stub to add windows support
meson: required changes for windows
eal: add new rte_os.h header to build system
eal: update common headers to use rte_os.h
build: add module definition file for windows
eal: sys/queue.h implementation for windows
eal: add headers for compatibility with windows
eal: add minimum viable code for eal on windows
doc: add documentation for windows
build: meson changes to build on windows

 MAINTAINERS                                   |   8 +
 app/meson.build                               |   6 +-
 buildtools/meson.build                        |   6 +-
 config/meson.build                            |  23 +-
 config/x86/meson.build                        |  14 +-
 doc/guides/index.rst                          |   3 +-
 doc/guides/windows_gsg/build_dpdk.rst         |  81 +++++
 doc/guides/windows_gsg/index.rst              |  14 +
 doc/guides/windows_gsg/intro.rst              |  20 ++
 drivers/meson.build                           |   6 +-
 examples/meson.build                          |   6 +-
 kernel/windows/meson.build                    |   4 +
 lib/librte_eal/common/include/rte_common.h    |   5 +-
 .../common/include/rte_string_fns.h           |   4 +-
 lib/librte_eal/freebsd/eal/Makefile           |   4 +-
 lib/librte_eal/freebsd/eal/include/rte_os.h   |  14 +
 lib/librte_eal/linux/eal/Makefile             |   3 +-
 lib/librte_eal/linux/eal/include/rte_os.h     |  14 +
 lib/librte_eal/meson.build                    |   6 +-
 lib/librte_eal/rte_eal_exports.def            |   9 +
 lib/librte_eal/windows/eal/eal.c              |  84 +++++
 lib/librte_eal/windows/eal/eal_debug.c        |  19 ++
 lib/librte_eal/windows/eal/eal_lcore.c        | 100 ++++++
 lib/librte_eal/windows/eal/eal_thread.c       | 153 +++++++++
 lib/librte_eal/windows/eal/include/fnmatch.h  |  48 +++
 lib/librte_eal/windows/eal/include/pthread.h  |  27 ++
 lib/librte_eal/windows/eal/include/regex.h    |  90 +++++
 lib/librte_eal/windows/eal/include/rte_os.h   |  53 +++
 lib/librte_eal/windows/eal/include/sched.h    |  46 +++
 .../windows/eal/include/sys/queue.h           | 320 ++++++++++++++++++
 lib/librte_eal/windows/eal/include/unistd.h   |  12 +
 lib/librte_eal/windows/eal/meson.build        |  18 +
 lib/librte_kvargs/rte_kvargs_exports.def      |   7 +
 lib/meson.build                               |  19 +-
 meson.build                                   |   6 +-
 mk/exec-env/freebsd/rte.vars.mk               |   5 +-
 mk/exec-env/linux/rte.vars.mk                 |   5 +-
 37 files changed, 1230 insertions(+), 32 deletions(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
 create mode 100644 kernel/windows/meson.build
 create mode 100644 lib/librte_eal/freebsd/eal/include/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/rte_os.h
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/rte_os.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/sys/queue.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
 create mode 100644 lib/librte_eal/windows/eal/meson.build
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
Signature · 1 line
2.17.1.windows.2
#152 lore raw

PATCH v8 1/10 eal: eal stub to add windows support

Added initial stub source files for windows support. Updated the MAINTAINERS list for windows support.

---
 MAINTAINERS                             |  7 ++++++
 lib/librte_eal/windows/eal/eal.c        | 14 +++++++++++
 lib/librte_eal/windows/eal/eal_debug.c  | 15 ++++++++++++
 lib/librte_eal/windows/eal/eal_lcore.c  | 32 +++++++++++++++++++++++++
 lib/librte_eal/windows/eal/eal_thread.c | 18 ++++++++++++++
 5 files changed, 86 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/eal.c
 create mode 100644 lib/librte_eal/windows/eal/eal_debug.c
 create mode 100644 lib/librte_eal/windows/eal/eal_lcore.c
 create mode 100644 lib/librte_eal/windows/eal/eal_thread.c
MAINTAINERS +7 -0
index 9f34f905f..5d70fba9b 100644
@@ -283,6 +283,13 @@ FreeBSD UIO
 M: Bruce Richardson <[email protected]>
 F: kernel/freebsd/nic_uio/
 
+Windows support
+M: Harini Ramakrishnan <[email protected]>
+M: Omar Cardona <[email protected]>
+M: Anand Rawat <[email protected]>
+M: Ranjit Menon <[email protected]>
+F: lib/librte_eal/windows/
+
 
 Core Libraries
 --------------
lib/librte_eal/windows/eal/eal.c new file +14 -0
new file mode 100644
index 000000000..37ed42233
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_common.h>
+
+ /* Launch threads, called at application init(). */
+int
+rte_eal_init(int argc __rte_unused, char **argv __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_debug.c new file +15 -0
new file mode 100644
index 000000000..a9705e257
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_common.h>
+
+ /* call abort(), it will generate a coredump if enabled */
+void
+__rte_panic(const char *funcname __rte_unused,
+		const char *format __rte_unused, ...)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	abort();
+}
lib/librte_eal/windows/eal/eal_lcore.c new file +32 -0
new file mode 100644
index 000000000..e4fcb2615
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_common.h>
+
+ /* Get the cpu core id value */
+unsigned int
+eal_cpu_core_id(unsigned int lcore_id)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return lcore_id;
+}
+
+/* Check if a cpu is present by the presence of the cpu information for it */
+int
+eal_cpu_detected(unsigned int lcore_id __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 1;
+}
+
+/* Get CPU socket id (NUMA node) for a logical core */
+unsigned int
+eal_cpu_socket_id(unsigned int cpu_id __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
lib/librte_eal/windows/eal/eal_thread.c new file +18 -0
new file mode 100644
index 000000000..f701443c3
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <windows.h>
+
+#include <rte_common.h>
+
+typedef uintptr_t eal_thread_t;
+
+/* function to create threads */
+int
+eal_thread_create(eal_thread_t *thread __rte_unused)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return 0;
+}
Signature · 1 line
2.17.1.windows.2
#153 lore raw

PATCH v8 2/10 meson: required changes for windows

In reply to Anand Rawat

These are the required meson changes for Windows. kernel/windows/meson is a stub file added to support Windows specific source in future releases.

---
 config/meson.build                     | 23 ++++++++++++++++-------
 config/x86/meson.build                 | 14 ++++++++------
 kernel/windows/meson.build             |  4 ++++
 lib/librte_eal/meson.build             |  6 +++++-
 lib/librte_eal/windows/eal/meson.build | 10 ++++++++++
 5 files changed, 43 insertions(+), 14 deletions(-)
 create mode 100644 kernel/windows/meson.build
 create mode 100644 lib/librte_eal/windows/eal/meson.build
config/meson.build +16 -7
index 30a7261a5..483139b10 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # set the major version, which might be used by drivers and libraries
 # depending on the configuration options
@@ -80,18 +80,27 @@ dpdk_extra_ldflags += '-Wl,--no-as-needed'
 add_project_link_arguments('-pthread', language: 'c')
 dpdk_extra_ldflags += '-pthread'
 
-# some libs depend on maths lib
-add_project_link_arguments('-lm', language: 'c')
-dpdk_extra_ldflags += '-lm'
+# on some OS, maths functions are in a separate library
+if cc.find_library('libm', required : false).found()
+	# some libs depend on maths lib
+	add_project_link_arguments('-lm', language: 'c')
+	dpdk_extra_ldflags += '-lm'
+endif
 
 # for linux link against dl, for bsd execinfo
 if host_machine.system() == 'linux'
 	link_lib = 'dl'
-else
+elif host_machine.system() == 'freebsd'
 	link_lib = 'execinfo'
+else
+	link_lib = ''
+endif
+
+# if link_lib is empty, do not add it to project properties
+if link_lib != ''
+	add_project_link_arguments('-l' + link_lib, language: 'c')
+	dpdk_extra_ldflags += '-l' + link_lib
 endif
-add_project_link_arguments('-l' + link_lib, language: 'c')
-dpdk_extra_ldflags += '-l' + link_lib
 
 # check for libraries used in multiple places in DPDK
 has_libnuma = 0
config/x86/meson.build +8 -6
index 7504cb9e5..558edfda9 100644
@@ -1,15 +1,17 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # for checking defines we need to use the correct compiler flags
 march_opt = ['-march=@0@'.format(machine)]
 
 # get binutils version for the workaround of Bug 97
-ldver = run_command('ld', '-v').stdout().strip()
-if ldver.contains('2.30')
-	if cc.has_argument('-mno-avx512f')
-		march_opt += '-mno-avx512f'
-		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+if host_machine.system() != 'windows'
+	ldver = run_command('ld', '-v').stdout().strip()
+	if ldver.contains('2.30')
+		if cc.has_argument('-mno-avx512f')
+			march_opt += '-mno-avx512f'
+			message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
+		endif
 	endif
 endif
 
kernel/windows/meson.build new file +4 -0
new file mode 100644
index 000000000..94c47682d
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+# stub file for supporting Windows logic in future release
lib/librte_eal/meson.build +5 -1
index d48c5e11d..1863622c0 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 # Custom EAL processing. EAL is complicated enough that it can't just
 # have a straight list of headers and source files.
@@ -17,6 +17,10 @@ elif host_machine.system() == 'freebsd'
 	dpdk_conf.set('RTE_EXEC_ENV_FREEBSD', 1)
 	subdir('freebsd/eal')
 
+elif host_machine.system() == 'windows'
+	dpdk_conf.set('RTE_EXEC_ENV_WINDOWS', 1)
+	subdir('windows/eal')
+
 else
 	error('unsupported system type "@0@"'.format(host_machine.system()))
 endif
lib/librte_eal/windows/eal/meson.build new file +10 -0
new file mode 100644
index 000000000..8b1735623
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+env_objs = []
+env_headers = []
+env_sources = files('eal.c',
+	'eal_debug.c',
+	'eal_lcore.c',
+	'eal_thread.c',
+)
Signature · 1 line
2.17.1.windows.2
#154 lore raw

Re: [PATCH v8 02/10] meson: required changes for windows

02/04/2019 05:54, Anand Rawat:

Quoted 4 lines

These are the required meson changes for Windows. kernel/windows/meson is a stub file added to support Windows specific source in future releases.

Quoted 8 lines
---
 config/meson.build                     | 23 ++++++++++++++++-------
 config/x86/meson.build                 | 14 ++++++++------
 kernel/windows/meson.build             |  4 ++++

For info, kernel/windows/ is not listed in MAINTAINERS. Will add it. If there is a different maintainer for the kernel part, you may create a new section in MAINTAINERS file later.

#155 lore raw

Re: [PATCH v8 02/10] meson: required changes for windows

Quoted 13 lines · Thomas Monjalon

02/04/2019 05:54, Anand Rawat:

Quoted 4 lines

These are the required meson changes for Windows. kernel/windows/meson is a stub file added to support Windows specific source in future releases.

Quoted 8 lines
---
  config/meson.build                     | 23 ++++++++++++++++-------
  config/x86/meson.build                 | 14 ++++++++------
  kernel/windows/meson.build             |  4 ++++
Quoted 3 lines

For info, kernel/windows/ is not listed in MAINTAINERS. Will add it. If there is a different maintainer for the kernel part, you may create a new section in MAINTAINERS file later.

Ok. Thanks, Thomas.

We will update the Maintainers list moving forward.

We can discuss more about it in the Bi-weekly meeting.

#156 lore raw

PATCH v8 3/10 eal: add new rte_os.h header to build system

In reply to Anand Rawat

Added rte_os.h files to support OS specific functionality. Updated build system to contain OS headers in the include path.

---
 lib/librte_eal/freebsd/eal/Makefile         |  4 ++--
 lib/librte_eal/freebsd/eal/include/rte_os.h | 14 ++++++++++++++
 lib/librte_eal/linux/eal/Makefile           |  3 ++-
 lib/librte_eal/linux/eal/include/rte_os.h   | 14 ++++++++++++++
 lib/librte_eal/windows/eal/include/rte_os.h | 14 ++++++++++++++
 meson.build                                 |  6 ++++--
 mk/exec-env/freebsd/rte.vars.mk             |  5 ++++-
 mk/exec-env/linux/rte.vars.mk               |  5 ++++-
 8 files changed, 58 insertions(+), 7 deletions(-)
 create mode 100644 lib/librte_eal/freebsd/eal/include/rte_os.h
 create mode 100644 lib/librte_eal/linux/eal/include/rte_os.h
 create mode 100644 lib/librte_eal/windows/eal/include/rte_os.h
lib/librte_eal/freebsd/eal/Makefile +2 -2
index 55d476e5b..19854ee2c 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2015 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
@@ -86,7 +86,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
 CFLAGS_eal_hpet.o += -Wno-return-type
 endif
 
-INC :=  # no bsd specific headers
+INC := rte_os.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_FREEBSD)-include := $(addprefix include/,$(INC))
 
lib/librte_eal/freebsd/eal/include/rte_os.h new file +14 -0
new file mode 100644
index 000000000..49cd4d4d9
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/**
+ * This is header should contain any function/macro definition
+ * which are not supported natively or named differently in the
+ * freebsd OS. Functions will be added in future releases.
+ */
+
+#endif /* _RTE_OS_H_ */
lib/librte_eal/linux/eal/Makefile +2 -1
index 2aa6e8c6a..6e5261152 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2016 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
@@ -94,6 +94,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
 endif
 
 INC := rte_kni_common.h
+INC += rte_os.h
 
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUX)-include := $(addprefix include/,$(INC))
 
lib/librte_eal/linux/eal/include/rte_os.h new file +14 -0
new file mode 100644
index 000000000..bc6ad14d2
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/**
+ * This is header should contain any function/macro definition
+ * which are not supported natively or named differently in the
+ * linux OS. Functions will be added in future releases.
+ */
+
+#endif /* _RTE_OS_H_ */
lib/librte_eal/windows/eal/include/rte_os.h new file +14 -0
new file mode 100644
index 000000000..421ed8e7f
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#ifndef _RTE_OS_H_
+#define _RTE_OS_H_
+
+/**
+ * This is header should contain any function/macro definition
+ * which are not supported natively or named differently in the
+ * Windows OS. Functions will be added in future releases.
+ */
+
+#endif /* _RTE_OS_H_ */
meson.build +4 -2
index 6061c4b1e..5a93c1f1a 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 project('DPDK', 'C',
 	# Get version number from file.
@@ -24,7 +24,9 @@ dpdk_app_link_libraries = []
 # configure the build, and make sure configs here and in config folder are
 # able to be included in any file. We also store a global array of include dirs
 # for passing to pmdinfogen scripts
-global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
+global_inc = include_directories('.', 'config',
+						'lib/librte_eal/common/include',
+						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))
 subdir('config')
 
 # build libs and drivers
mk/exec-env/freebsd/rte.vars.mk +4 -1
index c6be560b3..3608530d3 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2014 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 #
 # exec-env:
@@ -17,6 +17,9 @@ else
 EXECENV_CFLAGS  = -pthread
 endif
 
+# include in every library to build
+EXECENV_CFLAGS += -I$(RTE_SDK)/lib/librte_eal/freebsd/eal/include
+
 EXECENV_LDFLAGS =
 EXECENV_LDLIBS  = -lexecinfo
 EXECENV_ASFLAGS =
mk/exec-env/linux/rte.vars.mk +4 -1
index d04d0e29c..bea3f7657 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2014 Intel Corporation
+# Copyright(c) 2010-2019 Intel Corporation
 
 #
 # exec-env:
@@ -17,6 +17,9 @@ else
 EXECENV_CFLAGS  = -pthread
 endif
 
+# include in every library to build
+EXECENV_CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linux/eal/include
+
 EXECENV_LDLIBS  =
 EXECENV_ASFLAGS =
 
Signature · 1 line
2.17.1.windows.2
#157 lore raw

Re: [PATCH v8 03/10] eal: add new rte_os.h header to build system

02/04/2019 05:54, Anand Rawat:

meson.build dpdk_app_link_libraries = [] · line 29

Quoted 13 lines

Added rte_os.h files to support OS specific functionality. Updated build system to contain OS headers in the include path.

---

meson.build +3 -1
-global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
+global_inc = include_directories('.', 'config',
+						'lib/librte_eal/common/include',
+						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))

After having worked on rte_kni_common.h which is only in Linux, I think we should add rte_os.h in meson file of each OS:
- lib/librte_eal/linux/eal/meson.build
- lib/librte_eal/freebsd/eal/meson.build
- lib/librte_eal/windows/eal/meson.build

#158 lore raw

Re: [PATCH v8 03/10] eal: add new rte_os.h header to build system

02/04/2019 21:56, Thomas Monjalon:

Quoted 5 lines

02/04/2019 05:54, Anand Rawat:

Quoted 4 lines

Added rte_os.h files to support OS specific functionality. Updated build system to contain OS headers in the include path.

Quoted 15 lines

meson.build dpdk_app_link_libraries = [] · line 29

Quoted 9 lines

---

meson.build +3 -1
-global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
+global_inc = include_directories('.', 'config',
+						'lib/librte_eal/common/include',
+						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))

After having worked on rte_kni_common.h which is only in Linux, I think we should add rte_os.h in meson file of each OS:
- lib/librte_eal/linux/eal/meson.build
- lib/librte_eal/freebsd/eal/meson.build
- lib/librte_eal/windows/eal/meson.build

I confirm:
"global_inc" is used in "includes" variable but not in "headers" variable, so rte_os.h is not installed as other files in "headers".
We must fill "env_headers" which is pulled by:
headers = common_headers + env_headers

I will fix it before merging in master if you agree.

#159 lore raw

Re: [PATCH v8 03/10] eal: add new rte_os.h header to build system

Quoted 22 lines · Thomas Monjalon

02/04/2019 21:56, Thomas Monjalon:

Quoted 5 lines

02/04/2019 05:54, Anand Rawat:

Quoted 4 lines

Added rte_os.h files to support OS specific functionality. Updated build system to contain OS headers in the include path.

Quoted 15 lines

meson.build dpdk_app_link_libraries = [] · line 29

Quoted 9 lines

---

meson.build +3 -1
-global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
+global_inc = include_directories('.', 'config',
+						'lib/librte_eal/common/include',
+						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))

After having worked on rte_kni_common.h which is only in Linux, I think we should add rte_os.h in meson file of each OS:
- lib/librte_eal/linux/eal/meson.build
- lib/librte_eal/freebsd/eal/meson.build
- lib/librte_eal/windows/eal/meson.build

Quoted 9 lines

I confirm:
"global_inc" is used in "includes" variable but not in "headers" variable, so rte_os.h is not installed as other files in "headers".
We must fill "env_headers" which is pulled by:
headers = common_headers + env_headers

I will fix it before merging in master if you agree.

Agreed, env_headers need to be updated for rte_os.h.
I have tested the same and will incorporating the changes in v9. Please update this patch with your fix.

Signature · 1 line
Anand Rawat
#160 lore raw

Re: [PATCH v8 03/10] eal: add new rte_os.h header to build system

03/04/2019 00:11, Anand Rawat:

Quoted 29 lines · Thomas Monjalon
Quoted 28 lines

02/04/2019 21:56, Thomas Monjalon:

Quoted 5 lines

02/04/2019 05:54, Anand Rawat:

Quoted 4 lines

Added rte_os.h files to support OS specific functionality. Updated build system to contain OS headers in the include path.

Quoted 15 lines

meson.build dpdk_app_link_libraries = [] · line 29

Quoted 9 lines

---

meson.build +3 -1
-global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
+global_inc = include_directories('.', 'config',
+						'lib/librte_eal/common/include',
+						'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))

After having worked on rte_kni_common.h which is only in Linux, I think we should add rte_os.h in meson file of each OS:
- lib/librte_eal/linux/eal/meson.build
- lib/librte_eal/freebsd/eal/meson.build
- lib/librte_eal/windows/eal/meson.build

I confirm:
"global_inc" is used in "includes" variable but not in "headers" variable, so rte_os.h is not installed as other files in "headers".
We must fill "env_headers" which is pulled by:
headers = common_headers + env_headers

Quoted 5 lines
Quoted 2 lines

I will fix it before merging in master if you agree.

Agreed, env_headers need to be updated for rte_os.h.
I have tested the same and will incorporating the changes in v9. Please update this patch with your fix.

No need for a v9. Once it will be in master, new changes must be submitted in a separate patch.

#161 lore raw

Re: [PATCH v8 03/10] eal: add new rte_os.h header to build system

Quoted 30 lines · Thomas Monjalon

03/04/2019 00:11, Anand Rawat:

Quoted 29 lines · Thomas Monjalon
Quoted 28 lines

02/04/2019 21:56, Thomas Monjalon:

Quoted 5 lines

02/04/2019 05:54, Anand Rawat:

Quoted 4 lines

Added rte_os.h files to support OS specific functionality. Updated build system to contain OS headers in the include path.

Quoted 15 lines

meson.build dpdk_app_link_libraries = [] · line 29

Quoted 9 lines

---

meson.build +3 -1
-global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
+global_inc = include_directories('.', 'config',
+                        'lib/librte_eal/common/include',
+                        'lib/librte_eal/@0@/eal/include'.format(host_machine.system()))

After having worked on rte_kni_common.h which is only in Linux, I think we should add rte_os.h in meson file of each OS:
    - lib/librte_eal/linux/eal/meson.build
    - lib/librte_eal/freebsd/eal/meson.build
    - lib/librte_eal/windows/eal/meson.build

I confirm:
"global_inc" is used in "includes" variable but not in "headers" variable, so rte_os.h is not installed as other files in "headers".
We must fill "env_headers" which is pulled by:
    headers = common_headers + env_headers

Quoted 11 lines
Quoted 5 lines
Quoted 2 lines

I will fix it before merging in master if you agree.

Agreed, env_headers need to be updated for rte_os.h.
I have tested the same and will incorporating the changes in v9. Please update this patch with your fix.

No need for a v9. Once it will be in master, new changes must be submitted in a separate patch.

Understood. Thanks :)

Signature · 1 line
Anand Rawat
#162 lore raw

PATCH v8 4/10 eal: update common headers to use rte_os.h

In reply to Anand Rawat

Updated rte_common.h to include rte_os.h to contain OS specific macros and functions. Updated rte_string_fns.h to include rte_common.h for rte_os.h

---
 lib/librte_eal/common/include/rte_common.h    |  5 ++++-
 .../common/include/rte_string_fns.h           |  4 +++-
 lib/librte_eal/windows/eal/include/rte_os.h   | 19 +++++++++++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)
lib/librte_eal/common/include/rte_common.h +4 -1
index bcf8afd39..3e4768f4a 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_
@@ -24,6 +24,9 @@ extern "C" {
 
 #include <rte_config.h>
 
+/* os specific include */
+#include <rte_os.h>
+
 #ifndef typeof
 #define typeof __typeof__
 #endif
lib/librte_eal/common/include/rte_string_fns.h +3 -1
index 85bfe6c9a..8bac8243c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 /**
@@ -18,6 +18,8 @@ extern "C" {
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
+
 /**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like
lib/librte_eal/windows/eal/include/rte_os.h +19 -0
index 421ed8e7f..8da1e235f 100644
@@ -11,4 +11,23 @@
  * Windows OS. Functions will be added in future releases.
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* strdup is deprecated in Microsoft libc and _strdup is preferred */
+#define strdup(str) _strdup(str)
+
+typedef SSIZE_T ssize_t;
+
+#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_OS_H_ */
Signature · 1 line
2.17.1.windows.2
#163 lore raw

PATCH v8 5/10 build: add module definition file for windows

In reply to Anand Rawat

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

---
 lib/librte_eal/rte_eal_exports.def       |  9 +++++++++
 lib/librte_kvargs/rte_kvargs_exports.def |  7 +++++++
 lib/meson.build                          | 15 ++++++++++++---
 3 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_kvargs/rte_kvargs_exports.def
lib/librte_eal/rte_eal_exports.def new file +9 -0
new file mode 100644
index 000000000..12a6c79d6
@@ -0,0 +1,9 @@
+EXPORTS
+	__rte_panic
+	rte_eal_get_configuration
+	rte_eal_init
+	rte_eal_mp_remote_launch
+	rte_eal_mp_wait_lcore
+	rte_eal_remote_launch
+	rte_log
+	rte_vlog
lib/librte_kvargs/rte_kvargs_exports.def new file +7 -0
new file mode 100644
index 000000000..10e839e00
@@ -0,0 +1,7 @@
+EXPORTS
+	rte_kvargs_count
+	rte_kvargs_free
+	rte_kvargs_parse
+	rte_kvargs_process
+	rte_kvargs_parse_delim
+	rte_kvargs_strcmp
lib/meson.build +12 -3
index 99957ba7d..a7b5a9194 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible
@@ -117,14 +117,23 @@ foreach l:libraries
 			objs += static_lib.extract_all_objects(recursive: false)
 			version_map = '@0@/@1@/rte_@2@_version.map'.format(
 					meson.current_source_dir(), dir_name, name)
+			exports = []
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+				lk_args = ['-Wl,/def:' + exports, '-Wl,/implib:lib\\' + implib]
+			else
+				lk_args = ['-Wl,--version-script=' + version_map]
+			endif
 			shared_lib = shared_library(libname,
 					sources,
 					objects: objs,
 					c_args: cflags,
 					dependencies: shared_deps,
 					include_directories: includes,
-					link_args: '-Wl,--version-script=' + version_map,
-					link_depends: version_map,
+					link_args: lk_args,
+					link_depends: [version_map, exports],
 					version: lib_version,
 					soversion: so_version,
 					install: true)
Signature · 1 line
2.17.1.windows.2
#164 lore raw

Re: [PATCH v8 05/10] build: add module definition file for windows

02/04/2019 05:54, Anand Rawat:

Quoted 9 lines

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

---
 lib/librte_eal/rte_eal_exports.def       |  9 +++++++++

For info, this file is not listed in MAINTAINERS. Will add it.

#165 lore raw

PATCH v8 6/10 eal: sys/queue.h implementation for windows

In reply to Anand Rawat

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

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

PATCH v8 7/10 eal: add headers for compatibility with windows

In reply to Anand Rawat

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

---
 lib/librte_eal/windows/eal/include/fnmatch.h | 48 +++++++++++
 lib/librte_eal/windows/eal/include/pthread.h | 27 ++++++
 lib/librte_eal/windows/eal/include/regex.h   | 88 ++++++++++++++++++++
 lib/librte_eal/windows/eal/include/sched.h   | 46 ++++++++++
 lib/librte_eal/windows/eal/include/unistd.h  | 12 +++
 5 files changed, 221 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h
 create mode 100644 lib/librte_eal/windows/eal/include/pthread.h
 create mode 100644 lib/librte_eal/windows/eal/include/regex.h
 create mode 100644 lib/librte_eal/windows/eal/include/sched.h
 create mode 100644 lib/librte_eal/windows/eal/include/unistd.h
lib/librte_eal/windows/eal/include/fnmatch.h new file +48 -0
new file mode 100644
index 000000000..41b574312
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+/**
+ * This file is required to support the common code in eal_common_log.c
+ * as Microsoft libc does not contain fnmatch.h. This may be removed in
+ * future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FNM_NOMATCH 1
+
+/**
+ * This function is used for searhing a given string source
+ * with the given regular expression pattern.
+ *
+ * @param pattern
+ *	regular expression notation decribing the pattern to match
+ *
+ * @param string
+ *	source string to searcg for the pattern
+ *
+ * @param flag
+ *	containing information about the pattern
+ *
+ * @return
+ *	if the pattern is found then return 0 or else FNM_NOMATCH
+ */
+static inline int fnmatch(__rte_unused const char *pattern,
+		__rte_unused const char *string,
+		__rte_unused int flags)
+{
+	/* TODO */
+	/* This is a stub, not the expected result */
+	return FNM_NOMATCH;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FNMATCH_H_ */
lib/librte_eal/windows/eal/include/pthread.h new file +27 -0
new file mode 100644
index 000000000..503329266
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+/**
+ * This file is required to support the common code in eal_common_proc.c,
+ * eal_common_thread.c and common\include\rte_per_lcore.h as Microsoft libc
+ * does not contain pthread.h. This may be removed in future releases.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* defining pthread_t type on Windows since there is no in Microsoft libc*/
+typedef uintptr_t pthread_t;
+
+/* defining pthread_attr_t type on Windows since there is no in Microsoft libc*/
+typedef void *pthread_attr_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PTHREAD_H_ */
lib/librte_eal/windows/eal/include/regex.h new file +88 -0

88 lines not on this page · raw message

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

46 lines not on this page · raw message

lib/librte_eal/windows/eal/include/unistd.h new file +12 -0
new file mode 100644
index 000000000..757b7f3c5
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+/**
+ * This file is added to support common code in eal_common_lcore.c
+ * as Microsoft libc does not contain unistd.h. This may be removed
+ * in future releases.
+ */
+#endif /* _UNISTD_H_ */
Signature · 1 line
2.17.1.windows.2
#167 lore raw

PATCH v8 8/10 eal: add minimum viable code for eal on windows

In reply to Anand Rawat

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

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

116 lines not on this page · raw message

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

157 lines not on this page · raw message

lib/librte_eal/windows/eal/include/regex.h +2 -0
index c335120e1..827f93841 100644
@@ -17,6 +17,8 @@ extern "C" {
 #define REG_NOMATCH 1
 #define REG_ESPACE 12
 
+#include <rte_common.h>
+
 /* defining regex_t for Windows */
 typedef void *regex_t;
 /* defining regmatch_t for Windows */
lib/librte_eal/windows/eal/include/rte_os.h +20 -0
index 8da1e235f..4946af041 100644
@@ -15,7 +15,9 @@
 extern "C" {
 #endif
 
+#include <Windows.h>
 #include <BaseTsd.h>
+#include <pthread.h>
 
 #define strerror_r(a, b, c) strerror_s(b, c, a)
 
@@ -26,6 +28,24 @@ typedef SSIZE_T ssize_t;
 
 #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
 
+/**
+ * Create a thread.
+ * This function is private to EAL.
+ *
+ * @param thread
+ *   The location to store the thread id if successful.
+ * @return
+ *   0 for success, -1 if the thread is not created.
+ */
+int eal_thread_create(pthread_t *thread);
+
+/**
+ * Create a map of processors and cores on the system.
+ * This function is private to EAL.
+ *
+ */
+void eal_create_cpu_map(void);
+
 #ifdef __cplusplus
 }
 #endif
lib/librte_eal/windows/eal/meson.build +2 -0
index 8b1735623..6bc577e5c 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
Signature · 1 line
2.17.1.windows.2
#168 lore raw

Re: [PATCH v8 08/10] eal: add minimum viable code for eal on windows

02/04/2019 05:54, Anand Rawat:

Quoted 9 lines

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

---

[...]

lib/librte_eal/windows/eal/eal.c line 65

Quoted 7 lines
lib/librte_eal/windows/eal/eal.c +7 -0
+		/*
+		 * create communication pipes between master thread
+		 * and children
+		 */
+		if (_pipe(lcore_config[i].pipe_master2slave,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");

rte_panic should be used only in applications, not in libraries. The application can do something in case of DPDK failure. Please remove all calls to rte_panic() during next weeks, thanks.

#169 lore raw

Re: [PATCH v8 08/10] eal: add minimum viable code for eal on windows

Quoted 11 lines · Thomas Monjalon

02/04/2019 05:54, Anand Rawat:

Quoted 9 lines

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

---

[...]

Quoted 10 lines

lib/librte_eal/windows/eal/eal.c line 65

Quoted 7 lines
lib/librte_eal/windows/eal/eal.c +7 -0
+		/*
+		 * create communication pipes between master thread
+		 * and children
+		 */
+		if (_pipe(lcore_config[i].pipe_master2slave,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");

rte_panic should be used only in applications, not in libraries. The application can do something in case of DPDK failure. Please remove all calls to rte_panic() during next weeks, thanks.

Ok, will try to incorporate in v9. Just curious, is this the major issue?

Calls to rte_panic() can be seen in linux/eal and freebsd/eal.

Quoted 2 lines
#170 lore raw

Re: [PATCH v8 08/10] eal: add minimum viable code for eal on windows

02/04/2019 23:21, Pallavi Kadam:

Quoted 24 lines · Thomas Monjalon
Quoted 11 lines

02/04/2019 05:54, Anand Rawat:

Quoted 9 lines

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

---

[...]

Quoted 10 lines

lib/librte_eal/windows/eal/eal.c line 65

Quoted 7 lines
lib/librte_eal/windows/eal/eal.c +7 -0
+		/*
+		 * create communication pipes between master thread
+		 * and children
+		 */
+		if (_pipe(lcore_config[i].pipe_master2slave,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");

rte_panic should be used only in applications, not in libraries. The application can do something in case of DPDK failure. Please remove all calls to rte_panic() during next weeks, thanks.

Quoted 3 lines

Ok, will try to incorporate in v9. Just curious, is this the major issue?

Calls to rte_panic() can be seen in linux/eal and freebsd/eal.

No, there is a misunderstanding.
I am merging v8 and I am asking for a new patch to remove these calls.

By the way, I am fixing patch 3, please check my comment on this patch.

#171 lore raw

Re: [PATCH v8 08/10] eal: add minimum viable code for eal on windows

Quoted 23 lines · Thomas Monjalon

02/04/2019 23:21, Pallavi Kadam:

Quoted 22 lines · Thomas Monjalon
Quoted 21 lines

02/04/2019 05:54, Anand Rawat:

Quoted 9 lines

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

---

[...]

lib/librte_eal/windows/eal/eal.c line 65

Quoted 7 lines
lib/librte_eal/windows/eal/eal.c +7 -0
+		/*
+		 * create communication pipes between master thread
+		 * and children
+		 */
+		if (_pipe(lcore_config[i].pipe_master2slave,
+			sizeof(char), _O_BINARY) < 0)
+			rte_panic("Cannot create pipe\n");

rte_panic should be used only in applications, not in libraries. The application can do something in case of DPDK failure. Please remove all calls to rte_panic() during next weeks, thanks.

Quoted 7 lines
Quoted 3 lines

Ok, will try to incorporate in v9. Just curious, is this the major issue?

Calls to rte_panic() can be seen in linux/eal and freebsd/eal.

No, there is a misunderstanding.
I am merging v8 and I am asking for a new patch to remove these calls.

By the way, I am fixing patch 3, please check my comment on this patch.

Got it. Thanks.

Quoted 3 lines
#172 lore raw

Re: [PATCH v8 08/10] eal: add minimum viable code for eal on windows

In reply to Anand Rawat

I think the change below is bad because it is exposing an internal function in a header file which may be included by apps. I know you are still looking for pthread integration solutions, so we can discuss how to fix it later.

Note that there is already an EAL function to create normal threads:
rte_ctrl_thread_create()
You may want a similar function for dataplane threads perhaps.

02/04/2019 05:54, Anand Rawat:

Quoted 33 lines
lib/librte_eal/windows/eal/include/rte_os.h +19 -0
@@ -15,7 +15,9 @@
 extern "C" {
 #endif
 
+#include <Windows.h>
 #include <BaseTsd.h>
+#include <pthread.h>
 
 #define strerror_r(a, b, c) strerror_s(b, c, a)
 
@@ -26,6 +28,24 @@ typedef SSIZE_T ssize_t;
 
 #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
 
+/**
+ * Create a thread.
+ * This function is private to EAL.
+ *
+ * @param thread
+ *   The location to store the thread id if successful.
+ * @return
+ *   0 for success, -1 if the thread is not created.
+ */
+int eal_thread_create(pthread_t *thread);
+
+/**
+ * Create a map of processors and cores on the system.
+ * This function is private to EAL.
+ *
+ */
+void eal_create_cpu_map(void);
#173 lore raw

Re: [PATCH v8 08/10] eal: add minimum viable code for eal on windows

Quoted 10 lines · Thomas Monjalon

I think the change below is bad because it is exposing an internal function in a header file which may be included by apps. I know you are still looking for pthread integration solutions, so we can discuss how to fix it later.

Note that there is already an EAL function to create normal threads:
rte_ctrl_thread_create()
You may want a similar function for dataplane threads perhaps.

Yes, we can work on removing eal_thread_create and substituting it
with rte_ctrl_thread_create. We have been able to macro substitute
quite a lot of pthread lib functionality with Microsoft libc. I can start looking into porting those functionalities for rte_ctrl_thread_create() on Windows.

Signature · 1 line
Anand Rawat
#174 lore raw

PATCH v8 9/10 doc: add documentation for windows

In reply to Anand Rawat

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

---
 MAINTAINERS                           |  1 +
 doc/guides/index.rst                  |  3 +-
 doc/guides/windows_gsg/build_dpdk.rst | 81 +++++++++++++++++++++++++++
 doc/guides/windows_gsg/index.rst      | 14 +++++
 doc/guides/windows_gsg/intro.rst      | 20 +++++++
 5 files changed, 118 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/windows_gsg/build_dpdk.rst
 create mode 100644 doc/guides/windows_gsg/index.rst
 create mode 100644 doc/guides/windows_gsg/intro.rst
MAINTAINERS +1 -0
index 5d70fba9b..5273639f4 100644
@@ -289,6 +289,7 @@ M: Omar Cardona <[email protected]>
 M: Anand Rawat <[email protected]>
 M: Ranjit Menon <[email protected]>
 F: lib/librte_eal/windows/
+F: doc/guides/windows_gsg/
 
 
 Core Libraries
doc/guides/index.rst +2 -1
index 8a9ed65c8..8a1601b27 100644
@@ -1,5 +1,5 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2010-2014 Intel Corporation.
+    Copyright(c) 2010-2019 Intel Corporation.
 
 DPDK documentation
 ==================
@@ -9,6 +9,7 @@ DPDK documentation
 
    linux_gsg/index
    freebsd_gsg/index
+   windows_gsg/index
    sample_app_ug/index
    prog_guide/index
    howto/index
doc/guides/windows_gsg/build_dpdk.rst new file +81 -0

81 lines not on this page · raw message

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

PATCH v8 10/10 build: meson changes to build on windows

In reply to Anand Rawat

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

---
 app/meson.build                        | 6 +++++-
 buildtools/meson.build                 | 6 +++++-
 drivers/meson.build                    | 6 +++++-
 examples/meson.build                   | 6 ++++--
 lib/librte_eal/windows/eal/meson.build | 6 ++++++
 lib/meson.build                        | 4 ++++
 6 files changed, 29 insertions(+), 5 deletions(-)
app/meson.build +5 -1
index aa353f657..e949624b7 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 apps = [
 	'pdump',
buildtools/meson.build +5 -1
index cdd38ed24..0209bec8f 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 subdir('pmdinfogen')
 
drivers/meson.build +5 -1
index 8c76a5659..7520a16e3 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
+
+if host_machine.system() == 'windows'
+	subdir_done()
+endif
 
 # Defines the order in which the drivers are buit.
 dpdk_driver_classes = ['common',
examples/meson.build +4 -2
index af81c762e..3bf1c2db8 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 driver_libs = []
 if get_option('default_library') == 'static'
@@ -35,7 +35,9 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() == 'windows'
+		deps = ['eal'] # only supported lib on Windows currently
+	endif
 	subdir(example)
 
 	if build
lib/librte_eal/windows/eal/meson.build +6 -0
index 6bc577e5c..e9b7138c5 100644
@@ -5,6 +5,12 @@ eal_inc += include_directories('include')
 
 env_objs = []
 env_headers = []
+common_sources = files(
+	'../../common/eal_common_errno.c',
+	'../../common/eal_common_launch.c',
+	'../../common/eal_common_lcore.c',
+	'../../common/eal_common_log.c'
+)
 env_sources = files('eal.c',
 	'eal_debug.c',
 	'eal_lcore.c',
lib/meson.build +4 -0
index a7b5a9194..c3289f885 100644
@@ -30,6 +30,10 @@ libraries = [
 	# flow_classify lib depends on pkt framework table lib
 	'flow_classify', 'bpf', 'telemetry']
 
+if host_machine.system() == 'windows'
+	libraries = ['kvargs','eal'] # only supported libraries for windows
+endif
+
 default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
Signature · 1 line
2.17.1.windows.2
#176 lore raw

Re: [PATCH v8 10/10] build: meson changes to build on windows

02/04/2019 05:54, Anand Rawat:

Quoted 13 lines

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

---

examples/meson.build foreach example: examples · line 41

Quoted 8 lines
examples/meson.build +3 -1
@@ -35,7 +35,9 @@ foreach example: examples
 
 	ext_deps = [execinfo]
 	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() == 'windows'
+		deps = ['eal'] # only supported lib on Windows currently
+	endif
 	subdir(example)

This is not what I call keeping build intact for Linux/BSD :)

I did not catch it before because test-meson-builds.sh is not testing compilation of the examples with meson. Bruce, may we add it?

I will add back the original deps line in master branch.

#177 lore raw

Re: [PATCH v8 10/10] build: meson changes to build on windows

Quoted 25 lines · Thomas Monjalon

02/04/2019 05:54, Anand Rawat:

Quoted 13 lines

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

---

examples/meson.build foreach example: examples · line 41

Quoted 8 lines
examples/meson.build +3 -1
@@ -35,7 +35,9 @@ foreach example: examples
 
  	ext_deps = [execinfo]
  	includes = [include_directories(example)]
-	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+	if host_machine.system() == 'windows'
+		deps = ['eal'] # only supported lib on Windows currently
+	endif
  	subdir(example)

This is not what I call keeping build intact for Linux/BSD :)

Quoted 6 lines

I did not catch it before because test-meson-builds.sh is not testing compilation of the examples with meson. Bruce, may we add it?

I will add back the original deps line in master branch.

That is correct,
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline'] should have not been removed from this file. Please add the line back.

Signature · 1 line
Anand Rawat
#178 lore raw

Re: [PATCH v8 00/10] HelloWorld example for Windows

In reply to Anand Rawat

02/04/2019 05:54, Anand Rawat:

Quoted 2 lines

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

[...]

Quoted 11 lines

Anand Rawat (10):
eal: eal stub to add windows support
meson: required changes for windows
eal: add new rte_os.h header to build system
eal: update common headers to use rte_os.h
build: add module definition file for windows
eal: sys/queue.h implementation for windows
eal: add headers for compatibility with windows
eal: add minimum viable code for eal on windows
doc: add documentation for windows
build: meson changes to build on windows

Applied, with few changes as discussed, thanks.

First step is done, welcome to Windows world!

#179 lore raw

Re: [PATCH v8 00/10] HelloWorld example for Windows

Quoted 16 lines · Thomas Monjalon

02/04/2019 05:54, Anand Rawat:

Quoted 2 lines

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

[...]

Quoted 11 lines

Anand Rawat (10):
eal: eal stub to add windows support
meson: required changes for windows
eal: add new rte_os.h header to build system
eal: update common headers to use rte_os.h
build: add module definition file for windows
eal: sys/queue.h implementation for windows
eal: add headers for compatibility with windows
eal: add minimum viable code for eal on windows
doc: add documentation for windows
build: meson changes to build on windows

Quoted 5 lines

Applied, with few changes as discussed, thanks.

First step is done, welcome to Windows world!

Thanks Thomas :)

Signature · 1 line
Anand Rawat