From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by dpdk.org (Postfix) with ESMTP id 7A95B68AC for ; Fri, 9 May 2014 17:39:39 +0200 (CEST) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 09 May 2014 08:39:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,1018,1389772800"; d="scan'208";a="430009794" Received: from fmsmsx104.amr.corp.intel.com ([10.19.9.35]) by azsmga001.ch.intel.com with ESMTP; 09 May 2014 08:39:44 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX104.amr.corp.intel.com (10.19.9.35) with Microsoft SMTP Server (TLS) id 14.3.123.3; Fri, 9 May 2014 08:39:44 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.3.54]) by fmsmsx158.amr.corp.intel.com ([169.254.15.123]) with mapi id 14.03.0123.003; Fri, 9 May 2014 08:39:44 -0700 From: "Shaw, Jeffrey B" To: Olivier Matz , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH RFC 05/11] mbuf: merge physaddr and buf_len in a bitfield Thread-Index: AQHPa5Y6oEhAQPHLmkuZVbv+E7VQLJs4YDOg Date: Fri, 9 May 2014 15:39:42 +0000 Message-ID: <4032A54B6BB5F04B8C08B6CFF08C59285542081E@FMSMSX103.amr.corp.intel.com> References: <1399647038-15095-1-git-send-email-olivier.matz@6wind.com> <1399647038-15095-6-git-send-email-olivier.matz@6wind.com> In-Reply-To: <1399647038-15095-6-git-send-email-olivier.matz@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.200.106] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH RFC 05/11] mbuf: merge physaddr and buf_len in a bitfield 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: Fri, 09 May 2014 15:39:40 -0000 Hello Olivier, have you tested this patch to see if there is a negative imp= act to performance? Wouldn't the processor have to mask the high bytes of the physical address = when it is used, for example, to populate descriptors with buffer addresses= ? When compute bound, this could steal CPU cycles away from packet process= ing. I think we should understand the performance trade-off in order to sa= ve these 2 bytes. It would be interesting to see how throughput is impacted when the workload= is core-bound. This could be accomplished by running testpmd in io-fwd mo= de across 4x 10G ports. Thanks, Jeff -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Olivier Matz Sent: Friday, May 09, 2014 7:51 AM To: dev@dpdk.org Subject: [dpdk-dev] [PATCH RFC 05/11] mbuf: merge physaddr and buf_len in a= bitfield The physical address is never greater than (1 << 48) =3D 256 TB. We can win 2 bytes in the mbuf structure by merging the physical address an= d the buffer length in the same bitfield. Signed-off-by: Olivier Matz --- lib/librte_mbuf/rte_mbuf.c | 3 ++- lib/librte_mbuf/rte_mbuf.h | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index = c229525..9879095 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -104,7 +104,8 @@ rte_pktmbuf_init(struct rte_mempool *mp, m->buf_len =3D (uint16_t)buf_len; =20 /* keep some headroom between start of buffer and data */ - m->data =3D (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_le= n); + m->data =3D (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, + (uint16_t)m->buf_len); =20 /* init some constant fields */ m->pool =3D mp; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index = 803b223..275f6b2 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -130,8 +130,8 @@ union rte_vlan_macip { 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. */ + uint64_t buf_physaddr:48; /**< Physical address of segment buffer. */ + uint64_t buf_len:16; /**< Length of segment buffer. */ #ifdef RTE_MBUF_REFCNT /** * 16-bit Reference counter. @@ -148,8 +148,9 @@ 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. */ + uint32_t reserved; /**< Unused field. Required for padding. *= / =20 /* valid for any segment */ struct rte_mbuf *next; /**< Next segment of scattered packet. */ -- 1.9.2