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 76C5DA00E6 for ; Thu, 11 Jul 2019 09:53:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 33BF74C8E; Thu, 11 Jul 2019 09:53:23 +0200 (CEST) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 236703772 for ; Thu, 11 Jul 2019 09:53:22 +0200 (CEST) Received: from core.dev.6wind.com (unknown [10.0.0.1]) by proxy.6wind.com (Postfix) with ESMTPS id 03B772E51D1; Thu, 11 Jul 2019 09:53:22 +0200 (CEST) Received: from [10.16.0.195] (helo=6wind.com) by core.dev.6wind.com with smtp (Exim 4.84_2) (envelope-from ) id 1hlTtI-0004Bb-TF; Thu, 11 Jul 2019 09:53:21 +0200 Received: by 6wind.com (sSMTP sendmail emulation); Thu, 11 Jul 2019 09:53:20 +0200 Date: Thu, 11 Jul 2019 09:53:20 +0200 From: Olivier Matz To: "Wiles, Keith" Cc: dpdk dev community , Stephen Hemminger Message-ID: <20190711075320.woswl6fhl6szgdqb@glumotte.dev.6wind.com> References: <20190710092907.5565-1-olivier.matz@6wind.com> <20190710104917.73bc9201@hermes.lan> <3117C805-492A-4DA9-BE8F-E119E057C80D@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3117C805-492A-4DA9-BE8F-E119E057C80D@intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [RFC] mbuf: support dynamic fields and flags 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 Keith, On Wed, Jul 10, 2019 at 06:12:16PM +0000, Wiles, Keith wrote: > > > > On Jul 10, 2019, at 12:49 PM, Stephen Hemminger wrote: > > > > On Wed, 10 Jul 2019 11:29:07 +0200 > > Olivier Matz wrote: > > > >> /** > >> * Indicate that the metadata field in the mbuf is in use. > >> @@ -738,6 +741,8 @@ struct rte_mbuf { > >> */ > >> struct rte_mbuf_ext_shared_info *shinfo; > >> > >> + uint64_t dynfield1; /**< Reserved for dynamic fields. */ > >> + uint64_t dynfield2; /**< Reserved for dynamic fields. */ > >> } __rte_cache_aligned; > > > > Growing mbuf is a fundamental ABI break and this needs > > higher level approval. Why not one pointer? > > > > It looks like you are creating something like FreeBSD m_tag. > > Why not use that? > > Changing the mbuf structure causes a big problem for a number reasons as Stephen states. Can you elaborate? This is indeed an ABI break, but I think this is only due to the adding of rte_mbuf_dynfield_copy() in rte_pktmbuf_attach(). The size of the mbuf does not change and the fields are not initialized when creating a new mbuf. So I think there is no ABI change for code that is not using rte_pktmbuf_attach(). I don't think it's a problem to have one ABI change, if it avoids many others in the future. > If we leave the mbuf stucture alone and add this feature to the > headroom space between the mbuf structure and the packet. When setting > up the mempool/mbuf pool we define a headroom to hold the extra data > when the mbuf pool is created or just use the current headroom > space. Using this method we can eliminate the mbuf structure change > and add the data to the packet buffer. We can do away with dynfield1 > and 2 as we know where headroom space begins and ends. Just a thought. The size of the mbuf metadata (between the mbuf structure and the buffer) is configured per pool, so it can be different accross mbufs. So, the access to the dynamic field would be slower: *(mbuf + dynfield_offset + metadata_size(mbuf)) Also, the size of the data buffer can be 0: it happens for mbuf pools that are dedicated to mbuf clones (that reference data in another mbuf or in an external buffer). In this case, there is no room after metadata to store the dynamic fields. Thanks, Olivier