From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 09E865909 for ; Thu, 11 Sep 2014 15:11:22 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 11 Sep 2014 06:09:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,505,1406617200"; d="scan'208";a="601443234" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 11 Sep 2014 06:15:50 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s8BDFnhL002151; Thu, 11 Sep 2014 14:15:49 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s8BDFn7Z023644; Thu, 11 Sep 2014 14:15:49 +0100 Received: (from bricha3@localhost) by sivswdev02.ir.intel.com with id s8BDFnAM023639; Thu, 11 Sep 2014 14:15:49 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Thu, 11 Sep 2014 14:15:40 +0100 Message-Id: <1410441347-22840-7-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1410441347-22840-1-git-send-email-bruce.richardson@intel.com> References: <1409759378-10113-1-git-send-email-bruce.richardson@intel.com> <1410441347-22840-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH v2 06/13] mbuf: use macros only to access the mbuf metadata 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: Thu, 11 Sep 2014 13:11:23 -0000 Removed the explicit zero-sized metadata definition at the end of the mbuf data structure. Updated the metadata macros to take account of this change so that all existing code which uses those macros still works. Updates in V2: * None Signed-off-by: Bruce Richardson --- lib/librte_mbuf/rte_mbuf.h | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 6ce852a..f855e64 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -171,31 +171,25 @@ struct rte_mbuf { 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]; - uint32_t metadata32[0]; - uint64_t metadata64[0]; - } __rte_cache_aligned; } __rte_cache_aligned; #define RTE_MBUF_METADATA_UINT8(mbuf, offset) \ - (mbuf->metadata[offset]) + (((uint8_t *)&(mbuf)[1])[offset]) #define RTE_MBUF_METADATA_UINT16(mbuf, offset) \ - (mbuf->metadata16[offset/sizeof(uint16_t)]) + (((uint16_t *)&(mbuf)[1])[offset/sizeof(uint16_t)]) #define RTE_MBUF_METADATA_UINT32(mbuf, offset) \ - (mbuf->metadata32[offset/sizeof(uint32_t)]) + (((uint32_t *)&(mbuf)[1])[offset/sizeof(uint32_t)]) #define RTE_MBUF_METADATA_UINT64(mbuf, offset) \ - (mbuf->metadata64[offset/sizeof(uint64_t)]) + (((uint64_t *)&(mbuf)[1])[offset/sizeof(uint64_t)]) #define RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset) \ - (&mbuf->metadata[offset]) + (&RTE_MBUF_METADATA_UINT8(mbuf, offset)) #define RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset) \ - (&mbuf->metadata16[offset/sizeof(uint16_t)]) + (&RTE_MBUF_METADATA_UINT16(mbuf, offset)) #define RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset) \ - (&mbuf->metadata32[offset/sizeof(uint32_t)]) + (&RTE_MBUF_METADATA_UINT32(mbuf, offset)) #define RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset) \ - (&mbuf->metadata64[offset/sizeof(uint64_t)]) + (&RTE_MBUF_METADATA_UINT64(mbuf, offset)) /** * Given the buf_addr returns the pointer to corresponding mbuf. -- 1.9.3