DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: "Bruce Richardson" <bruce.richardson@intel.com>,
	"Morten Brørup" <mb@smartsharesystems.com>,
	"Tyler Retzlaff" <roretzla@linux.microsoft.com>,
	"Ciara Power" <ciara.power@intel.com>,
	"Nithin Dabilpuram" <ndabilpuram@marvell.com>,
	"Kiran Kumar K" <kirankumark@marvell.com>,
	"Sunil Kumar Kori" <skori@marvell.com>,
	"Satha Rao" <skoteshwar@marvell.com>,
	"Akhil Goyal" <gakhil@marvell.com>,
	"Fan Zhang" <fanzhang.oss@gmail.com>,
	"Thomas Monjalon" <thomas@monjalon.net>,
	"Ferruh Yigit" <ferruh.yigit@amd.com>,
	"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>,
	"Konstantin Ananyev" <konstantin.v.ananyev@yandex.ru>,
	"Vladimir Medvedkin" <vladimir.medvedkin@intel.com>
Subject: [PATCH v3 3/9] telemetry: rename unsigned 64-bit enum value to uint
Date: Thu, 12 Jan 2023 17:41:10 +0000	[thread overview]
Message-ID: <20230112174116.2105237-4-bruce.richardson@intel.com> (raw)
In-Reply-To: <20230112174116.2105237-1-bruce.richardson@intel.com>

For telemetry data, rather than having unsigned 64-bit values and signed
32-bit values, we want to just have unsigned and signed values, each
stored with the max bit-width i.e. 64-bits. To that end, we rename the
U64 enum entry to "UINT" to have a more generic name

For backward API-level compatibility, we can use a macro to alias the
old name to the new.

Suggested-by: Morten Brørup <mb@smartsharesystems.com>
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>
---
 app/test/test_telemetry_data.c               | 10 +++++-----
 drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c |  4 ++--
 drivers/net/cnxk/cnxk_ethdev_telemetry.c     |  2 +-
 lib/cryptodev/rte_cryptodev.c                |  2 +-
 lib/ethdev/rte_ethdev.c                      |  2 +-
 lib/ipsec/ipsec_telemetry.c                  |  2 +-
 lib/security/rte_security.c                  |  4 ++--
 lib/telemetry/rte_telemetry.h                |  6 ++++--
 lib/telemetry/telemetry.c                    |  4 ++--
 lib/telemetry/telemetry_data.c               |  4 ++--
 10 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c
