代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/dpdk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 7d1c58f6d3ab3d695553ea6018b8866ed43ca99a Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson@intel.com>
Date: Thu, 12 Jan 2023 17:41:08 +0000
Subject: telemetry: remove RTE prefix from internal enums
[ upstream commit 5a36d5311fafc0775922317928bb8892f5b13dc8 ]
To better distinguish which values are public and which are internal
remove the "RTE_" prefix off the internal enum defining the container
types.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Ciara Power <ciara.power@intel.com>
---
lib/ethdev/sff_telemetry.c | 2 +-
lib/telemetry/telemetry.c | 36 +++++++++++++++---------------
lib/telemetry/telemetry_data.c | 40 +++++++++++++++++-----------------
lib/telemetry/telemetry_data.h | 14 ++++++------
4 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/lib/ethdev/sff_telemetry.c b/lib/ethdev/sff_telemetry.c
index 887f07c..922841b 100644
--- a/lib/ethdev/sff_telemetry.c
+++ b/lib/ethdev/sff_telemetry.c
@@ -94,7 +94,7 @@ ssf_add_dict_string(struct rte_tel_data *d, const char *name_str, const char *va
{
struct tel_dict_entry *e = &d->data.dict[d->data_len];
- if (d->type != RTE_TEL_DICT)
+ if (d->type != TEL_DICT)
return;
if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) {
RTE_ETHDEV_LOG(ERR, "data_len has exceeded the maximum number of inserts\n");
diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 52048de..8f2aef4 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -166,27 +166,27 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len)
size_t used = 0;
unsigned int i;
- if (d->type != RTE_TEL_DICT && d->type != RTE_TEL_ARRAY_U64 &&
- d->type != RTE_TEL_ARRAY_INT && d->type != RTE_TEL_ARRAY_STRING)
+ if (d->type != TEL_DICT && d->type != TEL_ARRAY_U64 &&
+ d->type != TEL_ARRAY_INT && d->type != TEL_ARRAY_STRING)
return snprintf(out_buf, buf_len, "null");
used = rte_tel_json_empty_array(out_buf, buf_len, 0);
- if (d->type == RTE_TEL_ARRAY_U64)
+ if (d->type == TEL_ARRAY_U64)
for (i = 0; i < d->data_len; i++)
used = rte_tel_json_add_array_u64(out_buf,
buf_len, used,
d->data.array[i].u64val);
- if (d->type == RTE_TEL_ARRAY_INT)
+ if (d->type == TEL_ARRAY_INT)
for (i = 0; i < d->data_len; i++)
used = rte_tel_json_add_array_int(out_buf,
buf_len, used,
d->data.array[i].ival);
- if (d->type == RTE_TEL_ARRAY_STRING)
+ if (d->type == TEL_ARRAY_STRING)
for (i = 0; i < d->data_len; i++)
used = rte_tel_json_add_array_string(out_buf,
buf_len, used,
d->data.array[i].sval);
- if (d->type == RTE_TEL_DICT)
+ if (d->type == TEL_DICT)
for (i = 0; i < d->data_len; i++) {
const struct tel_dict_entry *v = &d->data.dict[i];
switch (v->type) {
@@ -244,15 +244,15 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
buf_len = sizeof(out_buf) - prefix_used - 1; /* space for '}' */
switch (d->type) {
- case RTE_TEL_NULL:
+ case TEL_NULL:
used = strlcpy(cb_data_buf, "null", buf_len);
break;
- case RTE_TEL_STRING:
+ case TEL_STRING:
used = rte_tel_json_str(cb_data_buf, buf_len, 0, d->data.str);
break;
- case RTE_TEL_DICT:
+ case TEL_DICT:
used = rte_tel_json_empty_obj(cb_data_buf, buf_len, 0);
for (i = 0; i < d->data_len; i++) {
const struct tel_dict_entry *v = &d->data.dict[i];
@@ -290,26 +290,26 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
}
break;
- case RTE_TEL_ARRAY_STRING:
- case RTE_TEL_ARRAY_INT:
- case RTE_TEL_ARRAY_U64:
- case RTE_TEL_ARRAY_CONTAINER:
+ case TEL_ARRAY_STRING:
+ case TEL_ARRAY_INT:
+ case TEL_ARRAY_U64:
+ case TEL_ARRAY_CONTAINER:
used = rte_tel_json_empty_array(cb_data_buf, buf_len, 0);
for (i = 0; i < d->data_len; i++)
- if (d->type == RTE_TEL_ARRAY_STRING)
+ if (d->type == TEL_ARRAY_STRING)
used = rte_tel_json_add_array_string(
cb_data_buf,
buf_len, used,
d->data.array[i].sval);
- else if (d->type == RTE_TEL_ARRAY_INT)
+ else if (d->type == TEL_ARRAY_INT)
used = rte_tel_json_add_array_int(cb_data_buf,
buf_len, used,
d->data.array[i].ival);
- else if (d->type == RTE_TEL_ARRAY_U64)
+ else if (d->type == TEL_ARRAY_U64)
used = rte_tel_json_add_array_u64(cb_data_buf,
buf_len, used,
d->data.array[i].u64val);
- else if (d->type == RTE_TEL_ARRAY_CONTAINER) {
+ else if (d->type == TEL_ARRAY_CONTAINER) {
char temp[buf_len];
const struct container *rec_data =
&d->data.array[i].container;
@@ -350,7 +350,7 @@ static int
unknown_command(const char *cmd __rte_unused, const char *params __rte_unused,
struct rte_tel_data *d)
{
- return d->type = RTE_TEL_NULL;
+ return d->type = TEL_NULL;
}
static void *
diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c
index 61d9eea..15bcf8c 100644
--- a/lib/telemetry/telemetry_data.c
+++ b/lib/telemetry/telemetry_data.c
@@ -16,10 +16,10 @@ int
rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type)
{
enum tel_container_types array_types[] = {
- RTE_TEL_ARRAY_STRING, /* RTE_TEL_STRING_VAL = 0 */
- RTE_TEL_ARRAY_INT, /* RTE_TEL_INT_VAL = 1 */
- RTE_TEL_ARRAY_U64, /* RTE_TEL_u64_VAL = 2 */
- RTE_TEL_ARRAY_CONTAINER, /* RTE_TEL_CONTAINER = 3 */
+ TEL_ARRAY_STRING, /* RTE_TEL_STRING_VAL = 0 */
+ TEL_ARRAY_INT, /* RTE_TEL_INT_VAL = 1 */
+ TEL_ARRAY_U64, /* RTE_TEL_U64_VAL = 2 */
+ TEL_ARRAY_CONTAINER, /* RTE_TEL_CONTAINER = 3 */
};
d->type = array_types[type];
d->data_len = 0;
@@ -29,7 +29,7 @@ rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type)
int
rte_tel_data_start_dict(struct rte_tel_data *d)
{
- d->type = RTE_TEL_DICT;
+ d->type = TEL_DICT;
d->data_len = 0;
return 0;
}
@@ -37,7 +37,7 @@ rte_tel_data_start_dict(struct rte_tel_data *d)
int
rte_tel_data_string(struct rte_tel_data *d, const char *str)
{
- d->type = RTE_TEL_STRING;
+ d->type = TEL_STRING;
d->data_len = strlcpy(d->data.str, str, sizeof(d->data.str));
if (d->data_len >= RTE_TEL_MAX_SINGLE_STRING_LEN) {
d->data_len = RTE_TEL_MAX_SINGLE_STRING_LEN - 1;
@@ -49,7 +49,7 @@ rte_tel_data_string(struct rte_tel_data *d, const char *str)
int
rte_tel_data_add_array_string(struct rte_tel_data *d, const char *str)
{
- if (d->type != RTE_TEL_ARRAY_STRING)
+ if (d->type != TEL_ARRAY_STRING)
return -EINVAL;
if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES)
return -ENOSPC;
@@ -61,7 +61,7 @@ rte_tel_data_add_array_string(struct rte_tel_data *d, const char *str)
int
rte_tel_data_add_array_int(struct rte_tel_data *d, int x)
{
- if (d->type != RTE_TEL_ARRAY_INT)
+ if (d->type != TEL_ARRAY_INT)
return -EINVAL;
if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES)
return -ENOSPC;
@@ -72,7 +72,7 @@ rte_tel_data_add_array_int(struct rte_tel_data *d, int x)
int
rte_tel_data_add_array_u64(struct rte_tel_data *d, uint64_t x)
{
- if (d->type != RTE_TEL_ARRAY_U64)
+ if (d->type != TEL_ARRAY_U64)
return -EINVAL;
if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES)
return -ENOSPC;
@@ -84,10 +84,10 @@ int
rte_tel_data_add_array_container(struct rte_tel_data *d,
struct rte_tel_data *val, int keep)
{
- if (d->type != RTE_TEL_ARRAY_CONTAINER ||
- (val->type != RTE_TEL_ARRAY_U64
- && val->type != RTE_TEL_ARRAY_INT
- && val->type != RTE_TEL_ARRAY_STRING))
+ if (d->type != TEL_ARRAY_CONTAINER ||
+ (val->type != TEL_ARRAY_U64
+ && val->type != TEL_ARRAY_INT
+ && val->type != TEL_ARRAY_STRING))
return -EINVAL;
if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES)
return -ENOSPC;
@@ -176,7 +176,7 @@ rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name,
struct tel_dict_entry *e = &d->data.dict[d->data_len];
size_t nbytes, vbytes;
- if (d->type != RTE_TEL_DICT)
+ if (d->type != TEL_DICT)
return -EINVAL;
if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES)
return -ENOSPC;
@@ -198,7 +198,7 @@ int
rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val)
{
struct tel_dict_entry *e = &d->data.dict[d->data_len];
- if (d->type != RTE_TEL_DICT)
+ if (d->type != TEL_DICT)
return -EINVAL;
if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES)
return -ENOSPC;
@@ -218,7 +218,7 @@ rte_tel_data_add_dict_u64(struct rte_tel_data *d,
const char *name, uint64_t val)
{
struct tel_dict_entry *e = &d->data.dict[d->data_len];
- if (d->type != RTE_TEL_DICT)
+ if (d->type != TEL_DICT)
return -EINVAL;
if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES)
return -ENOSPC;
@@ -239,10 +239,10 @@ rte_tel_data_add_dict_container(struct rte_tel_data *d, const char *name,
{
struct tel_dict_entry *e = &d->data.dict[d->data_len];
- if (d->type != RTE_TEL_DICT || (val->type != RTE_TEL_ARRAY_U64
- && val->type != RTE_TEL_ARRAY_INT
- && val->type != RTE_TEL_ARRAY_STRING
- && val->type != RTE_TEL_DICT))
+ if (d->type != TEL_DICT || (val->type != TEL_ARRAY_U64
+ && val->type != TEL_ARRAY_INT
+ && val->type != TEL_ARRAY_STRING
+ && val->type != TEL_DICT))
return -EINVAL;
if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES)
return -ENOSPC;
diff --git a/lib/telemetry/telemetry_data.h b/lib/telemetry/telemetry_data.h
index adb84a0..2e5504a 100644
--- a/lib/telemetry/telemetry_data.h
+++ b/lib/telemetry/telemetry_data.h
@@ -9,13 +9,13 @@
#include "rte_telemetry.h"
enum tel_container_types {
- RTE_TEL_NULL, /** null, used as error value */
- RTE_TEL_STRING, /** basic string type, no included data */
- RTE_TEL_DICT, /** name-value pairs, of individual value type */
- RTE_TEL_ARRAY_STRING, /** array of string values only */
- RTE_TEL_ARRAY_INT, /** array of signed, 32-bit int values */
- RTE_TEL_ARRAY_U64, /** array of unsigned 64-bit int values */
- RTE_TEL_ARRAY_CONTAINER, /** array of container structs */
+ TEL_NULL, /** null, used as error value */
+ TEL_STRING, /** basic string type, no included data */
+ TEL_DICT, /** name-value pairs, of individual value type */
+ TEL_ARRAY_STRING, /** array of string values only */
+ TEL_ARRAY_INT, /** array of signed, 32-bit int values */
+ TEL_ARRAY_U64, /** array of unsigned 64-bit int values */
+ TEL_ARRAY_CONTAINER, /** array of container structs */
};
struct container {
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。