From patchwork Wed Mar 10 17:24:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 88890 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 19A15A056A; Wed, 10 Mar 2021 18:24:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F097522A38A; Wed, 10 Mar 2021 18:24:45 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 492D022A387 for ; Wed, 10 Mar 2021 18:24:44 +0100 (CET) IronPort-SDR: qNB5qD1RThTbg9xUgp8mPmMkD2Yevy01GEJWmWI+9FgE7Vy/m1/N/abIIW0xNclMKBDxwEf+cW KNkKJ4cZANlw== X-IronPort-AV: E=McAfee;i="6000,8403,9919"; a="249887291" X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="249887291" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 09:24:41 -0800 IronPort-SDR: CRuXZ9zPqw1xOT6EwoVfyOWhf0LHSR/aX1BZKYuB/vcB9z0WRSonaDPUM0Ajw6X+WOTP4Fdfjz aDs/jB7SxMoA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="410271649" Received: from silpixa00399126.ir.intel.com ([10.237.223.188]) by orsmga008.jf.intel.com with ESMTP; 10 Mar 2021 09:24:40 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Kevin Laatz Date: Wed, 10 Mar 2021 17:24:27 +0000 Message-Id: <20210310172430.412405-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210310172430.412405-1-bruce.richardson@intel.com> References: <20210310172430.412405-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/4] telemetry: use rte_log for logging X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Rather than passing back an error string to the caller, take as input the rte_log function to use, and just use regular logging. Signed-off-by: Bruce Richardson Acked-by: Ciara Power --- lib/librte_eal/freebsd/eal.c | 10 ++-- lib/librte_eal/linux/eal.c | 10 ++-- lib/librte_telemetry/rte_telemetry.h | 15 ++++-- lib/librte_telemetry/telemetry.c | 72 +++++++++++++--------------- 4 files changed, 49 insertions(+), 58 deletions(-) -- 2.27.0 diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c index e2cdad5283..b8a798bc7d 100644 --- a/lib/librte_eal/freebsd/eal.c +++ b/lib/librte_eal/freebsd/eal.c @@ -941,15 +941,11 @@ rte_eal_init(int argc, char **argv) return -1; } if (!internal_conf->no_telemetry) { - const char *error_str = NULL; + uint32_t tlog = rte_log_register_type_and_pick_level( + "lib.telemetry", RTE_LOG_WARNING); if (rte_telemetry_init(rte_eal_get_runtime_dir(), - &internal_conf->ctrl_cpuset, &error_str) - != 0) { - rte_eal_init_alert(error_str); + &internal_conf->ctrl_cpuset, rte_log, tlog) != 0) return -1; - } - if (error_str != NULL) - RTE_LOG(NOTICE, EAL, "%s\n", error_str); } eal_mcfg_complete(); diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c index 6c34ac8903..23e3a32036 100644 --- a/lib/librte_eal/linux/eal.c +++ b/lib/librte_eal/linux/eal.c @@ -1314,15 +1314,11 @@ rte_eal_init(int argc, char **argv) return -1; } if (!internal_conf->no_telemetry) { - const char *error_str = NULL; + uint32_t tlog = rte_log_register_type_and_pick_level( + "lib.telemetry", RTE_LOG_WARNING); if (rte_telemetry_init(rte_eal_get_runtime_dir(), - &internal_conf->ctrl_cpuset, &error_str) - != 0) { - rte_eal_init_alert(error_str); + &internal_conf->ctrl_cpuset, rte_log, tlog) != 0) return -1; - } - if (error_str != NULL) - RTE_LOG(NOTICE, EAL, "%s\n", error_str); } eal_mcfg_complete(); diff --git a/lib/librte_telemetry/rte_telemetry.h b/lib/librte_telemetry/rte_telemetry.h index f8e54dc68e..2c3da3ab7f 100644 --- a/lib/librte_telemetry/rte_telemetry.h +++ b/lib/librte_telemetry/rte_telemetry.h @@ -292,6 +292,12 @@ __rte_experimental int rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help); +/** + * @internal + * Log function type, to allow passing as parameter if necessary + */ +typedef int (*rte_log_fn)(uint32_t level, uint32_t logtype, const char *format, ...); + /** * @internal * Initialize Telemetry. @@ -300,9 +306,10 @@ rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help); * The runtime directory of DPDK. * @param cpuset * The CPU set to be used for setting the thread affinity. - * @param err_str - * This err_str pointer should point to NULL on entry. In the case of an error - * or warning, it will be non-NULL on exit. + * @param log_fn + * Function pointer to the rte_log function for logging use + * @param registered_logtype + * The registered log type to use for logging * * @return * 0 on success. @@ -312,7 +319,7 @@ rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help); __rte_internal int rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset, - const char **err_str); + rte_log_fn log_fn, uint32_t registered_logtype); /** * Get a pointer to a container with memory allocated. The container is to be diff --git a/lib/librte_telemetry/telemetry.c b/lib/librte_telemetry/telemetry.c index b142729da4..18f2ae2e2f 100644 --- a/lib/librte_telemetry/telemetry.c +++ b/lib/librte_telemetry/telemetry.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "rte_telemetry.h" #include "telemetry_json.h" @@ -48,7 +49,15 @@ 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 */ + +static const char *socket_dir; +static rte_cpuset_t *thread_cpuset; +static rte_log_fn rte_log_ptr; +static uint32_t logtype; + +#define TMTY_LOG(l, ...) \ + rte_log_ptr(RTE_LOG_ ## l, logtype, "TELEMETRY: " __VA_ARGS__) + /* 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 */ @@ -344,9 +353,7 @@ socket_listener(void *socket) struct socket *s = (struct socket *)socket; int s_accepted = accept(s->sock, NULL, NULL); if (s_accepted < 0) { - snprintf(telemetry_log_error, - sizeof(telemetry_log_error), - "Error with accept, telemetry thread quitting"); + TMTY_LOG(ERR, "Error with accept, telemetry thread quitting\n"); return NULL; } if (s->num_clients != NULL) { @@ -388,9 +395,7 @@ create_socket(char *path) { int sock = socket(AF_UNIX, SOCK_SEQPACKET, 0); if (sock < 0) { - snprintf(telemetry_log_error, sizeof(telemetry_log_error), - "Error with socket creation, %s", - strerror(errno)); + TMTY_LOG(ERR, "Error with socket creation, %s\n", strerror(errno)); return -1; } @@ -398,17 +403,13 @@ create_socket(char *path) strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); unlink(sun.sun_path); if (bind(sock, (void *) &sun, sizeof(sun)) < 0) { - snprintf(telemetry_log_error, sizeof(telemetry_log_error), - "Error binding socket: %s", - strerror(errno)); + TMTY_LOG(ERR, "Error binding socket: %s\n", strerror(errno)); sun.sun_path[0] = 0; goto error; } if (listen(sock, 1) < 0) { - snprintf(telemetry_log_error, sizeof(telemetry_log_error), - "Error calling listen for socket: %s", - strerror(errno)); + TMTY_LOG(ERR, "Error calling listen for socket: %s\n", strerror(errno)); goto error; } @@ -421,35 +422,33 @@ create_socket(char *path) } static int -telemetry_legacy_init(const char *runtime_dir, rte_cpuset_t *cpuset) +telemetry_legacy_init(void) { pthread_t t_old; if (num_legacy_callbacks == 1) { - snprintf(telemetry_log_error, sizeof(telemetry_log_error), - "No legacy callbacks, legacy socket not created"); + TMTY_LOG(WARNING, "No legacy callbacks, legacy socket not created\n"); return -1; } v1_socket.fn = legacy_client_handler; if ((size_t) snprintf(v1_socket.path, sizeof(v1_socket.path), - "%s/telemetry", runtime_dir) - >= sizeof(v1_socket.path)) { - snprintf(telemetry_log_error, sizeof(telemetry_log_error), - "Error with socket binding, path too long"); + "%s/telemetry", socket_dir) >= sizeof(v1_socket.path)) { + TMTY_LOG(ERR, "Error with socket binding, path too long\n"); return -1; } v1_socket.sock = create_socket(v1_socket.path); if (v1_socket.sock < 0) return -1; pthread_create(&t_old, NULL, socket_listener, &v1_socket); - pthread_setaffinity_np(t_old, sizeof(*cpuset), cpuset); + pthread_setaffinity_np(t_old, sizeof(*thread_cpuset), thread_cpuset); + TMTY_LOG(DEBUG, "Legacy telemetry socket initialized ok\n"); return 0; } static int -telemetry_v2_init(const char *runtime_dir, rte_cpuset_t *cpuset) +telemetry_v2_init(void) { pthread_t t_new; @@ -461,10 +460,9 @@ telemetry_v2_init(const char *runtime_dir, rte_cpuset_t *cpuset) rte_telemetry_register_cmd("/help", command_help, "Returns help text for a command. Parameters: string command"); v2_socket.fn = client_handler; - if (strlcpy(v2_socket.path, get_socket_path(runtime_dir, 2), + if (strlcpy(v2_socket.path, get_socket_path(socket_dir, 2), sizeof(v2_socket.path)) >= sizeof(v2_socket.path)) { - snprintf(telemetry_log_error, sizeof(telemetry_log_error), - "Error with socket binding, path too long"); + TMTY_LOG(ERR, "Error with socket binding, path too long\n"); return -1; } @@ -472,7 +470,7 @@ telemetry_v2_init(const char *runtime_dir, rte_cpuset_t *cpuset) if (v2_socket.sock < 0) return -1; pthread_create(&t_new, NULL, socket_listener, &v2_socket); - pthread_setaffinity_np(t_new, sizeof(*cpuset), cpuset); + pthread_setaffinity_np(t_new, sizeof(*thread_cpuset), thread_cpuset); atexit(unlink_sockets); return 0; @@ -482,23 +480,17 @@ telemetry_v2_init(const char *runtime_dir, rte_cpuset_t *cpuset) int32_t rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset, - const char **err_str) + rte_log_fn log_fn, uint32_t registered_logtype) { + socket_dir = runtime_dir; + thread_cpuset = cpuset; + rte_log_ptr = log_fn; + logtype = registered_logtype; #ifndef RTE_EXEC_ENV_WINDOWS - if (telemetry_v2_init(runtime_dir, cpuset) != 0) { - *err_str = telemetry_log_error; + if (telemetry_v2_init() != 0) return -1; - } - 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."); + TMTY_LOG(DEBUG, "Telemetry initialized ok\n"); + telemetry_legacy_init(); #endif /* RTE_EXEC_ENV_WINDOWS */ return 0; From patchwork Wed Mar 10 17:24:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 88891 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 46BFDA056A; Wed, 10 Mar 2021 18:24:54 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 32A8F22A3C2; Wed, 10 Mar 2021 18:24:54 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id F1F6C22A3AC for ; Wed, 10 Mar 2021 18:24:51 +0100 (CET) IronPort-SDR: 9dRGjqe47AfPtpJ6SKkiNg0l9qLLm/zV29A7qWdD3tB7TI34Qh7lnDJ2hCEqAAnDIK++vcVnS3 f0PntnGYJGhw== X-IronPort-AV: E=McAfee;i="6000,8403,9919"; a="185164649" X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="185164649" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 09:24:47 -0800 IronPort-SDR: dbRJQW43GY4ruCszICgtONrXr384unCGc9pPh4cpiY6VhqSb+Hp7dVGaxwxXD7CBfIq6Q4UrCy I1Lolh8oCfGQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="410271688" Received: from silpixa00399126.ir.intel.com ([10.237.223.188]) by orsmga008.jf.intel.com with ESMTP; 10 Mar 2021 09:24:46 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Kevin Laatz , Ray Kinsella , Neil Horman Date: Wed, 10 Mar 2021 17:24:28 +0000 Message-Id: <20210310172430.412405-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210310172430.412405-1-bruce.richardson@intel.com> References: <20210310172430.412405-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/4] telemetry: make the legacy registration function internal X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" The function for registration of callbacks for legacy telemetry was documented as internal-only in the API documents, but marked as experimental in the version.map file. Since this is an internal-only function, for consistency we update the version mapping to have it as internal. Signed-off-by: Bruce Richardson Acked-by: Ciara Power --- doc/guides/rel_notes/release_21_05.rst | 5 +++++ lib/librte_telemetry/rte_telemetry_legacy.h | 2 +- lib/librte_telemetry/version.map | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst index 23f7f0bff9..1624f43d73 100644 --- a/doc/guides/rel_notes/release_21_05.rst +++ b/doc/guides/rel_notes/release_21_05.rst @@ -117,6 +117,11 @@ ABI Changes * No ABI change that would break compatibility with 20.11. +* The experimental function ``rte_telemetry_legacy_register`` has been + removed from the public API and is now an internal-only function. This + function was already marked as internal in the API documentation for it, + and was not for use by external applications. + Known Issues ------------ diff --git a/lib/librte_telemetry/rte_telemetry_legacy.h b/lib/librte_telemetry/rte_telemetry_legacy.h index c83f9a8d90..fb44740186 100644 --- a/lib/librte_telemetry/rte_telemetry_legacy.h +++ b/lib/librte_telemetry/rte_telemetry_legacy.h @@ -78,7 +78,7 @@ legacy_client_handler(void *sock_id); * @return * -ENOENT if max callbacks limit has been reached. */ -__rte_experimental +__rte_internal int rte_telemetry_legacy_register(const char *cmd, enum rte_telemetry_legacy_data_req data_req, diff --git a/lib/librte_telemetry/version.map b/lib/librte_telemetry/version.map index ec0ebc1bec..bde80ce29b 100644 --- a/lib/librte_telemetry/version.map +++ b/lib/librte_telemetry/version.map @@ -14,12 +14,12 @@ EXPERIMENTAL { rte_tel_data_start_array; rte_tel_data_start_dict; rte_tel_data_string; - rte_telemetry_legacy_register; rte_telemetry_register_cmd; local: *; }; INTERNAL { + rte_telemetry_legacy_register; rte_telemetry_init; }; From patchwork Wed Mar 10 17:24:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 88892 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4B473A056A; Wed, 10 Mar 2021 18:25:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6331422A3C3; Wed, 10 Mar 2021 18:24:55 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 9854A22A3AC for ; Wed, 10 Mar 2021 18:24:52 +0100 (CET) IronPort-SDR: tP1oVsgihD15O8gJNMJkUOgXBapq5vfp4H4cdS6Uh/4d1xP95EmEJ/cSWW3WQ6teHRxgNwsd9C vJXJO90LeIKA== X-IronPort-AV: E=McAfee;i="6000,8403,9919"; a="185164652" X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="185164652" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 09:24:50 -0800 IronPort-SDR: v6r4RFR86Ykl255M56xa+QSNnVpf1f4TUm+SVQ8A7XgWemAcHjnlxBeoBDih8wmMxDT7ZIwiDL AuN362p0GZfg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="410271713" Received: from silpixa00399126.ir.intel.com ([10.237.223.188]) by orsmga008.jf.intel.com with ESMTP; 10 Mar 2021 09:24:49 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Kevin Laatz Date: Wed, 10 Mar 2021 17:24:29 +0000 Message-Id: <20210310172430.412405-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210310172430.412405-1-bruce.richardson@intel.com> References: <20210310172430.412405-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 3/4] telemetry: create internal-only header file X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" The header file containing the legacy telemetry function prototypes was all internal-only, so we rename the file to be an internal-only one to make it clearer it's not for installation. Signed-off-by: Bruce Richardson Acked-by: Ciara Power --- lib/librte_metrics/rte_metrics_telemetry.c | 2 +- lib/librte_telemetry/telemetry.c | 2 +- .../{rte_telemetry_legacy.h => telemetry_internal.h} | 6 +++--- lib/librte_telemetry/telemetry_legacy.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename lib/librte_telemetry/{rte_telemetry_legacy.h => telemetry_internal.h} (93%) diff --git a/lib/librte_metrics/rte_metrics_telemetry.c b/lib/librte_metrics/rte_metrics_telemetry.c index b8ee56ef01..bbc6a79f88 100644 --- a/lib/librte_metrics/rte_metrics_telemetry.c +++ b/lib/librte_metrics/rte_metrics_telemetry.c @@ -7,7 +7,7 @@ #include #include #ifdef RTE_LIB_TELEMETRY -#include +#include #endif #include "rte_metrics.h" diff --git a/lib/librte_telemetry/telemetry.c b/lib/librte_telemetry/telemetry.c index 18f2ae2e2f..c3c988e972 100644 --- a/lib/librte_telemetry/telemetry.c +++ b/lib/librte_telemetry/telemetry.c @@ -21,7 +21,7 @@ #include "rte_telemetry.h" #include "telemetry_json.h" #include "telemetry_data.h" -#include "rte_telemetry_legacy.h" +#include "telemetry_internal.h" #define MAX_CMD_LEN 56 #define MAX_HELP_LEN 64 diff --git a/lib/librte_telemetry/rte_telemetry_legacy.h b/lib/librte_telemetry/telemetry_internal.h similarity index 93% rename from lib/librte_telemetry/rte_telemetry_legacy.h rename to lib/librte_telemetry/telemetry_internal.h index fb44740186..ad076b9119 100644 --- a/lib/librte_telemetry/rte_telemetry_legacy.h +++ b/lib/librte_telemetry/telemetry_internal.h @@ -2,8 +2,8 @@ * Copyright(c) 2020 Intel Corporation */ -#ifndef _RTE_TELEMETRY_LEGACY_H_ -#define _RTE_TELEMETRY_LEGACY_H_ +#ifndef _RTE_TELEMETRY_INTERNAL_H_ +#define _RTE_TELEMETRY_INTERNAL_H_ #include #include "rte_telemetry.h" @@ -14,7 +14,7 @@ * @b EXPERIMENTAL: this API may change without prior notice * @file - * RTE Telemetry Legacy + * RTE Telemetry Legacy and internal definitions * ***/ diff --git a/lib/librte_telemetry/telemetry_legacy.c b/lib/librte_telemetry/telemetry_legacy.c index edd76ca359..5e9af37db1 100644 --- a/lib/librte_telemetry/telemetry_legacy.c +++ b/lib/librte_telemetry/telemetry_legacy.c @@ -15,7 +15,7 @@ #include #include -#include "rte_telemetry_legacy.h" +#include "telemetry_internal.h" #define MAX_LEN 128 #define BUF_SIZE 1024 From patchwork Wed Mar 10 17:24:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 88893 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 37E06A056A; Wed, 10 Mar 2021 18:25:11 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EDC8322A400; Wed, 10 Mar 2021 18:24:56 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 7956640F35 for ; Wed, 10 Mar 2021 18:24:53 +0100 (CET) IronPort-SDR: GJ2MbEHFJCgMwIJXp1Dtk0aM2kuf5fMDQwQ5CJvDOzudn1zWes9WGFXeYa47P7pVS4CFXc7gD+ NHES7XgPG1FA== X-IronPort-AV: E=McAfee;i="6000,8403,9919"; a="185164660" X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="185164660" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 09:24:53 -0800 IronPort-SDR: EHAGuGzB7bLq6P4yPEWjnZloQW7A29bDFTMcqT2UGsposw65v3mEDLkIuomiir8FLEzXZodD/C lFlywQjgo3iw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="410271733" Received: from silpixa00399126.ir.intel.com ([10.237.223.188]) by orsmga008.jf.intel.com with ESMTP; 10 Mar 2021 09:24:52 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Kevin Laatz Date: Wed, 10 Mar 2021 17:24:30 +0000 Message-Id: <20210310172430.412405-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210310172430.412405-1-bruce.richardson@intel.com> References: <20210310172430.412405-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 4/4] telemetry: move init function to internal header X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" The rte_telemetry_init() function is for EAL use only, so can be moved to the internal header rather than being in the public one. Signed-off-by: Bruce Richardson Acked-by: Ciara Power --- lib/librte_eal/freebsd/eal.c | 2 +- lib/librte_eal/linux/eal.c | 2 +- lib/librte_telemetry/rte_telemetry.h | 29 ----------------------- lib/librte_telemetry/telemetry_internal.h | 29 +++++++++++++++++++++++ 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c index b8a798bc7d..be02f70510 100644 --- a/lib/librte_eal/freebsd/eal.c +++ b/lib/librte_eal/freebsd/eal.c @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include "eal_private.h" #include "eal_thread.h" diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c index 23e3a32036..da2d6602a8 100644 --- a/lib/librte_eal/linux/eal.c +++ b/lib/librte_eal/linux/eal.c @@ -49,8 +49,8 @@ #include #include #include -#include +#include #include "eal_private.h" #include "eal_thread.h" #include "eal_internal_cfg.h" diff --git a/lib/librte_telemetry/rte_telemetry.h b/lib/librte_telemetry/rte_telemetry.h index 2c3da3ab7f..334ea8ddd4 100644 --- a/lib/librte_telemetry/rte_telemetry.h +++ b/lib/librte_telemetry/rte_telemetry.h @@ -292,35 +292,6 @@ __rte_experimental int rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help); -/** - * @internal - * Log function type, to allow passing as parameter if necessary - */ -typedef int (*rte_log_fn)(uint32_t level, uint32_t logtype, const char *format, ...); - -/** - * @internal - * Initialize Telemetry. - * - * @param runtime_dir - * The runtime directory of DPDK. - * @param cpuset - * The CPU set to be used for setting the thread affinity. - * @param log_fn - * Function pointer to the rte_log function for logging use - * @param registered_logtype - * The registered log type to use for logging - * - * @return - * 0 on success. - * @return - * -1 on failure. - */ -__rte_internal -int -rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset, - rte_log_fn log_fn, uint32_t registered_logtype); - /** * Get a pointer to a container with memory allocated. The container is to be * used embedded within an existing telemetry dict/array. diff --git a/lib/librte_telemetry/telemetry_internal.h b/lib/librte_telemetry/telemetry_internal.h index ad076b9119..601f16cc96 100644 --- a/lib/librte_telemetry/telemetry_internal.h +++ b/lib/librte_telemetry/telemetry_internal.h @@ -84,4 +84,33 @@ rte_telemetry_legacy_register(const char *cmd, enum rte_telemetry_legacy_data_req data_req, telemetry_legacy_cb fn); +/** + * @internal + * Log function type, to allow passing as parameter if necessary + */ +typedef int (*rte_log_fn)(uint32_t level, uint32_t logtype, const char *format, ...); + +/** + * @internal + * Initialize Telemetry. + * + * @param runtime_dir + * The runtime directory of DPDK. + * @param cpuset + * The CPU set to be used for setting the thread affinity. + * @param log_fn + * Function pointer to the rte_log function for logging use + * @param registered_logtype + * The registered log type to use for logging + * + * @return + * 0 on success. + * @return + * -1 on failure. + */ +__rte_internal +int +rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset, + rte_log_fn log_fn, uint32_t registered_logtype); + #endif