X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_port%2Frte_port.h;h=d84e5a12850ce30fabf8955148abc18d951adb93;hb=e033c005c225e2fdcdb5de3846cbcd2ecc5df5bf;hp=1d763c2ece8edc9f4eeb0a685475663feb899800;hpb=a9cf8ad6514689903c497af8e082c62913885c1f;p=dpdk.git diff --git a/lib/librte_port/rte_port.h b/lib/librte_port/rte_port.h index 1d763c2ece..d84e5a1285 100644 --- a/lib/librte_port/rte_port.h +++ b/lib/librte_port/rte_port.h @@ -50,6 +50,29 @@ 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 *