From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Olivier Matz <olivier.matz@6wind.com>,
Santosh Shukla <santosh.shukla@caviumnetworks.com>,
<stable@dpdk.org>
Subject: [dpdk-stable] [PATCH] mempool: fix phys contig check if populate default skipped
Date: Thu, 1 Feb 2018 14:02:23 +0000 [thread overview]
Message-ID: <1517493743-18585-1-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1516713372-10572-2-git-send-email-arybchenko@solarflare.com>
There is not specified dependency between rte_mempool_populate_default()
and rte_mempool_populate_iova(). So, the second should not rely on the
fact that the first adds capability flags to the mempool flags.
Fixes: 65cf769f5e6a ("mempool: detect physical contiguous objects")
Cc: stable@dpdk.org
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
lib/librte_mempool/rte_mempool.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 6fdb723..54f7f4b 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -333,6 +333,7 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,
void *opaque)
{
unsigned total_elt_sz;
+ unsigned int mp_capa_flags;
unsigned i = 0;
size_t off;
struct rte_mempool_memhdr *memhdr;
@@ -357,8 +358,17 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,
total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size;
+ /* Get mempool capabilities */
+ mp_capa_flags = 0;
+ ret = rte_mempool_ops_get_capabilities(mp, &mp_capa_flags);
+ if ((ret < 0) && (ret != -ENOTSUP))
+ return ret;
+
+ /* update mempool capabilities */
+ mp->flags |= mp_capa_flags;
+
/* Detect pool area has sufficient space for elements */
- if (mp->flags & MEMPOOL_F_CAPA_PHYS_CONTIG) {
+ if (mp_capa_flags & MEMPOOL_F_CAPA_PHYS_CONTIG) {
if (len < total_elt_sz * mp->size) {
RTE_LOG(ERR, MEMPOOL,
"pool area %" PRIx64 " not enough\n",
@@ -378,7 +388,7 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,
memhdr->free_cb = free_cb;
memhdr->opaque = opaque;
- if (mp->flags & MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS)
+ if (mp_capa_flags & MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS)
/* align object start address to a multiple of total_elt_sz */
off = total_elt_sz - ((uintptr_t)vaddr % total_elt_sz);
else if (mp->flags & MEMPOOL_F_NO_CACHE_ALIGN)
--
2.7.4
next prev parent reply other threads:[~2018-02-01 14:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1511539591-20966-1-git-send-email-arybchenko@solarflare.com>
[not found] ` <1516713372-10572-1-git-send-email-arybchenko@solarflare.com>
2018-01-23 13:15 ` [dpdk-stable] [RFC v2 01/17] " Andrew Rybchenko
2018-01-31 16:45 ` Olivier Matz
2018-02-01 5:05 ` santosh
2018-02-01 6:54 ` Andrew Rybchenko
2018-02-01 9:09 ` santosh
2018-02-01 9:18 ` [dpdk-stable] [dpdk-dev] " Andrew Rybchenko
2018-02-01 9:30 ` santosh
2018-02-01 10:00 ` Andrew Rybchenko
2018-02-01 10:14 ` Olivier Matz
2018-02-01 10:33 ` santosh
2018-02-01 14:02 ` Andrew Rybchenko
2018-02-01 10:17 ` santosh
2018-02-01 14:02 ` Andrew Rybchenko [this message]
2018-02-05 23:53 ` [dpdk-stable] [PATCH] " Thomas Monjalon
[not found] ` <1521994855-8808-1-git-send-email-arybchenko@solarflare.com>
2018-03-25 16:20 ` [dpdk-stable] [PATCH v2 01/11] mempool: fix memhdr leak when no objects are populated Andrew Rybchenko
[not found] ` <1522080591-24705-1-git-send-email-arybchenko@solarflare.com>
2018-03-26 16:09 ` [dpdk-stable] [PATCH v3 " Andrew Rybchenko
2018-04-06 15:50 ` Olivier Matz
[not found] ` <1523885080-17168-1-git-send-email-arybchenko@solarflare.com>
2018-04-16 13:24 ` [dpdk-stable] [PATCH v4 " Andrew Rybchenko
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=1517493743-18585-1-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.com \
--cc=santosh.shukla@caviumnetworks.com \
--cc=stable@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).