get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 117924,
    "url": "http://patches.dpdk.org/api/patches/117924/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20221011121720.2657-5-fengchengwen@huawei.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": "<20221011121720.2657-5-fengchengwen@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221011121720.2657-5-fengchengwen@huawei.com",
    "date": "2022-10-11T12:17:15",
    "name": "[v8,4/9] test/memarea: support alloc/free/update-refcnt test",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f0f8c9ff9b9c300062454bf2e51f1dc003768aa5",
    "submitter": {
        "id": 2146,
        "url": "http://patches.dpdk.org/api/people/2146/?format=api",
        "name": "fengchengwen",
        "email": "fengchengwen@huawei.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/20221011121720.2657-5-fengchengwen@huawei.com/mbox/",
    "series": [
        {
            "id": 25146,
            "url": "http://patches.dpdk.org/api/series/25146/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=25146",
            "date": "2022-10-11T12:17:17",
            "name": "introduce memarea library",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/25146/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/117924/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/117924/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 919C5A0547;\n\tTue, 11 Oct 2022 14:23:17 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C246E42DED;\n\tTue, 11 Oct 2022 14:23:08 +0200 (CEST)",
            "from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189])\n by mails.dpdk.org (Postfix) with ESMTP id 1CBA242CCC\n for <dev@dpdk.org>; Tue, 11 Oct 2022 14:23:05 +0200 (CEST)",
            "from dggpeml500024.china.huawei.com (unknown [172.30.72.53])\n by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Mmvxr3wK8z1CF1H;\n Tue, 11 Oct 2022 20:20:32 +0800 (CST)",
            "from localhost.localdomain (10.67.165.24) by\n dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2375.31; Tue, 11 Oct 2022 20:23:03 +0800"
        ],
        "From": "Chengwen Feng <fengchengwen@huawei.com>",
        "To": "<david.marchand@redhat.com>, <mb@smartsharesystems.com>,\n <anatoly.burakov@intel.com>, <dmitry.kozliuk@gmail.com>,\n <jerinjacobk@gmail.com>, <hofors@lysator.liu.se>",
        "CC": "<thomas@monjalon.net>, <dev@dpdk.org>",
        "Subject": "[PATCH v8 4/9] test/memarea: support alloc/free/update-refcnt test",
        "Date": "Tue, 11 Oct 2022 12:17:15 +0000",
        "Message-ID": "<20221011121720.2657-5-fengchengwen@huawei.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20221011121720.2657-1-fengchengwen@huawei.com>",
        "References": "<20220721044648.6817-1-fengchengwen@huawei.com>\n <20221011121720.2657-1-fengchengwen@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.67.165.24]",
        "X-ClientProxiedBy": "dggems701-chm.china.huawei.com (10.3.19.178) To\n dggpeml500024.china.huawei.com (7.185.36.10)",
        "X-CFilter-Loop": "Reflected",
        "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": "This patch supports rte_memarea_alloc()/rte_memarea_free()/\nrte_memarea_update_refcnt() test.\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n app/test/test_memarea.c | 150 +++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 149 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/app/test/test_memarea.c b/app/test/test_memarea.c\nindex f02b33394f..5f7868f8f6 100644\n--- a/app/test/test_memarea.c\n+++ b/app/test/test_memarea.c\n@@ -57,6 +57,12 @@ test_memarea_init_param(struct rte_memarea_param *init)\n \tinit->mt_safe = 1;\n }\n \n+static void\n+test_memarea_fill_region(void *ptr, size_t size)\n+{\n+\tmemset(ptr, 0xff, size);\n+}\n+\n static int\n test_memarea_create_bad_param(void)\n {\n@@ -122,8 +128,8 @@ static int\n test_memarea_create_destroy(void)\n {\n \tuint8_t user_buffer[MEMAREA_TEST_DEFAULT_SIZE + RTE_CACHE_LINE_SIZE];\n+\tstruct rte_memarea *ma, *src_ma;\n \tstruct rte_memarea_param init;\n-\tstruct rte_memarea *ma;\n \n \t/* test for create with HEAP */\n \ttest_memarea_init_param(&init);\n@@ -149,6 +155,145 @@ test_memarea_create_destroy(void)\n \tRTE_TEST_ASSERT(ma != NULL, \"Expected Non-NULL\");\n \trte_memarea_destroy(ma);\n \n+\t/* test for create with another memarea */\n+\ttest_memarea_init_param(&init);\n+\tinit.source = RTE_MEMAREA_SOURCE_LIBC;\n+\tsrc_ma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(src_ma != NULL, \"Expected Non-NULL\");\n+\ttest_memarea_init_param(&init);\n+\tinit.source = RTE_MEMAREA_SOURCE_MEMAREA;\n+\tinit.total_sz = init.total_sz >> 1;\n+\tinit.src_memarea = src_ma;\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma != NULL, \"Expected Non-NULL\");\n+\trte_memarea_destroy(ma);\n+\trte_memarea_destroy(src_ma);\n+\n+\treturn 0;\n+}\n+\n+static int\n+test_memarea_alloc_fail(void)\n+{\n+\tstruct rte_memarea_param init;\n+\tstruct rte_memarea *ma;\n+\tvoid *ptr[2];\n+\n+\ttest_memarea_init_param(&init);\n+\tinit.source = RTE_MEMAREA_SOURCE_LIBC;\n+\tinit.total_sz = MEMAREA_TEST_DEFAULT_SIZE;\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma != NULL, \"Expected Non-NULL\");\n+\n+\t/* test alloc fail with big size */\n+\tptr[0] = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE, 0);\n+\tRTE_TEST_ASSERT(ptr[0] == NULL, \"Expected NULL\");\n+\n+\t/* test alloc fail because no memory */\n+\tptr[0] = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE - RTE_CACHE_LINE_SIZE, 0);\n+\tRTE_TEST_ASSERT(ptr[0] != NULL, \"Expected Non-NULL\");\n+\tptr[1] = rte_memarea_alloc(ma, 1, 0);\n+\tRTE_TEST_ASSERT(ptr[1] == NULL, \"Expected NULL\");\n+\trte_memarea_free(ma, ptr[0]);\n+\n+\t/* test alloc fail when second fail */\n+\tptr[0] = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE >> 1, 0);\n+\tRTE_TEST_ASSERT(ptr[0] != NULL, \"Expected Non-NULL\");\n+\ttest_memarea_fill_region(ptr[0], MEMAREA_TEST_DEFAULT_SIZE >> 1);\n+\tptr[1] = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE >> 1, 0);\n+\tRTE_TEST_ASSERT(ptr[1] == NULL, \"Expected NULL\");\n+\trte_memarea_free(ma, ptr[0]);\n+\tptr[1] = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE >> 1, 0);\n+\tRTE_TEST_ASSERT(ptr[1] != NULL, \"Expected Non-NULL\");\n+\ttest_memarea_fill_region(ptr[1], MEMAREA_TEST_DEFAULT_SIZE >> 1);\n+\trte_memarea_free(ma, ptr[1]);\n+\n+\trte_memarea_destroy(ma);\n+\n+\treturn 0;\n+}\n+\n+static int\n+test_memarea_free_fail(void)\n+{\n+\tstruct rte_memarea_param init;\n+\tstruct rte_memarea *ma;\n+\tvoid *ptr;\n+\n+\t/* prepare env */\n+\ttest_memarea_init_param(&init);\n+\tinit.source = RTE_MEMAREA_SOURCE_LIBC;\n+\tinit.total_sz = MEMAREA_TEST_DEFAULT_SIZE;\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma != NULL, \"Expected Non-NULL\");\n+\n+\t/* test invalid parameters with update-refcnt */\n+\trte_memarea_update_refcnt(NULL, (void *)(uintptr_t)1, 0);\n+\trte_memarea_update_refcnt(ma, NULL, 0);\n+\trte_memarea_update_refcnt(NULL, NULL, 0);\n+\n+\t/* test free with refcnt fail */\n+\tptr = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE >> 1, 0);\n+\tRTE_TEST_ASSERT(ptr != NULL, \"Expected Non-NULL\");\n+\ttest_memarea_fill_region(ptr, MEMAREA_TEST_DEFAULT_SIZE >> 1);\n+\trte_memarea_free(ma, ptr);\n+\trte_memarea_free(ma, ptr);\n+\n+\t/* test update refcnt with fail */\n+\tptr = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE >> 1, 0);\n+\tRTE_TEST_ASSERT(ptr != NULL, \"Expected Non-NULL\");\n+\ttest_memarea_fill_region(ptr, MEMAREA_TEST_DEFAULT_SIZE >> 1);\n+\trte_memarea_update_refcnt(ma, ptr, -2);\n+\tptr = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE >> 1, 0);\n+\tRTE_TEST_ASSERT(ptr == NULL, \"Expected NULL\");\n+\n+\trte_memarea_destroy(ma);\n+\n+\treturn 0;\n+}\n+\n+static int\n+test_memarea_alloc_free(void)\n+{\n+#define ALLOC_MAX_NUM\t8\n+\tstruct rte_memarea_param init;\n+\tstruct rte_memarea *ma;\n+\tvoid *ptr[ALLOC_MAX_NUM];\n+\tint i;\n+\n+\t/* prepare env */\n+\ttest_memarea_init_param(&init);\n+\tinit.source = RTE_MEMAREA_SOURCE_LIBC;\n+\tinit.total_sz = MEMAREA_TEST_DEFAULT_SIZE;\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma != NULL, \"Expected Non-NULL\");\n+\tmemset(ptr, 0, sizeof(ptr));\n+\n+\t/* test random alloc and free */\n+\tfor (i = 0; i < ALLOC_MAX_NUM; i++)\n+\t\tptr[i] = rte_memarea_alloc(ma, 1, 0);\n+\n+\t/* test merge left */\n+\trte_memarea_free(ma, ptr[0]);\n+\trte_memarea_free(ma, ptr[1]);\n+\n+\t/* test merge right */\n+\trte_memarea_free(ma, ptr[7]);\n+\trte_memarea_free(ma, ptr[6]);\n+\n+\t/* test merge left and right */\n+\trte_memarea_free(ma, ptr[3]);\n+\trte_memarea_free(ma, ptr[2]);\n+\n+\t/* test merge remains */\n+\trte_memarea_free(ma, ptr[4]);\n+\trte_memarea_free(ma, ptr[5]);\n+\n+\t/* test free NULL */\n+\trte_memarea_free(ma, NULL);\n+\n+\trte_memarea_destroy(ma);\n+\n \treturn 0;\n }\n \n@@ -159,6 +304,9 @@ test_memarea(void)\n \n \tMEMAREA_TEST_API_RUN(test_memarea_create_bad_param);\n \tMEMAREA_TEST_API_RUN(test_memarea_create_destroy);\n+\tMEMAREA_TEST_API_RUN(test_memarea_alloc_fail);\n+\tMEMAREA_TEST_API_RUN(test_memarea_free_fail);\n+\tMEMAREA_TEST_API_RUN(test_memarea_alloc_free);\n \n \treturn test_memarea_retcode();\n }\n",
    "prefixes": [
        "v8",
        "4/9"
    ]
}