From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0EE97A0540; Tue, 13 Dec 2022 19:28:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0216242D1F; Tue, 13 Dec 2022 19:27:57 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 3F3DD42C29 for ; Tue, 13 Dec 2022 19:27:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670956073; x=1702492073; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3aUSgccpUEqr1kd/O3/T4U+4fImPSyAuW9KTcQcA574=; b=Egf1yzgdG32K/AHg3DU+0aBesgnpdlRiB697i1kbpF92lINRt4MFxL3p hNA7KPmNiZu/ZTvnr6fExdKoGwreCAAnHt8oGqLeP0CmauXWepm7B+hTJ ql4uDC7KgVLUM5IiXTI1wRtTm1gZDaZpcxN3pf/UQvgo4tsBfeEMvwjYw /sTU8CogrzLmakL8RyRjwlObVBFXkIS7WsCClTltxj/PJf2yeRwfnzDOk NOQatowU5qbAlbRavLgbRABoRn+KepCvcSMRxwCFEKsoYdhEcJo1RFwQA Ly6Uk+DmIQnOzNk27dqGncDZI7ssZ/4vGcQ9snaHiAjvhVcl1pIApqgV4 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10560"; a="382506976" X-IronPort-AV: E=Sophos;i="5.96,242,1665471600"; d="scan'208";a="382506976" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2022 10:27:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10560"; a="626445201" X-IronPort-AV: E=Sophos;i="5.96,242,1665471600"; d="scan'208";a="626445201" Received: from silpixa00401459.ir.intel.com (HELO silpixa00401459.ger.corp.intel.com) ([10.237.223.55]) by orsmga006.jf.intel.com with ESMTP; 13 Dec 2022 10:27:50 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [RFC PATCH 3/7] telemetry: remove RTE prefix from internal enum values Date: Tue, 13 Dec 2022 18:27:26 +0000 Message-Id: <20221213182730.97065-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221213182730.97065-1-bruce.richardson@intel.com> References: <20221213182730.97065-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 --- 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 ca6d196560..5923350424 100644 --- a/lib/ethdev/sff_telemetry.c +++ b/lib/ethdev/sff_telemetry.c @@ -96,7 +96,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 fd8186383f..89bdde8422 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -167,27 +167,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_UINT && - d->type != RTE_TEL_ARRAY_INT && d->type != RTE_TEL_ARRAY_STRING) + if (d->type != TEL_DICT && d->type != TEL_ARRAY_UINT && + 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_UINT) + if (d->type == TEL_ARRAY_UINT) for (i = 0; i < d->data_len; i++) used = rte_tel_json_add_array_u64(out_buf, buf_len, used, d->data.array[i].uval); - 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) { @@ -245,15 +245,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]; @@ -291,26 +291,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_UINT: - case RTE_TEL_ARRAY_CONTAINER: + case TEL_ARRAY_STRING: + case TEL_ARRAY_INT: + case TEL_ARRAY_UINT: + 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_UINT) + else if (d->type == TEL_ARRAY_UINT) used = rte_tel_json_add_array_u64(cb_data_buf, buf_len, used, d->data.array[i].uval); - 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; @@ -351,7 +351,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 077b0c4a6f..d51724e1f5 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_UINT, /* RTE_TEL_UINT_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_UINT, /* RTE_TEL_UINT_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_uint(struct rte_tel_data *d, uint64_t x) { - if (d->type != RTE_TEL_ARRAY_UINT) + if (d->type != TEL_ARRAY_UINT) return -EINVAL; if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES) return -ENOSPC; @@ -90,10 +90,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_UINT - && val->type != RTE_TEL_ARRAY_INT - && val->type != RTE_TEL_ARRAY_STRING)) + if (d->type != TEL_ARRAY_CONTAINER || + (val->type != TEL_ARRAY_UINT + && val->type != TEL_ARRAY_INT + && val->type != TEL_ARRAY_STRING)) return -EINVAL; if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES) return -ENOSPC; @@ -128,7 +128,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; @@ -150,7 +150,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; @@ -170,7 +170,7 @@ rte_tel_data_add_dict_uint(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; @@ -197,10 +197,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_UINT - && 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_UINT + && 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 939deaa618..8db6875a81 100644 --- a/lib/telemetry/telemetry_data.h +++ b/lib/telemetry/telemetry_data.h @@ -8,13 +8,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_UINT, /** 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_UINT, /** array of unsigned 64-bit int values */ + TEL_ARRAY_CONTAINER, /** array of container structs */ }; struct container { -- 2.34.1