[dpdk-dev] [PATCH v2] Move rte_mbuf macros to common header file

Aaron Conole aconole at redhat.com
Wed Sep 30 21:41:18 CEST 2015


Ravi Kerur <rkerur at gmail.com> writes:

> Macros RTE_MBUF_DATA_DMA_ADDR and RTE_MBUF_DATA_DMA_ADDR_DEFAULT
> are defined in each PMD driver file. Move those macros into common
> lib/librte_mbuf/rte_mbuf.h file. PMD drivers include rte_mbuf.h
> file directly/indirectly hence no additionl header file inclusion
> is necessary.
I think this should also mention that they are no longer macros, as
well.

<<snip>>
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -843,6 +843,16 @@ struct rte_mbuf {
>  	uint16_t timesync;
>  } __rte_cache_aligned;
>  
> +static inline uint64_t RTE_MBUF_DATA_DMA_ADDR(struct rte_mbuf* mb)
> +{
> +	return ((uint64_t)((mb)->buf_physaddr + (mb)->data_off));
> +}
> +
> +static inline uint64_t RTE_MBUF_DATA_DMA_ADDR_DEFAULT(struct rte_mbuf *mb)
> +{
> +	return ((uint64_t)((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM));
> +}
> +
I think these names should be made lower case as well.


More information about the dev mailing list