From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 60BB75916 for ; Wed, 17 Sep 2014 17:29:44 +0200 (CEST) Received: from nat-pool-rdu-u.redhat.com ([66.187.233.203] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1XUHGI-0001QY-63; Wed, 17 Sep 2014 11:35:24 -0400 Date: Wed, 17 Sep 2014 11:35:10 -0400 From: Neil Horman To: Bruce Richardson Message-ID: <20140917153510.GG4213@localhost.localdomain> References: <1410948102-12740-1-git-send-email-bruce.richardson@intel.com> <1410948102-12740-5-git-send-email-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1410948102-12740-5-git-send-email-bruce.richardson@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 4/5] mbuf: add userdata pointer field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Sep 2014 15:29:44 -0000 On Wed, Sep 17, 2014 at 11:01:41AM +0100, Bruce Richardson wrote: > While some applications may store metadata about packets in the packet > mbuf headroom, this is not a workable solution for packet metadata which > is either: > * larger than the headroom (or headroom is needed for adding pkt headers) > * needs to be shared or copied among packets > > To support these use cases in applications, we reserve a general > "userdata" pointer field inside the second cache-line of the mbuf. This > is better than having the application store the pointer to the external > metadata in the packet headroom, as it saves an additional cache-line > from being used. > > Apart from storing metadata, this field also provides a general 8-byte > scratch space inside the mbuf for any other application uses that are > applicable. > > Signed-off-by: Bruce Richardson > --- > lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h | 3 ++- > lib/librte_mbuf/rte_mbuf.h | 3 +++ > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h > index 25ed672..d27e891 100644 > --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h > +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h > @@ -117,7 +117,8 @@ struct rte_kni_mbuf { > uint16_t data_len; /**< Amount of data in segment buffer. */ > uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */ > char pad3[8]; > - void *pool __attribute__((__aligned__(64))); > + void *pad4 __attribute__((__aligned__(64))); > + void *pool; I don't see a comment about this in the changelog, only about the userdata pointer being added below. > void *next; > }; > > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > index 8e27d2e..b1acfc3 100644 > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -172,6 +172,9 @@ struct rte_mbuf { > > /* second cache line - fields only used in slow path or on TX */ > MARKER cacheline1 __rte_cache_aligned; > + > + void *userdata; /**< Can be used for external metadata */ > + Do you want to make this a void* or a char[8]? I ask because if people are going to use is as a scratch space (rather than a pointer), they get a suprise when they build this on 32 bit systems, and their 8 byte scratch space is reduced to 4 bytes. Neil > struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ > struct rte_mbuf *next; /**< Next segment of scattered packet. */ > > -- > 1.9.3 > >