get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 138113,
    "url": "http://patches.dpdk.org/api/patches/138113/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240307203943.188101-5-paul.szczepanek@arm.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20240307203943.188101-5-paul.szczepanek@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240307203943.188101-5-paul.szczepanek@arm.com",
    "date": "2024-03-07T20:39:43",
    "name": "[v8,4/4] test: add unit test for ptr compression",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b06648463cff6c6d65c5e659b804a53b1733cb54",
    "submitter": {
        "id": 3199,
        "url": "http://patches.dpdk.org/api/people/3199/?format=api",
        "name": "Paul Szczepanek",
        "email": "paul.szczepanek@arm.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240307203943.188101-5-paul.szczepanek@arm.com/mbox/",
    "series": [
        {
            "id": 31429,
            "url": "http://patches.dpdk.org/api/series/31429/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31429",
            "date": "2024-03-07T20:39:40",
            "name": "[v8,1/4] ptr_compress: add pointer compression library",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/31429/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/138113/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/138113/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id F139443C21;\n\tThu,  7 Mar 2024 21:40:23 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 8F3FC42F1B;\n\tThu,  7 Mar 2024 21:40:00 +0100 (CET)",
            "from foss.arm.com (foss.arm.com [217.140.110.172])\n by mails.dpdk.org (Postfix) with ESMTP id C803A40272\n for <dev@dpdk.org>; Thu,  7 Mar 2024 21:39:53 +0100 (CET)",
            "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 21F3C150C;\n Thu,  7 Mar 2024 12:40:30 -0800 (PST)",
            "from ampere-altra-2-1.usa.Arm.com (ampere-altra-2-1.usa.arm.com\n [10.118.91.158])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 166023F762;\n Thu,  7 Mar 2024 12:39:53 -0800 (PST)"
        ],
        "From": "Paul Szczepanek <paul.szczepanek@arm.com>",
        "To": "dev@dpdk.org",
        "Cc": "Paul Szczepanek <paul.szczepanek@arm.com>,\n Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,\n Nathan Brown <Nathan.Brown@arm.com>",
        "Subject": "[PATCH v8 4/4] test: add unit test for ptr compression",
        "Date": "Thu,  7 Mar 2024 20:39:43 +0000",
        "Message-Id": "<20240307203943.188101-5-paul.szczepanek@arm.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20240307203943.188101-1-paul.szczepanek@arm.com>",
        "References": "<20230927150854.3670391-2-paul.szczepanek@arm.com>\n <20240307203943.188101-1-paul.szczepanek@arm.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Test compresses and decompresses pointers with various combinations\nof memory regions and alignments and verifies the pointers are\nrecovered correctly.\n\nSigned-off-by: Paul Szczepanek <paul.szczepanek@arm.com>\nReviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\nReviewed-by: Nathan Brown <Nathan.Brown@arm.com>\n---\n app/test/meson.build         |   1 +\n app/test/test_ptr_compress.c | 108 +++++++++++++++++++++++++++++++++++\n 2 files changed, 109 insertions(+)\n create mode 100644 app/test/test_ptr_compress.c\n\n--\n2.25.1",
    "diff": "diff --git a/app/test/meson.build b/app/test/meson.build\nindex df8cc00730..e29258e6ec 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -144,6 +144,7 @@ source_file_deps = {\n     'test_power_intel_uncore.c': ['power'],\n     'test_power_kvm_vm.c': ['power'],\n     'test_prefetch.c': [],\n+    'test_ptr_compress.c': ['ptr_compress'],\n     'test_rand_perf.c': [],\n     'test_rawdev.c': ['rawdev', 'bus_vdev'],\n     'test_rcu_qsbr.c': ['rcu', 'hash'],\ndiff --git a/app/test/test_ptr_compress.c b/app/test/test_ptr_compress.c\nnew file mode 100644\nindex 0000000000..972f832776\n--- /dev/null\n+++ b/app/test/test_ptr_compress.c\n@@ -0,0 +1,108 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2024 Arm Limited\n+ */\n+\n+#include \"test.h\"\n+#include <stdint.h>\n+#include <string.h>\n+\n+#include <rte_ptr_compress.h>\n+\n+#define MAX_ALIGN_EXPONENT 3\n+#define MAX_PTRS 16\n+#define NUM_BASES 2\n+#define NUM_REGIONS 4\n+#define MAX_32BIT_REGION ((uint64_t)UINT32_MAX + 1)\n+#define MAX_16BIT_REGION (UINT16_MAX + 1)\n+\n+static int\n+test_ptr_compress_params(\n+\tvoid *base,\n+\tuint64_t mem_sz,\n+\tunsigned int align_exp,\n+\tunsigned int num_ptrs,\n+\tbool use_32_bit)\n+{\n+\tunsigned int i;\n+\tunsigned int align = 1 << align_exp;\n+\tvoid *ptrs[MAX_PTRS] = {0};\n+\tvoid *ptrs_out[MAX_PTRS] = {0};\n+\tuint32_t offsets32[MAX_PTRS] = {0};\n+\tuint16_t offsets16[MAX_PTRS] = {0};\n+\n+\tfor (i = 0; i < num_ptrs; i++) {\n+\t\t/* make pointers point at memory in steps of align */\n+\t\t/* alternate steps from the start and end of memory region */\n+\t\tif ((i & 1) == 1)\n+\t\t\tptrs[i] = (char *)base + mem_sz - i * align;\n+\t\telse\n+\t\t\tptrs[i] = (char *)base + i * align;\n+\t}\n+\n+\tif (use_32_bit) {\n+\t\trte_ptr_compress_32(base, ptrs, offsets32, num_ptrs, align_exp);\n+\t\trte_ptr_decompress_32(base, offsets32, ptrs_out, num_ptrs,\n+\t\t\t\talign_exp);\n+\t} else {\n+\t\trte_ptr_compress_16(base, ptrs, offsets16, num_ptrs, align_exp);\n+\t\trte_ptr_decompress_16(base, offsets16, ptrs_out, num_ptrs,\n+\t\t\t\talign_exp);\n+\t}\n+\n+\tTEST_ASSERT_BUFFERS_ARE_EQUAL(ptrs, ptrs_out, sizeof(void *) * num_ptrs,\n+\t\t\"Decompressed pointers corrupted\\nbase pointer: %p, \"\n+\t\t\"memory region size: %\" PRIu64 \", alignment exponent: %u, \"\n+\t\t\"num of pointers: %u, using %s offsets\",\n+\t\tbase, mem_sz, align_exp, num_ptrs,\n+\t\tuse_32_bit ? \"32-bit\" : \"16-bit\");\n+\n+\treturn 0;\n+}\n+\n+static int\n+test_ptr_compress(void)\n+{\n+\tunsigned int j, k, n;\n+\tint ret = 0;\n+\tvoid * const bases[NUM_BASES] = { (void *)0, (void *)UINT16_MAX };\n+\t/* maximum size for pointers aligned by consecutive powers of 2 */\n+\tconst uint64_t region_sizes_16[NUM_REGIONS] = {\n+\t\tMAX_16BIT_REGION,\n+\t\tMAX_16BIT_REGION * 2,\n+\t\tMAX_16BIT_REGION * 4,\n+\t\tMAX_16BIT_REGION * 8,\n+\t};\n+\tconst uint64_t region_sizes_32[NUM_REGIONS] = {\n+\t\tMAX_32BIT_REGION,\n+\t\tMAX_32BIT_REGION * 2,\n+\t\tMAX_32BIT_REGION * 4,\n+\t\tMAX_32BIT_REGION * 8,\n+\t};\n+\n+\tfor (j = 0; j < NUM_REGIONS; j++) {\n+\t\tfor (k = 0; k < NUM_BASES; k++) {\n+\t\t\tfor (n = 1; n < MAX_PTRS; n++) {\n+\t\t\t\tret |= test_ptr_compress_params(\n+\t\t\t\t\tbases[k],\n+\t\t\t\t\tregion_sizes_16[j],\n+\t\t\t\t\tj /* exponent of alignment */,\n+\t\t\t\t\tn,\n+\t\t\t\t\tfalse\n+\t\t\t\t);\n+\t\t\t\tret |= test_ptr_compress_params(\n+\t\t\t\t\tbases[k],\n+\t\t\t\t\tregion_sizes_32[j],\n+\t\t\t\t\tj /* exponent of alignment */,\n+\t\t\t\t\tn,\n+\t\t\t\t\ttrue\n+\t\t\t\t);\n+\t\t\t\tif (ret != 0)\n+\t\t\t\t\treturn ret;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\treturn ret;\n+}\n+\n+REGISTER_FAST_TEST(ptr_compress_autotest, true, true, test_ptr_compress);\n",
    "prefixes": [
        "v8",
        "4/4"
    ]
}