From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 ; 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: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgdekhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdejueei iedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: 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 To: Olivier Matz 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > > Reviewed-by: Andrew Rybchenko > > --- [...] > > +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.