[dpdk-dev,1/2] mempool: notify mempool area after mempool alloc

Message ID 20171215160031.11354-1-pbhagavatula@caviumnetworks.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pavan Nikhilesh Dec. 15, 2017, 4 p.m. UTC
  Mempool creation needs to be completed first before notifying mempool to
register the mempool area.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 lib/librte_mempool/rte_mempool.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
  

Comments

Santosh Shukla Dec. 18, 2017, 4:56 a.m. UTC | #1
On Friday 15 December 2017 09:30 PM, Pavan Nikhilesh wrote:
> Mempool creation needs to be completed first before notifying mempool to
> register the mempool area.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---

LGTM.
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
  
Olivier Matz Dec. 22, 2017, 3:11 p.m. UTC | #2
On Fri, Dec 15, 2017 at 09:30:30PM +0530, Pavan Nikhilesh wrote:
> Mempool creation needs to be completed first before notifying mempool to
> register the mempool area.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>

Looks good to me.

Did you see any issue?
If yes, can you please resubmit the patch
with an updated title "mempool: fix first memory area notification",
a Fixes: and Cc: stable@dpdk.org?

Thanks,
Olivier
  
Pavan Nikhilesh Dec. 24, 2017, 7:07 a.m. UTC | #3
On Fri, Dec 22, 2017 at 04:11:21PM +0100, Olivier MATZ wrote:
> On Fri, Dec 15, 2017 at 09:30:30PM +0530, Pavan Nikhilesh wrote:
> > Mempool creation needs to be completed first before notifying mempool to
> > register the mempool area.
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
>
> Looks good to me.
>
> Did you see any issue?
> If yes, can you please resubmit the patch
> with an updated title "mempool: fix first memory area notification",
> a Fixes: and Cc: stable@dpdk.org?

I will roll out a v2 updating.

>
> Thanks,
> Olivier

Thanks,
Pavan.
  

Patch

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index d50dba4..6d17022 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -367,11 +367,6 @@  rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,
 	struct rte_mempool_memhdr *memhdr;
 	int ret;
 
-	/* Notify memory area to mempool */
-	ret = rte_mempool_ops_register_memory_area(mp, vaddr, iova, len);
-	if (ret != -ENOTSUP && ret < 0)
-		return ret;
-
 	/* create the internal ring if not already done */
 	if ((mp->flags & MEMPOOL_F_POOL_CREATED) == 0) {
 		ret = rte_mempool_ops_alloc(mp);
@@ -380,6 +375,11 @@  rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,
 		mp->flags |= MEMPOOL_F_POOL_CREATED;
 	}
 
+	/* Notify memory area to mempool */
+	ret = rte_mempool_ops_register_memory_area(mp, vaddr, iova, len);
+	if (ret != -ENOTSUP && ret < 0)
+		return ret;
+
 	/* mempool is already populated */
 	if (mp->populated_size >= mp->size)
 		return -ENOSPC;