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 14395A04DD;
	Mon, 26 Oct 2020 20:03:24 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id E741B1E2B;
	Mon, 26 Oct 2020 20:03:22 +0100 (CET)
Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com
 [66.111.4.230]) by dpdk.org (Postfix) with ESMTP id 290271D9E
 for <dev@dpdk.org>; Mon, 26 Oct 2020 20:03:21 +0100 (CET)
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42])
 by mailnew.nyi.internal (Postfix) with ESMTP id A43EE5801D5;
 Mon, 26 Oct 2020 15:03:19 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Mon, 26 Oct 2020 15:03:19 -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=
 S7dKbjKytWtYV14PXIIYcAU0h5/6Jtg86gJlLVUuoMA=; b=RdLLtkbFwxAuOOml
 kw9hNoUwpAYsxmiy/IIxeM9LV+kqmByNfMg6MV9PcYL+hQHrx67FrxVHE8u39ZhU
 3+8SyruWu7CD2K++O5uQxHhaigJdWVG5TRXZi9wV32oROgEYcxTzdr5jSFStHOwm
 0Jubwdumx1dvK53s5gFvqElhzKx0M5lK98MkiPpE4/XL0SZYIqwUxhjTXjOKuj49
 Jqntrep+TICBOBIH9VueR6jiXU/L+FbMlPh4sV15uZbA+OtVzOlHwelFlT0nh7K5
 4bbNBLDyN3yR+05FuRNinENTfhq8kfRMyLLlJWxW6VHk553eOT4ciQxqqaN27uqz
 4uvgRA==
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=S7dKbjKytWtYV14PXIIYcAU0h5/6Jtg86gJlLVUuo
 MA=; b=pi16/SV7knaW5Za4pfLnm7fr6NHTuBa8gWjLHQ/2yEKWN3bRe7s8BSPkR
 fQerfbcWaZWcARgYPk/2Z6PL4LyP5vxZVJTb91I0ZIFun7dkxEoPs0XNxE4i60Pw
 56VQ0DgejMcEoX2/kLRZ6xCSdY0TJWfVH+bSYiAFa+ts0kn+PkE0prDb1ll9ClcE
 YPTl9uVufc1SGI84WKocjgog4km8gYvS9/sL89ks1dpoPC/oM2YM29rm/k/uULbA
 N7/6QoWhVCfMc/6IYfvX9RBty/z8pruCYdzSoUssv2EsAs2+VwjyvNnUAnZ6ctR7
 XdlBq7xECAdxl/rat6xuO5Y596G8w==
X-ME-Sender: <xms:dR2XX6SFmg870O_QX792Y-__TdetvTcefLrF9fNEXeWYAPpDJRdGLQ>
 <xme:dR2XX_xaAiwzCthGQAQ57TDDrdhZ-qgsB5NrvwOCSAMIjiVFl7ujMzMqWFXqom2Zz
 f2TRbyAiUtd7z5-rg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeejgdekgecutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs
 ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf
 frrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdejueei
 iedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih
 iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho
 nhdrnhgvth
X-ME-Proxy: <xmx:dh2XX319bzq5DARd1k6SyVidg0kqVi8HQIkjL-uQYGNs8OfEVAv_Lg>
 <xmx:dh2XX2AoVma9vh_hnmf8EHaqXsAtRFd-ZBn2EmYRrEfICdHo6e5BKg>
 <xmx:dh2XXzg1ua_xh6r-0Dve7MW2voxrHLa0VCzSNqUs6-foIi4TWneJxg>
 <xmx:dx2XXzz3-HevDSGBz1edo4WqywOIVXphZVs5W_bqD5RbaeAP27KBIQ>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 47F2C328005E;
 Mon, 26 Oct 2020 15:03:16 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: dev@dpdk.org, ferruh.yigit@intel.com, david.marchand@redhat.com,
 bruce.richardson@intel.com, olivier.matz@6wind.com, akhil.goyal@nxp.com,
 Declan Doherty <declan.doherty@intel.com>,
 Ankur Dwivedi <adwivedi@marvell.com>, Anoob Joseph <anoobj@marvell.com>,
 Jeff Guo <jia.guo@intel.com>, Haiyue Wang <haiyue.wang@intel.com>,
 Jerin Jacob <jerinj@marvell.com>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
 Kiran Kumar K <kirankumark@marvell.com>, Radu Nicolau <radu.nicolau@intel.com>,
 Ray Kinsella <mdr@ashroe.eu>, Neil Horman <nhorman@tuxdriver.com>
Date: Mon, 26 Oct 2020 20:03:14 +0100
Message-ID: <1707239.2vJ7HY3LlE@thomas>
In-Reply-To: <8861526.BORFLOU9qx@thomas>
References: <20201026052105.1561859-1-thomas@monjalon.net>
 <13f99aa6-04d6-553f-0c3a-1d40ee5dbf65@oktetlabs.ru>
 <8861526.BORFLOU9qx@thomas>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [PATCH 05/15] security: switch metadata 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>

26/10/2020 17:49, Thomas Monjalon:
> 26/10/2020 16:06, Andrew Rybchenko:
> > On 10/26/20 8:20 AM, Thomas Monjalon wrote:
> > [snip]
> > > -			sa = pkt->userdata;
> > > +			sa = RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
> > > +					struct ipsec_sa *);
> > 
> > I think it should be de-reference above, i.e.
> > sa = (struct ipsec_sa *)*RTE_MBUF_DYNFIELD(pkt,
> > security_dynfield_offset, RTE_SECURITY_DYNFIELD_TYPE *);
> > or just
> > sa = *RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset, struct ipsec_sa **);
> 
> You're right something is wrong.
> I should add a dereference.
> 
> > and why not rte_security_dynfield()?
> 
> Because I need good reviews from you and David :)

The initial idea was to have a field lookup in the app,
and to not rely on what drivers have registered.
After more thoughts, the lookup can be replaced with a check
rte_security_dynfield_is_registered(),
so rte_security_dynfield() can be used.

> Will fix one and the other occurences.
> I've prepared a v2 using a macro, but I think I will follow
> your suggestion of having static inline functions.
> 
> > It all looks very fragile. May be at least add
> >    RTE_BUILD_BUG_ON(sizeof(RTE_SECURITY_DYNFIELD_TYPE) ==
> >                     sizeof(ipsec_sa *));
> > and similar checks when an application or a library does
> > lookup for a dynamic field.
> 
> You mean adding this after the lookup in the app?

I will remove the lookup, it is less fragile.