From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 297C058E8 for ; Mon, 15 Sep 2014 10:14:08 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 15 Sep 2014 01:19:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,526,1406617200"; d="scan'208";a="599619762" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga002.fm.intel.com with ESMTP; 15 Sep 2014 01:19:34 -0700 Received: from irsmsx106.ger.corp.intel.com (163.33.3.31) by IRSMSX101.ger.corp.intel.com (163.33.3.153) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 15 Sep 2014 09:19:33 +0100 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.112]) by IRSMSX106.ger.corp.intel.com ([169.254.8.3]) with mapi id 14.03.0195.001; Mon, 15 Sep 2014 09:19:32 +0100 From: "Richardson, Bruce" To: "Liu, Jijiang" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 02/13] mbuf: reorder fields by time of use Thread-Index: AQHPzcKnAqnQAGI7DUOex+lsgDJZ2JwBvFuAgAAjCgA= Date: Mon, 15 Sep 2014 08:19:31 +0000 Message-ID: <59AF69C657FD0841A61C55336867B5B0343F160F@IRSMSX103.ger.corp.intel.com> References: <1409759378-10113-1-git-send-email-bruce.richardson@intel.com> <1410441347-22840-1-git-send-email-bruce.richardson@intel.com> <1410441347-22840-3-git-send-email-bruce.richardson@intel.com> <1ED644BD7E0A5F4091CF203DAFB8E4CC01D701BA@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <1ED644BD7E0A5F4091CF203DAFB8E4CC01D701BA@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 02/13] mbuf: reorder fields by time of use 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: Mon, 15 Sep 2014 08:14:10 -0000 > -----Original Message----- > From: Liu, Jijiang > Sent: Monday, September 15, 2014 8:12 AM > To: Richardson, Bruce; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v2 02/13] mbuf: reorder fields by time of = use >=20 > Hi Bruce, >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bruce Richardson > > Sent: Thursday, September 11, 2014 9:16 PM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v2 02/13] mbuf: reorder fields by time of us= e > > > > * Reorder the fields in the mbuf so that we have fields that are used = together > > side-by-side in the structure. This means that we have a contiguous blo= ck of > > 8-bytes in the mbuf which are used to reset an mbuf of descriptor rearm= , and a > > block of 16-bytes of data (excluding flags) which are set on RX from th= e > > received packet descriptor. > > * Use dummy fields as appropriate to ensure alignment or to reserve gap= s for > > later field additions. > > * Place most items which are not used by fast-path RX separately at the= end of > > the structure so they can later be moved to a separate cache line. > > [The l2/l3 length fields are not moved at this stage as doing so will c= ause > > overflow to the next cache line]. > > > > Updated in V2: > > * Updated the KNI buffer structure to match that of new mbuf > > * Cleaned up commit message typos. > > > > Signed-off-by: Bruce Richardson > > --- > > .../linuxapp/eal/include/exec-env/rte_kni_common.h | 12 ++++++----- > > lib/librte_mbuf/rte_mbuf.h | 25 > > ++++++++++++---------- > > 2 files changed, 21 insertions(+), 16 deletions(-) > > > > diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_commo= n.h > > b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h > > index 07908ac..f2b502c 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 > > @@ -108,15 +108,17 @@ struct rte_kni_fifo { > > * Padding is necessary to assure the offsets of these fields > > */ > > struct rte_kni_mbuf { > > - void *pool; > > void *buf_addr; > > - char pad0[16]; > > - void *next; > > + char pad0[10]; > > uint16_t data_off; /**< Start address of data in segment buffer.= */ > > + char pad1[4]; > > + uint16_t ol_flags; /**< Offload features. */ > > + char pad2[8]; > > uint16_t data_len; /**< Amount of data in segment buffer. */ > > uint32_t pkt_len; /**< Total pkt len: sum of all segment data_l= en. > > */ > > - char pad2[4]; > > - uint16_t ol_flags; /**< Offload features. */ > > + char pad3[8]; > > + void *pool; > > + void *next; > > } __attribute__((__aligned__(64))); > > > > /* > > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h in= dex > > 71080e5..413a5a1 100644 > > --- a/lib/librte_mbuf/rte_mbuf.h > > +++ b/lib/librte_mbuf/rte_mbuf.h > > @@ -115,16 +115,12 @@ extern "C" { > > * The generic rte_mbuf, containing a packet mbuf. > > */ > > struct rte_mbuf { > > - struct rte_mempool *pool; /**< Pool from which mbuf was allocated. > */ > > void *buf_addr; /**< Virtual address of segment buffer. */ > > phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */ > > - uint16_t buf_len; /**< Length of segment buffer. */ > > > > - /* valid for any segment */ > > - struct rte_mbuf *next; /**< Next segment of scattered packet. */ > > + /* next 8 bytes are initialised on RX descriptor rearm */ > > + uint16_t buf_len; /**< Length of segment buffer. */ > > uint16_t data_off; > > - uint16_t data_len; /**< Amount of data in segment buffer. */ > > - uint32_t pkt_len; /**< Total pkt len: sum of all segments. */ > > > > #ifdef RTE_MBUF_REFCNT > > /** > > @@ -142,14 +138,17 @@ struct rte_mbuf { > > #else > > uint16_t refcnt_reserved; /**< Do not use this field */ > > #endif > > - uint16_t reserved; /**< Unused field. Required for padding > > */ > > - uint16_t ol_flags; /**< Offload features. */ > > - > > - /* these fields are valid for first segment only */ > > uint8_t nb_segs; /**< Number of segments. */ > > uint8_t port; /**< Input port. */ > > > > - /* offload features, valid for first segment only */ > > + uint16_t ol_flags; /**< Offload features. */ > > + uint16_t reserved0; /**< Unused field. Required for padding */ > > + uint32_t reserved1; /**< Unused field. Required for padding */ > > + > > + /* remaining bytes are set on RX when pulling packet from descriptor = */ > > + uint16_t reserved2; /**< Unused field. Required for padding */ > > + uint16_t data_len; /**< Amount of data in segment buffer. */ > > + uint32_t pkt_len; /**< Total pkt len: sum of all segments. */ > > union { > > uint16_t l2_l3_len; /**< combined l2/l3 lengths as single var */ > > struct { > > @@ -167,6 +166,10 @@ struct rte_mbuf { > > uint32_t sched; /**< Hierarchical scheduler */ > > } hash; /**< hash information */ > > > > + /* fields only used in slow path or on TX */ > > + struct rte_mempool *pool; /**< Pool from which mbuf was allocated. > */ > > + struct rte_mbuf *next; /**< Next segment of scattered packet. */ > > + > > union { > > uint8_t metadata[0]; > > uint16_t metadata16[0]; > > -- > > 1.9.3 >=20 > It seems that you removed the inner_l3_len and inner_l2_len fields from t= he > rte_mbuf.h structure, what is the reason? >=20 > /Jijiang Liu No, those fields were never added to the mbuf, they were simply proposed as= a new field addition in an RFC patch set. The adding of new fields to the = mbuf is beyond the scope of the two patch sets already submitted. Those pat= ch sets merely reorder the existing l2 and l3 length fields without changin= g their size or name. /Bruce