get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 48839,
    "url": "https://patches.dpdk.org/api/patches/48839/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1544781564-63598-2-git-send-email-lee.daly@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": "<1544781564-63598-2-git-send-email-lee.daly@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1544781564-63598-2-git-send-email-lee.daly@intel.com",
    "date": "2018-12-14T09:59:23",
    "name": "[v4,2/3] test/compress: add checksum tests",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "aa71ea33508c4be80d6ad29cdcb68f05f728aa7d",
    "submitter": {
        "id": 825,
        "url": "https://patches.dpdk.org/api/people/825/?format=api",
        "name": "Daly, Lee",
        "email": "lee.daly@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/1544781564-63598-2-git-send-email-lee.daly@intel.com/mbox/",
    "series": [
        {
            "id": 2773,
            "url": "https://patches.dpdk.org/api/series/2773/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=2773",
            "date": "2018-12-14T09:59:22",
            "name": "[v4,1/3] compress/isal: enable checksum support in driver",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/2773/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/48839/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/48839/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 608BB1B9E5;\n\tFri, 14 Dec 2018 10:59:33 +0100 (CET)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id E46CB1B9CD\n\tfor <dev@dpdk.org>; Fri, 14 Dec 2018 10:59:30 +0100 (CET)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t14 Dec 2018 01:59:30 -0800",
            "from silpixa00399501.ir.intel.com ([10.237.223.69])\n\tby orsmga003.jf.intel.com with ESMTP; 14 Dec 2018 01:59:29 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.56,352,1539673200\"; d=\"scan'208\";a=\"110349976\"",
        "From": "Lee Daly <lee.daly@intel.com>",
        "To": "akhil.goyal@nxp.com",
        "Cc": "dev@dpdk.org,\n\tLee Daly <lee.daly@intel.com>",
        "Date": "Fri, 14 Dec 2018 09:59:23 +0000",
        "Message-Id": "<1544781564-63598-2-git-send-email-lee.daly@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1544781564-63598-1-git-send-email-lee.daly@intel.com>",
        "References": "<11544697752-156863-1-git-send-email-lee.daly@intel.com>\n\t<1544781564-63598-1-git-send-email-lee.daly@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 2/3] test/compress: add checksum tests",
        "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 a test which examines what type of checksum the PMD\nsupports, adler, crc32 or alder32_crc32\nand tests that feature if the PMD supports it.\n\nV2:\nDocumentation Changes\nV3:\nAdded Release note\nV4:\nRemoved dependency on offset unit test\n\nSigned-off-by: Lee Daly <lee.daly@intel.com>\nAcked-by: Tomasz Jozwiak <tomasz.jozwiak@intel.com>\nAcked-by: Fiona Trahe <fiona.trahe@intel.com>\n---\n test/test/test_compressdev.c | 206 ++++++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 203 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c\nindex dab3c12..2e70ca3 100644\n--- a/test/test/test_compressdev.c\n+++ b/test/test/test_compressdev.c\n@@ -36,6 +36,12 @@\n #define NUM_MAX_INFLIGHT_OPS 128\n #define CACHE_SIZE 0\n \n+#define ZLIB_CRC_CHECKSUM_WINDOW_BITS 31\n+#define ZLIB_HEADER_SIZE 2\n+#define ZLIB_TRAILER_SIZE 4\n+#define GZIP_HEADER_SIZE 10\n+#define GZIP_TRAILER_SIZE 8\n+\n const char *\n huffman_type_strings[] = {\n \t[RTE_COMP_HUFFMAN_DEFAULT]\t= \"PMD default\",\n@@ -318,6 +324,10 @@ compress_zlib(struct rte_comp_op *op,\n \t * When doing raw DEFLATE, this number will be negative.\n \t */\n \twindow_bits = -(xform->compress.window_size);\n+\tif (xform->compress.chksum == RTE_COMP_CHECKSUM_ADLER32)\n+\t\twindow_bits *= -1;\n+\telse if (xform->compress.chksum == RTE_COMP_CHECKSUM_CRC32)\n+\t\twindow_bits = ZLIB_CRC_CHECKSUM_WINDOW_BITS;\n \n \tcomp_level = xform->compress.level;\n \n@@ -401,8 +411,19 @@ compress_zlib(struct rte_comp_op *op,\n \t}\n \n \top->consumed = stream.total_in;\n-\top->produced = stream.total_out;\n+\tif (xform->compress.chksum == RTE_COMP_CHECKSUM_ADLER32) {\n+\t\trte_pktmbuf_adj(op->m_dst, ZLIB_HEADER_SIZE);\n+\t\top->produced = stream.total_out -\n+\t\t\t\t(ZLIB_HEADER_SIZE + ZLIB_TRAILER_SIZE);\n+\t} else if (xform->compress.chksum == RTE_COMP_CHECKSUM_CRC32) {\n+\t\trte_pktmbuf_adj(op->m_dst, GZIP_HEADER_SIZE);\n+\t\top->produced = stream.total_out -\n+\t\t\t\t(GZIP_HEADER_SIZE + GZIP_TRAILER_SIZE);\n+\t} else\n+\t\top->produced = stream.total_out;\n+\n \top->status = RTE_COMP_OP_STATUS_SUCCESS;\n+\top->output_chksum = stream.adler;\n \n \tdeflateReset(&stream);\n \n@@ -436,7 +457,6 @@ decompress_zlib(struct rte_comp_op *op,\n \t * When doing raw DEFLATE, this number will be negative.\n \t */\n \twindow_bits = -(xform->decompress.window_size);\n-\n \tret = inflateInit2(&stream, window_bits);\n \n \tif (ret != Z_OK) {\n@@ -652,6 +672,7 @@ test_deflate_comp_decomp(const char * const test_bufs[],\n \tconst struct rte_compressdev_capabilities *capa =\n \t\trte_compressdev_capability_get(0, RTE_COMP_ALGO_DEFLATE);\n \tchar *contig_buf = NULL;\n+\tuint64_t compress_checksum[num_bufs];\n \n \t/* Initialize all arrays to NULL */\n \tmemset(uncomp_bufs, 0, sizeof(struct rte_mbuf *) * num_bufs);\n@@ -838,6 +859,7 @@ test_deflate_comp_decomp(const char * const test_bufs[],\n \t\t\t\t\t&ops_processed[num_total_deqd], num_bufs);\n \t\t\tnum_total_deqd += num_deqd;\n \t\t\tdeqd_retries++;\n+\n \t\t} while (num_total_deqd < num_enqd);\n \n \t\tdeqd_retries = 0;\n@@ -871,6 +893,8 @@ test_deflate_comp_decomp(const char * const test_bufs[],\n \t\t\tops_processed[i]->consumed == 0 ? 0 :\n \t\t\t(float)ops_processed[i]->produced /\n \t\t\tops_processed[i]->consumed * 100);\n+\t\tif (compress_xform->chksum != RTE_COMP_CHECKSUM_NONE)\n+\t\t\tcompress_checksum[i] = ops_processed[i]->output_chksum;\n \t\tops[i] = NULL;\n \t}\n \n@@ -1106,11 +1130,23 @@ test_deflate_comp_decomp(const char * const test_bufs[],\n \n \t\tbuf2 = rte_pktmbuf_read(ops_processed[i]->m_dst, 0,\n \t\t\t\tops_processed[i]->produced, contig_buf);\n-\n \t\tif (compare_buffers(buf1, strlen(buf1) + 1,\n \t\t\t\tbuf2, ops_processed[i]->produced) < 0)\n \t\t\tgoto exit;\n \n+\t\t/* Test checksums */\n+\t\tif (compress_xforms[0]->compress.chksum !=\n+\t\t\t\tRTE_COMP_CHECKSUM_NONE) {\n+\t\t\tif (ops_processed[i]->output_chksum !=\n+\t\t\t\t\tcompress_checksum[i]) {\n+\t\t\t\tRTE_LOG(ERR, USER1, \"The checksums differ\\n\"\n+\t\t\t\"Compression Checksum: %\" PRIu64 \"\\tDecompression \"\n+\t\t\t\"Checksum: %\" PRIu64 \"\\n\", compress_checksum[i],\n+\t\t\tops_processed[i]->output_chksum);\n+\t\t\t\tgoto exit;\n+\t\t\t}\n+\t\t}\n+\n \t\trte_free(contig_buf);\n \t\tcontig_buf = NULL;\n \t}\n@@ -1462,6 +1498,168 @@ test_compressdev_deflate_stateless_sgl(void)\n \t}\n \n \treturn TEST_SUCCESS;\n+\n+}\n+\n+static int\n+test_compressdev_deflate_stateless_checksum(void)\n+{\n+\tstruct comp_testsuite_params *ts_params = &testsuite_params;\n+\tconst char *test_buffer;\n+\tuint16_t i;\n+\tint ret;\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+\t/* Check if driver supports any checksum */\n+\tif ((capab->comp_feature_flags & RTE_COMP_FF_CRC32_CHECKSUM) == 0 &&\n+\t\t\t(capab->comp_feature_flags &\n+\t\t\tRTE_COMP_FF_ADLER32_CHECKSUM) == 0 &&\n+\t\t\t(capab->comp_feature_flags &\n+\t\t\tRTE_COMP_FF_CRC32_ADLER32_CHECKSUM) == 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+\tif (compress_xform == NULL) {\n+\t\tRTE_LOG(ERR, USER1, \"Compress xform could not be created\\n\");\n+\t\tret = TEST_FAILED;\n+\t\tgoto exit;\n+\t}\n+\n+\tmemcpy(compress_xform, ts_params->def_comp_xform,\n+\t\t\tsizeof(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\tret = TEST_FAILED;\n+\t\tgoto exit;\n+\t}\n+\n+\tmemcpy(decompress_xform, ts_params->def_decomp_xform,\n+\t\t\tsizeof(struct rte_comp_xform));\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+\n+\t\tfor (i = 0; i < RTE_DIM(compress_test_bufs); i++) {\n+\t\t\ttest_buffer = compress_test_bufs[i];\n+\n+\t\t\t/* Generate zlib checksum and test against selected\n+\t\t\t * drivers decompression checksum\n+\t\t\t */\n+\t\t\tif (test_deflate_comp_decomp(&test_buffer, 1,\n+\t\t\t\t\t&i,\n+\t\t\t\t\t&compress_xform,\n+\t\t\t\t\t&decompress_xform,\n+\t\t\t\t\t1,\n+\t\t\t\t\tRTE_COMP_OP_STATELESS,\n+\t\t\t\t\t0,\n+\t\t\t\t\tZLIB_COMPRESS,\n+\t\t\t\t\t0) < 0) {\n+\t\t\t\tret = TEST_FAILED;\n+\t\t\t\tgoto exit;\n+\t\t\t}\n+\n+\t\t\t/* Generate compression and decompression\n+\t\t\t * checksum of selected driver\n+\t\t\t */\n+\t\t\tif (test_deflate_comp_decomp(&test_buffer, 1,\n+\t\t\t\t\t&i,\n+\t\t\t\t\t&compress_xform,\n+\t\t\t\t\t&decompress_xform,\n+\t\t\t\t\t1,\n+\t\t\t\t\tRTE_COMP_OP_STATELESS,\n+\t\t\t\t\t0,\n+\t\t\t\t\tZLIB_NONE,\n+\t\t\t\t\t0) < 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+\n+\t\tfor (i = 0; i < RTE_DIM(compress_test_bufs); i++) {\n+\t\t\ttest_buffer = compress_test_bufs[i];\n+\n+\t\t\t/* Generate zlib checksum and test against selected\n+\t\t\t * drivers decompression checksum\n+\t\t\t */\n+\t\t\tif (test_deflate_comp_decomp(&test_buffer, 1,\n+\t\t\t\t\t&i,\n+\t\t\t\t\t&compress_xform,\n+\t\t\t\t\t&decompress_xform,\n+\t\t\t\t\t1,\n+\t\t\t\t\tRTE_COMP_OP_STATELESS,\n+\t\t\t\t\t0,\n+\t\t\t\t\tZLIB_COMPRESS,\n+\t\t\t\t\t0) < 0) {\n+\t\t\t\tret = TEST_FAILED;\n+\t\t\t\tgoto exit;\n+\t\t\t}\n+\t\t\t/* Generate compression and decompression\n+\t\t\t * checksum of selected driver\n+\t\t\t */\n+\t\t\tif (test_deflate_comp_decomp(&test_buffer, 1,\n+\t\t\t\t\t&i,\n+\t\t\t\t\t&compress_xform,\n+\t\t\t\t\t&decompress_xform,\n+\t\t\t\t\t1,\n+\t\t\t\t\tRTE_COMP_OP_STATELESS,\n+\t\t\t\t\t0,\n+\t\t\t\t\tZLIB_NONE,\n+\t\t\t\t\t0) < 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+\n+\t\tfor (i = 0; i < RTE_DIM(compress_test_bufs); i++) {\n+\t\t\ttest_buffer = compress_test_bufs[i];\n+\n+\t\t\t/* Generate compression and decompression\n+\t\t\t * checksum of selected driver\n+\t\t\t */\n+\t\t\tif (test_deflate_comp_decomp(&test_buffer, 1,\n+\t\t\t\t\t&i,\n+\t\t\t\t\t&compress_xform,\n+\t\t\t\t\t&decompress_xform,\n+\t\t\t\t\t1,\n+\t\t\t\t\tRTE_COMP_OP_STATELESS,\n+\t\t\t\t\t0,\n+\t\t\t\t\tZLIB_NONE,\n+\t\t\t\t\t0) < 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@@ -1483,6 +1681,8 @@ static struct unit_test_suite compressdev_testsuite  = {\n \t\t\ttest_compressdev_deflate_stateless_multi_xform),\n \t\tTEST_CASE_ST(generic_ut_setup, generic_ut_teardown,\n \t\t\ttest_compressdev_deflate_stateless_sgl),\n+\t\tTEST_CASE_ST(generic_ut_setup, generic_ut_teardown,\n+\t\t\ttest_compressdev_deflate_stateless_checksum),\n \t\tTEST_CASES_END() /**< NULL terminate unit test array */\n \t}\n };\n",
    "prefixes": [
        "v4",
        "2/3"
    ]
}