From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 5E50FA04B5;
	Tue, 27 Oct 2020 17:14:26 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 3D9205947;
	Tue, 27 Oct 2020 17:14:25 +0100 (CET)
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com
 [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id B3340378B
 for <dev@dpdk.org>; Tue, 27 Oct 2020 17:14:22 +0100 (CET)
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42])
 by mailout.nyi.internal (Postfix) with ESMTP id 464565C0180;
 Tue, 27 Oct 2020 12:14:22 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Tue, 27 Oct 2020 12:14:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding:content-type; s=fm2; bh=
 gQbGLFqOFGk9DL0NcFcMxN/PNZ8QRCMmwd2e6FicNfc=; b=Ty2FrN0g9DMhXcjT
 PwECQmH9aRTPCs6uaArr3PZjY5/N99fcAWoNJl6vTCHMQL6dVsdthU2jNSjmOm0F
 Psva6FDa0+qKNxfBwPiuoqL5AODTJrBTEqjl2L9vTTgJcJhp6Jv+Ig1SG/yZXiag
 CPToaF75Wr4WtHe1MinExE0eqL4uWte6tRJ0CdyLQPZCNUptsW3EPzNb9lvpy83j
 yWQdGNMWHIDZ75rz5DQ16cYWKX06Te7avzXrdYFtD7Ad6afnKxml1KHvzokz+5Ma
 Bk8C4h5zMS/BaHf3wTipCOt1V6mVdZiFNmucjve/aPgUjubhZ6nP21JpdmBQW8xU
 /r4O8g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm1; bh=gQbGLFqOFGk9DL0NcFcMxN/PNZ8QRCMmwd2e6FicN
 fc=; b=Ctr5p8o2flEvL7QvOCv4DT6F/yqYBCj1fELV1qPufbwVcrULQMQ/4ywL4
 iVonqAIdBjQFFnXAPhuD6WgMTpAuidPKzVpa7t9YBhJKk5FK+AwjxlwanJX5O0LX
 Ih1eX5ko6Z051ceMQp2XI/5hYN6+jOT4cCVvKAVfRbCVaejjxFgk+a1yHfc0FNzq
 ZCJHQRt1WioA9C4kFjuxQOgaHnF2AnJ4Jbu1B8FBn0MZUQRdYIXWH0NtpR6dCZVY
 w8JLVpiZjch+/EWzYclmmERwlucy6dQZPBkS8T/57JmH03wu7GOidtmxFUPAEH59
 UuwwXpiiO8VblbenIKkW/FJ81dNXg==
X-ME-Sender: <xms:XEeYX7No7mIT7lM8azOikH4qNUhY942L6FHxQi84DAteewQjcYtXXw>
 <xme:XEeYX1-CjViUtlUibsNlWoRVsgojgtm485z2-tpqauDH-N3ekpEBgP7og1CWim8xi
 yevFXDvIhQzFEVHwQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgdekhecutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs
 ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf
 frrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdejueei
 iedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih
 iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho
 nhdrnhgvth
X-ME-Proxy: <xmx:XEeYX6Q0VmAEm9RBeTF6nkqo-iQwhQ_0O7WNztqulxTKcd6hGRX3AQ>
 <xmx:XEeYX_stE3youG58hmq_A_wEenook3EIeR-qe5Dj18y7R8iWF7egCg>
 <xmx:XEeYXzfaIVn_f1QOY9HFeiW0AMO5Fhy6kvnEHHnHww58w6YjgFTdBw>
 <xmx:XkeYX0Euh0VEmDLjGfzoBWyA0xYxc-MvocQU_BnoHz66iWNqXgntFA>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id E56FE3280068;
 Tue, 27 Oct 2020 12:14:19 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: dev@dpdk.org, ferruh.yigit@intel.com, david.marchand@redhat.com,
 bruce.richardson@intel.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com,
 Harry van Haaren <harry.van.haaren@intel.com>
Date: Tue, 27 Oct 2020 17:14:19 +0100
Message-ID: <10216517.RybBKMbYot@thomas>
In-Reply-To: <20201027101531.GP1898@platinum>
References: <20201026052105.1561859-1-thomas@monjalon.net>
 <20201026222013.2147904-7-thomas@monjalon.net>
 <20201027101531.GP1898@platinum>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [PATCH v2 06/15] event/sw: switch test counter to
	dynamic mbuf field
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

27/10/2020 11:15, Olivier Matz:
> On Mon, Oct 26, 2020 at 11:20:04PM +0100, Thomas Monjalon wrote:
> > The test worker_loopback used the deprecated mbuf field udata64.
> > It is moved to a dynamic field in order to allow removal of udata64.
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > ---
[...]
> > +static int counter_dynfield_offset;
> 
> In general, I wonder if we shouldn't initialize offset to -1.

Yes good idea.

> > +#define COUNTER_FIELD_TYPE uint8_t
> 
> Another general comment, I suggest to use a typedef instead of
> a define when relevant.

Yes

> > +#define COUNTER_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
> > +		counter_dynfield_offset, COUNTER_FIELD_TYPE *))
> > +
> 
> I'm not sure this comment applies here, but since it's a simple example,
> it's a good place for another general comment. The RTE_MBUF_DYNFIELD()
> macro is convenient because it can be used to set or get a value of any
> type, but in my opinion it is not always easy to read:
> 
>   RTE_MBUF_DYNFIELD(m, off, type) = value;
> 
> In some situations, having wrappers may make the code more readable:
> 
>   static inline void mbuf_set_counter(struct rte_mbuf *m, counter_field_t counter);
>   static inline counter_field_t mbuf_get_counter(struct rte_mbuf *m);
>   static inline void mbuf_inc_counter(struct rte_mbuf *m);

I agree, I will add some wrapper functions.