From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C947C433E2 for ; Thu, 10 Sep 2020 23:51:04 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 6DF30208CA for ; Thu, 10 Sep 2020 23:51:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DF30208CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=monjalon.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E45671C0D8; Fri, 11 Sep 2020 01:51:00 +0200 (CEST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 2A2191C0D8 for ; Fri, 11 Sep 2020 01:51:00 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id D09A25C00E3; Thu, 10 Sep 2020 19:50:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 10 Sep 2020 19:50:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=C7dp9Q/rg7pvV ikyJAlkoo4xGzB9DpeWT7c1DhiXl7Q=; b=CqBmSRRSkCgiV+pBLciPIIW0gV0Vf JzbdxDIQnp/9NoleJ8SCffAvTCNuLu/ijgC3PK9pBrJvEzrd9X8uJF2/HdnlODX0 hgw/jmbbDiEFC+37UwUUYDP+dWooZv94Df2xeiBNfoa4RwYeJbEScGmEd68/BJTN 9yoSFS0wUXGGWs/r3RfZKU9XA/ni6mcikFTTgG5iqBaTR6hxJ7H0UiwnrmCayf1/ iXfI2rZqcjTkxGYezWYyBKf5FqKte49VkV7RadqW+GI/6Eg2n1wJzur+xpwCKwLF hkTfUKWDVsq5Q4wfr0eojkJmMp7IdcY1yGrFPmU9eQKgvsIKnO6jXUd6Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=C7dp9Q/rg7pvVikyJAlkoo4xGzB9DpeWT7c1DhiXl7Q=; b=bU9YJW4d qmB6U/w4Oh0KOpB3dFnIFTvrW6bSbW1GIzqtsWkvpj0HNaC0qmxUcRUu4T/tkzpz ITKdaxsEt+I7YNGst0ZBt072pB55YhqKV3+ejXj/ZlzD3D51QVuTv8ERT0GNDzHV wkkOZjxkJ7PEQ3l3dJt4d6dPo0mCJI/Q4PwZQL6PGzilXMpMS3TcfUU87dT/FnI7 B2jEQdDLFI4rYRzW4ACsYzPJYRBzjof59DTQTtxP5YNPVgeAcm1j5eBsRmgDayxx 5JLSs7Haaxj+GDe1LB8v82aNKsHOMHbN3Dbn4DC9Nn74HozRp13O4dWYSUFMdzyB IMuf1glPXINm4g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudehkedgvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id AC090306467D; Thu, 10 Sep 2020 19:50:58 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, bruce.richardson@intel.com, Fady Bader , Narcisa Vasile , Dmitry Kozlyuk , Ranjit Menon , Kevin Laatz Date: Fri, 11 Sep 2020 01:50:03 +0200 Message-Id: <20200910235005.2420342-4-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910235005.2420342-1-thomas@monjalon.net> References: <20200625133038.25180-1-fady@mellanox.com> <20200910235005.2420342-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 3/5] telemetry: build 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" From: Fady Bader Telemetry didn't compile under Windows. Empty stubs are arranged, waiting for a proper implementation. Signed-off-by: Fady Bader Acked-by: Narcisa Vasile Acked-by: Dmitry Kozlyuk Acked-by: Ranjit Menon Signed-off-by: Thomas Monjalon --- 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 +#include #include #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 #include #include #include #include +#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 #include #include #include +#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