From: Bruce Richardson Date: Thu, 11 Sep 2014 13:15:41 +0000 (+0100) Subject: mbuf: move metadata macros to rte_port library X-Git-Tag: spdx-start~10428 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fa363849d0c465a5711e8ba60cd9966eac7a6a3b;p=dpdk.git mbuf: move metadata macros to rte_port library 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 Acked-by: Thomas Monjalon --- diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f855e64d99..2f1bd4a619 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 1d763c2ece..6bd5039484 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 *