DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: david.marchand@redhat.com, bruce.richardson@intel.com,
	Fady Bader <fady@mellanox.com>,
	Narcisa Vasile <navasile@linux.microsoft.com>,
	Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
	Ranjit Menon <ranjit.menon@intel.com>,
	Kevin Laatz <kevin.laatz@intel.com>
Subject: [dpdk-dev] [PATCH v6 3/5] telemetry: build stubs for Windows
Date: Fri, 11 Sep 2020 01:50:03 +0200	[thread overview]
Message-ID: <20200910235005.2420342-4-thomas@monjalon.net> (raw)
In-Reply-To: <20200910235005.2420342-1-thomas@monjalon.net>

From: Fady Bader <fady@mellanox.com>

Telemetry didn't compile under Windows.
Empty stubs are arranged, waiting for a proper implementation.

Signed-off-by: Fady Bader <fady@mellanox.com>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_telemetry/rte_telemetry.h    |  1 +
 lib/librte_telemetry/telemetry.c        | 22 ++++++++++++++++++++++
 lib/librte_telemetry/telemetry_legacy.c | 11 ++++++++++-
 lib/meson.build                         |  1 +
 4 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/lib/librte_telemetry/rte_telemetry.h b/lib/librte_telemetry/rte_telemetry.h
index d13010b8fb..deac2e71ca 100644
--- a/lib/librte_telemetry/rte_telemetry.h
+++ b/lib/librte_telemetry/rte_telemetry.h
@@ -3,6 +3,7 @@
  */
 
 #include <stdint.h>
+#include <sched.h>
 #include <rte_compat.h>
 
 #ifndef _RTE_TELEMETRY_H_
diff --git a/lib/librte_telemetry/telemetry.c b/lib/librte_telemetry/telemetry.c
index 0252282735..51e7ceeb1b 100644
--- a/lib/librte_telemetry/telemetry.c
+++ b/lib/librte_telemetry/telemetry.c
@@ -2,11 +2,13 @@
  * Copyright(c) 2020 Intel Corporation
  */
 
+#ifndef RTE_EXEC_ENV_WINDOWS
 #include <unistd.h>
 #include <pthread.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <dlfcn.h>
+#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 /* we won't link against libbsd, so just always use DPDKs-specific strlcpy */
 #undef RTE_USE_LIBBSD
@@ -25,8 +27,10 @@
 #define MAX_OUTPUT_LEN (1024 * 16)
 #define MAX_CONNECTIONS 10
 
+#ifndef RTE_EXEC_ENV_WINDOWS
 static void *
 client_handler(void *socket);
+#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 struct cmd_callback {
 	char cmd[MAX_CMD_LEN];
@@ -34,6 +38,7 @@ struct cmd_callback {
 	char help[MAX_HELP_LEN];
 };
 
+#ifndef RTE_EXEC_ENV_WINDOWS
 struct socket {
 	int sock;
 	char path[sizeof(((struct sockaddr_un *)0)->sun_path)];
@@ -42,13 +47,16 @@ struct socket {
 };
 static struct socket v2_socket; /* socket for v2 telemetry */
 static struct socket v1_socket; /* socket for v1 telemetry */
+#endif /* !RTE_EXEC_ENV_WINDOWS */
 static char telemetry_log_error[1024]; /* Will contain error on init failure */
 /* list of command callbacks, with one command registered by default */
 static struct cmd_callback callbacks[TELEMETRY_MAX_CALLBACKS];
 static int num_callbacks; /* How many commands are registered */
 /* Used when accessing or modifying list of command callbacks */
 static rte_spinlock_t callback_sl = RTE_SPINLOCK_INITIALIZER;
+#ifndef RTE_EXEC_ENV_WINDOWS
 static uint16_t v2_clients;
+#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 int
 rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help)
@@ -78,6 +86,8 @@ rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help)
 	return 0;
 }
 
+#ifndef RTE_EXEC_ENV_WINDOWS
+
 static int
 list_commands(const char *cmd __rte_unused, const char *params __rte_unused,
 		struct rte_tel_data *d)
@@ -412,10 +422,13 @@ telemetry_v2_init(const char *runtime_dir, rte_cpuset_t *cpuset)
 	return 0;
 }
 
