From 902437a373229350815054281ddae75d5859f66b Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Wed, 8 Jan 2020 16:05:41 +0100 Subject: [PATCH] fix anatoly's issue --- lib/librte_mempool/rte_mempool.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 78d8eb941e..b05b417d26 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -297,8 +297,8 @@ mempool_ops_alloc_once(struct rte_mempool *mp) * zone. Return the number of objects added, or a negative value * on error. */ -int -rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr, +static int +__rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr, rte_iova_t iova, size_t len, rte_mempool_memchunk_free_cb_t *free_cb, void *opaque) { @@ -343,7 +343,7 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr, /* not enough room to store one object */ if (i == 0) { - ret = -EINVAL; + ret = -ENOBUFS; goto fail; } @@ -356,6 +356,21 @@ fail: return ret; } +int +rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr, + rte_iova_t iova, size_t len, rte_mempool_memchunk_free_cb_t *free_cb, + void *opaque) +{ + int ret; + + /* to be removed for 20.11 */ + ret = __rte_mempool_populate_iova(mp, vaddr, iova, len, free_cb, opaque); + if (ret == -ENOBUFS) + ret = -EINVAL; + + return ret; +} + static rte_iova_t get_iova(void *addr) { @@ -406,8 +421,10 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr, break; } - ret = rte_mempool_populate_iova(mp, addr + off, iova, + ret = __rte_mempool_populate_iova(mp, addr + off, iova, phys_len, free_cb, opaque); + if (ret < 0 && ret == -ENOBUFS) + continue; if (ret < 0) goto fail; /* no need to call the free callback for next chunks */ -- 2.20.1