get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 117360,
    "url": "http://patches.dpdk.org/api/patches/117360/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/tencent_6E4DB9F7AB18D07BBF83ACE9ADFBE6F4F906@qq.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": "<tencent_6E4DB9F7AB18D07BBF83ACE9ADFBE6F4F906@qq.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/tencent_6E4DB9F7AB18D07BBF83ACE9ADFBE6F4F906@qq.com",
    "date": "2022-10-05T04:09:47",
    "name": "[v5,05/10] memarea: support dump API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f5f4475f9de3ad7dc37dbf4ff6780de2779b9ead",
    "submitter": {
        "id": 2867,
        "url": "http://patches.dpdk.org/api/people/2867/?format=api",
        "name": "datshan",
        "email": "datshan@qq.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/tencent_6E4DB9F7AB18D07BBF83ACE9ADFBE6F4F906@qq.com/mbox/",
    "series": [
        {
            "id": 24981,
            "url": "http://patches.dpdk.org/api/series/24981/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=24981",
            "date": "2022-10-05T04:09:43",
            "name": "[v5,01/10] memarea: introduce memarea library",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/24981/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/117360/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/117360/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 D86A0A0542;\n\tWed,  5 Oct 2022 06:10:25 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B769F42847;\n\tWed,  5 Oct 2022 06:10:05 +0200 (CEST)",
            "from out162-62-58-211.mail.qq.com (out162-62-58-211.mail.qq.com\n [162.62.58.211]) by mails.dpdk.org (Postfix) with ESMTP id 3B03E42847\n for <dev@dpdk.org>; Wed,  5 Oct 2022 06:10:04 +0200 (CEST)",
            "from qq.com ([120.229.93.179])\n by newxmesmtplogicsvrsza31.qq.com (NewEsmtp) with SMTP\n id 27598E97; Wed, 05 Oct 2022 12:09:53 +0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512;\n t=1664943002; bh=z6PloYGYPgA27BvMg9YE4Jjc/waI/xX6qtuVqBf3C2c=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References;\n b=ISsGOqRtztritsUESaiqtTMzapOTmsLhW+VSW3i8RqO8WKFgrjCeLkPYP0lI2ZGqA\n O/HgYdafZfIa+E5c8F3+RlQlpe+TB7FTB1LLDg+7Cqs5wzDL4AiYofcmiG26DzY8+f\n 6uVRXmsWbucz0Jatz6eGansV1icPRfDxo/hW+XWw=",
        "X-QQ-mid": "xmsmtpt1664943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TC+886PDMbK18n\n 03+SwrdWnk3SwpX6XMxU731B7Vx/9WIbK2CjJ3OOVSgGcv5SNpl0jYo8vtNM4ZRSw/gIRGTEnJsu\n doUUO0Ybes+N3hXDBIVQIj/uomdy4=",
        "From": "datshan <datshan@qq.com>",
        "To": "david.marchand@redhat.com, mb@smartsharesystems.com,\n anatoly.burakov@intel.com, dmitry.kozliuk@gmail.com, jerinjacobk@gmail.com",
        "Cc": "thomas@monjalon.net, dev@dpdk.org, Chengwen Feng <fengchengwen@huawei.com>",
        "Subject": "[PATCH v5 05/10] memarea: support dump API",
        "Date": "Wed,  5 Oct 2022 12:09:47 +0800",
        "X-OQ-MSGID": "<20221005040952.8166-6-datshan@qq.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20221005040952.8166-1-datshan@qq.com>",
        "References": "<20220721044648.6817-1-fengchengwen@huawei.com>\n <20221005040952.8166-1-datshan@qq.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": "From: Chengwen Feng <fengchengwen@huawei.com>\n\nThis patch supports rte_memarea_dump() API which could be used for\ndebug.\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n doc/guides/prog_guide/memarea_lib.rst |  3 +\n lib/memarea/rte_memarea.c             | 85 +++++++++++++++++++++++++++\n lib/memarea/rte_memarea.h             | 21 +++++++\n lib/memarea/version.map               |  1 +\n 4 files changed, 110 insertions(+)",
    "diff": "diff --git a/doc/guides/prog_guide/memarea_lib.rst b/doc/guides/prog_guide/memarea_lib.rst\nindex 41bc0a90cd..c77012fe44 100644\n--- a/doc/guides/prog_guide/memarea_lib.rst\n+++ b/doc/guides/prog_guide/memarea_lib.rst\n@@ -43,6 +43,9 @@ The ``rte_memarea_update_refcnt()`` function is used to update the memory\n object's reference count, if the count reaches zero, the memory object will\n be freed to memarea.\n \n++The ``rte_memarea_dump()`` function is used to dump the internal information\n++of a memarea.\n+\n Reference\n ---------\n \ndiff --git a/lib/memarea/rte_memarea.c b/lib/memarea/rte_memarea.c\nindex a072f07f20..b70830d0bb 100644\n--- a/lib/memarea/rte_memarea.c\n+++ b/lib/memarea/rte_memarea.c\n@@ -2,6 +2,7 @@\n  * Copyright(c) 2022 HiSilicon Limited\n  */\n \n+#include <inttypes.h>\n #include <stdio.h>\n #include <stdlib.h>\n #include <sys/queue.h>\n@@ -298,3 +299,87 @@ rte_memarea_update_refcnt(struct rte_memarea *ma, void *ptr, int16_t value)\n \t\tmemarea_free_elem(ma, elem);\n \tmemarea_unlock(ma);\n }\n+\n+static const char *\n+memarea_source_name(enum rte_memarea_source source)\n+{\n+\tif (source == RTE_MEMAREA_SOURCE_RTE_MEMORY)\n+\t\treturn \"rte-memory\";\n+\telse if (source == RTE_MEMAREA_SOURCE_SYSTEM_API)\n+\t\treturn \"system-api\";\n+\telse if (source == RTE_MEMAREA_SOURCE_USER_ADDR)\n+\t\treturn \"user-addr\";\n+\telse if (source == RTE_MEMAREA_SOURCE_USER_MEMAREA)\n+\t\treturn \"user-memarea\";\n+\telse\n+\t\treturn \"unknown\";\n+}\n+\n+static const char *\n+memarea_alg_name(enum rte_memarea_alg alg)\n+{\n+\tif (alg == RTE_MEMAREA_ALG_DEFAULT)\n+\t\treturn \"default\";\n+\telse\n+\t\treturn \"unknown\";\n+}\n+\n+static uint32_t\n+memarea_elem_list_num(struct rte_memarea *ma)\n+{\n+\tstruct memarea_elem *elem;\n+\tuint32_t num = 0;\n+\n+\tTAILQ_FOREACH(elem, &ma->elem_list, elem_node)\n+\t\tnum++;\n+\n+\treturn num;\n+}\n+\n+static uint32_t\n+memarea_free_list_num(struct rte_memarea *ma)\n+{\n+\tstruct memarea_elem *elem;\n+\tuint32_t num = 0;\n+\n+\tTAILQ_FOREACH(elem, &ma->free_list, free_node)\n+\t\tnum++;\n+\n+\treturn num;\n+}\n+\n+static void\n+memarea_dump_all(struct rte_memarea *ma, FILE *f)\n+{\n+\tstruct memarea_elem *elem;\n+\n+\tfprintf(f, \"  regions:\\n\");\n+\tTAILQ_FOREACH(elem, &ma->elem_list, elem_node)\n+\t\tfprintf(f, \"    size: 0x%zx cookie: 0x%x refcnt: %d\\n\",\n+\t\t\telem->size, elem->cookie, elem->refcnt);\n+}\n+\n+int\n+rte_memarea_dump(struct rte_memarea *ma, FILE *f, bool dump_all)\n+{\n+\tif (ma == NULL || f == NULL)\n+\t\treturn -EINVAL;\n+\n+\tmemarea_lock(ma);\n+\tfprintf(f, \"memarea name: %s\\n\", ma->init.name);\n+\tfprintf(f, \"  source: %s\\n\", memarea_source_name(ma->init.source));\n+\tif (ma->init.source == RTE_MEMAREA_SOURCE_USER_MEMAREA)\n+\t\tfprintf(f, \"  source-user-memarea: %s\\n\", ma->init.user_memarea->init.name);\n+\tfprintf(f, \"  algorithm: %s\\n\", memarea_alg_name(ma->init.alg));\n+\tfprintf(f, \"  total-size: 0x%zx\\n\", ma->init.total_sz);\n+\tfprintf(f, \"  mt-safe: %s\\n\", ma->init.mt_safe ? \"yes\" : \"no\");\n+\tfprintf(f, \"  total-regions: %u\\n\", memarea_elem_list_num(ma));\n+\tfprintf(f, \"  total-free-regions: %u\\n\", memarea_free_list_num(ma));\n+\tfprintf(f, \"  alloc_fails: %\" PRIu64 \"\\n\", ma->alloc_fails);\n+\tfprintf(f, \"  refcnt_check_fails: %\" PRIu64 \"\\n\", ma->refcnt_check_fails);\n+\tif (dump_all)\n+\t\tmemarea_dump_all(ma, f);\n+\tmemarea_unlock(ma);\n+\n+\treturn 0;\n+}\ndiff --git a/lib/memarea/rte_memarea.h b/lib/memarea/rte_memarea.h\nindex 10e0d6ad5a..10b8229c64 100644\n--- a/lib/memarea/rte_memarea.h\n+++ b/lib/memarea/rte_memarea.h\n@@ -194,6 +194,27 @@ void rte_memarea_free(struct rte_memarea *ma, void *ptr);\n __rte_experimental\n void rte_memarea_update_refcnt(struct rte_memarea *ma, void *ptr, int16_t value);\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Dump memarea.\n+ *\n+ * Dump one memarea.\n+ *\n+ * @param ma\n+ *   The pointer of memarea.\n+ * @param f\n+ *   The file to write the output to.\n+ * @param dump_all\n+ *   Indicate whether to dump the allocated and free memory objects information.\n+ *\n+ * @return\n+ *   0 on success. Otherwise negative value is returned.\n+ */\n+__rte_experimental\n+int rte_memarea_dump(struct rte_memarea *ma, FILE *f, bool dump_all);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/memarea/version.map b/lib/memarea/version.map\nindex a0026fc5f9..d8ddd93c13 100644\n--- a/lib/memarea/version.map\n+++ b/lib/memarea/version.map\n@@ -4,6 +4,7 @@ EXPERIMENTAL {\n \trte_memarea_alloc;\n \trte_memarea_create;\n \trte_memarea_destroy;\n+\trte_memarea_dump;\n \trte_memarea_free;\n \trte_memarea_update_refcnt;\n \n",
    "prefixes": [
        "v5",
        "05/10"
    ]
}