index d92667a527..24a2035b61 100644
--- a/app/test/test_telemetry_data.c
+++ b/app/test/test_telemetry_data.c
@@ -283,7 +283,7 @@ test_case_array_u64(void)
 {
 	int i;
 
-	rte_tel_data_start_array(&response_data, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(&response_data, RTE_TEL_UINT_VAL);
 	for (i = 0; i < 5; i++)
 		rte_tel_data_add_array_u64(&response_data, i);
 	return CHECK_OUTPUT("[0,1,2,3,4]");
@@ -310,10 +310,10 @@ test_dict_with_array_u64_values(void)
 	int i;
 
 	struct rte_tel_data *child_data = rte_tel_data_alloc();
-	rte_tel_data_start_array(child_data, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(child_data, RTE_TEL_UINT_VAL);
 
 	struct rte_tel_data *child_data2 = rte_tel_data_alloc();
-	rte_tel_data_start_array(child_data2, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(child_data2, RTE_TEL_UINT_VAL);
 
 	rte_tel_data_start_dict(&response_data);
 
@@ -336,10 +336,10 @@ test_array_with_array_u64_values(void)
 	int i;
 
 	struct rte_tel_data *child_data = rte_tel_data_alloc();
-	rte_tel_data_start_array(child_data, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(child_data, RTE_TEL_UINT_VAL);
 
 	struct rte_tel_data *child_data2 = rte_tel_data_alloc();
-	rte_tel_data_start_array(child_data2, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(child_data2, RTE_TEL_UINT_VAL);
 
 	rte_tel_data_start_array(&response_data, RTE_TEL_CONTAINER);
 
diff --git a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c
index 8e6277cbcd..59f0cce5ab 100644
--- a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c
+++ b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c
@@ -94,7 +94,7 @@ copy_outb_sa_10k(struct rte_tel_data *d, uint32_t i, void *sa)
 		return -ENOMEM;
 	}
 
-	rte_tel_data_start_array(outer_hdr, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(outer_hdr, RTE_TEL_UINT_VAL);
 
 	for (j = 0; j < RTE_DIM(out_sa->outer_hdr.ipv6.src_addr); j++)
 		rte_tel_data_add_array_u64(outer_hdr,
@@ -167,7 +167,7 @@ copy_inb_sa_10k(struct rte_tel_data *d, uint32_t i, void *sa)
 		return -ENOMEM;
 	}
 
-	rte_tel_data_start_array(outer_hdr, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(outer_hdr, RTE_TEL_UINT_VAL);
 
 	for (j = 0; j < RTE_DIM(in_sa->outer_hdr.ipv6.src_addr); j++)
 		rte_tel_data_add_array_u64(outer_hdr,
diff --git a/drivers/net/cnxk/cnxk_ethdev_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_telemetry.c
index 180108ab9c..5db973d620 100644
--- a/drivers/net/cnxk/cnxk_ethdev_telemetry.c
+++ b/drivers/net/cnxk/cnxk_ethdev_telemetry.c
@@ -52,7 +52,7 @@ ethdev_tel_handle_info(const char *cmd __rte_unused,
 	i_data = rte_tel_data_alloc();
 	if (i_data == NULL)
 		return -ENOMEM;
-	rte_tel_data_start_array(i_data, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(i_data, RTE_TEL_UINT_VAL);
 
 	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
 		/* Skip if port is unused */
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 2165a0688c..79ea958db4 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -2744,7 +2744,7 @@ crypto_caps_array(struct rte_tel_data *d,
 	uint64_t caps_val[CRYPTO_CAPS_SZ];
 	unsigned int i = 0, j;
 
-	rte_tel_data_start_array(d, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(d, RTE_TEL_UINT_VAL);
 
 	while ((dev_caps = &capabilities[i++])->op !=
 			RTE_CRYPTO_OP_TYPE_UNDEFINED) {
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 5d5e18db1e..28028e5de5 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -5818,7 +5818,7 @@ eth_dev_add_port_queue_stats(struct rte_tel_data *d, uint64_t *q_stats,
 	struct rte_tel_data *q_data = rte_tel_data_alloc();
 	if (q_data == NULL)
 		return;
-	rte_tel_data_start_array(q_data, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(q_data, RTE_TEL_UINT_VAL);
 	for (q = 0; q < RTE_ETHDEV_QUEUE_STAT_CNTRS; q++)
 		rte_tel_data_add_array_u64(q_data, q_stats[q]);
 	rte_tel_data_add_dict_container(d, stat_name, q_data, 0);
diff --git a/lib/ipsec/ipsec_telemetry.c b/lib/ipsec/ipsec_telemetry.c
index cfebf454d6..b184e8df99 100644
--- a/lib/ipsec/ipsec_telemetry.c
+++ b/lib/ipsec/ipsec_telemetry.c
@@ -22,7 +22,7 @@ handle_telemetry_cmd_ipsec_sa_list(const char *cmd __rte_unused,
 		struct rte_tel_data *data)
 {
 	struct ipsec_telemetry_entry *entry;
-	rte_tel_data_start_array(data, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(data, RTE_TEL_UINT_VAL);
 
 	LIST_FOREACH(entry, &ipsec_telemetry_list, next) {
 		const struct rte_ipsec_sa *sa = entry->sa;
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 29af5f3e4b..68063f6450 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -316,7 +316,7 @@ crypto_caps_array(struct rte_tel_data *d,
 	uint64_t caps_val[CRYPTO_CAPS_SZ];
 	unsigned int i = 0, j;
 
-	rte_tel_data_start_array(d, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(d, RTE_TEL_UINT_VAL);
 
 	while ((dev_caps = &capabilities[i++])->op !=
 	   RTE_CRYPTO_OP_TYPE_UNDEFINED) {
@@ -341,7 +341,7 @@ sec_caps_array(struct rte_tel_data *d,
 	uint64_t caps_val[SEC_CAPS_SZ];
 	unsigned int i = 0, j;
 
-	rte_tel_data_start_array(d, RTE_TEL_U64_VAL);
+	rte_tel_data_start_array(d, RTE_TEL_UINT_VAL);
 
 	while ((dev_caps = &capabilities[i++])->action !=
 	   RTE_SECURITY_ACTION_TYPE_NONE) {
diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h
index d9918c4e96..c2ad65effe 100644
--- a/lib/telemetry/rte_telemetry.h
+++ b/lib/telemetry/rte_telemetry.h
@@ -43,10 +43,12 @@ struct rte_tel_data;
 enum rte_tel_value_type {
 	RTE_TEL_STRING_VAL, /** a string value */
 	RTE_TEL_INT_VAL,    /** a signed 32-bit int value */
-	RTE_TEL_U64_VAL,    /** an unsigned 64-bit int value */
+	RTE_TEL_UINT_VAL,  /** an unsigned 64-bit int value */
 	RTE_TEL_CONTAINER, /** a container struct */
 };
 
+#define RTE_TEL_U64_VAL RTE_TEL_UINT_VAL
+
 /**
  * Start an array of the specified type for returning from a callback
  *
@@ -121,7 +123,7 @@ rte_tel_data_add_array_int(struct rte_tel_data *d, int x);
 /**
  * Add a uint64_t to an array.
  * The array must have been started by rte_tel_data_start_array() with
- * RTE_TEL_U64_VAL as the type parameter.
+ * RTE_TEL_UINT_VAL as the type parameter.
  *
  * @param d
  *   The data structure passed to the callback
diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 792b4e12b6..916a0a4604 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -201,7 +201,7 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len)
 						buf_len, used,
 						v->name, v->value.ival);
 				break;
-			case RTE_TEL_U64_VAL:
+			case RTE_TEL_UINT_VAL:
 				used = rte_tel_json_add_obj_u64(out_buf,
 						buf_len, used,
 						v->name, v->value.u64val);
@@ -268,7 +268,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
 						buf_len, used,
 						v->name, v->value.ival);
 				break;
-			case RTE_TEL_U64_VAL:
+			case RTE_TEL_UINT_VAL:
 				used = rte_tel_json_add_obj_u64(cb_data_buf,
 						buf_len, used,
 						v->name, v->value.u64val);
diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c
index 3f5ef3979b..d4345908d5 100644
--- a/lib/telemetry/telemetry_data.c
+++ b/lib/telemetry/telemetry_data.c
@@ -18,7 +18,7 @@ rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type)
 	enum tel_container_types array_types[] = {
 			[RTE_TEL_STRING_VAL] = TEL_ARRAY_STRING,
 			[RTE_TEL_INT_VAL] = TEL_ARRAY_INT,
-			[RTE_TEL_U64_VAL] = TEL_ARRAY_U64,
+			[RTE_TEL_UINT_VAL] = TEL_ARRAY_U64,
 			[RTE_TEL_CONTAINER] = TEL_ARRAY_CONTAINER,
 	};
 	d->type = array_types[type];
@@ -173,7 +173,7 @@ rte_tel_data_add_dict_u64(struct rte_tel_data *d,
 		return -EINVAL;
 
 	d->data_len++;
-	e->type = RTE_TEL_U64_VAL;
+	e->type = RTE_TEL_UINT_VAL;
 	e->value.u64val = val;
 	const size_t bytes = strlcpy(e->name, name, RTE_TEL_MAX_STRING_LEN);
 	return bytes < RTE_TEL_MAX_STRING_LEN ? 0 : E2BIG;
-- 
2.37.2


  parent reply	other threads:[~2023-01-12 17:42 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13 18:27 [RFC PATCH 0/7] Standardize telemetry int types Bruce Richardson
2022-12-13 18:27 ` [RFC PATCH 1/7] telemetry: rename unsigned 64-bit enum value to uint Bruce Richardson
2022-12-14 17:30   ` Tyler Retzlaff
2022-12-15  9:41     ` Bruce Richardson
2022-12-15 17:53       ` Tyler Retzlaff
2022-12-13 18:27 ` [RFC PATCH 2/7] telemetry: add uint type as alias for u64 Bruce Richardson
2022-12-14 17:38   ` Tyler Retzlaff
2022-12-15  9:44     ` Bruce Richardson
2022-12-15 13:36       ` Thomas Monjalon
2022-12-15 13:58         ` Bruce Richardson
2022-12-19 10:37           ` Thomas Monjalon
2022-12-19 13:22             ` Bruce Richardson
2022-12-15 17:58       ` Tyler Retzlaff
2022-12-15  1:49   ` lihuisong (C)
2022-12-15  9:42     ` Bruce Richardson
2022-12-15 18:02       ` Tyler Retzlaff
2022-12-13 18:27 ` [RFC PATCH 3/7] telemetry: remove RTE prefix from internal enum values Bruce Richardson
2022-12-13 18:27 ` [RFC PATCH 4/7] telemetry: make array initialization more robust Bruce Richardson
2022-12-14 17:50   ` Tyler Retzlaff
2023-01-09 12:16     ` Bruce Richardson
2023-01-09 17:49       ` Tyler Retzlaff
2023-01-10  9:11         ` Ferruh Yigit
2022-12-13 18:27 ` [RFC PATCH 5/7] telemetry: update json functions to use int/uint in names Bruce Richardson
2022-12-13 18:27 ` [RFC PATCH 6/7] telemetry: make internal int representation 64-bits Bruce Richardson
2022-12-13 18:27 ` [RFC PATCH 7/7] telemetry: change public API to use 64-bit signed values Bruce Richardson
2022-12-13 20:19   ` Morten Brørup
2022-12-14 17:53     ` Tyler Retzlaff
2022-12-15  2:39       ` lihuisong (C)
2023-01-12 10:58 ` [PATCH v2 0/9] Standardize telemetry int types Bruce Richardson
2023-01-12 10:58   ` [PATCH v2 1/9] telemetry: remove RTE prefix from internal enum values Bruce Richardson
2023-01-12 10:58   ` [PATCH v2 2/9] telemetry: make array initialization more robust Bruce Richardson
2023-01-12 10:58   ` [PATCH v2 3/9] telemetry: rename unsigned 64-bit enum value to uint Bruce Richardson
2023-01-12 10:58   ` [PATCH v2 4/9] telemetry: add uint type as alias for u64 Bruce Richardson
2023-01-12 10:58   ` [PATCH v2 5/9] global: rename telemetry functions to newer versions Bruce Richardson
2023-01-12 10:59   ` [PATCH v2 6/9] telemetry: mark old names of renamed fns as deprecated Bruce Richardson
2023-01-12 10:59   ` [PATCH v2 7/9] telemetry: update json functions to use int/uint in names Bruce Richardson
2023-01-12 10:59   ` [PATCH v2 8/9] telemetry: make internal int representation 64-bits Bruce Richardson
2023-01-12 10:59   ` [PATCH v2 9/9] telemetry: change public API to use 64-bit signed values Bruce Richardson
2023-01-12 17:41 ` [PATCH v3 0/9] Standardize telemetry int types Bruce Richardson
2023-01-12 17:41   ` [PATCH v3 1/9] telemetry: remove RTE prefix from internal enum values Bruce Richardson
2023-01-12 17:41   ` [PATCH v3 2/9] telemetry: make array initialization more robust Bruce Richardson
2023-01-12 17:41   ` Bruce Richardson [this message]
2023-01-12 17:41   ` [PATCH v3 4/9] telemetry: add uint type as alias for u64 Bruce Richardson
2023-01-12 17:41   ` [PATCH v3 5/9] global: rename telemetry functions to newer versions Bruce Richardson
2023-01-12 17:41   ` [PATCH v3 6/9] telemetry: mark old names of renamed fns as deprecated Bruce Richardson
2023-01-12 17:41   ` [PATCH v3 7/9] telemetry: update json functions to use int/uint in names Bruce Richardson
2023-01-12 17:41   ` [PATCH v3 8/9] telemetry: make internal int representation 64-bits Bruce Richardson
2023-01-12 17:41   ` [PATCH v3 9/9] telemetry: change public API to use 64-bit signed values Bruce Richardson
2023-02-05 22:55     ` Thomas Monjalon
2023-01-13 16:39   ` [PATCH v3 0/9] Standardize telemetry int types Power, Ciara
2023-02-05 23:15     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230112174116.2105237-4-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=ferruh.yigit@amd.com \
    --cc=gakhil@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=mb@smartsharesystems.com \
    --cc=ndabilpuram@marvell.com \
    --cc=roretzla@linux.microsoft.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=thomas@monjalon.net \
    --cc=vladimir.medvedkin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).