DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mempool: fix calculating address of object trailers
@ 2015-07-22 13:57 Yuichi Nakai
  2015-07-23  8:47 ` Olivier MATZ
  0 siblings, 1 reply; 3+ messages in thread
From: Yuichi Nakai @ 2015-07-22 13:57 UTC (permalink / raw)
  To: dev

__mempool_get_trailer() calculated header's address.
The address of trailer should set after element area.
This patch fixes this calculating.

This issue was mixed with the following commit:
 Fixes: 97e7e685bfcd ("mempool: add structure for object trailers")

Signed-off-by: Yuichi Nakai <xoxyuxu@gmail.com>
---
 lib/librte_mempool/rte_mempool.h | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index ee67ce7..075bcdf 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -271,12 +271,6 @@ static inline struct rte_mempool_objhdr *__mempool_get_header(void *obj)
 	return RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objhdr));
 }
 
-/* return the trailer of a mempool object (internal) */
-static inline struct rte_mempool_objtlr *__mempool_get_trailer(void *obj)
-{
-	return RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objtlr));
-}
-
 /**
  * Return a pointer to the mempool owning this object.
  *
@@ -292,6 +286,13 @@ static inline struct rte_mempool *rte_mempool_from_obj(void *obj)
 	return hdr->mp;
 }
 
+/* return the trailer of a mempool object (internal) */
+static inline struct rte_mempool_objtlr *__mempool_get_trailer(void *obj)
+{
+	struct rte_mempool *mp = rte_mempool_from_obj(obj);
+	return RTE_PTR_ADD(obj, mp->elt_size);
+}
+
 /**
  * @internal Check and update cookies or panic.
  *
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH] mempool: fix calculating address of object trailers
  2015-07-22 13:57 [dpdk-dev] [PATCH] mempool: fix calculating address of object trailers Yuichi Nakai
@ 2015-07-23  8:47 ` Olivier MATZ
  2015-07-26 13:24   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Olivier MATZ @ 2015-07-23  8:47 UTC (permalink / raw)
  To: Yuichi Nakai, dev

Hi,

On 07/22/2015 03:57 PM, Yuichi Nakai wrote:
> __mempool_get_trailer() calculated header's address.
> The address of trailer should set after element area.
> This patch fixes this calculating.
>
> This issue was mixed with the following commit:
>   Fixes: 97e7e685bfcd ("mempool: add structure for object trailers")
>
> Signed-off-by: Yuichi Nakai <xoxyuxu@gmail.com>

Thank you for fixing it.

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

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

* Re: [dpdk-dev] [PATCH] mempool: fix calculating address of object trailers
  2015-07-23  8:47 ` Olivier MATZ
@ 2015-07-26 13:24   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2015-07-26 13:24 UTC (permalink / raw)
  To: Yuichi Nakai; +Cc: dev

> > __mempool_get_trailer() calculated header's address.
> > The address of trailer should set after element area.
> > This patch fixes this calculating.
> >
> > This issue was mixed with the following commit:
> >   Fixes: 97e7e685bfcd ("mempool: add structure for object trailers")
> >
> > Signed-off-by: Yuichi Nakai <xoxyuxu@gmail.com>
> 
> Thank you for fixing it.
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks

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

end of thread, other threads:[~2015-07-26 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-22 13:57 [dpdk-dev] [PATCH] mempool: fix calculating address of object trailers Yuichi Nakai
2015-07-23  8:47 ` Olivier MATZ
2015-07-26 13:24   ` 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).