+#endif /* !RTE_EXEC_ENV_WINDOWS */
+
 int32_t
 rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
 		const char **err_str)
 {
+#ifndef RTE_EXEC_ENV_WINDOWS
 	if (telemetry_v2_init(runtime_dir, cpuset) != 0) {
 		*err_str = telemetry_log_error;
 		return -1;
@@ -423,5 +436,14 @@ rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
 	if (telemetry_legacy_init(runtime_dir, cpuset) != 0) {
 		*err_str = telemetry_log_error;
 	}
+#else /* RTE_EXEC_ENV_WINDOWS */
+	RTE_SET_USED(runtime_dir);
+	RTE_SET_USED(cpuset);
+	RTE_SET_USED(err_str);
+
+	snprintf(telemetry_log_error, sizeof(telemetry_log_error),
+		"DPDK Telemetry is not supported on Windows.");
+#endif /* RTE_EXEC_ENV_WINDOWS */
+
 	return 0;
 }
diff --git a/lib/librte_telemetry/telemetry_legacy.c b/lib/librte_telemetry/telemetry_legacy.c
index a341fe4ebd..b8e424041c 100644
--- a/lib/librte_telemetry/telemetry_legacy.c
+++ b/lib/librte_telemetry/telemetry_legacy.c
@@ -2,10 +2,12 @@
  * Copyright(c) 2020 Intel Corporation
  */
 
+#ifndef RTE_EXEC_ENV_WINDOWS
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <pthread.h>
+#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 /* we won't link against libbsd, so just always use DPDKs-specific strlcpy */
 #undef RTE_USE_LIBBSD
@@ -24,7 +26,6 @@
 #define DATA_REQ_LABEL "\"data\":"
 #define TELEMETRY_LEGACY_MAX_CALLBACKS 4
 
-
 static int
 register_client(const char *cmd __rte_unused,
 		const char *params __rte_unused,
@@ -77,15 +78,18 @@ static int
 register_client(const char *cmd __rte_unused, const char *params,
 		char *buffer __rte_unused, int buf_len __rte_unused)
 {
+#ifndef RTE_EXEC_ENV_WINDOWS
 	pthread_t th;
 	char data[BUF_SIZE];
 	int fd;
 	struct sockaddr_un addrs;
+#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 	if (!strchr(params, ':')) {
 		fprintf(stderr, "Invalid data\n");
 		return -1;
 	}
+#ifndef RTE_EXEC_ENV_WINDOWS
 	strlcpy(data, strchr(params, ':'), sizeof(data));
 	memcpy(data, &data[strlen(":\"")], strlen(data));
 	if (!strchr(data, '\"')) {
@@ -109,9 +113,12 @@ register_client(const char *cmd __rte_unused, const char *params,
 	}
 	pthread_create(&th, NULL, &legacy_client_handler,
 			(void *)(uintptr_t)fd);
+#endif /* !RTE_EXEC_ENV_WINDOWS */
 	return 0;
 }
 
+#ifndef RTE_EXEC_ENV_WINDOWS
+
 static int
 send_error_response(int s, int err)
 {
@@ -239,3 +246,5 @@ legacy_client_handler(void *sock_id)
 	close(s);
 	return NULL;
 }
+
+#endif /* !RTE_EXEC_ENV_WINDOWS */
diff --git a/lib/meson.build b/lib/meson.build
index 283ee6c505..eb0cd9090a 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -38,6 +38,7 @@ libraries = [
 if is_windows
 	libraries = [
 		'kvargs',
+		'telemetry',
 		'eal',
 		'ring',
 		'mempool', 'mbuf', 'net', 'pci',
-- 
2.28.0


  parent reply	other threads:[~2020-09-10 23:51 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25 13:30 [dpdk-dev] [PATCH 0/5] compiling ethdev lib under windows Fady Bader
2020-06-25 13:30 ` [dpdk-dev] [PATCH 1/5] eal: added interrupts empty stubs Fady Bader
2020-06-28 10:58   ` [dpdk-dev] [PATCH v2 0/5] compiling ethdev lib under windows Fady Bader
2020-06-28 10:58     ` [dpdk-dev] [PATCH v2 1/5] eal: added interrupts empty stubs Fady Bader
2020-06-28 10:58     ` [dpdk-dev] [PATCH v2 2/5] eal: updated export list for Windows Fady Bader
2020-06-28 10:58     ` [dpdk-dev] [PATCH v2 3/5] ethdev: remove structs from export list Fady Bader
2020-06-28 10:58     ` [dpdk-dev] [PATCH v2 4/5] telemetry: implement empty stubs for Windows Fady Bader
2020-06-28 18:04       ` Stephen Hemminger
2020-06-29  7:59         ` Thomas Monjalon
2020-06-28 10:58     ` [dpdk-dev] [PATCH v2 5/5] ethdev: compiling ethdev under Windows Fady Bader
2020-07-26  9:24     ` [dpdk-dev] [PATCH v2 0/5] compiling ethdev lib under windows Fady Bader
2020-07-27 18:53       ` Narcisa Ana Maria Vasile
2020-06-25 13:30 ` [dpdk-dev] [PATCH 2/5] eal: updated export list for Windows Fady Bader
2020-06-25 13:30 ` [dpdk-dev] [PATCH 3/5] ethdev: remove structs from export list Fady Bader
2020-06-25 13:30 ` [dpdk-dev] [PATCH 4/5] telemetry: implement empty stubs for Windows Fady Bader
2020-06-25 13:30 ` [dpdk-dev] [PATCH 5/5] ethdev: compiling ethdev under Windows Fady Bader
2020-07-29  1:01 ` [dpdk-dev] [PATCH 0/5] compiling ethdev lib under windows Narcisa Ana Maria Vasile
2020-08-03  6:16   ` Fady Bader
2020-08-03 10:38 ` [dpdk-dev] [PATCH v3 " Fady Bader
2020-08-03 10:38   ` [dpdk-dev] [PATCH v3 1/5] eal: added interrupts empty stubs Fady Bader
2020-08-03 10:38   ` [dpdk-dev] [PATCH v3 2/5] eal: updated export list for Windows Fady Bader
2020-08-03 10:38   ` [dpdk-dev] [PATCH v3 3/5] ethdev: remove structs from export list Fady Bader
2020-08-03 10:38   ` [dpdk-dev] [PATCH v3 4/5] telemetry: implement empty stubs for Windows Fady Bader
2020-08-04  1:26     ` Narcisa Ana Maria Vasile
2020-08-04  6:05       ` Fady Bader
2020-08-03 10:38   ` [dpdk-dev] [PATCH v3 5/5] ethdev: compiling ethdev under Windows Fady Bader
2020-08-04  6:29 ` [dpdk-dev] [PATCH v4 0/5] compiling ethdev lib under windows Fady Bader
2020-08-04  6:29   ` [dpdk-dev] [PATCH v4 1/5] eal: added interrupts empty stubs Fady Bader
2020-08-04 18:45     ` Narcisa Ana Maria Vasile
2020-08-04 23:43     ` Dmitry Kozlyuk
2020-08-04  6:29   ` [dpdk-dev] [PATCH v4 2/5] eal: updated export list for Windows Fady Bader
2020-08-04 18:46     ` Narcisa Ana Maria Vasile
2020-08-04  6:29   ` [dpdk-dev] [PATCH v4 3/5] ethdev: remove structs from export list Fady Bader
2020-08-04 18:47     ` Narcisa Ana Maria Vasile
2020-08-04  6:29   ` [dpdk-dev] [PATCH v4 4/5] telemetry: implement empty stubs for Windows Fady Bader
2020-08-04 18:47     ` Narcisa Ana Maria Vasile
2020-08-04 23:39     ` Dmitry Kozlyuk
2020-08-05  8:27       ` Thomas Monjalon
2020-08-05  8:40         ` Bruce Richardson
2020-08-05  9:06           ` Thomas Monjalon
2020-08-05 10:02             ` Bruce Richardson
2020-08-05  8:28     ` Thomas Monjalon
2020-08-04  6:29   ` [dpdk-dev] [PATCH v4 5/5] ethdev: compiling ethdev under Windows Fady Bader
2020-08-04 18:51     ` Narcisa Ana Maria Vasile
2020-08-11  6:24 ` [dpdk-dev] [PATCH v5 0/5] compiling ethdev lib under windows Fady Bader
2020-08-11  6:24   ` [dpdk-dev] [PATCH v5 1/5] eal: added interrupts empty stubs Fady Bader
2020-08-11  6:24   ` [dpdk-dev] [PATCH v5 2/5] eal: updated export list for Windows Fady Bader
2020-08-11  6:24   ` [dpdk-dev] [PATCH v5 3/5] ethdev: remove structs from export list Fady Bader
2020-08-11  6:24   ` [dpdk-dev] [PATCH v5 4/5] telemetry: implement empty stubs for Windows Fady Bader
2020-09-10 23:35     ` Thomas Monjalon
2020-08-11  6:24   ` [dpdk-dev] [PATCH v5 5/5] ethdev: compiling ethdev under Windows Fady Bader
2020-08-13  7:02   ` [dpdk-dev] [PATCH v5 0/5] compiling ethdev lib under windows Thomas Monjalon
2020-08-18 16:13   ` Dmitry Kozlyuk
2020-08-20 21:40   ` Ranjit Menon
2020-09-10 23:50 ` [dpdk-dev] [PATCH v6 0/5] build ethdev on Windows Thomas Monjalon
2020-09-10 23:50   ` [dpdk-dev] [PATCH v6 1/5] eal/windows: add stub for Rx interrupt control Thomas Monjalon
2020-09-10 23:50   ` [dpdk-dev] [PATCH v6 2/5] eal/windows: update symbols export Thomas Monjalon
2020-09-10 23:50   ` Thomas Monjalon [this message]
2020-09-10 23:50   ` [dpdk-dev] [PATCH v6 4/5] ethdev: remove structs from export map Thomas Monjalon
2020-09-10 23:50   ` [dpdk-dev] [PATCH v6 5/5] ethdev: build on Windows Thomas Monjalon
2020-09-10 23:58   ` [dpdk-dev] [PATCH v6 0/5] build ethdev " Thomas Monjalon

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20200910235005.2420342-4-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=fady@mellanox.com \
    --cc=kevin.laatz@intel.com \
    --cc=navasile@linux.microsoft.com \
    --cc=ranjit.menon@intel.com \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).