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 7F1D8A04DD; Mon, 26 Oct 2020 19:13:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E04101E2B; Mon, 26 Oct 2020 19:13:41 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 1AEF71D9E for ; Mon, 26 Oct 2020 19:13:41 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 7F1C85C00A5; Mon, 26 Oct 2020 14:13:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 26 Oct 2020 14:13:39 -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= LyB8NhhA3D7CLiN+AvkP6bvmn/lqXiz/HdYnj9CD9zo=; b=gdqpQbiqpmsN3xtJ HLtSioNzufh2Vhf2rZqKHYlnVqDW7E2FOFlVnfO/HJnHo2v8WSl87sgKNF0VItUb /1Pda0G4yRaihUurtcOL5jlC2W6ATEdCYsCqEaY84Ur5xC8pu8pnOiNmyCQVR/hT jpt6UrAsN9p2mBLLGWyOgG6Sp2aEWCQpz1sljAmIH3EIfyjAVrZ7hyL3EiKFrIqH +pyQqMq/LDcswAmSP4tLgIzqNGW97NXNQMWZr1ibcyVfsAaq/HTDYbix0C2xAYpe RBB0fbT9WyOmueJBakAcfMObJI19HqCy0EtDMgOT9U9qO/An/BVDFO9IgIwVh9S/ lYCGiw== 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=LyB8NhhA3D7CLiN+AvkP6bvmn/lqXiz/HdYnj9CD9 zo=; b=GsthUM4LXV4joSvDZDiUYu+vpXrQZU1K+YamaVRiNgeDQ+fc4iOaTZLjS 5t05rcAJ701z+ObZTcON29dI0nMmEkNnC+d8QnRAnelXySE3kYoLfTNqAKe4Ejsy MszcKu1NrEwiGQwHVJEQY6XC8e4n+pcV9V4at9a51N5oVO/WpIgoi7q1BMfexVhs tiLmeunOgFwOm90mrtXEKciCoXXC/WZW1UmS+N/w3I2HppzT3V4N4T5rzgeiuAu9 AxL6BLH9bP2e0ORWypJcNThg/ZS4m9N9e8vMSg6LqtZVsMW8dr8a761lxTYvlsca WPcR8pyj43hPRKE3tl9JbS4ITzceg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeejgdejgecutefuodetggdotefrodftvf 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 684CB328005D; Mon, 26 Oct 2020 14:13:37 -0400 (EDT) From: Thomas Monjalon To: Andrew Rybchenko Cc: dev@dpdk.org, ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, akhil.goyal@nxp.com, Yong Wang Date: Mon, 26 Oct 2020 19:13:33 +0100 Message-ID: <11295049.oK00N4afW4@thomas> In-Reply-To: <6339991.yY2z8fZqqB@thomas> References: <20201026052105.1561859-1-thomas@monjalon.net> <6339991.yY2z8fZqqB@thomas> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH 09/15] net/vmxnet3: switch MSS hint 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" 26/10/2020 17:50, Thomas Monjalon: > 26/10/2020 16:21, Andrew Rybchenko: > > On 10/26/20 6:14 PM, Andrew Rybchenko wrote: > > > On 10/26/20 8:20 AM, Thomas Monjalon wrote: > > >> - rxm->udata64 = rcde->segCnt; > > >> + *RTE_MBUF_DYNFIELD(rxm, vmxnet3_segs_dynfield_offset, > > >> + uint8_t *) = rcde->segCnt; > > > > > > I think it should be a rule of thumb to introduce helper > > > macro to access a dynamic field (as you do in few of > > > previous patches). > > > > > > It should be just nearby declaration of the the offset > > > variable. > > > > May be inline function is even better since, IMHO, if you > > both ways are possible, inline function is the right choice. > > In this particular case inline function will not add value > > from type safety point of view, but it is still better as > > an example to follow. In some case inline function could be > > used as a place to put build assertion to check size. > > OK I will review the patches to provide a static inline getter function > for each dynamic field. After more thoughts, I think it is good to have static inline returning a pointer to the field in general case: static inline my_type * rte_foo_dynfield_bar(struct rte_mbuf * mbuf) { return RTE_MBUF_DYNFIELD(mbuf, my_dynfield_offset, my_type *); } But when the scope is limited, it is easier to read a macro which contains dereferencing of the field pointer with the right type: #define MY_DYNFIELD(mbuf) \ (*RTE_MBUF_DYNFIELD(mbuf, my_dynfield_offset, my_type *)) If type cast is never needed, this form allows simple assignment: MY_DYNFIELD(mbuf) = field_value; I would tend to use this latter form for tests or small apps.