diff options
author | Dan Gora <dg@adax.com> | 2018-06-18 16:35:34 -0700 |
---|---|---|
committer | Thomas Monjalon <thomas@monjalon.net> | 2018-07-13 23:08:15 +0200 |
commit | f5f45caeb049ea52b6e8fd2abe0a46c204dea533 (patch) | |
tree | a3f3bc838fc331c83f6b82bd345620700ea348e4 /lib/librte_mbuf | |
parent | 6bf10ab69be027401cc63b99fd30bc91fde525a9 (diff) | |
download | dpdk-f5f45caeb049ea52b6e8fd2abe0a46c204dea533.zip dpdk-f5f45caeb049ea52b6e8fd2abe0a46c204dea533.tar.gz dpdk-f5f45caeb049ea52b6e8fd2abe0a46c204dea533.tar.xz |
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>
Diffstat (limited to 'lib/librte_mbuf')
-rw-r--r-- | lib/librte_mbuf/rte_mbuf.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 8e6b4d2..00793ed 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -729,6 +729,24 @@ rte_mbuf_to_baddr(struct rte_mbuf *md) } /** + * 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. * |