Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/133024/?format=api
http://patchwork.dpdk.org/api/patches/133024/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20231019173011.1186656-8-skori@marvell.com/", "project": { "id": 1, "url": "http://patchwork.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-8-skori@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20231019173011.1186656-8-skori@marvell.com", "date": "2023-10-19T17:30:06", "name": "[v11,07/12] app/graph: support IPv6 lookup command line interfaces", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "bf3bc6e4ad8f9aa62fd14e0128d9ff5a7e900098", "submitter": { "id": 1318, "url": "http://patchwork.dpdk.org/api/people/1318/?format=api", "name": "Sunil Kumar Kori", "email": "skori@marvell.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20231019173011.1186656-8-skori@marvell.com/mbox/", "series": [ { "id": 29924, "url": "http://patchwork.dpdk.org/api/series/29924/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=29924", "date": "2023-10-19T17:29:59", "name": "add CLI based graph application", "version": 11, "mbox": "http://patchwork.dpdk.org/series/29924/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/133024/comments/", "check": "warning", "checks": "http://patchwork.dpdk.org/api/patches/133024/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 24DCB431B0;\n\tThu, 19 Oct 2023 19:31:19 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 48E0242DF2;\n\tThu, 19 Oct 2023 19:30:37 +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 F1FE242DE6\n for <dev@dpdk.org>; Thu, 19 Oct 2023 19:30:33 +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 39JCXquM008133 for <dev@dpdk.org>; Thu, 19 Oct 2023 10:30:33 -0700", "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ttshubs6m-2\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Thu, 19 Oct 2023 10:30:32 -0700", "from DC5-EXCH01.marvell.com (10.69.176.38) 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:30 -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; Thu, 19 Oct 2023 10:30:30 -0700", "from localhost.localdomain (unknown [10.28.34.25])\n by maili.marvell.com (Postfix) with ESMTP id A2D703F703F;\n Thu, 19 Oct 2023 10:30:29 -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=4juaL9QmmG+C/Qz3+YSXNDs7m7OigePsjGqLH0a0skc=;\n b=UtrC84pt0dA2UTDBnExW4ad6rUr+lN4a7aXRRGPkyDIwypvLG0k1toeGBh8hcKcrjWa/\n GJLQwPN8IAJVw7raNU+CaslNoOUrQg8UJb5S1OkSYaJSbNCoZgFEfn/oTGCkO1dguOmv\n Dy2We7Bx+Bji0RkV0QU44sx5YtAg0rGAU7MFj/KniWzp0nE4zjcw/nx51mX+Zp1ViROu\n tBGjEbpcy/19JFXW/z7xEni//gD136RgT8i8mCT6/4MBIkgjfecjjJJrCIs8RT/O5wng\n 8q2CWhjWksxlvZK7UcXNpGF2wqJIwYbBwwxxudH2QLQwynbDbWkAVKVmmzR1GaFMgohK cw==", "From": "<skori@marvell.com>", "To": "Sunil Kumar Kori <skori@marvell.com>, Rakesh Kudurumalla\n <rkudurumalla@marvell.com>", "CC": "<dev@dpdk.org>", "Subject": "[PATCH v11 07/12] app/graph: support IPv6 lookup command line\n interfaces", "Date": "Thu, 19 Oct 2023 23:00:06 +0530", "Message-ID": "<20231019173011.1186656-8-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": "3nhUxzGU-a7Bhm3Zq8p2UiGdxqgMJ4Ll", "X-Proofpoint-ORIG-GUID": "3nhUxzGU-a7Bhm3Zq8p2UiGdxqgMJ4Ll", "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 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 *)ðdev_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 4e4d23b692..e3f9ee3e0c 100644\n--- a/app/graph/ethdev.c\n+++ b/app/graph/ethdev.c\n@@ -165,6 +165,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 7530ef6f65..56c2eaad26 100644\n--- a/doc/guides/tools/graph.rst\n+++ b/doc/guides/tools/graph.rst\n@@ -121,6 +121,15 @@ file to express the requested use case configuration.\n | help ipv4_lookup | | Command to dump ``ipv4_lookup`` | Yes | Yes |\n | | | help message. | | |\n +--------------------------------------+-----------------------------------+---------+----------+\n+ | | ipv6_lookup route add ipv6 <ip> | | Command to add a route into | Yes | Yes |\n+ | | netmask <mask> via <ip> | | ``ipv6_lookup`` LPM table. It is| | |\n+ | | | needed if user wishes to route | | |\n+ | | | the packets based on LPM6 lookup| | |\n+ | | | table. | | |\n+ +--------------------------------------+-----------------------------------+---------+----------+\n+ | help ipv6_lookup | | Command to dump ``ipv6_lookup`` | Yes | Yes |\n+ | | | help message. | | |\n+ +--------------------------------------+-----------------------------------+---------+----------+\n \n Runtime configuration\n ---------------------\n", "prefixes": [ "v11", "07/12" ] }{ "id": 133024, "url": "