[dpdk-dev] [PATCH 1/4] mbuf: add accessor function for private data area

Burakov, Anatoly anatoly.burakov at intel.com
Fri Jun 8 10:30:17 CEST 2018


On 08-Jun-18 12:54 AM, Dan Gora wrote:
> Add an inline accessor function to return the starting address of
> the private data area in the supplied mbuf.
> 
> If the user did not allocate space for a private data area in the
> mbuf's memory pool, then return NULL.
> 
> This allows applications to easily access the private data area
> between the struct rte_mbuf and the data buffer in the specified mbuf
> without creating private macros or accessor functions.
> 
> Signed-off-by: Dan Gora <dg at adax.com>
> ---

<...>

> +static inline void *
> +rte_mbuf_to_priv(struct rte_mbuf *md)
> +{
> +	if (md->priv_size == 0)
> +		return NULL;
> +
> +	return RTE_PTR_ADD(md, sizeof(struct rte_mbuf));
> +}

Hi Dan,

New API's should be marked as __rte_experimental for at least one release.

> +
>   /**
>    * Returns TRUE if given mbuf is cloned by mbuf indirection, or FALSE
>    * otherwise.
> 


-- 
Thanks,
Anatoly


More information about the dev mailing list