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 DB8D6A0C55; Mon, 6 Sep 2021 18:25:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6BB5C410EF; Mon, 6 Sep 2021 18:25:18 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 032A2410ED for ; Mon, 6 Sep 2021 18:25:16 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10099"; a="220058836" X-IronPort-AV: E=Sophos;i="5.85,272,1624345200"; d="scan'208";a="220058836" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2021 09:25:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,272,1624345200"; d="scan'208";a="468897483" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga007.jf.intel.com with ESMTP; 06 Sep 2021 09:25:15 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 6 Sep 2021 09:25:15 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Mon, 6 Sep 2021 09:25:15 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.171) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Mon, 6 Sep 2021 09:25:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bF+HFnbXvl+7dzgU8YDTSUtyonG3/J3lvSPH+DWAd79QvHX6GqxtR/FeeVIpybBNX7ksXXj12gNoxSqjC12eLRaygYDcvoPCZynW4EVoPhupFCmZXj0IMn8SP/tEcLf45n06BHH3ICZAk+sGbOJKHhQTv6Zvx4gkL79lmQ45vMCRdSeYqUp8USNDLMpV3MGsL+4qIMnJtwee8E/T9aJ6BgTko74hOQ4K8S7VP/OXBXuR7q1N1e7IJ1MmLn/Qoc58eRWVaIJi4I5NFG/O9h8f4TSKDjQjvXuLFaHd3+2B1tn6oT9Osi/nducqE1Xv6r8Q0pw317i78PwJRi7eHP1TKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=VVG3SgSmtkpWJw4w9DQGsRbJvAlYZjTJ6s/lu3rafU8=; b=TMb/CYBVCwKthL/h71/mzT1AwL44jziyLeou06kNfNPtAR95eEC3IiQ9S4Di8T/IE+aMT75ujdnvzB9ZCnUG/qwNaqKw6QvioI3g1bcdmRXe7ApkaCv2csSoYtCPzkti1nyr1zapV0lEDY54wEkYjjxvmrf7rmY4LcNhSupKgEb8hF6Qt4v/YnHDaYzLF8LBALZt9amKC6e9t3c8pL7PBIqwvLe31jpUyUani8dm8JXUgaUfQ6xsA3fcf2zlAv2WK0olQdA7dS6OL2MmQKl/gmF2BJm1aKkrEdUB/5GpZG73ymGsUD/5DvsScz9gk3099PiwhrwW0A7LsEBKgHqpBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VVG3SgSmtkpWJw4w9DQGsRbJvAlYZjTJ6s/lu3rafU8=; b=LNRySRTbXpXgqYdO5q1eqDUZ7dxOpRDO9XKxPK6ZqfSlWd3I5WAlDnlQqX/49XatJSEtIXyW6LEHoAptnfk+DefIzJdFm9oKH1gKSZw9QwVbLJo+cUcFxOAVoiyvYvBEQNl6YoNI2CuxgfOd23SON8q15aGFvouQ2ECGWM6j8zY= Received: from MN2PR11MB3821.namprd11.prod.outlook.com (2603:10b6:208:f7::24) by MN2PR11MB3551.namprd11.prod.outlook.com (2603:10b6:208:ea::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.22; Mon, 6 Sep 2021 16:25:10 +0000 Received: from MN2PR11MB3821.namprd11.prod.outlook.com ([fe80::ec2a:14c6:a7de:bcb3]) by MN2PR11MB3821.namprd11.prod.outlook.com ([fe80::ec2a:14c6:a7de:bcb3%6]) with mapi id 15.20.4478.025; Mon, 6 Sep 2021 16:25:10 +0000 From: "Power, Ciara" To: "Nicolau, Radu" CC: "dev@dpdk.org" , "Doherty, Declan" , "Richardson, Bruce" Thread-Topic: [PATCH] telemetry: add support for dicts of dicts Thread-Index: AQHXoLNURSbTINQWn0SMzVJfOH+kdauXNGCA Date: Mon, 6 Sep 2021 16:25:10 +0000 Message-ID: References: <20210903105725.243477-1-radu.nicolau@intel.com> In-Reply-To: <20210903105725.243477-1-radu.nicolau@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.200.16 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b926fe14-80eb-4a4e-4845-08d97152e5e1 x-ms-traffictypediagnostic: MN2PR11MB3551: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dTVfI4FaPOJ8Eu06yZeP6k7wDfzeHaAs0vRXVy9+UvOCy6aS5fgN5EqNwj5TIpLZr2NitiubvVXt3VSDTurg796HeTEgqBLA4Ky4XC4C++P3Rr53T1/O9Fl1FRBDiy8S7wKLOew9ldvgAqeO+gcG+/qsbzXVMss5E0DEIcKtPpiRBAjYiihlE4MkE1ia5qV0yR2hbKCfBE0bavATCxmbrPRqKKMF8/nRQCozWhEprkG1/nWCQ4L2WEpHifrkaQ6qvsXiO62wvKtJK+Ll7wqwr5N5/Il9q4cJgm8UrheE6Lu7pYBaDcgm4qAf1Qo/CTsDVZdDfsi9eEbTsUjv2RJKx49qXQxo2S4CmzNyDAeSmuc1xAPTT3PWEfMbUYZMnYwpOTnozdsVG6ZLS4qBqH83jXIsVq0LnfFV8hnbYjdr/S3Hy1FQZzQXKrqnE+4wt5wXqAMb62QdnF9gRfFfwqpvNTOePTkQjUFpwcxziPKZ2B25BgJ8DrsugT+FbjaNAtLcXKzAD/ScPrVG6RfZLgKum8Bi9/gwrWL673axPP1nA2lfS+CUPChmgmbCckloEDtR2JGsalGCLsj130P6pI4P+N/kpIkF1rsXZXrJvxnZm1NrZfc2wlSYlF5Jj6fBTH4dXc8XeFK8Lv4ZbbcRq4YoethN6gUvO11+mU2xsNW2p7FJE/HjRJ+k68lbu1b6ZTX9QOuvq+5jZiiDj+hi/O307Q== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB3821.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(39860400002)(346002)(366004)(396003)(136003)(54906003)(122000001)(7696005)(186003)(316002)(38100700002)(6862004)(8936002)(52536014)(5660300002)(6636002)(38070700005)(26005)(64756008)(33656002)(4326008)(107886003)(66946007)(86362001)(71200400001)(76116006)(2906002)(9686003)(83380400001)(6506007)(66476007)(66446008)(8676002)(55016002)(478600001)(66556008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?DWwnwO+MwwMKlln9Cz3V8Xt5GrDoyKdzAVHs8onYD7uOYabWd0XMPnxy1dgm?= =?us-ascii?Q?hy/eKC6V4unUnrNsZnugHMCjI3dCExb4HOia0YDInCTlQEgJ0d9Zm80DuLT+?= =?us-ascii?Q?WS4RSwb0dhkQN1Kd8OU6TqcrWnkzZ9AxkRmQDkWcDxjJAR2e/fcwQ80EXna3?= =?us-ascii?Q?2kZ/V2a/i1vR75G5ziNZUqAMX9G4ifaCNiuEthqLLxihoQefnomiyp3IZ5GJ?= =?us-ascii?Q?EIb7gLaR92JOfVu46Xq3XuaZ2PMqpFJX39ZpvRy1OajoUk8L0fVZzpuKlLJM?= =?us-ascii?Q?dVbTDKfbJHGdrUmrzCCEcED2qErAnn+QOJmfB47uC3xolraOZ0fY629+8Kjx?= =?us-ascii?Q?taj+V4wslXprmFMCCfjGpV8ogTzehOQnXoUYFLN1//v+D447RP+DMle1tt4T?= =?us-ascii?Q?ZGhGGUxx0Z2mNbXRtXk0VoLbh5MUm9OYYT4SA1QIJLAXxW9ngkS8JT1ZCY/z?= =?us-ascii?Q?8eeqZHzGGc2QV/sT+wuER93rlinF2ax/j2/FB8C8t4VncAsvGvZif4Bzrsn2?= =?us-ascii?Q?PV7hiA03Ns5Lum4CEgf57XBmjBTAhPJrQORmDDDRWhpdvaErBf2JQXAbAEZq?= =?us-ascii?Q?3w17QMRaX5s3FHRgA+/T+6MpRAxLXyYRnIaHVOTDoYPSVga4F1CTZdWkfWXZ?= =?us-ascii?Q?/Ib8Y35z3FfvSU5LVryN78l1biQG/9nO/SKbJVu/QEnPp65mZ/Jw9VvTdvkK?= =?us-ascii?Q?Ky47cLDADw5K8t9HKiOsi+lni9m2pP1e1xurxIQfq14HPKOVHcpCTOAfp161?= =?us-ascii?Q?pRDfjyVch85pSvevKi/gjsAVgzoFvRd9LX3uOlYadyt1l04gUzH/Q5R5sb2P?= =?us-ascii?Q?vpqPTIKVCpakNjX7HvZ7fFmP1Do64JngihGRvzMmy1KLhgBnRp75bPINfIzV?= =?us-ascii?Q?yCl0d4zuEmWhZWXvHtjlDkFU24c51tm9RHUIPt+8WDkzPPbbh/NE4VWhZtUn?= =?us-ascii?Q?52AiEyPHbpC+uUOZOQCU6QGN1Clg5hZY2qXV7tfMEbq/DBWWc2PFb7rnV13Y?= =?us-ascii?Q?OFMVdhFuL9+nABpM3l1ajuASPWwVX05216xotP961rv3jUqpYVlMA2b6HyhF?= =?us-ascii?Q?VnDuYk8zRsQFj6ykelqRI/FhPsm5RkGuZYChuAWbWbEv0zbZD8lYN+WNVTaL?= =?us-ascii?Q?qe0PMtTLb6bFGElRUbza6kq6Jd/3XoBYgswpcVw0JN43kcyIxeQjnQAXbk59?= =?us-ascii?Q?WGZfVpE0sPn9smv29M6jHYBOnMy6+6AKEX5XdbuOrZcM1LRzbPgIxJWCiLvg?= =?us-ascii?Q?FdyTDkJMUm3FUhA+mOqxuWOeClefqJ2Z+EspaDUD3Qap2Ls08qsHfokLWi4j?= =?us-ascii?Q?2ySSWGaLUjH5YGIglonMg4gc?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR11MB3821.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b926fe14-80eb-4a4e-4845-08d97152e5e1 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2021 16:25:10.5670 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4h2KO9FHttJYD9ypbmU/owh1aZ8JOumrcCu4v4z35nNTStek1P0hjRFaAgXdGMvOt2VVQ4f0RyOaoUCW+vhE0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3551 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] telemetry: add support for dicts of dicts 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 Sender: "dev" Hi Radu,=20 >-----Original Message----- >From: Nicolau, Radu >Sent: Friday 3 September 2021 11:57 >To: Power, Ciara >Cc: dev@dpdk.org; Nicolau, Radu ; Doherty, Declan > >Subject: [PATCH] telemetry: add support for dicts of dicts > >Add support for dicts of dicts to telemetry library. > >Signed-off-by: Declan Doherty >Signed-off-by: Radu Nicolau >--- > lib/telemetry/telemetry.c | 43 +++++++++++++++++++++++++++++++--- > lib/telemetry/telemetry_data.c | 2 +- > 2 files changed, 41 insertions(+), 4 deletions(-) > >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 > #define MAX_OUTPUT_LEN (1024 * 16) > #define MAX_CONNECTIONS 10 > >@@ -157,8 +157,8 @@ container_to_json(const struct rte_tel_data *d, char >*out_buf, size_t buf_len) > size_t used =3D 0; > unsigned int i; > >- if (d->type !=3D RTE_TEL_ARRAY_U64 && d->type !=3D RTE_TEL_ARRAY_INT >- && d->type !=3D RTE_TEL_ARRAY_STRING) >+ if (d->type !=3D RTE_TEL_DICT && d->type !=3D RTE_TEL_ARRAY_U64 && >+ d->type !=3D RTE_TEL_ARRAY_INT && d->type !=3D >RTE_TEL_ARRAY_STRING) > return snprintf(out_buf, buf_len, "null"); > > used =3D rte_tel_json_empty_array(out_buf, buf_len, 0); @@ -177,6 >+177,43 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, >size_t buf_len) > used =3D rte_tel_json_add_array_string(out_buf, > buf_len, used, > d->data.array[i].sval); >+ if (d->type =3D=3D RTE_TEL_DICT) >+ for (i =3D 0; i < d->data_len; i++) { >+ const struct tel_dict_entry *v =3D &d->data.dict[i]; >+ switch (v->type) { >+ case RTE_TEL_STRING_VAL: >+ used =3D rte_tel_json_add_obj_str(out_buf, >+ buf_len, used, >+ v->name, v->value.sval); >+ break; >+ case RTE_TEL_INT_VAL: >+ used =3D rte_tel_json_add_obj_int(out_buf, >+ buf_len, used, >+ v->name, v->value.ival); >+ break; >+ case RTE_TEL_U64_VAL: >+ used =3D rte_tel_json_add_obj_u64(out_buf, >+ buf_len, used, >+ v->name, v->value.u64val); >+ break; >+ case RTE_TEL_CONTAINER: >+ { >+ char temp[buf_len]; >+ const struct container *cont =3D >+ &v->value.container; >+ if (container_to_json(cont->data, >+ temp, buf_len) !=3D 0) >+ used =3D rte_tel_json_add_obj_json( >+ out_buf, >+ buf_len, used, >+ v->name, temp); >+ if (!cont->keep) >+ rte_tel_data_free(cont->data); >+ break; >+ } >+ } >+ } >+ > return used; > } > >diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data= .c >index 77b0fe09a5..54a7c79fff 100644 >--- a/lib/telemetry/telemetry_data.c >+++ b/lib/telemetry/telemetry_data.c >@@ -153,7 +153,7 @@ rte_tel_data_add_dict_container(struct rte_tel_data *d= , >const char *name, { > struct tel_dict_entry *e =3D &d->data.dict[d->data_len]; > >- if (d->type !=3D RTE_TEL_DICT || (val->type !=3D RTE_TEL_ARRAY_U64 >+ if ((d->type !=3D RTE_TEL_DICT && val->type !=3D RTE_TEL_ARRAY_U64 > && val->type !=3D RTE_TEL_ARRAY_INT > && val->type !=3D RTE_TEL_ARRAY_STRING)) > return -EINVAL; >-- >2.25.1 Thanks for this, it will be a good addition to Telemetry. I think tests should be added with this feature. Different combinations of data are tested in the test_telemetry_data.c file= , tests for these nested dicts would be valuable there. Thanks, Ciara