[dpdk-dev] [PATCH 1/2] compressdev: add api to bulk free ops

Verma, Shally Shally.Verma at cavium.com
Tue Nov 20 06:20:54 CET 2018



>-----Original Message-----
>From: Fiona Trahe <fiona.trahe at intel.com>
>Sent: 20 November 2018 03:40
>To: dev at dpdk.org
>Cc: akhil.goyal at nxp.com; tomaszx.jozwiak at intel.com; Verma, Shally <Shally.Verma at cavium.com>; Gupta, Ashish
><Ashish.Gupta at cavium.com>; lee.daly at intel.com; fiona.trahe at intel.com
>Subject: [PATCH 1/2] compressdev: add api to bulk free ops
>
>External Email
>
>There's an API to bulk allocate operations,
>this adds a corresponding bulk free API.
>
>
>Signed-off-by: Fiona Trahe <fiona.trahe at intel.com>

Acked-by: Shally Verma <shally.verma at caviumnetworks.com>

>---
> lib/librte_compressdev/rte_comp.c                  | 12 ++++++++++++
> lib/librte_compressdev/rte_comp.h                  | 14 ++++++++++++++
> lib/librte_compressdev/rte_compressdev_version.map |  1 +
> 3 files changed, 27 insertions(+)
>
>diff --git a/lib/librte_compressdev/rte_comp.c b/lib/librte_compressdev/rte_comp.c
>index 4634c12..06e3d44 100644
>--- a/lib/librte_compressdev/rte_comp.c
>+++ b/lib/librte_compressdev/rte_comp.c
>@@ -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;
>+       }
>+}
>diff --git a/lib/librte_compressdev/rte_comp.h b/lib/librte_compressdev/rte_comp.h
>index 395ce29..c2b3de8 100644
>--- a/lib/librte_compressdev/rte_comp.h
>+++ b/lib/librte_compressdev/rte_comp.h
>@@ -467,6 +467,20 @@ 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
>  *
>  * @param flag
>diff --git a/lib/librte_compressdev/rte_compressdev_version.map b/lib/librte_compressdev/rte_compressdev_version.map
>index 6f900b6..13a047e 100644
>--- a/lib/librte_compressdev/rte_compressdev_version.map
>+++ b/lib/librte_compressdev/rte_compressdev_version.map
>@@ -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;
>
>--
>2.7.4



More information about the dev mailing list