app/compress-perf: prevent output buffer overflow
[dpdk.git] / app / test-compress-perf / comp_perf_test_verify.c
index 37ac38d..f66f95f 100644 (file)
@@ -217,7 +217,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;
@@ -293,12 +302,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,