telemetry: build stubs on Windows
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>
This commit is contained in:
parent
fc5ae478f8
commit
5ae0d39d4a
@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sched.h>
|
||||
#include <rte_compat.h>
|
||||
|
||||
#ifndef _RTE_TELEMETRY_H_
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
@ -77,15 +79,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 +114,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 +247,5 @@ legacy_client_handler(void *sock_id)
|
||||
close(s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* !RTE_EXEC_ENV_WINDOWS */
|
||||
|
@ -38,6 +38,7 @@ libraries = [
|
||||
if is_windows
|
||||
libraries = [
|
||||
'kvargs',
|
||||
'telemetry',
|
||||
'eal',
|
||||
'ring',
|
||||
'mempool', 'mbuf', 'net', 'pci',
|
||||
|
Loading…
Reference in New Issue
Block a user