mbuf: add accessor function for private data area

Add an inline accessor function to return the starting address of
the private data area in the supplied mbuf.

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.

No checks are made to ensure that a private data area actually exists
in the buffer.

Signed-off-by: Dan Gora <dg@adax.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Dan Gora 2018-06-18 16:35:34 -07:00 committed by Thomas Monjalon
parent 6bf10ab69b
commit f5f45caeb0

View File

@ -728,6 +728,24 @@ rte_mbuf_to_baddr(struct rte_mbuf *md)
return buffer_addr;
}
/**
* Return the starting address of the private data area embedded in
* the given mbuf.
*
* Note that no check is made to ensure that a private data area
* actually exists in the supplied mbuf.
*
* @param m
* The pointer to the mbuf.
* @return
* The starting address of the private data area of the given mbuf.
*/
static inline void * __rte_experimental
rte_mbuf_to_priv(struct rte_mbuf *m)
{
return RTE_PTR_ADD(m, sizeof(struct rte_mbuf));
}
/**
* Returns TRUE if given mbuf is cloned by mbuf indirection, or FALSE
* otherwise.