DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Power, Ciara" <ciara.power@intel.com>
To: "Nicolau, Radu" <radu.nicolau@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Richardson, Bruce" <bruce.richardson@intel.com>,
	"Doherty, Declan" <declan.doherty@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2] telemetry: add support for dicts of dicts
Date: Tue, 14 Sep 2021 15:41:40 +0000	[thread overview]
Message-ID: <MN2PR11MB38219268C995DF2778D33E07E6DA9@MN2PR11MB3821.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210910112752.872337-1-radu.nicolau@intel.com>

Hi Radu,

Thanks for adding the test, one more comment inline that I have just noticed.


>-----Original Message-----
>From: Nicolau, Radu <radu.nicolau@intel.com>
>Sent: Friday 10 September 2021 12:28
>To: Power, Ciara <ciara.power@intel.com>
>Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>; Nicolau,
>Radu <radu.nicolau@intel.com>; Doherty, Declan
><declan.doherty@intel.com>
>Subject: [PATCH v2] telemetry: add support for dicts of dicts
>
>Add support for dicts of dicts to telemetry library.
>
>Signed-off-by: Declan Doherty <declan.doherty@intel.com>
>Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
>---
> app/test/test_telemetry_data.c | 29 +++++++++++++++++++++++
> lib/telemetry/telemetry.c      | 43 +++++++++++++++++++++++++++++++---
> lib/telemetry/telemetry_data.c |  3 ++-
> 3 files changed, 71 insertions(+), 4 deletions(-)
>
>diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c
>index f34d691265..18b93db8ef 100644
>--- a/app/test/test_telemetry_data.c
>+++ b/app/test/test_telemetry_data.c
>@@ -200,6 +200,34 @@ test_dict_with_array_string_values(void)
> 			"[\"bbbb\"]}}");
> }
>
>+static int
>+test_dict_with_dict_values(void)
>+{
>+	struct rte_tel_data *dict_of_dicts = rte_tel_data_alloc();
>+	rte_tel_data_start_dict(dict_of_dicts);
>+
>+	struct rte_tel_data *child_data = rte_tel_data_alloc();
>+	rte_tel_data_start_array(child_data, RTE_TEL_STRING_VAL);
>+
>+	struct rte_tel_data *child_data2 = rte_tel_data_alloc();
>+	rte_tel_data_start_array(child_data2, RTE_TEL_STRING_VAL);
>+
>+	memset(&response_data, 0, sizeof(response_data));
>+	rte_tel_data_start_dict(&response_data);
>+
>+	rte_tel_data_add_array_string(child_data, "aaaa");
>+	rte_tel_data_add_array_string(child_data2, "bbbb");
>+	rte_tel_data_add_dict_container(dict_of_dicts, "dict_0",
>+			child_data, 0);
>+	rte_tel_data_add_dict_container(dict_of_dicts, "dict_1",
>+			child_data2, 0);
>+	rte_tel_data_add_dict_container(&response_data, "dict_of_dicts",
>+			dict_of_dicts, 0);
>+
>+	return TEST_OUTPUT("{\"/test\":{\"dict_of_dicts\":{\"dict_0\":"
>+			"[\"aaaa\"],\"dict_1\":[\"bbbb\"]}}}");
>+}
>+
> static int
> test_array_with_array_string_values(void)
> {
>@@ -355,6 +383,7 @@ test_telemetry_data(void)
> 			test_dict_with_array_int_values,
> 			test_dict_with_array_u64_values,
> 			test_dict_with_array_string_values,
>+			test_dict_with_dict_values,
> 			test_array_with_array_int_values,
> 			test_array_with_array_u64_values,
> 			test_array_with_array_string_values }; diff --git
>a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index
>8665db8d03..3f83476112 100644
>--- a/lib/telemetry/telemetry.c
>+++ b/lib/telemetry/telemetry.c
>@@ -24,7 +24,7 @@
> #include "telemetry_internal.h"
>
> #define MAX_CMD_LEN 56
>-#define MAX_HELP_LEN 64
>+#define MAX_HELP_LEN 128

This change will not do much - it will allow a longer help text to be given for the command on registration,
but when the user actually asks for help text for a command, there is a restriction on the size of the string value that is added to the dict reply,
which will truncate the help text:

In telemetry_data.c/rte_tel_data_add_dict_string:

vbytes = strlcpy(e->value.sval, val, RTE_TEL_MAX_STRING_LEN);

where RTE_TEL_MAX_STRING_LEN is 64

Maybe we could just increase RTE_TEL_MAX_STRING_LEN to 128 and replace use of MAX_HELP_LEN with that, to keep them aligned.

Thanks, 
Ciara


  reply	other threads:[~2021-09-14 15:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 10:57 [dpdk-dev] [PATCH] " Radu Nicolau
2021-09-06 16:25 ` Power, Ciara
2021-09-07 10:01   ` Nicolau, Radu
2021-09-10 11:27 ` [dpdk-dev] [PATCH v2] " Radu Nicolau
2021-09-14 15:41   ` Power, Ciara [this message]
2021-09-14 16:05 ` [dpdk-dev] [PATCH v3] " Radu Nicolau
2021-09-15  8:30   ` Power, Ciara
2021-09-23 12:17     ` 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=MN2PR11MB38219268C995DF2778D33E07E6DA9@MN2PR11MB3821.namprd11.prod.outlook.com \
    --to=ciara.power@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=radu.nicolau@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).