DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 1/4] mbuf: add accessor function for private data area
@ 2018-06-18 23:35 Dan Gora
  2018-06-19 12:56 ` Andrew Rybchenko
  2018-06-26  7:39 ` Olivier Matz
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Gora @ 2018-06-18 23:35 UTC (permalink / raw)
  To: dev; +Cc: Dan Gora, Olivier Matz

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>
---
 lib/librte_mbuf/rte_mbuf.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 8e6b4d292..08c58335d 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -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 md
+ *   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.
-- 
2.18.0.rc1.1.g6f333ff2f

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] mbuf: add accessor function for private data area
  2018-06-18 23:35 [dpdk-dev] [PATCH v2 1/4] mbuf: add accessor function for private data area Dan Gora
@ 2018-06-19 12:56 ` Andrew Rybchenko
  2018-06-26  7:39 ` Olivier Matz
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Rybchenko @ 2018-06-19 12:56 UTC (permalink / raw)
  To: Dan Gora, dev; +Cc: Olivier Matz

On 06/19/2018 02:35 AM, Dan Gora wrote:
> 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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] mbuf: add accessor function for private data area
  2018-06-18 23:35 [dpdk-dev] [PATCH v2 1/4] mbuf: add accessor function for private data area Dan Gora
  2018-06-19 12:56 ` Andrew Rybchenko
@ 2018-06-26  7:39 ` Olivier Matz
  2018-07-13 21:10   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Olivier Matz @ 2018-06-26  7:39 UTC (permalink / raw)
  To: Dan Gora; +Cc: dev

Hi Dan,

On Mon, Jun 18, 2018 at 04:35:34PM -0700, Dan Gora wrote:
> 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>

Thank you for this patch.

Few (late) comments to your previous questions:

- about rte_mbuf vs rte_pktmbuf, as Andrew said pktmbuf was used in
  the past when there was a ctrlmbuf. This one has been removed now, so
  mbuf should be used.

- I agree that removing the test (m->priv_size == 0) is better for
  the reasons mentionned, and also because it would add a test in the
  dataplane area, which would sometimes be useless: the application create
  the mbuf pools, so it can know that all mbufs have a priv area.


Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] mbuf: add accessor function for private data area
  2018-06-26  7:39 ` Olivier Matz
@ 2018-07-13 21:10   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2018-07-13 21:10 UTC (permalink / raw)
  To: Dan Gora; +Cc: dev, Olivier Matz

26/06/2018 09:39, Olivier Matz:
> Hi Dan,
> 
> On Mon, Jun 18, 2018 at 04:35:34PM -0700, Dan Gora wrote:
> > 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>
> 
> Thank you for this patch.
> 
> Few (late) comments to your previous questions:
> 
> - about rte_mbuf vs rte_pktmbuf, as Andrew said pktmbuf was used in
>   the past when there was a ctrlmbuf. This one has been removed now, so
>   mbuf should be used.
> 
> - I agree that removing the test (m->priv_size == 0) is better for
>   the reasons mentionned, and also because it would add a test in the
>   dataplane area, which would sometimes be useless: the application create
>   the mbuf pools, so it can know that all mbufs have a priv area.
> 
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Series applied

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-13 21:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18 23:35 [dpdk-dev] [PATCH v2 1/4] mbuf: add accessor function for private data area Dan Gora
2018-06-19 12:56 ` Andrew Rybchenko
2018-06-26  7:39 ` Olivier Matz
2018-07-13 21:10   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).