From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce Richardson Subject: [PATCH v2 07/13] mbuf: move metadata macros to rte_port library Date: Thu, 11 Sep 2014 14:15:41 +0100 Message-ID: <1410441347-22840-8-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> To: dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <1410441347-22840-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" The metadata macros are only used by libs and apps using the rte_port packet framework library, so move them to a header file there. Signed-off-by: Bruce Richardson --- lib/librte_mbuf/rte_mbuf.h | 18 ------------------ lib/librte_port/rte_port.h | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f855e64..2f1bd4a 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -173,24 +173,6 @@ struct rte_mbuf { } __rte_cache_aligned; -#define RTE_MBUF_METADATA_UINT8(mbuf, offset) \ - (((uint8_t *)&(mbuf)[1])[offset]) -#define RTE_MBUF_METADATA_UINT16(mbuf, offset) \ - (((uint16_t *)&(mbuf)[1])[offset/sizeof(uint16_t)]) -#define RTE_MBUF_METADATA_UINT32(mbuf, offset) \ - (((uint32_t *)&(mbuf)[1])[offset/sizeof(uint32_t)]) -#define RTE_MBUF_METADATA_UINT64(mbuf, offset) \ - (((uint64_t *)&(mbuf)[1])[offset/sizeof(uint64_t)]) - -#define RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset) \ - (&RTE_MBUF_METADATA_UINT8(mbuf, offset)) -#define RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset) \ - (&RTE_MBUF_METADATA_UINT16(mbuf, offset)) -#define RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset) \ - (&RTE_MBUF_METADATA_UINT32(mbuf, offset)) -#define RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset) \ - (&RTE_MBUF_METADATA_UINT64(mbuf, offset)) - /** * Given the buf_addr returns the pointer to corresponding mbuf. */ diff --git a/lib/librte_port/rte_port.h b/lib/librte_port/rte_port.h index 1d763c2..6bd5039 100644 --- a/lib/librte_port/rte_port.h +++ b/lib/librte_port/rte_port.h @@ -50,6 +50,28 @@ extern "C" { #include #include +/** + * Macros to allow accessing metadata stored in the mbuf headroom + * just beyond the end of the mbuf data structure returned by a port + */ +#define RTE_MBUF_METADATA_UINT8(mbuf, offset) \ + (((uint8_t *)&(mbuf)[1])[offset]) +#define RTE_MBUF_METADATA_UINT16(mbuf, offset) \ + (((uint16_t *)&(mbuf)[1])[offset/sizeof(uint16_t)]) +#define RTE_MBUF_METADATA_UINT32(mbuf, offset) \ + (((uint32_t *)&(mbuf)[1])[offset/sizeof(uint32_t)]) +#define RTE_MBUF_METADATA_UINT64(mbuf, offset) \ + (((uint64_t *)&(mbuf)[1])[offset/sizeof(uint64_t)]) + +#define RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset) \ + (&RTE_MBUF_METADATA_UINT8(mbuf, offset)) +#define RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset) \ + (&RTE_MBUF_METADATA_UINT16(mbuf, offset)) +#define RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset) \ + (&RTE_MBUF_METADATA_UINT32(mbuf, offset)) +#define RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset) \ + (&RTE_MBUF_METADATA_UINT64(mbuf, offset)) + /* * Port IN * -- 1.9.3