From patchwork Thu Jun 25 13:30:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fady Bader X-Patchwork-Id: 72179 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BEE49A0350; Thu, 25 Jun 2020 15:31:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 71FEF1BE94; Thu, 25 Jun 2020 15:31:13 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 6A5761BE83 for ; Thu, 25 Jun 2020 15:31:10 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from fady@mellanox.com) with SMTP; 25 Jun 2020 16:31:05 +0300 Received: from l-wincomp04-vm.labs.mlnx (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05PDV4Kp025704; Thu, 25 Jun 2020 16:31:05 +0300 From: Fady Bader To: dev@dpdk.org Cc: fady@mellanox.com, thomas@monjalon.net, tbashar@mellanox.com, talshn@mellanox.com, yohadt@mellanox.com, dmitry.kozliuk@gmail.com, harini.ramakrishnan@microsoft.com, ocardona@microsoft.com, ranjit.menon@intel.com, pallavi.kadam@intel.com, kevin.laatz@intel.com, ferruh.yigit@intel.com, arybchenko@solarflare.com Date: Thu, 25 Jun 2020 16:30:37 +0300 Message-Id: <20200625133038.25180-5-fady@mellanox.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20200625133038.25180-1-fady@mellanox.com> References: <20200625133038.25180-1-fady@mellanox.com> Subject: [dpdk-dev] [PATCH 4/5] telemetry: implement empty stubs for Windows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Telemetry didn't compile under Windows. Empty stubs implementation was added for Windows. Signed-off-by: Fady Bader --- lib/librte_telemetry/rte_telemetry.h | 4 +++ lib/librte_telemetry/telemetry.c | 43 ++++++++++++++++++++++++++++++++- lib/librte_telemetry/telemetry_legacy.c | 26 +++++++++++++++++++- 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/lib/librte_telemetry/rte_telemetry.h b/lib/librte_telemetry/rte_telemetry.h index eb7f2c917c..bad255c385 100644 --- a/lib/librte_telemetry/rte_telemetry.h +++ b/lib/librte_telemetry/rte_telemetry.h @@ -5,6 +5,10 @@ #include #include +#ifdef RTE_EXEC_ENV_WINDOWS +#include +#endif + #ifndef _RTE_TELEMETRY_H_ #define _RTE_TELEMETRY_H_ diff --git a/lib/librte_telemetry/telemetry.c b/lib/librte_telemetry/telemetry.c index e7e3d861dd..3e202a089b 100644 --- a/lib/librte_telemetry/telemetry.c +++ b/lib/librte_telemetry/telemetry.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2020 Intel Corporation */ - +#ifndef RTE_EXEC_ENV_WINDOWS #include #include #include @@ -20,6 +20,18 @@ #include "telemetry_data.h" #include "rte_telemetry_legacy.h" +#else + +#include + +#include "rte_telemetry.h" +#include "telemetry_json.h" +#include "telemetry_data.h" +#include "rte_telemetry_legacy.h" + +#endif + +#ifndef RTE_EXEC_ENV_WINDOWS #define MAX_CMD_LEN 56 #define MAX_HELP_LEN 64 #define MAX_OUTPUT_LEN (1024 * 16) @@ -46,10 +58,13 @@ 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; +#endif int rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help) { +#ifndef RTE_EXEC_ENV_WINDOWS + int i = 0; if (strlen(cmd) >= MAX_CMD_LEN || fn == NULL || cmd[0] != '/' @@ -73,8 +88,19 @@ rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help) rte_spinlock_unlock(&callback_sl); return 0; + +#else + + RTE_SET_USED(cmd); + RTE_SET_USED(fn); + RTE_SET_USED(help); + + return 0; + +#endif } +#ifndef RTE_EXEC_ENV_WINDOWS static int list_commands(const char *cmd __rte_unused, const char *params __rte_unused, struct rte_tel_data *d) @@ -396,11 +422,14 @@ telemetry_v2_init(const char *runtime_dir, rte_cpuset_t *cpuset) return 0; } +#endif 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; @@ -409,4 +438,16 @@ rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset, *err_str = telemetry_log_error; } return 0; + +#else + + RTE_SET_USED(runtime_dir); + RTE_SET_USED(cpuset); + RTE_SET_USED(err_str); + + RTE_LOG(WARNING, TELEMETRY, "Telemetry is not supported on Windows.\n"); + + return 0; + +#endif } diff --git a/lib/librte_telemetry/telemetry_legacy.c b/lib/librte_telemetry/telemetry_legacy.c index a341fe4ebd..674f9c40ef 100644 --- a/lib/librte_telemetry/telemetry_legacy.c +++ b/lib/librte_telemetry/telemetry_legacy.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2020 Intel Corporation */ - +#ifndef RTE_EXEC_ENV_WINDOWS #include #include #include @@ -15,6 +15,15 @@ #include "rte_telemetry_legacy.h" +#else + +#include + +#include "rte_telemetry_legacy.h" + +#endif +#ifndef RTE_EXEC_ENV_WINDOWS + #define MAX_LEN 128 #define BUF_SIZE 1024 #define CLIENTS_UNREG_ACTION "\"action\":2" @@ -48,12 +57,15 @@ struct json_command callbacks[TELEMETRY_LEGACY_MAX_CALLBACKS] = { }; int num_legacy_callbacks = 1; static rte_spinlock_t callback_sl = RTE_SPINLOCK_INITIALIZER; +#endif int rte_telemetry_legacy_register(const char *cmd, enum rte_telemetry_legacy_data_req data_req, telemetry_legacy_cb fn) { +#ifndef RTE_EXEC_ENV_WINDOWS + if (fn == NULL) return -EINVAL; if (num_legacy_callbacks >= (int) RTE_DIM(callbacks)) @@ -71,8 +83,19 @@ rte_telemetry_legacy_register(const char *cmd, rte_spinlock_unlock(&callback_sl); return 0; + +#else + + RTE_SET_USED(cmd); + RTE_SET_USED(data_req); + RTE_SET_USED(fn); + + return 0; + +#endif } +#ifndef RTE_EXEC_ENV_WINDOWS static int register_client(const char *cmd __rte_unused, const char *params, char *buffer __rte_unused, int buf_len __rte_unused) @@ -239,3 +262,4 @@ legacy_client_handler(void *sock_id) close(s); return NULL; } +#endif