From: Yuichi Nakai <xoxyuxu@gmail.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] mempool: fix calculating address of object trailers
Date: Wed, 22 Jul 2015 22:57:00 +0900 [thread overview]
Message-ID: <1437573420-16230-1-git-send-email-xoxyuxu@gmail.com> (raw)
__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
next reply other threads:[~2015-07-22 13:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 13:57 Yuichi Nakai [this message]
2015-07-23 8:47 ` Olivier MATZ
2015-07-26 13:24 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437573420-16230-1-git-send-email-xoxyuxu@gmail.com \
--to=xoxyuxu@gmail.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).