]> git.droids-corp.org - dpdk.git/commitdiff
compressdev: add bulk free operation API
authorFiona Trahe <fiona.trahe@intel.com>
Mon, 19 Nov 2018 22:10:10 +0000 (22:10 +0000)
committerAkhil Goyal <akhil.goyal@nxp.com>
Wed, 19 Dec 2018 10:19:10 +0000 (11:19 +0100)
There's an API to bulk allocate operations,
this adds a corresponding bulk free API.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Shally Verma <shally.verma@caviumnetworks.com>
Acked-by: Lee Daly <lee.daly@intel.com>
lib/librte_compressdev/rte_comp.c
lib/librte_compressdev/rte_comp.h
lib/librte_compressdev/rte_compressdev_version.map

index 4634c1274f73f2e4218c05fbd92df6ad437ac506..06e3d442ae06bd0703f91e9486d65f53173eff9d 100644 (file)
@@ -213,3 +213,15 @@ rte_comp_op_free(struct rte_comp_op *op)
        if (op != NULL && op->mempool != NULL)
                rte_mempool_put(op->mempool, op);
 }
+
+void __rte_experimental
+rte_comp_op_bulk_free(struct rte_comp_op **ops, uint16_t nb_ops)
+{
+       uint16_t i;
+
+       for (i = 0; i < nb_ops; i++) {
+               if (ops[i] != NULL && ops[i]->mempool != NULL)
+                       rte_mempool_put(ops[i]->mempool, ops[i]);
+               ops[i] = NULL;
+       }
+}
index 395ce29f843bdbfd0317edb341a58b67dffcb39b..c2b3de8ed5198cb32f47ae6f963c91486c330e3e 100644 (file)
@@ -466,6 +466,20 @@ rte_comp_op_bulk_alloc(struct rte_mempool *mempool,
 void __rte_experimental
 rte_comp_op_free(struct rte_comp_op *op);
 
+/**
+ * Bulk free operation structures
+ * If operations have been allocated from an rte_mempool, then the operations
+ * will be returned to the mempool.
+ * The array entry will be cleared.
+ *
+ * @param ops
+ *   Array of Compress operations
+ * @param nb_ops
+ *   Number of operations to free
+ */
+void __rte_experimental
+rte_comp_op_bulk_free(struct rte_comp_op **ops, uint16_t nb_ops);
+
 /**
  * Get the name of a compress service feature flag
  *
index 9e2d352850b930b8d789162aad4596acf9566767..e2a108b6509f3c23cbe74bff7367339e12309718 100644 (file)
@@ -32,6 +32,7 @@ EXPERIMENTAL {
        rte_comp_get_feature_name;
        rte_comp_op_alloc;
        rte_comp_op_bulk_alloc;
+       rte_comp_op_bulk_free;
        rte_comp_op_free;
        rte_comp_op_pool_create;