get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 132836,
    "url": "http://patches.dpdk.org/api/patches/132836/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231018063347.68081-8-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": "<20231018063347.68081-8-skori@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231018063347.68081-8-skori@marvell.com",
    "date": "2023-10-18T06:33:42",
    "name": "[v9,07/12] app/graph: support IPv6 lookup command line interfaces",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "a09bbf2555ac33fca9d86990d8ecf6181f2b58ca",
    "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/20231018063347.68081-8-skori@marvell.com/mbox/",
    "series": [
        {
            "id": 29897,
            "url": "http://patches.dpdk.org/api/series/29897/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29897",
            "date": "2023-10-18T06:33:35",
            "name": "add CLI based graph application",
            "version": 9,
            "mbox": "http://patches.dpdk.org/series/29897/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/132836/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/132836/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 254E043196;\n\tWed, 18 Oct 2023 08:34:52 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 96FE0427D7;\n\tWed, 18 Oct 2023 08:34:10 +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 D19964114B\n for <dev@dpdk.org>; Wed, 18 Oct 2023 08:34:08 +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 39I3vCWU019943 for <dev@dpdk.org>; Tue, 17 Oct 2023 23:34:08 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3tstb3uqfm-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Tue, 17 Oct 2023 23:34:08 -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 Tue, 17 Oct 2023 23:34:05 -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; Tue, 17 Oct 2023 23:34:05 -0700",
            "from localhost.localdomain (unknown [10.28.34.25])\n by maili.marvell.com (Postfix) with ESMTP id 61FA33F7048;\n Tue, 17 Oct 2023 23:34:04 -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=83UdNpCVpp4V86fQ8Nrht3bW39fJ6Xwx6ZZ4StB5Cjk=;\n b=GMly816OtZKEFqO/VCfMaVVcyPa0KWOWjvT1Tow9lWk0hLzDV2DfaLM7KoJmPtxHcIq3\n ltxPxCz3B5fSZ4JlvNJbmNGl+oCt8OItVi3RkihG+4eD2k8Lh9fSjwNXd6BHZgXw2Rla\n tA+B0ifE1Z3DF8HADOFGsjTSC/1oE+jsFPGPieFYBz7iNws+sHn/RWRUnJQdu0QL0IwZ\n ZNnvedNWGLDxkAdW7TojcEYsHEZ26b5TF7Ri5DGOkCM2gL0Pt2n3QCRXWMysdH9Xu03t\n izrE7Q4jWYvBit6J/wPbTkKE2D+EI/vEMmYXEIIAyLejRC9XXAWst2kOmlZ5bb/Z3Q2v Hg==",
        "From": "<skori@marvell.com>",
        "To": "Sunil Kumar Kori <skori@marvell.com>, Rakesh Kudurumalla\n <rkudurumalla@marvell.com>",
        "CC": "<dev@dpdk.org>",
        "Subject": "[PATCH v9 07/12] app/graph: support IPv6 lookup command line\n interfaces",
        "Date": "Wed, 18 Oct 2023 12:03:42 +0530",
        "Message-ID": "<20231018063347.68081-8-skori@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20231018063347.68081-1-skori@marvell.com>",
        "References": "<20230929095814.692890-2-skori@marvell.com>\n <20231018063347.68081-1-skori@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "5NePsI9L0ABVbGHcS4Big8zggV0369vV",
        "X-Proofpoint-GUID": "5NePsI9L0ABVbGHcS4Big8zggV0369vV",
        "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-18_03,2023-10-17_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 ipv6_lookup module to configure LPM6 table. This LPM6 table\nwill be used for IPv6 lookup and forwarding.\n\nFollowing commands are exposed:\n - ipv6_lookup route add ipv6 <ip> netmask <mask> via <ip>\n - help ipv6_lookup\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.c         |   1 +\n app/graph/ip6_route.c      | 226 +++++++++++++++++++++++++++++++++++++\n app/graph/meson.build      |   1 +\n app/graph/route.h          |  14 +++\n doc/guides/tools/graph.rst |   9 ++\n 6 files changed, 253 insertions(+)\n create mode 100644 app/graph/ip6_route.c",
    "diff": "diff --git a/app/graph/cli.c b/app/graph/cli.c\nindex 25785ea4dc..1280422388 100644\n--- a/app/graph/cli.c\n+++ b/app/graph/cli.c\n@@ -32,6 +32,8 @@ cmdline_parse_ctx_t modules_ctx[] = {\n \t(cmdline_parse_inst_t *)&ethdev_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,\n+\t(cmdline_parse_inst_t *)&ipv6_lookup_help_cmd_ctx,\n \tNULL,\n };\n \ndiff --git a/app/graph/ethdev.c b/app/graph/ethdev.c\nindex 4d2bc73e7c..4c70953b99 100644\n--- a/app/graph/ethdev.c\n+++ b/app/graph/ethdev.c\n@@ -161,6 +161,7 @@ ethdev_stop(void)\n \n \tethdev_list_clean();\n \troute_ip4_list_clean();\n+\troute_ip6_list_clean();\n \tprintf(\"Bye...\\n\");\n }\n \ndiff --git a/app/graph/ip6_route.c b/app/graph/ip6_route.c\nnew file mode 100644\nindex 0000000000..e793cde830\n--- /dev/null\n+++ b/app/graph/ip6_route.c\n@@ -0,0 +1,226 @@\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+#include <cmdline_parse.h>\n+#include <cmdline_parse_num.h>\n+#include <cmdline_parse_string.h>\n+#include <cmdline_socket.h>\n+\n+#include <rte_node_ip6_api.h>\n+\n+#include \"module_api.h\"\n+#include \"route_priv.h\"\n+\n+static const char\n+cmd_ipv6_lookup_help[] = \"ipv6_lookup route add ipv6 <ip> netmask <mask> via <ip>\";\n+\n+struct ip6_route route6 = TAILQ_HEAD_INITIALIZER(route6);\n+\n+void\n+route_ip6_list_clean(void)\n+{\n+\tstruct route_ipv6_config *route;\n+\n+\twhile (!TAILQ_EMPTY(&route6)) {\n+\t\troute = TAILQ_FIRST(&route6);\n+\t\tTAILQ_REMOVE(&route6, route, next);\n+\t}\n+}\n+\n+static struct route_ipv6_config *\n+find_route6_entry(struct route_ipv6_config *route)\n+{\n+\tstruct route_ipv6_config *ipv6route;\n+\n+\tTAILQ_FOREACH(ipv6route, &route6, next) {\n+\t\tif (!memcmp(ipv6route, route, sizeof(*route)))\n+\t\t\treturn ipv6route;\n+\t}\n+\treturn NULL;\n+}\n+\n+static uint8_t\n+convert_ip6_netmask_to_depth(uint8_t *netmask)\n+{\n+\tuint8_t setbits = 0;\n+\tuint8_t mask;\n+\tint i;\n+\n+\tfor (i = 0; i < ETHDEV_IPV6_ADDR_LEN; i++) {\n+\t\tmask = netmask[i];\n+\t\twhile (mask & 0x80) {\n+\t\t\tmask = mask << 1;\n+\t\t\tsetbits++;\n+\t\t}\n+\t}\n+\n+\treturn setbits;\n+}\n+\n+static int\n+route6_rewirte_table_update(struct route_ipv6_config *ipv6route)\n+{\n+\tuint8_t depth;\n+\tint portid;\n+\n+\tportid = ethdev_portid_by_ip6(ipv6route->gateway, ipv6route->mask);\n+\tif (portid < 0) {\n+\t\tprintf(\"Invalid portid found to install the route\\n\");\n+\t\treturn portid;\n+\t}\n+\tdepth = convert_ip6_netmask_to_depth(ipv6route->mask);\n+\n+\treturn rte_node_ip6_route_add(ipv6route->ip, depth, portid,\n+\t\t\tRTE_NODE_IP6_LOOKUP_NEXT_REWRITE);\n+\n+}\n+\n+static int\n+route_ip6_add(struct route_ipv6_config *route)\n+{\n+\tstruct route_ipv6_config *ipv6route;\n+\tint rc = -EINVAL;\n+\tint j;\n+\n+\tipv6route = find_route6_entry(route);\n+\tif (!ipv6route) {\n+\t\tipv6route = malloc(sizeof(struct route_ipv6_config));\n+\t\tif (!ipv6route)\n+\t\t\treturn -ENOMEM;\n+\t} else {\n+\t\treturn 0;\n+\t}\n+\n+\tfor (j = 0; j < ETHDEV_IPV6_ADDR_LEN; j++) {\n+\t\tipv6route->ip[j] = route->ip[j];\n+\t\tipv6route->mask[j] = route->mask[j];\n+\t\tipv6route->gateway[j] = route->gateway[j];\n+\t}\n+\tipv6route->is_used = true;\n+\n+\t/* FIXME: Get graph status here and then update table */\n+\trc = route6_rewirte_table_update(ipv6route);\n+\tif (rc)\n+\t\tgoto free;\n+\n+\tTAILQ_INSERT_TAIL(&route6, ipv6route, next);\n+\treturn 0;\n+free:\n+\tfree(ipv6route);\n+\treturn rc;\n+}\n+\n+int\n+route_ip6_add_to_lookup(void)\n+{\n+\tstruct route_ipv6_config *route = NULL;\n+\tint rc = -EINVAL;\n+\n+\tTAILQ_FOREACH(route, &route6, next) {\n+\t\trc = route6_rewirte_table_update(route);\n+\t\tif (rc < 0)\n+\t\t\treturn rc;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static void\n+cli_ipv6_lookup_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 \"--------------------------- ipv6_lookup command help ---------------------------\",\n+\t\t cmd_ipv6_lookup_help);\n+\n+\tlen = strlen(conn->msg_out);\n+\tconn->msg_out_len_max -= len;\n+}\n+\n+static void\n+cli_ipv6_lookup(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused)\n+{\n+\tstruct ip6_lookup_cmd_tokens *res = parsed_result;\n+\tstruct route_ipv6_config config;\n+\tint rc = -EINVAL;\n+\n+\tif (parser_ip6_read(config.ip, res->ip)) {\n+\t\tprintf(MSG_ARG_INVALID, \"ipv6\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_ip6_read(config.mask, res->mask)) {\n+\t\tprintf(MSG_ARG_INVALID, \"netmask\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_ip6_read(config.gateway, res->via_ip)) {\n+\t\tprintf(MSG_ARG_INVALID, \"gateway ip\");\n+\t\treturn;\n+\t}\n+\n+\trc = route_ip6_add(&config);\n+\tif (rc)\n+\t\tprintf(MSG_CMD_FAIL, res->cmd);\n+}\n+\n+cmdline_parse_token_string_t ip6_lookup_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, cmd, \"ipv6_lookup\");\n+cmdline_parse_token_string_t ip6_lookup_route =\n+\tTOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, route, \"route\");\n+cmdline_parse_token_string_t ip6_lookup_add =\n+\tTOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, add, \"add\");\n+cmdline_parse_token_string_t ip6_lookup_ip6 =\n+\tTOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, ip6, \"ipv6\");\n+cmdline_parse_token_string_t ip6_lookup_ip =\n+\tTOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, ip, NULL);\n+cmdline_parse_token_string_t ip6_lookup_netmask =\n+\tTOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, netmask, \"netmask\");\n+cmdline_parse_token_string_t ip6_lookup_mask =\n+\tTOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, mask, NULL);\n+cmdline_parse_token_string_t ip6_lookup_via =\n+\tTOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, via, \"via\");\n+cmdline_parse_token_string_t ip6_lookup_via_ip =\n+\tTOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, via_ip, NULL);\n+\n+cmdline_parse_inst_t ipv6_lookup_cmd_ctx = {\n+\t.f = cli_ipv6_lookup,\n+\t.data = NULL,\n+\t.help_str = cmd_ipv6_lookup_help,\n+\t.tokens = {\n+\t\t(void *)&ip6_lookup_cmd,\n+\t\t(void *)&ip6_lookup_route,\n+\t\t(void *)&ip6_lookup_add,\n+\t\t(void *)&ip6_lookup_ip6,\n+\t\t(void *)&ip6_lookup_ip,\n+\t\t(void *)&ip6_lookup_netmask,\n+\t\t(void *)&ip6_lookup_mask,\n+\t\t(void *)&ip6_lookup_via,\n+\t\t(void *)&ip6_lookup_via_ip,\n+\t\tNULL,\n+\t},\n+};\n+\n+cmdline_parse_token_string_t ipv6_lookup_help_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct ipv6_lookup_help_cmd_tokens, cmd, \"help\");\n+cmdline_parse_token_string_t ipv6_lookup_help_module =\n+\tTOKEN_STRING_INITIALIZER(struct ipv6_lookup_help_cmd_tokens, module, \"ipv6_lookup\");\n+\n+cmdline_parse_inst_t ipv6_lookup_help_cmd_ctx = {\n+\t.f = cli_ipv6_lookup_help,\n+\t.data = NULL,\n+\t.help_str = \"\",\n+\t.tokens = {\n+\t\t(void *)&ipv6_lookup_help_cmd,\n+\t\t(void *)&ipv6_lookup_help_module,\n+\t\tNULL,\n+\t},\n+};\ndiff --git a/app/graph/meson.build b/app/graph/meson.build\nindex 1f35f82583..413bbefc4e 100644\n--- a/app/graph/meson.build\n+++ b/app/graph/meson.build\n@@ -14,6 +14,7 @@ sources = files(\n         'conn.c',\n         'ethdev.c',\n         'ip4_route.c',\n+        'ip6_route.c',\n         'main.c',\n         'mempool.c',\n         'utils.c',\ndiff --git a/app/graph/route.h b/app/graph/route.h\nindex a44d401d55..0d271d1350 100644\n--- a/app/graph/route.h\n+++ b/app/graph/route.h\n@@ -8,7 +8,9 @@\n #define MAX_ROUTE_ENTRIES 32\n \n extern cmdline_parse_inst_t ipv4_lookup_cmd_ctx;\n+extern cmdline_parse_inst_t ipv6_lookup_cmd_ctx;\n extern cmdline_parse_inst_t ipv4_lookup_help_cmd_ctx;\n+extern cmdline_parse_inst_t ipv6_lookup_help_cmd_ctx;\n \n struct route_ipv4_config {\n \tTAILQ_ENTRY(route_ipv4_config) next;\n@@ -20,7 +22,19 @@ struct route_ipv4_config {\n \n TAILQ_HEAD(ip4_route, route_ipv4_config);\n \n+struct route_ipv6_config {\n+\tTAILQ_ENTRY(route_ipv6_config) next;\n+\tuint8_t ip[16];\n+\tuint8_t mask[16];\n+\tuint8_t gateway[16];\n+\tbool is_used;\n+};\n+\n+TAILQ_HEAD(ip6_route, route_ipv6_config);\n+\n int route_ip4_add_to_lookup(void);\n+int route_ip6_add_to_lookup(void);\n void route_ip4_list_clean(void);\n+void route_ip6_list_clean(void);\n \n #endif\ndiff --git a/doc/guides/tools/graph.rst b/doc/guides/tools/graph.rst\nindex 333e46654e..4d4357f202 100644\n--- a/doc/guides/tools/graph.rst\n+++ b/doc/guides/tools/graph.rst\n@@ -131,6 +131,15 @@ file to express the requested use case configuration.\n      - Command to dump ipv4_lookup help message\n      - Yes\n      - Yes\n+   * - ipv6_lookup route add ipv6 <ip> netmask <mask> via <ip>\n+     - Command to add a route into ``ipv6_lookup`` LPM table. It is needed if user\n+       wishes to route the packets based on LPM6 lookup table.\n+     - Yes\n+     - Yes\n+   * - help ipv6_lookup\n+     - Command to dump ipv6_lookup help message\n+     - Yes\n+     - Yes\n \n Runtime configuration\n ---------------------\n",
    "prefixes": [
        "v9",
        "07/12"
    ]
}