get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 131958,
    "url": "http://patches.dpdk.org/api/patches/131958/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230926105742.2638594-9-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": "<20230926105742.2638594-9-skori@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230926105742.2638594-9-skori@marvell.com",
    "date": "2023-09-26T10:57:38",
    "name": "[v6,08/12] app/graph: add neigh command line interfaces",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c9c0daf923dfb0fa543d24c6ab11194b75e895d5",
    "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/20230926105742.2638594-9-skori@marvell.com/mbox/",
    "series": [
        {
            "id": 29635,
            "url": "http://patches.dpdk.org/api/series/29635/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29635",
            "date": "2023-09-26T10:57:30",
            "name": "add CLI based graph application",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/29635/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/131958/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/131958/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 B162A42642;\n\tTue, 26 Sep 2023 12:58:48 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 86E8640E64;\n\tTue, 26 Sep 2023 12:58:14 +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 E4287406B8\n for <dev@dpdk.org>; Tue, 26 Sep 2023 12:58:05 +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 38Q9xiwK012823 for <dev@dpdk.org>; Tue, 26 Sep 2023 03:58:05 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tbw5gg5hs-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Tue, 26 Sep 2023 03:58:04 -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, 26 Sep 2023 03:58:03 -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, 26 Sep 2023 03:58:03 -0700",
            "from localhost.localdomain (unknown [10.28.34.25])\n by maili.marvell.com (Postfix) with ESMTP id E9AAB3F70B5;\n Tue, 26 Sep 2023 03:58:01 -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=3CVpNhTz+AdgQPW4zFs1krsn+8RXF7LFTY3ALC0XhW8=;\n b=RQ7tW9Yuk7JwPWpMRYWtrb/VLzuIUlc6DbmkkcPqQl5SX67H32QwHyRfre4v6cRkVALC\n Vp773abkmiQND1+4KFem6kKhKPGMwNv8DxK/tY1PMWoUHVDBbZnpp86SyC8s078z6yV7\n e/M3kNREoQ2jZilioROy+C/u3vBwzfOUzEAFkjfTBsgtBAbVfJezvzzb07MuqsZNojkO\n YFHIg05QsqQaclWe6oCydY3oraiTcympzxTKeqcJs+jkeZwRG+uyaoAMQqDhpheP1w+d\n BBBtbkAlSIAqcmFGZsNqUa0w9CrxW3CMccsKKY/Th2g1TAufN2QL4nU5Tb3nObrjcRFu Dw==",
        "From": "<skori@marvell.com>",
        "To": "Sunil Kumar Kori <skori@marvell.com>, Rakesh Kudurumalla\n <rkudurumalla@marvell.com>",
        "CC": "<dev@dpdk.org>",
        "Subject": "[PATCH v6 08/12] app/graph: add neigh command line interfaces",
        "Date": "Tue, 26 Sep 2023 16:27:38 +0530",
        "Message-ID": "<20230926105742.2638594-9-skori@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230926105742.2638594-1-skori@marvell.com>",
        "References": "<20230921100832.2036256-13-skori@marvell.com>\n <20230926105742.2638594-1-skori@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "kOOZBmlgnSmeZlt3i9saGfVoFZyPDOWq",
        "X-Proofpoint-ORIG-GUID": "kOOZBmlgnSmeZlt3i9saGfVoFZyPDOWq",
        "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-26_07,2023-09-25_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: Sunil Kumar Kori <skori@marvell.com>\n\nIt adds neigh module to configure arp/neigh. This module uses\nipv4_rewrite and ipv6_rewrite node to write neigh information.\n\nFollowing commands are exposed:\n - neigh add ipv4 <ip> <mac>\n - neigh add ipv6 <ip> <mac>\n - help neigh\n\nSigned-off-by: Sunil Kumar Kori <skori@marvell.com>\nSigned-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>\n---\n app/graph/cli.c            |   3 +\n app/graph/ethdev.c         |   2 +\n app/graph/meson.build      |   1 +\n app/graph/module_api.h     |   2 +\n app/graph/neigh.c          | 331 +++++++++++++++++++++++++++++++++++++\n app/graph/neigh.h          |  17 ++\n app/graph/neigh_priv.h     |  49 ++++++\n doc/guides/tools/graph.rst |  12 ++\n 8 files changed, 417 insertions(+)\n create mode 100644 app/graph/neigh.c\n create mode 100644 app/graph/neigh.h\n create mode 100644 app/graph/neigh_priv.h",
    "diff": "diff --git a/app/graph/cli.c b/app/graph/cli.c\nindex 7213a91ad2..36338d5173 100644\n--- a/app/graph/cli.c\n+++ b/app/graph/cli.c\n@@ -34,6 +34,9 @@ cmdline_parse_ctx_t modules_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+\t(cmdline_parse_inst_t *)&neigh_v4_cmd_ctx,\n+\t(cmdline_parse_inst_t *)&neigh_v6_cmd_ctx,\n+\t(cmdline_parse_inst_t *)&neigh_help_cmd_ctx,\n \tNULL,\n };\n \ndiff --git a/app/graph/ethdev.c b/app/graph/ethdev.c\nindex 0a4eb7be4f..fc0bd8f05f 100644\n--- a/app/graph/ethdev.c\n+++ b/app/graph/ethdev.c\n@@ -162,6 +162,8 @@ ethdev_stop(void)\n \tethdev_list_clean();\n \troute_ip4_list_clean();\n \troute_ip6_list_clean();\n+\tneigh4_list_clean();\n+\tneigh6_list_clean();\n \tprintf(\"Bye...\\n\");\n }\n \ndiff --git a/app/graph/meson.build b/app/graph/meson.build\nindex 6841a25eb6..c0b8418b89 100644\n--- a/app/graph/meson.build\n+++ b/app/graph/meson.build\n@@ -16,5 +16,6 @@ sources = files(\n         'ip6_route.c',\n         'main.c',\n         'mempool.c',\n+        'neigh.c',\n         'utils.c',\n )\ndiff --git a/app/graph/module_api.h b/app/graph/module_api.h\nindex bd4d245c75..e9e42da7cc 100644\n--- a/app/graph/module_api.h\n+++ b/app/graph/module_api.h\n@@ -12,8 +12,10 @@\n #include \"conn.h\"\n #include \"ethdev.h\"\n #include \"mempool.h\"\n+#include \"neigh.h\"\n #include \"route.h\"\n #include \"utils.h\"\n+\n /*\n  * Externs\n  */\ndiff --git a/app/graph/neigh.c b/app/graph/neigh.c\nnew file mode 100644\nindex 0000000000..f59d61152b\n--- /dev/null\n+++ b/app/graph/neigh.c\n@@ -0,0 +1,331 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 Marvell.\n+ */\n+\n+#include <stdbool.h>\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_ethdev.h>\n+#include <rte_node_ip4_api.h>\n+#include <rte_node_ip6_api.h>\n+\n+#include \"neigh_priv.h\"\n+#include \"module_api.h\"\n+\n+static const char\n+cmd_neigh_v4_help[] = \"neigh add ipv4 <ip> <mac>\";\n+\n+static const char\n+cmd_neigh_v6_help[] = \"neigh add ipv6 <ip> <mac>\";\n+\n+struct neigh4_head neigh4 = TAILQ_HEAD_INITIALIZER(neigh4);\n+struct neigh6_head neigh6 = TAILQ_HEAD_INITIALIZER(neigh6);\n+\n+void\n+neigh4_list_clean(void)\n+{\n+\tstruct neigh_ipv4_config *v4_config;\n+\n+\twhile (!TAILQ_EMPTY(&neigh4)) {\n+\t\tv4_config = TAILQ_FIRST(&neigh4);\n+\t\tTAILQ_REMOVE(&neigh4, v4_config, next);\n+\t}\n+}\n+\n+void\n+neigh6_list_clean(void)\n+{\n+\tstruct neigh_ipv6_config *v6_config;\n+\n+\twhile (!TAILQ_EMPTY(&neigh6)) {\n+\t\tv6_config = TAILQ_FIRST(&neigh6);\n+\t\tTAILQ_REMOVE(&neigh6, v6_config, next);\n+\t}\n+}\n+\n+static struct neigh_ipv4_config *\n+find_neigh4_entry(uint32_t ip, uint64_t mac)\n+{\n+\tstruct neigh_ipv4_config *v4_config;\n+\n+\tTAILQ_FOREACH(v4_config, &neigh4, next) {\n+\t\tif ((v4_config->ip == ip) && (v4_config->mac == mac))\n+\t\t\treturn v4_config;\n+\t}\n+\treturn NULL;\n+}\n+\n+static struct neigh_ipv6_config *\n+find_neigh6_entry(uint8_t *ip, uint64_t mac)\n+{\n+\tstruct neigh_ipv6_config *v6_config;\n+\n+\tTAILQ_FOREACH(v6_config, &neigh6, next) {\n+\t\tif (!(memcmp(v6_config->ip, ip, 16)) && (v6_config->mac == mac))\n+\t\t\treturn v6_config;\n+\t}\n+\treturn NULL;\n+}\n+\n+static int\n+neigh_ip4_add(uint32_t ip, uint64_t mac)\n+{\n+\tstruct neigh_ipv4_config *v4_config;\n+\n+\tv4_config = find_neigh4_entry(ip, mac);\n+\n+\tif (!v4_config) {\n+\t\tv4_config = malloc(sizeof(struct neigh_ipv4_config));\n+\t\tif (!v4_config)\n+\t\t\treturn -ENOMEM;\n+\t}\n+\n+\tv4_config->ip = ip;\n+\tv4_config->mac = mac;\n+\tv4_config->is_used = true;\n+\n+\tTAILQ_INSERT_TAIL(&neigh4, v4_config, next);\n+\treturn 0;\n+}\n+\n+static int\n+neigh_ip6_add(uint8_t *ip, uint64_t mac)\n+{\n+\tint j;\n+\tstruct neigh_ipv6_config *v6_config;\n+\n+\tv6_config = find_neigh6_entry(ip, mac);\n+\n+\tif (!v6_config) {\n+\t\tv6_config = malloc(sizeof(struct neigh_ipv6_config));\n+\t\tif (!v6_config)\n+\t\t\treturn -ENOMEM;\n+\t}\n+\n+\tfor (j = 0; j < ETHDEV_IPV6_ADDR_LEN; j++)\n+\t\tv6_config->ip[j] = ip[j];\n+\n+\tv6_config->mac = mac;\n+\tv6_config->is_used = true;\n+\n+\tTAILQ_INSERT_TAIL(&neigh6, v6_config, next);\n+\treturn 0;\n+}\n+\n+int\n+neigh_ip4_add_to_rewrite(void)\n+{\n+\tuint8_t data[2 * RTE_ETHER_ADDR_LEN];\n+\tuint8_t len = 2 * RTE_ETHER_ADDR_LEN;\n+\tstruct rte_ether_addr smac = {0};\n+\tstruct neigh_ipv4_config *neigh;\n+\tint16_t portid = 0;\n+\tint rc;\n+\n+\tTAILQ_FOREACH(neigh, &neigh4, next) {\n+\t\tportid = ethdev_portid_by_ip4(neigh->ip, 0);\n+\t\tif (portid < 0) {\n+\t\t\tprintf(\"Invalid portid found to add  neigh\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tmemset(data, 0, len);\n+\n+\t\t/* Copy dst mac */\n+\t\trte_memcpy((void *)&data[0], (void *)&neigh->mac, RTE_ETHER_ADDR_LEN);\n+\n+\t\t/* Copy src mac */\n+\t\trc = rte_eth_macaddr_get(portid, &smac);\n+\t\tif (rc < 0) {\n+\t\t\tprintf(\"Cannot get MAC address: err=%d, port=%d\\n\", rc, portid);\n+\t\t\treturn rc;\n+\t\t}\n+\n+\t\trte_memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN);\n+\n+\t\trc = rte_node_ip4_rewrite_add(portid, data, len, portid);\n+\t\tif (rc < 0) {\n+\t\t\tprintf(\"Error in writing rewrite data: err=%d, port=%d\\n\", rc, portid);\n+\t\t\treturn rc;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n+int\n+neigh_ip6_add_to_rewrite(void)\n+{\n+\tuint8_t data[2 * RTE_ETHER_ADDR_LEN];\n+\tuint8_t len = 2 * RTE_ETHER_ADDR_LEN;\n+\tstruct rte_ether_addr smac = {0};\n+\tstruct neigh_ipv6_config *neigh;\n+\tint16_t portid = 0;\n+\tint rc;\n+\n+\n+\tTAILQ_FOREACH(neigh, &neigh6, next) {\n+\n+\t\tportid = ethdev_portid_by_ip6(neigh->ip, NULL);\n+\t\tif (portid < 0) {\n+\t\t\tprintf(\"Invalid portid found to add neigh\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tmemset(data, 0, len);\n+\n+\t\t/* Copy dst mac */\n+\t\trte_memcpy((void *)&data[0], (void *)&neigh->mac, RTE_ETHER_ADDR_LEN);\n+\n+\t\t/* Copy src mac */\n+\t\trc = rte_eth_macaddr_get(portid, &smac);\n+\t\tif (rc < 0) {\n+\t\t\tprintf(\"Cannot get MAC address: err=%d, port=%d\\n\",\n+\t\t\t\trc, portid);\n+\t\t\treturn rc;\n+\t\t}\n+\n+\t\trte_memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN);\n+\n+\t\trc = rte_node_ip6_rewrite_add(portid, data, len, portid);\n+\t\tif (rc < 0) {\n+\t\t\tprintf(\"Error in writing rewrite data: err=%d, port=%d\\n\", rc, portid);\n+\t\t\treturn rc;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static void\n+cli_neigh_v4(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused)\n+{\n+\tstruct neigh_v4_cmd_tokens *res = parsed_result;\n+\tint rc = -EINVAL;\n+\tuint64_t mac;\n+\tuint32_t ip;\n+\n+\tif (parser_ip4_read(&ip, res->ip)) {\n+\t\tprintf(MSG_ARG_INVALID, \"ip\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_mac_read(&mac, res->mac)) {\n+\t\tprintf(MSG_ARG_INVALID, \"mac\");\n+\t\treturn;\n+\t}\n+\n+\trc = neigh_ip4_add(ip, mac);\n+\tif (rc < 0)\n+\t\tprintf(MSG_CMD_FAIL, res->cmd);\n+}\n+\n+static void\n+cli_neigh_v6(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused)\n+{\n+\tstruct neigh_v6_cmd_tokens *res = parsed_result;\n+\tuint8_t ip[ETHDEV_IPV6_ADDR_LEN];\n+\tint rc = -EINVAL;\n+\tuint64_t mac;\n+\n+\tif (parser_ip6_read(ip, res->ip)) {\n+\t\tprintf(MSG_ARG_INVALID, \"ip\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_mac_read(&mac, res->mac)) {\n+\t\tprintf(MSG_ARG_INVALID, \"mac\");\n+\t\treturn;\n+\t}\n+\n+\trc = neigh_ip6_add(ip, mac);\n+\tif (rc < 0)\n+\t\tprintf(MSG_CMD_FAIL, res->cmd);\n+}\n+\n+static void\n+cli_neigh_help(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl,\n+\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%s\\n\",\n+\t\t \"--------------------------- neigh command help ---------------------------\",\n+\t\t cmd_neigh_v4_help, cmd_neigh_v6_help);\n+\n+\tlen = strlen(conn->msg_out);\n+\tconn->msg_out_len_max -= len;\n+}\n+\n+cmdline_parse_token_string_t neigh_v4_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, cmd, \"neigh\");\n+cmdline_parse_token_string_t neigh_v4_add =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, add, \"add\");\n+cmdline_parse_token_string_t neigh_v4_ip4 =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, ip4, \"ipv4\");\n+cmdline_parse_token_string_t neigh_v4_ip =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, ip, NULL);\n+cmdline_parse_token_string_t neigh_v4_mac =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, mac, NULL);\n+\n+cmdline_parse_inst_t neigh_v4_cmd_ctx = {\n+\t.f = cli_neigh_v4,\n+\t.data = NULL,\n+\t.help_str = cmd_neigh_v4_help,\n+\t.tokens = {\n+\t\t(void *)&neigh_v4_cmd,\n+\t\t(void *)&neigh_v4_add,\n+\t\t(void *)&neigh_v4_ip4,\n+\t\t(void *)&neigh_v4_ip,\n+\t\t(void *)&neigh_v4_mac,\n+\t\tNULL,\n+\t},\n+};\n+\n+cmdline_parse_token_string_t neigh_v6_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, cmd, \"neigh\");\n+cmdline_parse_token_string_t neigh_v6_add =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, add, \"add\");\n+cmdline_parse_token_string_t neigh_v6_ip6 =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, ip6, \"ipv6\");\n+cmdline_parse_token_string_t neigh_v6_ip =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, ip, NULL);\n+cmdline_parse_token_string_t neigh_v6_mac =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, mac, NULL);\n+\n+cmdline_parse_inst_t neigh_v6_cmd_ctx = {\n+\t.f = cli_neigh_v6,\n+\t.data = NULL,\n+\t.help_str = cmd_neigh_v6_help,\n+\t.tokens = {\n+\t\t(void *)&neigh_v6_cmd,\n+\t\t(void *)&neigh_v6_add,\n+\t\t(void *)&neigh_v6_ip6,\n+\t\t(void *)&neigh_v6_ip,\n+\t\t(void *)&neigh_v6_mac,\n+\t\tNULL,\n+\t},\n+};\n+\n+cmdline_parse_token_string_t neigh_help_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_help_cmd_tokens, cmd, \"help\");\n+cmdline_parse_token_string_t neigh_help_module =\n+\tTOKEN_STRING_INITIALIZER(struct neigh_help_cmd_tokens, module, \"neigh\");\n+\n+cmdline_parse_inst_t neigh_help_cmd_ctx = {\n+\t.f = cli_neigh_help,\n+\t.data = NULL,\n+\t.help_str = \"\",\n+\t.tokens = {\n+\t\t(void *)&neigh_help_cmd,\n+\t\t(void *)&neigh_help_module,\n+\t\tNULL,\n+\t},\n+};\ndiff --git a/app/graph/neigh.h b/app/graph/neigh.h\nnew file mode 100644\nindex 0000000000..928981fc31\n--- /dev/null\n+++ b/app/graph/neigh.h\n@@ -0,0 +1,17 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 Marvell.\n+ */\n+\n+#ifndef APP_GRAPH_NEIGH_H\n+#define APP_GRAPH_NEIGH_H\n+\n+extern cmdline_parse_inst_t neigh_v4_cmd_ctx;\n+extern cmdline_parse_inst_t neigh_v6_cmd_ctx;\n+extern cmdline_parse_inst_t neigh_help_cmd_ctx;\n+\n+void neigh4_list_clean(void);\n+void neigh6_list_clean(void);\n+int neigh_ip4_add_to_rewrite(void);\n+int neigh_ip6_add_to_rewrite(void);\n+\n+#endif\ndiff --git a/app/graph/neigh_priv.h b/app/graph/neigh_priv.h\nnew file mode 100644\nindex 0000000000..0ec9b1510f\n--- /dev/null\n+++ b/app/graph/neigh_priv.h\n@@ -0,0 +1,49 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 Marvell.\n+ */\n+\n+#ifndef APP_GRAPH_NEIGH_PRIV_H\n+#define APP_GRAPH_NEIGH_PRIV_H\n+\n+#define MAX_NEIGH_ENTRIES 32\n+\n+struct neigh_v4_cmd_tokens {\n+\tcmdline_fixed_string_t cmd;\n+\tcmdline_fixed_string_t add;\n+\tcmdline_fixed_string_t ip4;\n+\tcmdline_fixed_string_t ip;\n+\tcmdline_fixed_string_t mac;\n+};\n+\n+struct neigh_v6_cmd_tokens {\n+\tcmdline_fixed_string_t cmd;\n+\tcmdline_fixed_string_t add;\n+\tcmdline_fixed_string_t ip6;\n+\tcmdline_fixed_string_t ip;\n+\tcmdline_fixed_string_t mac;\n+};\n+\n+struct neigh_help_cmd_tokens {\n+\tcmdline_fixed_string_t cmd;\n+\tcmdline_fixed_string_t module;\n+};\n+\n+struct neigh_ipv4_config {\n+\tTAILQ_ENTRY(neigh_ipv4_config) next;\n+\tuint32_t ip;\n+\tuint64_t mac;\n+\tbool is_used;\n+};\n+\n+TAILQ_HEAD(neigh4_head, neigh_ipv4_config);\n+\n+struct neigh_ipv6_config {\n+\tTAILQ_ENTRY(neigh_ipv6_config) next;\n+\tuint8_t ip[16];\n+\tuint64_t mac;\n+\tbool is_used;\n+};\n+\n+TAILQ_HEAD(neigh6_head, neigh_ipv6_config);\n+\n+#endif\ndiff --git a/doc/guides/tools/graph.rst b/doc/guides/tools/graph.rst\nindex 0782eb3461..c46c8c5737 100644\n--- a/doc/guides/tools/graph.rst\n+++ b/doc/guides/tools/graph.rst\n@@ -142,6 +142,18 @@ file to express the requested use case configuration.\n      - Command to dump ipv6_lookup help message\n      - Yes\n      - Yes\n+   * - neigh add ipv4 <ip> <mac>\n+     - Command to add a neighbour information into ``ipv4_rewrite`` node.\n+     - No\n+     - Yes\n+   * - neigh add ipv6 <ip> <mac>\n+     - Command to add a neighbour information into ``ipv6_rewrite`` node.\n+     - No\n+     - Yes\n+   * - help neigh\n+     - Command to dump neigh help message\n+     - Yes\n+     - Yes\n \n Runtime configuration\n ---------------------\n",
    "prefixes": [
        "v6",
        "08/12"
    ]
}