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 EEC844238D; Mon, 9 Jan 2023 18:49:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C349D40689; Mon, 9 Jan 2023 18:49:13 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 461BC40150 for ; Mon, 9 Jan 2023 18:49:13 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 8A98E20A3C9A; Mon, 9 Jan 2023 09:49:12 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8A98E20A3C9A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1673286552; bh=aws++veKMAlUPxqdRnmy17+Sy7A4wpc+f9B3FMQiPXI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F6JkWFQ9T0tp34wt6WrEXuISpxZzsbpX+0aXdWo8RBy6cLwwEyDkm7iQsHEM6LW+U KiFhaao+fbaya43qTdKFemZDRiDKK0FAuvGmIDIFjMx1vbS60VXFQL9eOvtjYJwLDI zn1SzeyT4DxzH1kZZParqPFWiYLJtALUiUKDLsWA= Date: Mon, 9 Jan 2023 09:49:12 -0800 From: Tyler Retzlaff To: Bruce Richardson Cc: dev@dpdk.org Subject: Re: [RFC PATCH 4/7] telemetry: make array initialization more robust Message-ID: <20230109174912.GA16104@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20221213182730.97065-1-bruce.richardson@intel.com> <20221213182730.97065-5-bruce.richardson@intel.com> <20221214175033.GD31935@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Mon, Jan 09, 2023 at 12:16:15PM +0000, Bruce Richardson wrote: > On Wed, Dec 14, 2022 at 09:50:33AM -0800, Tyler Retzlaff wrote: > > On Tue, Dec 13, 2022 at 06:27:27PM +0000, Bruce Richardson wrote: > > > Rather than relying on a specific ordering of elements in the array > > > matching that of elements in the enum definition, we can explicitly mark > > > each array entry using the equivalent enum value as an index. > > > > > > Signed-off-by: Bruce Richardson > > > --- > > > lib/telemetry/telemetry_data.c | 8 ++++---- > > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > > > diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c > > > index d51724e1f5..9a180937fd 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[] = { > > > - 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 */ > > > + [RTE_TEL_STRING_VAL] = TEL_ARRAY_STRING, > > > + [RTE_TEL_INT_VAL] = TEL_ARRAY_INT, > > > + [RTE_TEL_UINT_VAL] = TEL_ARRAY_UINT, > > > + [RTE_TEL_CONTAINER] = TEL_ARRAY_CONTAINER, > > > }; > > > > i might be a bit fuzzy and didn't double check but doesn't doing this > > require C99? > > > > though it would be great to move to a minimum of C99/C11 > > > Yep, I agree on version bump. > > For the specific array init - we actually already use this style of init > elsewhere in telemetry lib, so I'm going to keep it here in V2, as I > think it is the clearest way to initialize a lookup array like this. sounds good given our other discussion about moving to C99 as a minimum. > > /Bruce