get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 132976,
    "url": "http://patches.dpdk.org/api/patches/132976/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231019105000.520914-5-skori@marvell.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": "<20231019105000.520914-5-skori@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231019105000.520914-5-skori@marvell.com",
    "date": "2023-10-19T10:49:52",
    "name": "[v10,04/12] app/graph: support mempool command line interfaces",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "bb0952d267b0ef42df7f40e324e5eb2edc1f6306",
    "submitter": {
        "id": 1318,
        "url": "http://patches.dpdk.org/api/people/1318/?format=api",
        "name": "Sunil Kumar Kori",
        "email": "skori@marvell.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/20231019105000.520914-5-skori@marvell.com/mbox/",
    "series": [
        {
            "id": 29919,
            "url": "http://patches.dpdk.org/api/series/29919/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29919",
            "date": "2023-10-19T10:49:48",
            "name": "add CLI based graph application",
            "version": 10,
            "mbox": "http://patches.dpdk.org/series/29919/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/132976/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/132976/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 91AB9431A9;\n\tThu, 19 Oct 2023 12:50:42 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E29D642686;\n\tThu, 19 Oct 2023 12:50:16 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id 1792141611\n for <dev@dpdk.org>; Thu, 19 Oct 2023 12:50:16 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 39J8fCkw027267 for <dev@dpdk.org>; Thu, 19 Oct 2023 03:50:15 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3tstb41v4s-3\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Thu, 19 Oct 2023 03:50:15 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Thu, 19 Oct 2023 03:50:13 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Thu, 19 Oct 2023 03:50:13 -0700",
            "from localhost.localdomain (unknown [10.28.34.25])\n by maili.marvell.com (Postfix) with ESMTP id 585A05B6926;\n Thu, 19 Oct 2023 03:50:12 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=LPOzDsIFm54zE9E1DKR9mi8kT+q9s8IYFstrfHJ6NW0=;\n b=c3tOaNP3FVzcO+RKd4pmpnQQFiMf3gDuHLTci84zZ6zYBiRtI9VTP0zDMuY1bYt0hMDZ\n 7DVGEHoP5FnFFSn+XKhovCzIbgmE73juMCscY0Wk+r8aba1XDBPdjHfAGAtlSDe5OtSK\n s1VCcrqeRXqS4GBpKiaKD5+HxOw+8Ofo34Tn2oOWLeMZLqR2cuaRsuC0k0cMlF0Tb4U/\n Pgv1rIdwQJyTIfjujU3zBWqorczM9/AfxP0C4mUMqhMAQ4GQA/FsIy30mJAFQJq8e1P+\n dP+oJY/8fcrLg1yN8AJ19T0dFur094V5+chnU+lxCm15nhJ2IZoXuy52ST9qgvUNJc62 ig==",
        "From": "<skori@marvell.com>",
        "To": "Sunil Kumar Kori <skori@marvell.com>, Rakesh Kudurumalla\n <rkudurumalla@marvell.com>",
        "CC": "<dev@dpdk.org>, Jerin Jacob <jerinj@marvell.com>",
        "Subject": "[PATCH v10 04/12] app/graph: support mempool command line interfaces",
        "Date": "Thu, 19 Oct 2023 16:19:52 +0530",
        "Message-ID": "<20231019105000.520914-5-skori@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20231019105000.520914-1-skori@marvell.com>",
        "References": "<20231018063347.68081-13-skori@marvell.com>\n <20231019105000.520914-1-skori@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "rjvvs-KGlDLtWXrdX5UT77w-EJZDw7lj",
        "X-Proofpoint-GUID": "rjvvs-KGlDLtWXrdX5UT77w-EJZDw7lj",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2023-10-19_08,2023-10-19_01,2023-05-22_02",
        "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: Rakesh Kudurumalla <rkudurumalla@marvell.com>\n\nAdds mempool module which will be creating mempools.\n\nFollowing commands are exposed:\n - mempool <mempool_name> size <mbuf_size> buffers <number_of_buffers> \\\n\tcache <cache_size> numa <numa_id>\n - help mempool\n\nUser will add this command in .cli file according to its need.\n\nSigned-off-by: Sunil Kumar Kori <skori@marvell.com>\nSigned-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>\nAcked-by: Jerin Jacob <jerinj@marvell.com>\n---\n app/graph/cli.c            |   2 +\n app/graph/mempool.c        | 140 +++++++++++++++++++++++++++++++++++++\n app/graph/mempool.h        |  24 +++++++\n app/graph/mempool_priv.h   |  34 +++++++++\n app/graph/meson.build      |   1 +\n app/graph/module_api.h     |   2 +\n doc/guides/tools/graph.rst |   7 ++\n 7 files changed, 210 insertions(+)\n create mode 100644 app/graph/mempool.c\n create mode 100644 app/graph/mempool.h\n create mode 100644 app/graph/mempool_priv.h",
    "diff": "diff --git a/app/graph/cli.c b/app/graph/cli.c\nindex df4f8fcbb8..cf544d5f8f 100644\n--- a/app/graph/cli.c\n+++ b/app/graph/cli.c\n@@ -20,6 +20,8 @@\n #define MAX_LINE_SIZE 2048\n \n cmdline_parse_ctx_t modules_ctx[] = {\n+\t(cmdline_parse_inst_t *)&mempool_config_cmd_ctx,\n+\t(cmdline_parse_inst_t *)&mempool_help_cmd_ctx,\n \tNULL,\n };\n \ndiff --git a/app/graph/mempool.c b/app/graph/mempool.c\nnew file mode 100644\nindex 0000000000..9fd3f8460b\n--- /dev/null\n+++ b/app/graph/mempool.c\n@@ -0,0 +1,140 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 Marvell.\n+ */\n+\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <string.h>\n+\n+#include <cmdline_parse.h>\n+#include <cmdline_parse_num.h>\n+#include <cmdline_parse_string.h>\n+#include <cmdline_socket.h>\n+#include <rte_common.h>\n+#include <rte_mbuf.h>\n+\n+#include \"mempool_priv.h\"\n+#include \"module_api.h\"\n+\n+static const char\n+cmd_mempool_help[] = \"mempool <mempool_name> size <mbuf_size> buffers <number_of_buffers> \"\n+\t\t     \"cache <cache_size> numa <numa_id>\";\n+\n+struct mempools mpconfig;\n+\n+int\n+mempool_process(struct mempool_config *config)\n+{\n+\tstruct rte_mempool *mp;\n+\tuint8_t nb_pools;\n+\n+\tnb_pools = mpconfig.nb_pools;\n+\trte_strscpy(mpconfig.config[nb_pools].name, config->name, RTE_MEMPOOL_NAMESIZE);\n+\tmpconfig.config[nb_pools].pool_size = config->pool_size;\n+\tmpconfig.config[nb_pools].buffer_size = config->buffer_size;\n+\tmpconfig.config[nb_pools].cache_size = config->cache_size;\n+\tmpconfig.config[nb_pools].numa_node = config->numa_node;\n+\n+\tmp = rte_pktmbuf_pool_create(config->name, config->pool_size, config->cache_size,\n+\t\t128, config->buffer_size, config->numa_node);\n+\tif (!mp)\n+\t\treturn -EINVAL;\n+\n+\tmpconfig.mp[nb_pools] = mp;\n+\tnb_pools++;\n+\tmpconfig.nb_pools = nb_pools;\n+\n+\treturn 0;\n+}\n+\n+static void\n+cli_mempool_help(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl,\n+\t\t __rte_unused void *data)\n+{\n+\tsize_t len;\n+\n+\tlen = strlen(conn->msg_out);\n+\tconn->msg_out += len;\n+\tsnprintf(conn->msg_out, conn->msg_out_len_max, \"\\n%s\\n%s\\n\",\n+\t\t \"----------------------------- mempool command help -----------------------------\",\n+\t\t cmd_mempool_help);\n+\n+\tlen = strlen(conn->msg_out);\n+\tconn->msg_out_len_max -= len;\n+}\n+\n+static void\n+cli_mempool(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)\n+{\n+\tstruct mempool_config_cmd_tokens *res = parsed_result;\n+\tstruct mempool_config config;\n+\tint rc = -EINVAL;\n+\n+\n+\trte_strscpy(config.name, res->name, RTE_MEMPOOL_NAMESIZE);\n+\tconfig.name[strlen(res->name)] = '\\0';\n+\tconfig.pool_size = res->nb_bufs;\n+\tconfig.buffer_size = res->buf_sz;\n+\tconfig.cache_size = res->cache_size;\n+\tconfig.numa_node = res->node;\n+\n+\trc = mempool_process(&config);\n+\tif (rc < 0)\n+\t\tprintf(MSG_CMD_FAIL, \"mempool\");\n+}\n+\n+cmdline_parse_token_string_t mempool_config_add_mempool =\n+\tTOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, mempool, \"mempool\");\n+cmdline_parse_token_string_t mempool_config_add_name =\n+\tTOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, name, NULL);\n+cmdline_parse_token_string_t mempool_config_add_size =\n+\tTOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, size, \"size\");\n+cmdline_parse_token_num_t mempool_config_add_buf_sz =\n+\tTOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, buf_sz, RTE_UINT16);\n+cmdline_parse_token_string_t mempool_config_add_buffers =\n+\tTOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, buffers, \"buffers\");\n+cmdline_parse_token_num_t mempool_config_add_nb_bufs =\n+\tTOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, nb_bufs, RTE_UINT16);\n+cmdline_parse_token_string_t mempool_config_add_cache =\n+\tTOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, cache, \"cache\");\n+cmdline_parse_token_num_t mempool_config_add_cache_size =\n+\tTOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, cache_size, RTE_UINT16);\n+cmdline_parse_token_string_t mempool_config_add_numa =\n+\tTOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, numa, \"numa\");\n+cmdline_parse_token_num_t mempool_config_add_node =\n+\tTOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, node, RTE_UINT16);\n+\n+cmdline_parse_inst_t mempool_config_cmd_ctx = {\n+\t.f = cli_mempool,\n+\t.data = NULL,\n+\t.help_str = cmd_mempool_help,\n+\t.tokens = {\n+\t\t(void *)&mempool_config_add_mempool,\n+\t\t(void *)&mempool_config_add_name,\n+\t\t(void *)&mempool_config_add_size,\n+\t\t(void *)&mempool_config_add_buf_sz,\n+\t\t(void *)&mempool_config_add_buffers,\n+\t\t(void *)&mempool_config_add_nb_bufs,\n+\t\t(void *)&mempool_config_add_cache,\n+\t\t(void *)&mempool_config_add_cache_size,\n+\t\t(void *)&mempool_config_add_numa,\n+\t\t(void *)&mempool_config_add_node,\n+\t\tNULL,\n+\t},\n+};\n+\n+cmdline_parse_token_string_t mempool_help_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct mempool_help_cmd_tokens, help, \"help\");\n+cmdline_parse_token_string_t mempool_help_mempool =\n+\tTOKEN_STRING_INITIALIZER(struct mempool_help_cmd_tokens, mempool, \"mempool\");\n+\n+cmdline_parse_inst_t mempool_help_cmd_ctx = {\n+\t.f = cli_mempool_help,\n+\t.data = NULL,\n+\t.help_str = \"\",\n+\t.tokens = {\n+\t\t(void *)&mempool_help_cmd,\n+\t\t(void *)&mempool_help_mempool,\n+\t\tNULL,\n+\t},\n+};\ndiff --git a/app/graph/mempool.h b/app/graph/mempool.h\nnew file mode 100644\nindex 0000000000..0808c4259e\n--- /dev/null\n+++ b/app/graph/mempool.h\n@@ -0,0 +1,24 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 Marvell.\n+ */\n+\n+#ifndef APP_GRAPH_MEMPOOL_H\n+#define APP_GRAPH_MEMPOOL_H\n+\n+#include <cmdline_parse.h>\n+#include <rte_mempool.h>\n+\n+struct mempool_config {\n+\tchar name[RTE_MEMPOOL_NAMESIZE];\n+\tint pool_size;\n+\tint cache_size;\n+\tint buffer_size;\n+\tint numa_node;\n+};\n+\n+extern cmdline_parse_inst_t mempool_config_cmd_ctx;\n+extern cmdline_parse_inst_t mempool_help_cmd_ctx;\n+\n+int mempool_process(struct mempool_config *config);\n+\n+#endif\ndiff --git a/app/graph/mempool_priv.h b/app/graph/mempool_priv.h\nnew file mode 100644\nindex 0000000000..3ce64702a9\n--- /dev/null\n+++ b/app/graph/mempool_priv.h\n@@ -0,0 +1,34 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 Marvell.\n+ */\n+\n+#ifndef APP_GRAPH_MEMPOOL_PRIV_H\n+#define APP_GRAPH_MEMPOOL_PRIV_H\n+\n+#include \"mempool.h\"\n+\n+struct mempool_config_cmd_tokens {\n+\tcmdline_fixed_string_t mempool;\n+\tcmdline_fixed_string_t size;\n+\tcmdline_fixed_string_t buffers;\n+\tcmdline_fixed_string_t cache;\n+\tcmdline_fixed_string_t numa;\n+\tcmdline_fixed_string_t name;\n+\tuint16_t buf_sz;\n+\tuint16_t nb_bufs;\n+\tuint16_t cache_size;\n+\tuint16_t node;\n+};\n+\n+struct mempool_help_cmd_tokens {\n+\tcmdline_fixed_string_t help;\n+\tcmdline_fixed_string_t mempool;\n+};\n+\n+struct mempools {\n+\tstruct mempool_config config[RTE_MAX_ETHPORTS];\n+\tstruct rte_mempool *mp[RTE_MAX_ETHPORTS];\n+\tuint8_t\tnb_pools;\n+};\n+\n+#endif\ndiff --git a/app/graph/meson.build b/app/graph/meson.build\nindex fd71036a95..5dc23c875b 100644\n--- a/app/graph/meson.build\n+++ b/app/graph/meson.build\n@@ -13,5 +13,6 @@ sources = files(\n         'cli.c',\n         'conn.c',\n         'main.c',\n+        'mempool.c',\n         'utils.c',\n )\ndiff --git a/app/graph/module_api.h b/app/graph/module_api.h\nindex ad4fb50989..b45419811b 100644\n--- a/app/graph/module_api.h\n+++ b/app/graph/module_api.h\n@@ -10,11 +10,13 @@\n \n #include \"cli.h\"\n #include \"conn.h\"\n+#include \"mempool.h\"\n #include \"utils.h\"\n /*\n  * Externs\n  */\n extern volatile bool force_quit;\n+extern struct conn *conn;\n \n bool app_graph_exit(void);\n #endif\ndiff --git a/doc/guides/tools/graph.rst b/doc/guides/tools/graph.rst\nindex 943f915049..6009b0c291 100644\n--- a/doc/guides/tools/graph.rst\n+++ b/doc/guides/tools/graph.rst\n@@ -71,6 +71,13 @@ file to express the requested use case configuration.\n    +--------------------------------------+-----------------------------------+---------+----------+\n    |               Command                |             Description           | Dynamic | Optional |\n    +======================================+===================================+=========+==========+\n+   | | mempool <mempool_name> size        | | Command to create mempool which |   No    |    No    |\n+   | | <mbuf_size> buffers                | | will be further associated to   |         |          |\n+   | | <number_of_buffers>                | | RxQ to dequeue the packets.     |         |          |\n+   | | cache <cache_size> numa <numa_id>  |                                   |         |          |\n+   +--------------------------------------+-----------------------------------+---------+----------+\n+   | help mempool                         | | Command to dump mempool help    |   Yes   |    Yes   |\n+   |                                      | | message.                        |         |          |\n    |                                      |                                   |         |          |\n    +--------------------------------------+-----------------------------------+---------+----------+\n \n",
    "prefixes": [
        "v10",
        "04/12"
    ]
}