get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 123428,
    "url": "http://patches.dpdk.org/api/patches/123428/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230208082452.43883-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": "<20230208082452.43883-5-fengchengwen@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230208082452.43883-5-fengchengwen@huawei.com",
    "date": "2023-02-08T08:24:50",
    "name": "[v13,4/6] test/memarea: support alloc and free API test",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e5eff30efed21d2d85c21d1ae65627a2f55cf921",
    "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/20230208082452.43883-5-fengchengwen@huawei.com/mbox/",
    "series": [
        {
            "id": 26882,
            "url": "http://patches.dpdk.org/api/series/26882/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=26882",
            "date": "2023-02-08T08:24:50",
            "name": "introduce memarea library",
            "version": 13,
            "mbox": "http://patches.dpdk.org/series/26882/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/123428/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/123428/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 8A98C41C3C;\n\tWed,  8 Feb 2023 09:30:56 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 72EC7427F2;\n\tWed,  8 Feb 2023 09:30:56 +0100 (CET)",
            "from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188])\n by mails.dpdk.org (Postfix) with ESMTP id 4DF6440141\n for <dev@dpdk.org>; Wed,  8 Feb 2023 09:30:55 +0100 (CET)",
            "from dggpeml500024.china.huawei.com (unknown [172.30.72.57])\n by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PBY6k5DmczRrxG;\n Wed,  8 Feb 2023 16:28:30 +0800 (CST)",
            "from localhost.localdomain (10.50.163.32) 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.34; Wed, 8 Feb 2023 16:30:53 +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 v13 4/6] test/memarea: support alloc and free API test",
        "Date": "Wed, 8 Feb 2023 08:24:50 +0000",
        "Message-ID": "<20230208082452.43883-5-fengchengwen@huawei.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20230208082452.43883-1-fengchengwen@huawei.com>",
        "References": "<20220721044648.6817-1-fengchengwen@huawei.com>\n <20230208082452.43883-1-fengchengwen@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"UTF-8\"",
        "Content-Transfer-Encoding": "8bit",
        "X-Originating-IP": "[10.50.163.32]",
        "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() and rte_memarea_free() API\ntest.\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\nReviewed-by: Dongdong Liu <liudongdong3@huawei.com>\nAcked-by: Morten Brørup <mb@smartsharesystems.com>\n---\n app/test/test_memarea.c | 135 +++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 134 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/app/test/test_memarea.c b/app/test/test_memarea.c\nindex db5efc4c1b..3e67e59227 100644\n--- a/app/test/test_memarea.c\n+++ b/app/test/test_memarea.c\n@@ -47,6 +47,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@@ -95,8 +101,8 @@ test_memarea_create_bad_param(void)\n static int\n test_memarea_create_destroy(void)\n {\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@@ -113,6 +119,130 @@ 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_ma = 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);\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 >> 1);\n+\tRTE_TEST_ASSERT(ptr[0] != NULL, \"Expected Non-NULL\");\n+\tptr[1] = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE >> 1);\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);\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);\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);\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+\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 repeat free */\n+\tptr = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE >> 1);\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+\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+\tvoid *ptr[ALLOC_MAX_NUM];\n+\tstruct rte_memarea *ma;\n+\tint i;\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+\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);\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@@ -123,6 +253,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": [
        "v13",
        "4/6"
    ]
}