X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_compressdev%2Frte_comp.c;h=06e3d442ae06bd0703f91e9486d65f53173eff9d;hb=efad0db1ff58461a53d803bc4df1820cbb3ae500;hp=97ea0d922644714faca3c55c8b617196b45eac18;hpb=a6531d58b41516aa88d2703fea1447bcac9b5c03;p=dpdk.git diff --git a/lib/librte_compressdev/rte_comp.c b/lib/librte_compressdev/rte_comp.c index 97ea0d9226..06e3d442ae 100644 --- a/lib/librte_compressdev/rte_comp.c +++ b/lib/librte_compressdev/rte_comp.c @@ -36,6 +36,10 @@ rte_comp_get_feature_name(uint64_t flag) return "SHA2_SHA256_HASH"; case RTE_COMP_FF_SHAREABLE_PRIV_XFORM: return "SHAREABLE_PRIV_XFORM"; + case RTE_COMP_FF_HUFFMAN_FIXED: + return "HUFFMAN_FIXED"; + case RTE_COMP_FF_HUFFMAN_DYNAMIC: + return "HUFFMAN_DYNAMIC"; default: return NULL; } @@ -79,8 +83,8 @@ struct rte_comp_op_pool_private { * @param nb_ops * Number of operations to allocate * @return - * - 0: Success - * - -ENOENT: Not enough entries in the mempool; no ops are retrieved. + * - nb_ops: Success, the nb_ops requested was allocated + * - 0: Not enough entries in the mempool; no ops are retrieved. */ static inline int rte_comp_op_raw_bulk_alloc(struct rte_mempool *mempool, @@ -170,7 +174,7 @@ rte_comp_op_alloc(struct rte_mempool *mempool) int retval; retval = rte_comp_op_raw_bulk_alloc(mempool, &op, 1); - if (unlikely(retval < 0)) + if (unlikely(retval != 1)) return NULL; rte_comp_op_reset(op); @@ -182,12 +186,12 @@ int __rte_experimental rte_comp_op_bulk_alloc(struct rte_mempool *mempool, struct rte_comp_op **ops, uint16_t nb_ops) { - int ret; + int retval; uint16_t i; - ret = rte_comp_op_raw_bulk_alloc(mempool, ops, nb_ops); - if (unlikely(ret < nb_ops)) - return ret; + retval = rte_comp_op_raw_bulk_alloc(mempool, ops, nb_ops); + if (unlikely(retval != nb_ops)) + return 0; for (i = 0; i < nb_ops; i++) rte_comp_op_reset(ops[i]); @@ -209,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; + } +}