'rte_random.c',
'rte_reciprocal.c',
'rte_service.c',
+ 'rte_version.c',
)
subdir_done()
endif
'rte_random.c',
'rte_reciprocal.c',
'rte_service.c',
+ 'rte_version.c',
)
if is_linux
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Intel Corporation
+ */
+
+#include <rte_version.h>
+
+const char *
+rte_version_prefix(void) { return RTE_VER_PREFIX; }
+
+unsigned int
+rte_version_year(void) { return RTE_VER_YEAR; }
+
+unsigned int
+rte_version_month(void) { return RTE_VER_MONTH; }
+
+unsigned int
+rte_version_minor(void) { return RTE_VER_MINOR; }
+
+const char *
+rte_version_suffix(void) { return RTE_VER_SUFFIX; }
+
+unsigned int
+rte_version_release(void) { return RTE_VER_RELEASE; }
+
+const char *
+rte_version(void)
+{
+ static char version[32];
+ if (version[0] != 0)
+ return version;
+ if (strlen(RTE_VER_SUFFIX) == 0)
+ snprintf(version, sizeof(version), "%s %d.%02d.%d",
+ RTE_VER_PREFIX,
+ RTE_VER_YEAR,
+ RTE_VER_MONTH,
+ RTE_VER_MINOR);
+ else
+ snprintf(version, sizeof(version), "%s %d.%02d.%d%s%d",
+ RTE_VER_PREFIX,
+ RTE_VER_YEAR,
+ RTE_VER_MONTH,
+ RTE_VER_MINOR,
+ RTE_VER_SUFFIX,
+ RTE_VER_RELEASE);
+ return version;
+}
if (!internal_conf->no_telemetry) {
const char *error_str = NULL;
if (rte_telemetry_init(rte_eal_get_runtime_dir(),
+ rte_version(),
&internal_conf->ctrl_cpuset, &error_str)
!= 0) {
rte_eal_init_alert(error_str);
* All version numbers in one to compare with RTE_VERSION_NUM()
*/
#define RTE_VERSION RTE_VERSION_NUM( \
- RTE_VER_YEAR, \
- RTE_VER_MONTH, \
- RTE_VER_MINOR, \
- RTE_VER_RELEASE)
+ rte_version_year(), \
+ rte_version_month(), \
+ rte_version_minor(), \
+ rte_version_release())
+
+/**
+ * Function to return DPDK version prefix string
+ */
+const char *rte_version_prefix(void);
+
+/**
+ * Function to return DPDK version year
+ */
+unsigned int rte_version_year(void);
+
+/**
+ * Function to return DPDK version month
+ */
+unsigned int rte_version_month(void);
+
+/**
+ * Function to return DPDK minor version number
+ */
+unsigned int rte_version_minor(void);
+
+/**
+ * Function to return DPDK version suffix for any release candidates
+ */
+const char *rte_version_suffix(void);
+
+/**
+ * Function to return DPDK version release candidate value
+ */
+unsigned int rte_version_release(void);
/**
* Function returning version string
* @return
- * string
+ * DPDK version string
*/
-static inline const char *
-rte_version(void)
-{
- static char version[32];
- if (version[0] != 0)
- return version;
- if (strlen(RTE_VER_SUFFIX) == 0)
- snprintf(version, sizeof(version), "%s %d.%02d.%d",
- RTE_VER_PREFIX,
- RTE_VER_YEAR,
- RTE_VER_MONTH,
- RTE_VER_MINOR);
- else
- snprintf(version, sizeof(version), "%s %d.%02d.%d%s%d",
- RTE_VER_PREFIX,
- RTE_VER_YEAR,
- RTE_VER_MONTH,
- RTE_VER_MINOR,
- RTE_VER_SUFFIX,
- RTE_VER_RELEASE);
- return version;
-}
+const char *rte_version(void);
#ifdef __cplusplus
}
if (!internal_conf->no_telemetry) {
const char *error_str = NULL;
if (rte_telemetry_init(rte_eal_get_runtime_dir(),
+ rte_version(),
&internal_conf->ctrl_cpuset, &error_str)
!= 0) {
rte_eal_init_alert(error_str);
rte_uuid_is_null;
rte_uuid_parse;
rte_uuid_unparse;
+ rte_version;
+ rte_version_minor;
+ rte_version_month;
+ rte_version_prefix;
+ rte_version_release;
+ rte_version_suffix;
+ rte_version_year;
rte_vfio_clear_group;
rte_vfio_container_create;
rte_vfio_container_destroy;
*/
__rte_internal
int
-rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
+rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset,
const char **err_str);
/**
#include <rte_string_fns.h>
#include <rte_common.h>
#include <rte_spinlock.h>
-#include <rte_version.h>
#include "rte_telemetry.h"
#include "telemetry_json.h"
static struct socket v2_socket; /* socket for v2 telemetry */
static struct socket v1_socket; /* socket for v1 telemetry */
#endif /* !RTE_EXEC_ENV_WINDOWS */
+
+static const char *telemetry_version; /* save rte_version */
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];
struct rte_tel_data *d)
{
rte_tel_data_start_dict(d);
- rte_tel_data_add_dict_string(d, "version", rte_version());
+ rte_tel_data_add_dict_string(d, "version", telemetry_version);
rte_tel_data_add_dict_int(d, "pid", getpid());
rte_tel_data_add_dict_int(d, "max_output_len", MAX_OUTPUT_LEN);
return 0;
char info_str[1024];
snprintf(info_str, sizeof(info_str),
"{\"version\":\"%s\",\"pid\":%d,\"max_output_len\":%d}",
- rte_version(), getpid(), MAX_OUTPUT_LEN);
+ telemetry_version, getpid(), MAX_OUTPUT_LEN);
if (write(s, info_str, strlen(info_str)) < 0) {
close(s);
return NULL;
#endif /* !RTE_EXEC_ENV_WINDOWS */
int32_t
-rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
- const char **err_str)
+rte_telemetry_init(const char *runtime_dir, const char *rte_version,
+ rte_cpuset_t *cpuset, const char **err_str)
{
+ telemetry_version = rte_version;
#ifndef RTE_EXEC_ENV_WINDOWS
if (telemetry_v2_init(runtime_dir, cpuset) != 0) {
*err_str = telemetry_log_error;