get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/59615/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 59615,
    "url": "https://patches.dpdk.org/api/patches/59615/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190920200628.6444-4-adamx.dybkowski@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20190920200628.6444-4-adamx.dybkowski@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190920200628.6444-4-adamx.dybkowski@intel.com",
    "date": "2019-09-20T20:06:28",
    "name": "[v3,3/3] test/compress: add stateful decompression tests",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "83a43ffe76d86b8794d940d50f2f72077feb21d1",
    "submitter": {
        "id": 1322,
        "url": "https://patches.dpdk.org/api/people/1322/?format=api",
        "name": "Dybkowski, AdamX",
        "email": "adamx.dybkowski@intel.com"
    },
    "delegate": {
        "id": 6690,
        "url": "https://patches.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20190920200628.6444-4-adamx.dybkowski@intel.com/mbox/",
    "series": [
        {
            "id": 6488,
            "url": "https://patches.dpdk.org/api/series/6488/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6488",
            "date": "2019-09-20T20:06:25",
            "name": "compress/qat: add stateful decompression",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/6488/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/59615/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/59615/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 3611B1BF28;\n\tMon, 23 Sep 2019 15:25:49 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 618F11BEF7\n\tfor <dev@dpdk.org>; Mon, 23 Sep 2019 15:25:32 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t23 Sep 2019 06:25:32 -0700",
            "from adamdybx-mobl.ger.corp.intel.com (HELO\n\taddy-VirtualBox.isw.intel.com) ([10.103.104.111])\n\tby fmsmga001.fm.intel.com with ESMTP; 23 Sep 2019 06:25:30 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.64,540,1559545200\"; d=\"scan'208\";a=\"203127094\"",
        "From": "Adam Dybkowski <adamx.dybkowski@intel.com>",
        "To": "dev@dpdk.org, fiona.trahe@intel.com, arturx.trybula@intel.com,\n\takhil.goyal@nxp.com",
        "Cc": "Adam Dybkowski <adamx.dybkowski@intel.com>",
        "Date": "Fri, 20 Sep 2019 22:06:28 +0200",
        "Message-Id": "<20190920200628.6444-4-adamx.dybkowski@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190920200628.6444-1-adamx.dybkowski@intel.com>",
        "References": "<20190920124452.29449-2-adamx.dybkowski@intel.com>\n\t<20190920200628.6444-1-adamx.dybkowski@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 3/3] test/compress: add stateful decompression\n\ttests",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch adds two new tests that cover the stateful\ndecompression feature.\n\nSigned-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>\n---\n app/test/test_compressdev.c | 449 +++++++++++++++++++++++++++++++-----\n 1 file changed, 394 insertions(+), 55 deletions(-)",
    "diff": "diff --git a/app/test/test_compressdev.c b/app/test/test_compressdev.c\nindex 167c48f10..9a7989683 100644\n--- a/app/test/test_compressdev.c\n+++ b/app/test/test_compressdev.c\n@@ -95,11 +95,15 @@ struct interim_data_params {\n };\n \n struct test_data_params {\n-\tenum rte_comp_op_type state;\n+\tenum rte_comp_op_type compress_state;\n+\tenum rte_comp_op_type decompress_state;\n \tenum varied_buff buff_type;\n \tenum zlib_direction zlib_dir;\n \tunsigned int out_of_space;\n \tunsigned int big_data;\n+\t/* stateful decompression specific parameters */\n+\tunsigned int decompress_output_block_size;\n+\tunsigned int decompress_steps_max;\n };\n \n static struct comp_testsuite_params testsuite_params = { 0 };\n@@ -237,7 +241,7 @@ generic_ut_setup(void)\n \t\t.socket_id = rte_socket_id(),\n \t\t.nb_queue_pairs = 1,\n \t\t.max_nb_priv_xforms = NUM_MAX_XFORMS,\n-\t\t.max_nb_streams = 0\n+\t\t.max_nb_streams = 1\n \t};\n \n \tif (rte_compressdev_configure(0, &config) < 0) {\n@@ -275,7 +279,7 @@ test_compressdev_invalid_configuration(void)\n \t\t.socket_id = rte_socket_id(),\n \t\t.nb_queue_pairs = 1,\n \t\t.max_nb_priv_xforms = NUM_MAX_XFORMS,\n-\t\t.max_nb_streams = 0\n+\t\t.max_nb_streams = 1\n \t};\n \tstruct rte_compressdev_info dev_info;\n \n@@ -724,7 +728,8 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \tstruct rte_comp_xform **compress_xforms = int_data->compress_xforms;\n \tstruct rte_comp_xform **decompress_xforms = int_data->decompress_xforms;\n \tunsigned int num_xforms = int_data->num_xforms;\n-\tenum rte_comp_op_type state = test_data->state;\n+\tenum rte_comp_op_type compress_state = test_data->compress_state;\n+\tenum rte_comp_op_type decompress_state = test_data->decompress_state;\n \tunsigned int buff_type = test_data->buff_type;\n \tunsigned int out_of_space = test_data->out_of_space;\n \tunsigned int big_data = test_data->big_data;\n@@ -754,6 +759,13 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \t\trte_compressdev_capability_get(0, RTE_COMP_ALGO_DEFLATE);\n \tchar *contig_buf = NULL;\n \tuint64_t compress_checksum[num_bufs];\n+\tvoid *stream = NULL;\n+\tchar *all_decomp_data = NULL;\n+\tunsigned int decomp_produced_data_size = 0;\n+\tunsigned int step = 0;\n+\n+\tTEST_ASSERT(decompress_state == RTE_COMP_OP_STATELESS || num_bufs == 1,\n+\t\t    \"Number of stateful operations in a step should be 1\");\n \n \tif (capa == NULL) {\n \t\tRTE_LOG(ERR, USER1,\n@@ -768,6 +780,12 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \tmemset(ops_processed, 0, sizeof(struct rte_comp_op *) * num_bufs);\n \tmemset(priv_xforms, 0, sizeof(void *) * num_bufs);\n \n+\tif (decompress_state == RTE_COMP_OP_STATEFUL) {\n+\t\tdata_size = strlen(test_bufs[0]) + 1;\n+\t\tall_decomp_data = rte_malloc(NULL, data_size,\n+\t\t\t\t\t     RTE_CACHE_LINE_SIZE);\n+\t}\n+\n \tif (big_data)\n \t\tbuf_pool = ts_params->big_mbuf_pool;\n \telse if (buff_type == SGL_BOTH)\n@@ -859,9 +877,9 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \t\tops[i]->src.offset = 0;\n \t\tops[i]->src.length = rte_pktmbuf_pkt_len(uncomp_bufs[i]);\n \t\tops[i]->dst.offset = 0;\n-\t\tif (state == RTE_COMP_OP_STATELESS) {\n+\t\tif (compress_state == RTE_COMP_OP_STATELESS)\n \t\t\tops[i]->flush_flag = RTE_COMP_FLUSH_FINAL;\n-\t\t} else {\n+\t\telse {\n \t\t\tRTE_LOG(ERR, USER1,\n \t\t\t\t\"Stateful operations are not supported \"\n \t\t\t\t\"in these tests yet\\n\");\n@@ -1046,6 +1064,9 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \t\t\t\t\t(ops_processed[i] + 1);\n \t\t\tif (out_of_space == 1 && oos_zlib_compress)\n \t\t\t\tdata_size = OUT_OF_SPACE_BUF;\n+\t\t\telse if (test_data->decompress_output_block_size != 0)\n+\t\t\t\tdata_size =\n+\t\t\t\t\ttest_data->decompress_output_block_size;\n \t\t\telse\n \t\t\t\tdata_size =\n \t\t\t\tstrlen(test_bufs[priv_data->orig_idx]) + 1;\n@@ -1066,6 +1087,9 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \t\t\t\t\t(ops_processed[i] + 1);\n \t\t\tif (out_of_space == 1 && oos_zlib_compress)\n \t\t\t\tdata_size = OUT_OF_SPACE_BUF;\n+\t\t\telse if (test_data->decompress_output_block_size != 0)\n+\t\t\t\tdata_size =\n+\t\t\t\t\ttest_data->decompress_output_block_size;\n \t\t\telse\n \t\t\t\tdata_size =\n \t\t\t\tstrlen(test_bufs[priv_data->orig_idx]) + 1;\n@@ -1093,9 +1117,14 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \t\t * number of bytes that were produced in the previous stage\n \t\t */\n \t\tops[i]->src.length = ops_processed[i]->produced;\n+\n \t\tops[i]->dst.offset = 0;\n-\t\tif (state == RTE_COMP_OP_STATELESS) {\n+\t\tif (decompress_state == RTE_COMP_OP_STATELESS) {\n \t\t\tops[i]->flush_flag = RTE_COMP_FLUSH_FINAL;\n+\t\t\tops[i]->op_type = RTE_COMP_OP_STATELESS;\n+\t\t} else if (zlib_dir == ZLIB_COMPRESS || zlib_dir == ZLIB_NONE) {\n+\t\t\tops[i]->flush_flag = RTE_COMP_FLUSH_SYNC;\n+\t\t\tops[i]->op_type = RTE_COMP_OP_STATEFUL;\n \t\t} else {\n \t\t\tRTE_LOG(ERR, USER1,\n \t\t\t\t\"Stateful operations are not supported \"\n@@ -1132,33 +1161,12 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \t\t\tops_processed[i] = ops[i];\n \t\t}\n \t} else {\n-\t\t/* Create decompress private xform data */\n-\t\tfor (i = 0; i < num_xforms; i++) {\n-\t\t\tret = rte_compressdev_private_xform_create(0,\n-\t\t\t\t(const struct rte_comp_xform *)decompress_xforms[i],\n-\t\t\t\t&priv_xforms[i]);\n-\t\t\tif (ret < 0) {\n-\t\t\t\tRTE_LOG(ERR, USER1,\n-\t\t\t\t\t\"Decompression private xform \"\n-\t\t\t\t\t\"could not be created\\n\");\n-\t\t\t\tgoto exit;\n-\t\t\t}\n-\t\t\tnum_priv_xforms++;\n-\t\t}\n-\n-\t\tif (capa->comp_feature_flags & RTE_COMP_FF_SHAREABLE_PRIV_XFORM) {\n-\t\t\t/* Attach shareable private xform data to ops */\n-\t\t\tfor (i = 0; i < num_bufs; i++) {\n-\t\t\t\tpriv_data = (struct priv_op_data *)(ops[i] + 1);\n-\t\t\t\tuint16_t xform_idx = priv_data->orig_idx %\n-\t\t\t\t\t\t\t\tnum_xforms;\n-\t\t\t\tops[i]->private_xform = priv_xforms[xform_idx];\n-\t\t\t}\n-\t\t} else {\n-\t\t\t/* Create rest of the private xforms for the other ops */\n-\t\t\tfor (i = num_xforms; i < num_bufs; i++) {\n+\t\tif (decompress_state == RTE_COMP_OP_STATELESS) {\n+\t\t\t/* Create decompress private xform data */\n+\t\t\tfor (i = 0; i < num_xforms; i++) {\n \t\t\t\tret = rte_compressdev_private_xform_create(0,\n-\t\t\t\t\tdecompress_xforms[i % num_xforms],\n+\t\t\t\t\t(const struct rte_comp_xform *)\n+\t\t\t\t\tdecompress_xforms[i],\n \t\t\t\t\t&priv_xforms[i]);\n \t\t\t\tif (ret < 0) {\n \t\t\t\t\tRTE_LOG(ERR, USER1,\n@@ -1169,14 +1177,60 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \t\t\t\tnum_priv_xforms++;\n \t\t\t}\n \n-\t\t\t/* Attach non shareable private xform data to ops */\n-\t\t\tfor (i = 0; i < num_bufs; i++) {\n-\t\t\t\tpriv_data = (struct priv_op_data *)(ops[i] + 1);\n-\t\t\t\tuint16_t xform_idx = priv_data->orig_idx;\n-\t\t\t\tops[i]->private_xform = priv_xforms[xform_idx];\n+\t\t\tif (capa->comp_feature_flags &\n+\t\t\t\t\tRTE_COMP_FF_SHAREABLE_PRIV_XFORM) {\n+\t\t\t\t/* Attach shareable private xform data to ops */\n+\t\t\t\tfor (i = 0; i < num_bufs; i++) {\n+\t\t\t\t\tpriv_data = (struct priv_op_data *)\n+\t\t\t\t\t\t\t(ops[i] + 1);\n+\t\t\t\t\tuint16_t xform_idx =\n+\t\t\t\t\t       priv_data->orig_idx % num_xforms;\n+\t\t\t\t\tops[i]->private_xform =\n+\t\t\t\t\t\t\tpriv_xforms[xform_idx];\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\t/* Create rest of the private xforms */\n+\t\t\t\t/* for the other ops */\n+\t\t\t\tfor (i = num_xforms; i < num_bufs; i++) {\n+\t\t\t\t\tret =\n+\t\t\t\t\t rte_compressdev_private_xform_create(0,\n+\t\t\t\t\t      decompress_xforms[i % num_xforms],\n+\t\t\t\t\t      &priv_xforms[i]);\n+\t\t\t\t\tif (ret < 0) {\n+\t\t\t\t\t\tRTE_LOG(ERR, USER1,\n+\t\t\t\t\t\t\t\"Decompression private xform could not be created\\n\");\n+\t\t\t\t\t\tgoto exit;\n+\t\t\t\t\t}\n+\t\t\t\t\tnum_priv_xforms++;\n+\t\t\t\t}\n+\n+\t\t\t\t/* Attach non shareable private xform data */\n+\t\t\t\t/* to ops */\n+\t\t\t\tfor (i = 0; i < num_bufs; i++) {\n+\t\t\t\t\tpriv_data = (struct priv_op_data *)\n+\t\t\t\t\t\t\t(ops[i] + 1);\n+\t\t\t\t\tuint16_t xform_idx =\n+\t\t\t\t\t\t\tpriv_data->orig_idx;\n+\t\t\t\t\tops[i]->private_xform =\n+\t\t\t\t\t\t\tpriv_xforms[xform_idx];\n+\t\t\t\t}\n+\t\t\t}\n+\t\t} else {\n+\t\t\t/* Create a stream object for stateful decompression */\n+\t\t\tret = rte_compressdev_stream_create(0,\n+\t\t\t\t\tdecompress_xforms[0], &stream);\n+\t\t\tif (ret < 0) {\n+\t\t\t\tRTE_LOG(ERR, USER1,\n+\t\t\t\t\t\"Decompression stream could not be created, error %d\\n\",\n+\t\t\t\t\tret);\n+\t\t\t\tgoto exit;\n \t\t\t}\n+\t\t\t/* Attach stream to ops */\n+\t\t\tfor (i = 0; i < num_bufs; i++)\n+\t\t\t\tops[i]->stream = stream;\n \t\t}\n \n+next_step:\n \t\t/* Enqueue and dequeue all operations */\n \t\tnum_enqd = rte_compressdev_enqueue_burst(0, 0, ops, num_bufs);\n \t\tif (num_enqd < num_bufs) {\n@@ -1242,7 +1296,75 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \t\t\t\tcontinue;\n \t\t}\n \n-\t\tif (ops_processed[i]->status != RTE_COMP_OP_STATUS_SUCCESS) {\n+\t\tif (decompress_state == RTE_COMP_OP_STATEFUL\n+\t\t\t&& (ops_processed[i]->status ==\n+\t\t\t\tRTE_COMP_OP_STATUS_OUT_OF_SPACE_RECOVERABLE\n+\t\t\t    || ops_processed[i]->status ==\n+\t\t\t\tRTE_COMP_OP_STATUS_SUCCESS)) {\n+\t\t\t/* collect the output into all_decomp_data */\n+\t\t\tconst void *ptr = rte_pktmbuf_read(\n+\t\t\t\t\tops_processed[i]->m_dst,\n+\t\t\t\t\tops_processed[i]->dst.offset,\n+\t\t\t\t\tops_processed[i]->produced,\n+\t\t\t\t\tall_decomp_data +\n+\t\t\t\t\t\tdecomp_produced_data_size);\n+\t\t\tif (ptr != all_decomp_data + decomp_produced_data_size)\n+\t\t\t\trte_memcpy(all_decomp_data +\n+\t\t\t\t\t   decomp_produced_data_size,\n+\t\t\t\t\t   ptr, ops_processed[i]->produced);\n+\t\t\tdecomp_produced_data_size += ops_processed[i]->produced;\n+\t\t\tif (ops_processed[i]->src.length >\n+\t\t\t\t\tops_processed[i]->consumed) {\n+\t\t\t\tif (ops_processed[i]->status ==\n+\t\t\t\t\t\tRTE_COMP_OP_STATUS_SUCCESS) {\n+\t\t\t\t\tret_status = -1;\n+\t\t\t\t\tRTE_LOG(ERR, USER1,\n+\t\t\t\t\t      \"Operation finished too early\\n\");\n+\t\t\t\t\tgoto exit;\n+\t\t\t\t}\n+\t\t\t\tstep++;\n+\t\t\t\tif (step >= test_data->decompress_steps_max) {\n+\t\t\t\t\tret_status = -1;\n+\t\t\t\t\tRTE_LOG(ERR, USER1,\n+\t\t\t\t\t  \"Operation exceeded maximum steps\\n\");\n+\t\t\t\t\tgoto exit;\n+\t\t\t\t}\n+\t\t\t\tops[i] = ops_processed[i];\n+\t\t\t\tops[i]->status =\n+\t\t\t\t\t       RTE_COMP_OP_STATUS_NOT_PROCESSED;\n+\t\t\t\tops[i]->src.offset +=\n+\t\t\t\t\t\tops_processed[i]->consumed;\n+\t\t\t\tops[i]->src.length -=\n+\t\t\t\t\t\tops_processed[i]->consumed;\n+\t\t\t\tgoto next_step;\n+\t\t\t} else {\n+\t\t\t\t/* Compare the original stream with the */\n+\t\t\t\t/* decompressed stream (in size and the data) */\n+\t\t\t\tpriv_data = (struct priv_op_data *)\n+\t\t\t\t\t\t(ops_processed[i] + 1);\n+\t\t\t\tconst char *buf1 =\n+\t\t\t\t\t\ttest_bufs[priv_data->orig_idx];\n+\t\t\t\tconst char *buf2 = all_decomp_data;\n+\n+\t\t\t\tif (compare_buffers(buf1, strlen(buf1) + 1,\n+\t\t\t\t\t  buf2, decomp_produced_data_size) < 0)\n+\t\t\t\t\tgoto exit;\n+\t\t\t\t/* Test checksums */\n+\t\t\t\tif (compress_xforms[0]->compress.chksum\n+\t\t\t\t\t\t!= RTE_COMP_CHECKSUM_NONE) {\n+\t\t\t\t\tif (ops_processed[i]->output_chksum\n+\t\t\t\t\t\t      != compress_checksum[i]) {\n+\t\t\t\t\t\tRTE_LOG(ERR, USER1,\n+\t\t\t\t\t\t\t\"The checksums differ\\n\"\n+\t\t\t     \"Compression Checksum: %\" PRIu64 \"\\tDecompression \"\n+\t\t\t\t\"Checksum: %\" PRIu64 \"\\n\", compress_checksum[i],\n+\t\t\t\t\t       ops_processed[i]->output_chksum);\n+\t\t\t\t\t\tgoto exit;\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n+\t\t} else if (ops_processed[i]->status !=\n+\t\t\t   RTE_COMP_OP_STATUS_SUCCESS) {\n \t\t\tRTE_LOG(ERR, USER1,\n \t\t\t\t\"Some operations were not successful\\n\");\n \t\t\tgoto exit;\n@@ -1252,7 +1374,8 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \t\tcomp_bufs[priv_data->orig_idx] = NULL;\n \t}\n \n-\tif (out_of_space && oos_zlib_compress) {\n+\tif ((out_of_space && oos_zlib_compress)\n+\t\t\t|| (decompress_state == RTE_COMP_OP_STATEFUL)) {\n \t\tret_status = TEST_SUCCESS;\n \t\tgoto exit;\n \t}\n@@ -1305,10 +1428,13 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data,\n \t\trte_comp_op_free(ops[i]);\n \t\trte_comp_op_free(ops_processed[i]);\n \t}\n-\tfor (i = 0; i < num_priv_xforms; i++) {\n+\tfor (i = 0; i < num_priv_xforms; i++)\n \t\tif (priv_xforms[i] != NULL)\n \t\t\trte_compressdev_private_xform_free(0, priv_xforms[i]);\n-\t}\n+\tif (stream != NULL)\n+\t\trte_compressdev_stream_free(0, stream);\n+\tif (all_decomp_data != NULL)\n+\t\trte_free(all_decomp_data);\n \trte_free(contig_buf);\n \n \treturn ret_status;\n@@ -1352,10 +1478,13 @@ test_compressdev_deflate_stateless_fixed(void)\n \t};\n \n \tstruct test_data_params test_data = {\n+\t\tRTE_COMP_OP_STATELESS,\n \t\tRTE_COMP_OP_STATELESS,\n \t\tLB_BOTH,\n \t\tZLIB_DECOMPRESS,\n \t\t0,\n+\t\t0,\n+\t\t0,\n \t\t0\n \t};\n \n@@ -1421,10 +1550,13 @@ test_compressdev_deflate_stateless_dynamic(void)\n \t};\n \n \tstruct test_data_params test_data = {\n+\t\tRTE_COMP_OP_STATELESS,\n \t\tRTE_COMP_OP_STATELESS,\n \t\tLB_BOTH,\n \t\tZLIB_DECOMPRESS,\n \t\t0,\n+\t\t0,\n+\t\t0,\n \t\t0\n \t};\n \n@@ -1474,10 +1606,13 @@ test_compressdev_deflate_stateless_multi_op(void)\n \t};\n \n \tstruct test_data_params test_data = {\n+\t\tRTE_COMP_OP_STATELESS,\n \t\tRTE_COMP_OP_STATELESS,\n \t\tLB_BOTH,\n \t\tZLIB_DECOMPRESS,\n \t\t0,\n+\t\t0,\n+\t\t0,\n \t\t0\n \t};\n \n@@ -1526,10 +1661,13 @@ test_compressdev_deflate_stateless_multi_level(void)\n \t};\n \n \tstruct test_data_params test_data = {\n+\t\tRTE_COMP_OP_STATELESS,\n \t\tRTE_COMP_OP_STATELESS,\n \t\tLB_BOTH,\n \t\tZLIB_DECOMPRESS,\n \t\t0,\n+\t\t0,\n+\t\t0,\n \t\t0\n \t};\n \n@@ -1614,10 +1752,13 @@ test_compressdev_deflate_stateless_multi_xform(void)\n \t};\n \n \tstruct test_data_params test_data = {\n+\t\tRTE_COMP_OP_STATELESS,\n \t\tRTE_COMP_OP_STATELESS,\n \t\tLB_BOTH,\n \t\tZLIB_DECOMPRESS,\n \t\t0,\n+\t\t0,\n+\t\t0,\n \t\t0\n \t};\n \n@@ -1661,10 +1802,13 @@ test_compressdev_deflate_stateless_sgl(void)\n \t};\n \n \tstruct test_data_params test_data = {\n+\t\tRTE_COMP_OP_STATELESS,\n \t\tRTE_COMP_OP_STATELESS,\n \t\tSGL_BOTH,\n \t\tZLIB_DECOMPRESS,\n \t\t0,\n+\t\t0,\n+\t\t0,\n \t\t0\n \t};\n \n@@ -1770,10 +1914,13 @@ test_compressdev_deflate_stateless_checksum(void)\n \t};\n \n \tstruct test_data_params test_data = {\n+\t\tRTE_COMP_OP_STATELESS,\n \t\tRTE_COMP_OP_STATELESS,\n \t\tLB_BOTH,\n \t\tZLIB_DECOMPRESS,\n \t\t0,\n+\t\t0,\n+\t\t0,\n \t\t0\n \t};\n \n@@ -1868,7 +2015,7 @@ test_compressdev_out_of_space_buffer(void)\n \tuint16_t i;\n \tconst struct rte_compressdev_capabilities *capab;\n \n-\tRTE_LOG(ERR, USER1, \"This is a negative test errors are expected\\n\");\n+\tRTE_LOG(INFO, USER1, \"This is a negative test, errors are expected\\n\");\n \n \tcapab = rte_compressdev_capability_get(0, RTE_COMP_ALGO_DEFLATE);\n \tTEST_ASSERT(capab != NULL, \"Failed to retrieve device capabilities\");\n@@ -1876,16 +2023,6 @@ test_compressdev_out_of_space_buffer(void)\n \tif ((capab->comp_feature_flags & RTE_COMP_FF_HUFFMAN_FIXED) == 0)\n \t\treturn -ENOTSUP;\n \n-\tstruct rte_comp_xform *compress_xform =\n-\t\t\trte_malloc(NULL, sizeof(struct rte_comp_xform), 0);\n-\n-\tif (compress_xform == NULL) {\n-\t\tRTE_LOG(ERR, USER1,\n-\t\t\t\"Compress xform could not be created\\n\");\n-\t\tret = TEST_FAILED;\n-\t\tgoto exit;\n-\t}\n-\n \tstruct interim_data_params int_data = {\n \t\t&compress_test_bufs[0],\n \t\t1,\n@@ -1896,10 +2033,13 @@ test_compressdev_out_of_space_buffer(void)\n \t};\n \n \tstruct test_data_params test_data = {\n+\t\tRTE_COMP_OP_STATELESS,\n \t\tRTE_COMP_OP_STATELESS,\n \t\tLB_BOTH,\n \t\tZLIB_DECOMPRESS,\n \t\t1,  /* run out-of-space test */\n+\t\t0,\n+\t\t0,\n \t\t0\n \t};\n \t/* Compress with compressdev, decompress with Zlib */\n@@ -1933,7 +2073,6 @@ test_compressdev_out_of_space_buffer(void)\n \tret  = TEST_SUCCESS;\n \n exit:\n-\trte_free(compress_xform);\n \treturn ret;\n }\n \n@@ -1973,11 +2112,14 @@ test_compressdev_deflate_stateless_dynamic_big(void)\n \t};\n \n \tstruct test_data_params test_data = {\n+\t\tRTE_COMP_OP_STATELESS,\n \t\tRTE_COMP_OP_STATELESS,\n \t\tSGL_BOTH,\n \t\tZLIB_DECOMPRESS,\n \t\t0,\n-\t\t1\n+\t\t1,\n+\t\t0,\n+\t\t0\n \t};\n \n \tts_params->def_comp_xform->compress.deflate.huffman =\n@@ -2010,6 +2152,199 @@ test_compressdev_deflate_stateless_dynamic_big(void)\n \treturn ret;\n }\n \n+static int\n+test_compressdev_deflate_stateful_decomp(void)\n+{\n+\tstruct comp_testsuite_params *ts_params = &testsuite_params;\n+\tint ret;\n+\tuint16_t i;\n+\tconst struct rte_compressdev_capabilities *capab;\n+\n+\tcapab = rte_compressdev_capability_get(0, RTE_COMP_ALGO_DEFLATE);\n+\tTEST_ASSERT(capab != NULL, \"Failed to retrieve device capabilities\");\n+\n+\tif (!(capab->comp_feature_flags & RTE_COMP_FF_STATEFUL_DECOMPRESSION))\n+\t\treturn -ENOTSUP;\n+\n+\tstruct interim_data_params int_data = {\n+\t\t&compress_test_bufs[0],\n+\t\t1,\n+\t\t&i,\n+\t\t&ts_params->def_comp_xform,\n+\t\t&ts_params->def_decomp_xform,\n+\t\t1\n+\t};\n+\n+\tstruct test_data_params test_data = {\n+\t\tRTE_COMP_OP_STATELESS,\n+\t\tRTE_COMP_OP_STATEFUL,\n+\t\tLB_BOTH,\n+\t\tZLIB_COMPRESS,\n+\t\t0,\n+\t\t0,\n+\t\t2000,\n+\t\t4\n+\t};\n+\n+\t/* Compress with Zlib, decompress with compressdev */\n+\tif (test_deflate_comp_decomp(&int_data, &test_data) < 0) {\n+\t\tret = TEST_FAILED;\n+\t\tgoto exit;\n+\t}\n+\n+\tif (capab->comp_feature_flags & RTE_COMP_FF_OOP_SGL_IN_SGL_OUT) {\n+\t\t/* Now test with SGL buffers */\n+\t\ttest_data.buff_type = SGL_BOTH;\n+\t\tif (test_deflate_comp_decomp(&int_data, &test_data) < 0) {\n+\t\t\tret = TEST_FAILED;\n+\t\t\tgoto exit;\n+\t\t}\n+\t}\n+\n+\tret  = TEST_SUCCESS;\n+\n+exit:\n+\treturn ret;\n+}\n+\n+static int\n+test_compressdev_deflate_stateful_decomp_checksum(void)\n+{\n+\tstruct comp_testsuite_params *ts_params = &testsuite_params;\n+\tint ret;\n+\tuint16_t i;\n+\tconst struct rte_compressdev_capabilities *capab;\n+\n+\tcapab = rte_compressdev_capability_get(0, RTE_COMP_ALGO_DEFLATE);\n+\tTEST_ASSERT(capab != NULL, \"Failed to retrieve device capabilities\");\n+\n+\tif (!(capab->comp_feature_flags & RTE_COMP_FF_STATEFUL_DECOMPRESSION))\n+\t\treturn -ENOTSUP;\n+\n+\t/* Check if driver supports any checksum */\n+\tif (!(capab->comp_feature_flags &\n+\t     (RTE_COMP_FF_CRC32_CHECKSUM | RTE_COMP_FF_ADLER32_CHECKSUM |\n+\t      RTE_COMP_FF_CRC32_ADLER32_CHECKSUM)))\n+\t\treturn -ENOTSUP;\n+\n+\tstruct rte_comp_xform *compress_xform =\n+\t\t\trte_malloc(NULL, sizeof(struct rte_comp_xform), 0);\n+\tif (compress_xform == NULL) {\n+\t\tRTE_LOG(ERR, USER1, \"Compress xform could not be created\\n\");\n+\t\treturn TEST_FAILED;\n+\t}\n+\n+\tmemcpy(compress_xform, ts_params->def_comp_xform,\n+\t       sizeof(struct rte_comp_xform));\n+\n+\tstruct rte_comp_xform *decompress_xform =\n+\t\t\trte_malloc(NULL, sizeof(struct rte_comp_xform), 0);\n+\tif (decompress_xform == NULL) {\n+\t\tRTE_LOG(ERR, USER1, \"Decompress xform could not be created\\n\");\n+\t\trte_free(compress_xform);\n+\t\treturn TEST_FAILED;\n+\t}\n+\n+\tmemcpy(decompress_xform, ts_params->def_decomp_xform,\n+\t       sizeof(struct rte_comp_xform));\n+\n+\tstruct interim_data_params int_data = {\n+\t\t&compress_test_bufs[0],\n+\t\t1,\n+\t\t&i,\n+\t\t&compress_xform,\n+\t\t&decompress_xform,\n+\t\t1\n+\t};\n+\n+\tstruct test_data_params test_data = {\n+\t\tRTE_COMP_OP_STATELESS,\n+\t\tRTE_COMP_OP_STATEFUL,\n+\t\tLB_BOTH,\n+\t\tZLIB_COMPRESS,\n+\t\t0,\n+\t\t0,\n+\t\t2000,\n+\t\t4\n+\t};\n+\n+\t/* Check if driver supports crc32 checksum and test */\n+\tif (capab->comp_feature_flags & RTE_COMP_FF_CRC32_CHECKSUM) {\n+\t\tcompress_xform->compress.chksum = RTE_COMP_CHECKSUM_CRC32;\n+\t\tdecompress_xform->decompress.chksum = RTE_COMP_CHECKSUM_CRC32;\n+\t\t/* Compress with Zlib, decompress with compressdev */\n+\t\ttest_data.buff_type = LB_BOTH;\n+\t\tif (test_deflate_comp_decomp(&int_data, &test_data) < 0) {\n+\t\t\tret = TEST_FAILED;\n+\t\t\tgoto exit;\n+\t\t}\n+\t\tif (capab->comp_feature_flags &\n+\t\t\t\tRTE_COMP_FF_OOP_SGL_IN_SGL_OUT) {\n+\t\t\t/* Now test with SGL buffers */\n+\t\t\ttest_data.buff_type = SGL_BOTH;\n+\t\t\tif (test_deflate_comp_decomp(&int_data,\n+\t\t\t\t\t\t     &test_data) < 0) {\n+\t\t\t\tret = TEST_FAILED;\n+\t\t\t\tgoto exit;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t/* Check if driver supports adler32 checksum and test */\n+\tif (capab->comp_feature_flags & RTE_COMP_FF_ADLER32_CHECKSUM) {\n+\t\tcompress_xform->compress.chksum = RTE_COMP_CHECKSUM_ADLER32;\n+\t\tdecompress_xform->decompress.chksum = RTE_COMP_CHECKSUM_ADLER32;\n+\t\t/* Compress with Zlib, decompress with compressdev */\n+\t\ttest_data.buff_type = LB_BOTH;\n+\t\tif (test_deflate_comp_decomp(&int_data, &test_data) < 0) {\n+\t\t\tret = TEST_FAILED;\n+\t\t\tgoto exit;\n+\t\t}\n+\t\tif (capab->comp_feature_flags &\n+\t\t\t\tRTE_COMP_FF_OOP_SGL_IN_SGL_OUT) {\n+\t\t\t/* Now test with SGL buffers */\n+\t\t\ttest_data.buff_type = SGL_BOTH;\n+\t\t\tif (test_deflate_comp_decomp(&int_data,\n+\t\t\t\t\t\t     &test_data) < 0) {\n+\t\t\t\tret = TEST_FAILED;\n+\t\t\t\tgoto exit;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t/* Check if driver supports combined crc and adler checksum and test */\n+\tif (capab->comp_feature_flags & RTE_COMP_FF_CRC32_ADLER32_CHECKSUM) {\n+\t\tcompress_xform->compress.chksum =\n+\t\t\t\tRTE_COMP_CHECKSUM_CRC32_ADLER32;\n+\t\tdecompress_xform->decompress.chksum =\n+\t\t\t\tRTE_COMP_CHECKSUM_CRC32_ADLER32;\n+\t\t/* Zlib doesn't support combined checksum */\n+\t\ttest_data.zlib_dir = ZLIB_NONE;\n+\t\t/* Compress stateless, decompress stateful with compressdev */\n+\t\ttest_data.buff_type = LB_BOTH;\n+\t\tif (test_deflate_comp_decomp(&int_data, &test_data) < 0) {\n+\t\t\tret = TEST_FAILED;\n+\t\t\tgoto exit;\n+\t\t}\n+\t\tif (capab->comp_feature_flags &\n+\t\t\t\tRTE_COMP_FF_OOP_SGL_IN_SGL_OUT) {\n+\t\t\t/* Now test with SGL buffers */\n+\t\t\ttest_data.buff_type = SGL_BOTH;\n+\t\t\tif (test_deflate_comp_decomp(&int_data,\n+\t\t\t\t\t\t     &test_data) < 0) {\n+\t\t\t\tret = TEST_FAILED;\n+\t\t\t\tgoto exit;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tret  = TEST_SUCCESS;\n+\n+exit:\n+\trte_free(compress_xform);\n+\trte_free(decompress_xform);\n+\treturn ret;\n+}\n \n static struct unit_test_suite compressdev_testsuite  = {\n \t.suite_name = \"compressdev unit test suite\",\n@@ -2036,6 +2371,10 @@ static struct unit_test_suite compressdev_testsuite  = {\n \t\t\ttest_compressdev_deflate_stateless_checksum),\n \t\tTEST_CASE_ST(generic_ut_setup, generic_ut_teardown,\n \t\t\ttest_compressdev_out_of_space_buffer),\n+\t\tTEST_CASE_ST(generic_ut_setup, generic_ut_teardown,\n+\t\t\ttest_compressdev_deflate_stateful_decomp),\n+\t\tTEST_CASE_ST(generic_ut_setup, generic_ut_teardown,\n+\t\t\ttest_compressdev_deflate_stateful_decomp_checksum),\n \t\tTEST_CASES_END() /**< NULL terminate unit test array */\n \t}\n };\n",
    "prefixes": [
        "v3",
        "3/3"
    ]
}