mempool: introduce helpers for populate and required size
[dpdk.git] / app / test-compress-perf / comp_perf_test_verify.c
index 7be30ee..758a22f 100644 (file)
@@ -14,7 +14,9 @@ void
 cperf_verify_test_destructor(void *arg)
 {
        if (arg) {
-               comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)->mem);
+               comp_perf_free_memory(
+                               ((struct cperf_verify_ctx *)arg)->options,
+                               &((struct cperf_verify_ctx *)arg)->mem);
                rte_free(arg);
        }
 }
@@ -188,6 +190,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
                                ops[op_id]->private_xform = priv_xform;
                        }
 
+                       if (unlikely(test_data->perf_comp_force_stop))
+                               goto end;
+
                        num_enq = rte_compressdev_enqueue_burst(dev_id,
                                                                mem->qp_id, ops,
                                                                num_ops);
@@ -214,7 +219,16 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
                        for (i = 0; i < num_deq; i++) {
                                struct rte_comp_op *op = deq_ops[i];
 
-                               if (op->status != RTE_COMP_OP_STATUS_SUCCESS) {
+                               if (op->status ==
+                                 RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED ||
+                                 op->status ==
+                                 RTE_COMP_OP_STATUS_OUT_OF_SPACE_RECOVERABLE) {
+                                       RTE_LOG(ERR, USER1,
+"Out of space error occurred due to uncompressible input data expanding to larger than destination buffer. Increase the EXPANSE_RATIO constant to use this data.\n");
+                                       res = -1;
+                                       goto end;
+                               } else if (op->status !=
+                                               RTE_COMP_OP_STATUS_SUCCESS) {
                                        RTE_LOG(ERR, USER1,
                                                "Some operations were not successful\n");
                                        goto end;
@@ -268,6 +282,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
 
                /* Dequeue the last operations */
                while (total_deq_ops < total_ops) {
+                       if (unlikely(test_data->perf_comp_force_stop))
+                               goto end;
+
                        num_deq = rte_compressdev_dequeue_burst(dev_id,
                                                        mem->qp_id,
                                                        deq_ops,
@@ -287,12 +304,20 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
                        for (i = 0; i < num_deq; i++) {
                                struct rte_comp_op *op = deq_ops[i];
 
-                               if (op->status != RTE_COMP_OP_STATUS_SUCCESS) {
+                               if (op->status ==
+                                 RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED ||
+                                 op->status ==
+                                 RTE_COMP_OP_STATUS_OUT_OF_SPACE_RECOVERABLE) {
+                                       RTE_LOG(ERR, USER1,
+"Out of space error occurred due to uncompressible input data expanding to larger than destination buffer. Increase the EXPANSE_RATIO constant to use this data.\n");
+                                       res = -1;
+                                       goto end;
+                               } else if (op->status !=
+                                               RTE_COMP_OP_STATUS_SUCCESS) {
                                        RTE_LOG(ERR, USER1,
                                                "Some operations were not successful\n");
                                        goto end;
                                }
-
                                const void *read_data_addr =
                                                rte_pktmbuf_read(op->m_dst,
                                                                 op->dst.offset,
@@ -346,6 +371,14 @@ end:
        rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
        rte_compressdev_private_xform_free(dev_id, priv_xform);
        rte_free(ops);
+
+       if (test_data->perf_comp_force_stop) {
+               RTE_LOG(ERR, USER1,
+                     "lcore: %d Perf. test has been aborted by user\n",
+                       mem->lcore_id);
+               res = -1;
+       }
+
        return res;
 }