get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 133026,
    "url": "http://patches.dpdk.org/api/patches/133026/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231019173011.1186656-10-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": "<20231019173011.1186656-10-skori@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231019173011.1186656-10-skori@marvell.com",
    "date": "2023-10-19T17:30:08",
    "name": "[v11,09/12] app/graph: support ethdev Rx command line interfaces",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "195b9972c1cfdd91e2dec98f6aefede02b235c0a",
    "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/20231019173011.1186656-10-skori@marvell.com/mbox/",
    "series": [
        {
            "id": 29924,
            "url": "http://patches.dpdk.org/api/series/29924/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29924",
            "date": "2023-10-19T17:29:59",
            "name": "add CLI based graph application",
            "version": 11,
            "mbox": "http://patches.dpdk.org/series/29924/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/133026/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/133026/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 F399F431B0;\n\tThu, 19 Oct 2023 19:31:33 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9360442E16;\n\tThu, 19 Oct 2023 19:30:40 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 1502E42DD3\n for <dev@dpdk.org>; Thu, 19 Oct 2023 19:30:36 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 39JCXquT008133 for <dev@dpdk.org>; Thu, 19 Oct 2023 10:30:36 -0700",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ttshubs8b-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Thu, 19 Oct 2023 10:30:36 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Thu, 19 Oct 2023 10:30:34 -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 10:30:34 -0700",
            "from localhost.localdomain (unknown [10.28.34.25])\n by maili.marvell.com (Postfix) with ESMTP id 5C4403F709A;\n Thu, 19 Oct 2023 10:30:33 -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=OKX9ywoUIsXLOE6zgDplrwed78dS23CwFJP2LXCO1j4=;\n b=Yo3CnzCCAYah4om7gnaKbIXgiFHyxQGV5wvmjjgUOvJn/yJgGQ1y4Xih4w0X1NVka9N/\n YrkpD8Ar8AAfIa7kVGbwH1qxJblE8hBf/ulj3ccLWCB0gs2IPZxO0J+GWRWsfVod2tRc\n oeIfXJNQPXmFeD1AYMSZFhgftT6zso773O/OeCLBc3lG8J0/8sYuYTl6M0rSDP0QnvmY\n 2gfu9QUcjc+g+ZtNKm4UIGGMk0BAVG08raT17A07F4GolMlRQNdERdim0DYNoMCVSQUH\n fqgWFIIkYC3hDoYevo0uQscP/mH0O9HTIx+QTp9pXvAOhANlEVR0INyMaEV6l9kF0RCG xQ==",
        "From": "<skori@marvell.com>",
        "To": "Sunil Kumar Kori <skori@marvell.com>, Rakesh Kudurumalla\n <rkudurumalla@marvell.com>",
        "CC": "<dev@dpdk.org>",
        "Subject": "[PATCH v11 09/12] app/graph: support ethdev Rx command line\n interfaces",
        "Date": "Thu, 19 Oct 2023 23:00:08 +0530",
        "Message-ID": "<20231019173011.1186656-10-skori@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20231019173011.1186656-1-skori@marvell.com>",
        "References": "<20231019105000.520914-13-skori@marvell.com>\n <20231019173011.1186656-1-skori@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "oT4Icqx0UFKa4EYtC-Bq46c71thnvCZq",
        "X-Proofpoint-ORIG-GUID": "oT4Icqx0UFKa4EYtC-Bq46c71thnvCZq",
        "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_16,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 ethdev_rx module to create port-queue-core mapping.\n\nMapping will be used to launch graph worker thread and dequeue\npackets on mentioned core from desired port/queue.\n\nFollowing commands are exposed:\n - ethdev_rx map port <ethdev_name> queue <q_num> core <core_id>\n - help ethdev_rx\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/ethdev_rx.c      | 165 +++++++++++++++++++++++++++++++++++++\n app/graph/ethdev_rx.h      |  37 +++++++++\n app/graph/ethdev_rx_priv.h |  39 +++++++++\n app/graph/meson.build      |   1 +\n app/graph/module_api.h     |   1 +\n doc/guides/tools/graph.rst |  10 +++\n 7 files changed, 255 insertions(+)\n create mode 100644 app/graph/ethdev_rx.c\n create mode 100644 app/graph/ethdev_rx.h\n create mode 100644 app/graph/ethdev_rx_priv.h",
    "diff": "diff --git a/app/graph/cli.c b/app/graph/cli.c\nindex f564362da1..ad7d7deadf 100644\n--- a/app/graph/cli.c\n+++ b/app/graph/cli.c\n@@ -30,6 +30,8 @@ cmdline_parse_ctx_t modules_ctx[] = {\n \t(cmdline_parse_inst_t *)&ethdev_ip6_cmd_ctx,\n \t(cmdline_parse_inst_t *)&ethdev_cmd_ctx,\n \t(cmdline_parse_inst_t *)&ethdev_help_cmd_ctx,\n+\t(cmdline_parse_inst_t *)&ethdev_rx_cmd_ctx,\n+\t(cmdline_parse_inst_t *)&ethdev_rx_help_cmd_ctx,\n \t(cmdline_parse_inst_t *)&ipv4_lookup_cmd_ctx,\n \t(cmdline_parse_inst_t *)&ipv4_lookup_help_cmd_ctx,\n \t(cmdline_parse_inst_t *)&ipv6_lookup_cmd_ctx,\ndiff --git a/app/graph/ethdev_rx.c b/app/graph/ethdev_rx.c\nnew file mode 100644\nindex 0000000000..f2cb8cf9a5\n--- /dev/null\n+++ b/app/graph/ethdev_rx.c\n@@ -0,0 +1,165 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 Marvell.\n+ */\n+\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_ethdev.h>\n+\n+#include \"ethdev_rx_priv.h\"\n+#include \"module_api.h\"\n+\n+static const char\n+cmd_ethdev_rx_help[] = \"ethdev_rx map port <ethdev_name> queue <q_num> core <core_id>\";\n+\n+static struct lcore_params lcore_params_array[ETHDEV_RX_LCORE_PARAMS_MAX];\n+struct rte_node_ethdev_config ethdev_conf[RTE_MAX_ETHPORTS];\n+struct lcore_params *lcore_params = lcore_params_array;\n+struct lcore_conf lcore_conf[RTE_MAX_LCORE];\n+uint16_t nb_lcore_params;\n+\n+static void\n+rx_map_configure(uint8_t port_id, uint32_t queue, uint32_t core)\n+{\n+\tuint8_t n_rx_queue;\n+\n+\tn_rx_queue = lcore_conf[core].n_rx_queue;\n+\tlcore_conf[core].rx_queue_list[n_rx_queue].port_id = port_id;\n+\tlcore_conf[core].rx_queue_list[n_rx_queue].queue_id = queue;\n+\tlcore_conf[core].n_rx_queue++;\n+}\n+\n+uint8_t\n+ethdev_rx_num_rx_queues_get(uint16_t port)\n+{\n+\tint queue = -1;\n+\tuint16_t i;\n+\n+\tfor (i = 0; i < nb_lcore_params; ++i) {\n+\t\tif (lcore_params[i].port_id == port) {\n+\t\t\tif (lcore_params[i].queue_id == queue + 1)\n+\t\t\t\tqueue = lcore_params[i].queue_id;\n+\t\t\telse\n+\t\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\t \"Queue ids of the port %d must be\"\n+\t\t\t\t\t \" in sequence and must start with 0\\n\",\n+\t\t\t\t\t lcore_params[i].port_id);\n+\t\t}\n+\t}\n+\n+\treturn (uint8_t)(++queue);\n+}\n+\n+static int\n+ethdev_rx_map_add(char *name, uint32_t queue, uint32_t core)\n+{\n+\tuint64_t coremask;\n+\tuint16_t port_id;\n+\tint rc;\n+\n+\tif (nb_lcore_params >= ETHDEV_RX_LCORE_PARAMS_MAX)\n+\t\treturn -EINVAL;\n+\n+\trc = rte_eth_dev_get_port_by_name(name, &port_id);\n+\tif (rc)\n+\t\treturn -EINVAL;\n+\n+\tcoremask = 0xff; /* FIXME: Read from graph configuration */\n+\n+\tif (!(coremask & (1 << core)))\n+\t\treturn -EINVAL;\n+\n+\trx_map_configure(port_id, queue, core);\n+\n+\tlcore_params_array[nb_lcore_params].port_id = port_id;\n+\tlcore_params_array[nb_lcore_params].queue_id = queue;\n+\tlcore_params_array[nb_lcore_params].lcore_id = core;\n+\tnb_lcore_params++;\n+\treturn 0;\n+}\n+\n+static void\n+cli_ethdev_rx_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 \"----------------------------- ethdev_rx command help -----------------------------\",\n+\t\t cmd_ethdev_rx_help);\n+\n+\tlen = strlen(conn->msg_out);\n+\tconn->msg_out_len_max -= len;\n+}\n+\n+static void\n+cli_ethdev_rx(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused)\n+{\n+\tstruct ethdev_rx_cmd_tokens *res = parsed_result;\n+\tint rc = -EINVAL;\n+\n+\trc = ethdev_rx_map_add(res->dev, res->qid, res->core_id);\n+\tif (rc < 0) {\n+\t\tcli_exit();\n+\t\tprintf(MSG_CMD_FAIL, res->cmd);\n+\t\trte_exit(EXIT_FAILURE, \"input core is Invalid\\n\");\n+\t}\n+\n+}\n+\n+cmdline_parse_token_string_t ethdev_rx_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, cmd, \"ethdev_rx\");\n+cmdline_parse_token_string_t ethdev_rx_map =\n+\tTOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, map, \"map\");\n+cmdline_parse_token_string_t ethdev_rx_port =\n+\tTOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, port, \"port\");\n+cmdline_parse_token_string_t ethdev_rx_dev =\n+\tTOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, dev, NULL);\n+cmdline_parse_token_string_t ethdev_rx_queue =\n+\tTOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, queue, \"queue\");\n+cmdline_parse_token_num_t ethdev_rx_qid =\n+\tTOKEN_NUM_INITIALIZER(struct ethdev_rx_cmd_tokens, qid, RTE_UINT32);\n+cmdline_parse_token_string_t ethdev_rx_core =\n+\tTOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, core, \"core\");\n+cmdline_parse_token_num_t ethdev_rx_core_id =\n+\tTOKEN_NUM_INITIALIZER(struct ethdev_rx_cmd_tokens, core_id, RTE_UINT32);\n+\n+cmdline_parse_inst_t ethdev_rx_cmd_ctx = {\n+\t.f = cli_ethdev_rx,\n+\t.data = NULL,\n+\t.help_str = cmd_ethdev_rx_help,\n+\t.tokens = {\n+\t\t(void *)&ethdev_rx_cmd,\n+\t\t(void *)&ethdev_rx_map,\n+\t\t(void *)&ethdev_rx_port,\n+\t\t(void *)&ethdev_rx_dev,\n+\t\t(void *)&ethdev_rx_queue,\n+\t\t(void *)&ethdev_rx_qid,\n+\t\t(void *)&ethdev_rx_core,\n+\t\t(void *)&ethdev_rx_core_id,\n+\t\tNULL,\n+\t},\n+};\n+\n+cmdline_parse_token_string_t ethdev_rx_help_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct ethdev_rx_help_cmd_tokens, cmd, \"help\");\n+cmdline_parse_token_string_t ethdev_rx_help_module =\n+\tTOKEN_STRING_INITIALIZER(struct ethdev_rx_help_cmd_tokens, module, \"ethdev_rx\");\n+\n+cmdline_parse_inst_t ethdev_rx_help_cmd_ctx = {\n+\t.f = cli_ethdev_rx_help,\n+\t.data = NULL,\n+\t.help_str = \"\",\n+\t.tokens = {\n+\t\t(void *)&ethdev_rx_help_cmd,\n+\t\t(void *)&ethdev_rx_help_module,\n+\t\tNULL,\n+\t},\n+};\ndiff --git a/app/graph/ethdev_rx.h b/app/graph/ethdev_rx.h\nnew file mode 100644\nindex 0000000000..8e7b31448c\n--- /dev/null\n+++ b/app/graph/ethdev_rx.h\n@@ -0,0 +1,37 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 Marvell.\n+ */\n+\n+#ifndef APP_GRAPH_ETHDEV_RX_H\n+#define APP_GRAPH_ETHDEV_RX_H\n+\n+#include <rte_graph.h>\n+#include <rte_node_eth_api.h>\n+\n+#define ETHDEV_RX_LCORE_PARAMS_MAX 1024\n+#define ETHDEV_RX_QUEUE_PER_LCORE_MAX 16\n+\n+struct lcore_rx_queue {\n+\tuint16_t port_id;\n+\tuint8_t queue_id;\n+\tchar node_name[RTE_NODE_NAMESIZE];\n+};\n+\n+struct lcore_conf {\n+\tuint16_t n_rx_queue;\n+\tstruct lcore_rx_queue rx_queue_list[ETHDEV_RX_QUEUE_PER_LCORE_MAX];\n+\tstruct rte_graph *graph;\n+\tchar name[RTE_GRAPH_NAMESIZE];\n+\trte_graph_t graph_id;\n+} __rte_cache_aligned;\n+\n+uint8_t ethdev_rx_num_rx_queues_get(uint16_t port);\n+\n+extern struct rte_node_ethdev_config ethdev_conf[RTE_MAX_ETHPORTS];\n+extern struct lcore_conf lcore_conf[RTE_MAX_LCORE];\n+extern cmdline_parse_inst_t ethdev_rx_help_cmd_ctx;\n+extern cmdline_parse_inst_t ethdev_rx_cmd_ctx;\n+extern struct lcore_params *lcore_params;\n+extern uint16_t nb_lcore_params;\n+\n+#endif\ndiff --git a/app/graph/ethdev_rx_priv.h b/app/graph/ethdev_rx_priv.h\nnew file mode 100644\nindex 0000000000..5d155be043\n--- /dev/null\n+++ b/app/graph/ethdev_rx_priv.h\n@@ -0,0 +1,39 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 Marvell.\n+ */\n+\n+#ifndef APP_GRAPH_ETHDEV_RX_PRIV_H\n+#define APP_GRAPH_ETHDEV_RX_PRIV_H\n+\n+#include <stdint.h>\n+\n+#include <rte_graph.h>\n+#include <rte_node_eth_api.h>\n+\n+#define MAX_RX_QUEUE_PER_PORT 128\n+#define MAX_JUMBO_PKT_LEN  9600\n+#define NB_SOCKETS 8\n+\n+struct ethdev_rx_cmd_tokens {\n+\tcmdline_fixed_string_t cmd;\n+\tcmdline_fixed_string_t map;\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t dev;\n+\tcmdline_fixed_string_t queue;\n+\tcmdline_fixed_string_t core;\n+\tuint32_t core_id;\n+\tuint32_t qid;\n+};\n+\n+struct ethdev_rx_help_cmd_tokens {\n+\tcmdline_fixed_string_t cmd;\n+\tcmdline_fixed_string_t module;\n+};\n+\n+struct lcore_params {\n+\tuint16_t port_id;\n+\tuint8_t queue_id;\n+\tuint8_t lcore_id;\n+} __rte_cache_aligned;\n+\n+#endif\ndiff --git a/app/graph/meson.build b/app/graph/meson.build\nindex 8fa9d605b9..d8391d5cae 100644\n--- a/app/graph/meson.build\n+++ b/app/graph/meson.build\n@@ -12,6 +12,7 @@ deps += ['graph', 'eal', 'lpm', 'ethdev', 'node', 'cmdline']\n sources = files(\n         'cli.c',\n         'conn.c',\n+        'ethdev_rx.c',\n         'ethdev.c',\n         'ip4_route.c',\n         'ip6_route.c',\ndiff --git a/app/graph/module_api.h b/app/graph/module_api.h\nindex e9e42da7cc..56b7c94ecc 100644\n--- a/app/graph/module_api.h\n+++ b/app/graph/module_api.h\n@@ -11,6 +11,7 @@\n #include \"cli.h\"\n #include \"conn.h\"\n #include \"ethdev.h\"\n+#include \"ethdev_rx.h\"\n #include \"mempool.h\"\n #include \"neigh.h\"\n #include \"route.h\"\ndiff --git a/doc/guides/tools/graph.rst b/doc/guides/tools/graph.rst\nindex b1bd2e6048..318d92a0fb 100644\n--- a/doc/guides/tools/graph.rst\n+++ b/doc/guides/tools/graph.rst\n@@ -141,6 +141,16 @@ file to express the requested use case configuration.\n    | help neigh                           | | Command to dump neigh help      |   Yes   |    Yes   |\n    |                                      | | message.                        |         |          |\n    +--------------------------------------+-----------------------------------+---------+----------+\n+   | | ethdev_rx map port <ethdev_name>   | | Command to add port-queue-core  |   No    |    No    |\n+   | | queue <q_num> core <core_id>       | | mapping to ``ethdev_rx`` node.  |         |          |\n+   |                                      | | ``ethdev_rx`` node instance will|         |          |\n+   |                                      | | be pinned on given core and will|         |          |\n+   |                                      | | poll on requested port/queue    |         |          |\n+   |                                      | | pair.                           |         |          |\n+   +--------------------------------------+-----------------------------------+---------+----------+\n+   | help ethdev_rx                       | | Command to dump ethdev_rx help  |   Yes   |    Yes   |\n+   |                                      | | message.                        |         |          |\n+   +--------------------------------------+-----------------------------------+---------+----------+\n \n Runtime configuration\n ---------------------\n",
    "prefixes": [
        "v11",
        "09/12"
    ]
}