Skip to contentSkip to conversation

mempool: fix calculating address of object trailers

PATCH Applied Yuichi Nakai 3 participants 3 messages Jul 22, 2015 – Jul 26, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mempool: fix calculating address of object trailers

__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")
---
 lib/librte_mempool/rte_mempool.h | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
lib/librte_mempool/rte_mempool.h +7 -6
index ee67ce7..075bcdf 100644
@@ -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.
  *
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 8 lines · Yuichi Nakai

__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")

Thank you for fixing it.

#2 lore raw
Quoted 4 lines
Quoted 4 lines

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

Quoted 8 lines
Quoted 4 lines

This issue was mixed with the following commit:

Fixes 97e7e685bfcd ("mempool: add structure for object trailers")

Thank you for fixing it.

Applied, thanks