Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/131770/?format=api
https://patches.dpdk.org/api/patches/131770/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230921100832.2036256-8-skori@marvell.com/", "project": { "id": 1, "url": "https://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": "<20230921100832.2036256-8-skori@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230921100832.2036256-8-skori@marvell.com", "date": "2023-09-21T10:08:27", "name": "[v5,07/12] app/graph: add ipv6_lookup command line interfaces", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "28f582d782393fcf87f169ca0feb5e21328eaa29", "submitter": { "id": 1318, "url": "https://patches.dpdk.org/api/people/1318/?format=api", "name": "Sunil Kumar Kori", "email": "skori@marvell.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20230921100832.2036256-8-skori@marvell.com/mbox/", "series": [ { "id": 29586, "url": "https://patches.dpdk.org/api/series/29586/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=29586", "date": "2023-09-21T10:08:20", "name": "add CLI based graph application", "version": 5, "mbox": "https://patches.dpdk.org/series/29586/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/131770/comments/", "check": "warning", "checks": "https://patches.dpdk.org/api/patches/131770/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 1D190425CD;\n\tThu, 21 Sep 2023 12:09:39 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 68AE240E01;\n\tThu, 21 Sep 2023 12:09:00 +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 EF53840DF8\n for <dev@dpdk.org>; Thu, 21 Sep 2023 12:08:55 +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 38L7PKvR008644 for <dev@dpdk.org>; Thu, 21 Sep 2023 03:08:55 -0700", "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3t85pttqe0-3\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Thu, 21 Sep 2023 03:08:55 -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, 21 Sep 2023 03:08:51 -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, 21 Sep 2023 03:08:51 -0700", "from localhost.localdomain (unknown [10.28.34.25])\n by maili.marvell.com (Postfix) with ESMTP id 7B9DA5B6942;\n Thu, 21 Sep 2023 03:08:50 -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=bOnJeXqA/pJg5AkUZu40tE/ejJXFDFsTY2Ix+yM8u8w=;\n b=DoKGtajjstCdrIDlJyb70GlpYe0MlrWIjdF7qQ3UknkUM2nrTAF/HUTZ6J6mVKSGIWWC\n wETNnr35NiMhsEiB4lnXn1th/EJcRDW0p4ycSYjZE16YpwZkPwZRTROq0aThGOLUoTmg\n rFeXbtjUqxSrsFb1otEqYI1NWUViA0jC8G3zYWNoSmTxPGklu1fv3lKHI3O2CORocX3x\n mayvr3Mm7VhaUNZjoVfaBVKgfcZHAMBwpEcJzaUNbnh2BicTd8SkwPkkK4LA4N3cdHE7\n xAh0FeY5il0T0eH95xx8vwM7/eI/lnZEJgmZaQV5U2idhKpUdqBrxX1GGx0fqqWbxcGP 5Q==", "From": "<skori@marvell.com>", "To": "Sunil Kumar Kori <skori@marvell.com>, Rakesh Kudurumalla\n <rkudurumalla@marvell.com>", "CC": "<dev@dpdk.org>", "Subject": "[PATCH v5 07/12] app/graph: add ipv6_lookup command line interfaces", "Date": "Thu, 21 Sep 2023 15:38:27 +0530", "Message-ID": "<20230921100832.2036256-8-skori@marvell.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20230921100832.2036256-1-skori@marvell.com>", "References": "<20230919160455.1678716-1-skori@marvell.com>\n <20230921100832.2036256-1-skori@marvell.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Proofpoint-GUID": "qN7ysms3y0RzMWz54OWneJnfWGgxMoY5", "X-Proofpoint-ORIG-GUID": "qN7ysms3y0RzMWz54OWneJnfWGgxMoY5", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26\n definitions=2023-09-21_06,2023-09-20_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 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 | 210 +++++++++++++++++++++++++++++++++++++\n app/graph/meson.build | 1 +\n app/graph/route.h | 14 +++\n doc/guides/tools/graph.rst | 9 ++\n 6 files changed, 237 insertions(+)\n create mode 100644 app/graph/ip6_route.c", "diff": "diff --git a/app/graph/cli.c b/app/graph/cli.c\nindex 430750db6e..7213a91ad2 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 cb29c9054d..0a4eb7be4f 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..93c2c967aa\n--- /dev/null\n+++ b/app/graph/ip6_route.c\n@@ -0,0 +1,210 @@\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+route_ip6_add(struct route_ipv6_config *route)\n+{\n+\tint j;\n+\n+\tstruct route_ipv6_config *ipv6route;\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+\treturn 0;\n+}\n+\n+int\n+route_ip6_add_to_lookup(void)\n+{\n+\tstruct route_ipv6_config *route = NULL;\n+\tint rc = -EINVAL;\n+\tuint8_t depth;\n+\tint portid;\n+\n+\tTAILQ_FOREACH(route, &route6, next) {\n+\n+\t\tportid = ethdev_portid_by_ip6(route->gateway, route->mask);\n+\t\tif (portid < 0) {\n+\t\t\tprintf(\"Invalid portid found to install the route\\n\");\n+\t\t\treturn rc;\n+\t\t}\n+\t\tdepth = convert_ip6_netmask_to_depth(route->mask);\n+\n+\t\trc = rte_node_ip6_route_add(route->ip, depth, portid,\n+\t\t\t\t\t RTE_NODE_IP6_LOOKUP_NEXT_REWRITE);\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 b993d6375f..6841a25eb6 100644\n--- a/app/graph/meson.build\n+++ b/app/graph/meson.build\n@@ -13,6 +13,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 e2b4a3dfd5..0782eb3461 100644\n--- a/doc/guides/tools/graph.rst\n+++ b/doc/guides/tools/graph.rst\n@@ -133,6 +133,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+ - No\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": [ "v5", "07/12" ] }{ "id": 131770, "url": "