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 B3A06A04C1; Thu, 21 Nov 2019 15:15:14 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 188DC2BA3; Thu, 21 Nov 2019 15:15:14 +0100 (CET) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 32C9A91 for ; Thu, 21 Nov 2019 15:15:13 +0100 (CET) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id EE43C34441A; Thu, 21 Nov 2019 15:15:12 +0100 (CET) Date: Thu, 21 Nov 2019 15:15:12 +0100 From: Olivier Matz To: Stephen Hemminger Cc: Shahaf Shuler , Thomas Monjalon , "dev@dpdk.org" Message-ID: <20191121141512.GD14387@glumotte.dev.6wind.com> References: <20191118100247.74241-1-shahafs@mellanox.com> <20191119082515.41848e4e@hermes.lan> <2817003.Afhorg6P4o@xps> <20191119155032.78a0180c@hermes.lan> <20191120075614.07bf2207@hermes.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191120075614.07bf2207@hermes.lan> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH] mbuf: extend pktmbuf pool private structure 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" Hi, On Wed, Nov 20, 2019 at 07:56:14AM -0800, Stephen Hemminger wrote: > On Wed, 20 Nov 2019 07:01:26 +0000 > Shahaf Shuler wrote: > > > Wednesday, November 20, 2019 1:51 AM, Stephen Hemminger: > > > Subject: Re: [dpdk-dev] [PATCH] mbuf: extend pktmbuf pool private > > > structure > > > > > > On Tue, 19 Nov 2019 23:30:15 +0100 > > > Thomas Monjalon wrote: > > > > > > > 19/11/2019 17:25, Stephen Hemminger: > > > > > On Tue, 19 Nov 2019 15:23:50 +0000 > > > > > Shahaf Shuler wrote: > > > > > > > > > > > Tuesday, November 19, 2019 11:33 AM, Thomas Monjalon: > > > > > > > Subject: Re: [PATCH] mbuf: extend pktmbuf pool private structure > > > > > > > > > > > > > > 18/11/2019 11:02, Shahaf Shuler: > > > > > > > > struct rte_pktmbuf_pool_private { > > > > > > > > uint16_t mbuf_data_room_size; /**< Size of data space in > > > each > > > > > > > mbuf. */ > > > > > > > > uint16_t mbuf_priv_size; /**< Size of private area in each > > > mbuf. > > > > > > > */ > > > > > > > > + uint32_t reserved; /**< reserved for future use. */ > > > > > > > > > > > > > > Maybe simpler to give the future name "flags" and keep the > > > comment > > > > > > > "reserved for future use". > > > > > > > > > > > > I'm am OK w/ changing to flags. > > > > > > If Olivier accepts maybe you can change while applying? OK for flags. > > > > > > > > > > After the Linux openat experience if you want to add flags. > > > > > Then all usage of API needs to validate that flags is 0. > > > > > > > > Sorry Stephen, I don't understand what you mean. > > > > Please could you explain? > > > > > > > > > > > > > > Any time a new field is added that maybe used later you can not guarantee > > > that existing code correctly initializes the value to zero. What happened with > > > openat() was that there was a flag value that was originally unused, but since > > > kernel did not enforce that it was zero; it could not later be used for > > > extensions. > > > > > > You need to make sure that all reserved fields are initialized. > > > That means when a private pool is created it is zeroed. And if a flag is new > > > argument to an API, check for zero at create time. +1, this is a good point > > > > I guess we can hard code the value for 0 on the rte_pktmbuf_pool_create function and have some assert on the rte_pktmbuf_pool_init callback (we cannot fail as this function returns void). > > Any other places you find problematic? > > No. that should be good. Adding an assertion in rte_pktmbuf_pool_init() to check that flag is 0 is a good idea. In addition, we must ensure that mbp_priv->flags is set to 0 by calling memset(&mbp_priv, 0, sizeof(mbp_priv)) at several places: - in rte_pktmbuf_pool_init() when user_mbp_priv == NULL - in rte_pktmbuf_pool_create_by_ops() - in examples/ntb/ntb_fwd.c:ntb_mbuf_pool_create() I think an entry in the release note could be added too. Olivier