mempool: introduce helpers for populate and required size
[dpdk.git] / drivers / mempool / octeontx2 / otx2_mempool_ops.c
index f5a4fe3..3aea92a 100644 (file)
@@ -713,24 +713,12 @@ static ssize_t
 otx2_npa_calc_mem_size(const struct rte_mempool *mp, uint32_t obj_num,
                       uint32_t pg_shift, size_t *min_chunk_size, size_t *align)
 {
-       ssize_t mem_size;
-
        /*
         * Simply need space for one more object to be able to
         * fulfill alignment requirements.
         */
-       mem_size = rte_mempool_op_calc_mem_size_default(mp, obj_num + 1,
-                                                       pg_shift,
-                                                       min_chunk_size, align);
-       if (mem_size >= 0) {
-               /*
-                * Memory area which contains objects must be physically
-                * contiguous.
-                */
-               *min_chunk_size = mem_size;
-       }
-
-       return mem_size;
+       return rte_mempool_op_calc_mem_size_helper(mp, obj_num + 1, pg_shift,
+                                                   min_chunk_size, align);
 }
 
 static int
@@ -761,7 +749,7 @@ otx2_npa_populate(struct rte_mempool *mp, unsigned int max_objs, void *vaddr,
        if (npa_lf_aura_range_update_check(mp->pool_id) < 0)
                return -EBUSY;
 
-       return rte_mempool_op_populate_default(mp, max_objs, vaddr, iova, len,
+       return rte_mempool_op_populate_helper(mp, max_objs, vaddr, iova, len,
                                               obj_cb, obj_cb_arg);
 }