get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 132006,
    "url": "http://patches.dpdk.org/api/patches/132006/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230927115412.55018-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": "<20230927115412.55018-5-skori@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230927115412.55018-5-skori@marvell.com",
    "date": "2023-09-27T11:54:04",
    "name": "[v7,04/12] app/graph: add mempool command line interfaces",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9ca50e7ad0f9529a9c8c6300e699cd3d7afe9251",
    "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/20230927115412.55018-5-skori@marvell.com/mbox/",
    "series": [
        {
            "id": 29655,
            "url": "http://patches.dpdk.org/api/series/29655/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29655",
            "date": "2023-09-27T11:54:00",
            "name": "add CLI based graph application",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/29655/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/132006/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/132006/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 5422242651;\n\tWed, 27 Sep 2023 13:54:51 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id BAFFF40DCD;\n\tWed, 27 Sep 2023 13:54:32 +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 74A114069D\n for <dev@dpdk.org>; Wed, 27 Sep 2023 13:54:28 +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 38R81TQd029616 for <dev@dpdk.org>; Wed, 27 Sep 2023 04:54:27 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3t9yhm6a1v-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Wed, 27 Sep 2023 04:54:27 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Wed, 27 Sep 2023 04:54:25 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Wed, 27 Sep 2023 04:54:25 -0700",
            "from localhost.localdomain (unknown [10.28.34.25])\n by maili.marvell.com (Postfix) with ESMTP id 19B833F7090;\n Wed, 27 Sep 2023 04:54:23 -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=RnV5dj10Y0kpMOqPYJqVRP95+rpK9gSyn/btq9iAeI0=;\n b=IbEcCPyhIlBHcu8UF7xZzpStCgAGvK/VhTl3+GmXq/b8KIwlVCor2sq9JP9qMlngpZR6\n NAZNGAcVI/Png5ZzfRmoNsc9rcsBH6spmv/eIABpuuoqwEG48+UUpGv0e1vFOKr9uf61\n LDCt1vvT/S4GsgkhNbv8zPB28ZURjXO3/T1u1jFytVLYR0yNtZd+Er90Z2eEfHu1qzwm\n b5xIJS0szWPWs0+FjS12ynJnRouWWbNInC6EWh4Sna0JIn7JWE8qKd7hkGf0IpSJGV4Y\n 84JLPGY9QXR0YDhAsR030ZE+w23DbVOEngbTdJbSniNiXNb7wcuIcDGCXTRiDwGj9/nI Iw==",
        "From": "<skori@marvell.com>",
        "To": "Sunil Kumar Kori <skori@marvell.com>, Rakesh Kudurumalla\n <rkudurumalla@marvell.com>",
        "CC": "<dev@dpdk.org>",
        "Subject": "[PATCH v7 04/12] app/graph: add mempool command line interfaces",
        "Date": "Wed, 27 Sep 2023 17:24:04 +0530",
        "Message-ID": "<20230927115412.55018-5-skori@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230927115412.55018-1-skori@marvell.com>",
        "References": "<20230926105742.2638594-13-skori@marvell.com>\n <20230927115412.55018-1-skori@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "MvArOxleLZO9gOUQNYa6fD6HEKA321Qc",
        "X-Proofpoint-ORIG-GUID": "MvArOxleLZO9gOUQNYa6fD6HEKA321Qc",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2023-09-27_06,2023-09-27_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\nIt adds 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>\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 |   8 +++\n 7 files changed, 211 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 473fa1635a..c9f932517e 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..901f07f461\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+\tstrcpy(mpconfig.config[nb_pools].name, config->name);\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\t64, 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+\tstrcpy(config.name, res->name);\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 d322f27d8e..2027183050 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 26a7982722..9f6b83e248 100644\n--- a/doc/guides/tools/graph.rst\n+++ b/doc/guides/tools/graph.rst\n@@ -80,6 +80,14 @@ file to express the requested use case configuration.\n      - Dummy command description\n      - No\n      - No\n+   * - mempool <mempool_name> size <mbuf_size> buffers <number_of_buffers> cache <cache_size> numa <numa_id>\n+     - Command to create mempool which will be further associated to RxQ to dequeue the packets\n+     - No\n+     - No\n+   * - help mempool\n+     - Command to dump mempool help message\n+     - Yes\n+     - Yes\n \n Runtime configuration\n ---------------------\n",
    "prefixes": [
        "v7",
        "04/12"
    ]
}