get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 132010,
    "url": "https://patches.dpdk.org/api/patches/132010/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230927115412.55018-9-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": "<20230927115412.55018-9-skori@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230927115412.55018-9-skori@marvell.com",
    "date": "2023-09-27T11:54:08",
    "name": "[v7,08/12] app/graph: add neigh command line interfaces",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e6ab8a7bd4b87ed29141a5aeb38985b0eec560f8",
    "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/20230927115412.55018-9-skori@marvell.com/mbox/",
    "series": [
        {
            "id": 29655,
            "url": "https://patches.dpdk.org/api/series/29655/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=29655",
            "date": "2023-09-27T11:54:00",
            "name": "add CLI based graph application",
            "version": 7,
            "mbox": "https://patches.dpdk.org/series/29655/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/132010/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/132010/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 3705942651;\n\tWed, 27 Sep 2023 13:55:24 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 248E340E4A;\n\tWed, 27 Sep 2023 13:54:44 +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 15EF240A6F\n for <dev@dpdk.org>; Wed, 27 Sep 2023 13:54:35 +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 38R0x2cQ025046 for <dev@dpdk.org>; Wed, 27 Sep 2023 04:54:35 -0700",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tbw5gnwuy-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Wed, 27 Sep 2023 04:54:35 -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 Wed, 27 Sep 2023 04:54:33 -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; Wed, 27 Sep 2023 04:54:33 -0700",
            "from localhost.localdomain (unknown [10.28.34.25])\n by maili.marvell.com (Postfix) with ESMTP id 33A5E3F7090;\n Wed, 27 Sep 2023 04:54:31 -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=3WMgyTSZRvzzTYc1yPrIokiAZSFYkFdS5TdV7lFtj2k=;\n b=ONWhMxA5fZFPDdr+BTvfwpDVXqeFgrVkg3juNFqvEd3rdPDqPHfry99W9pqENDRuKLmz\n k8P7Z2INQZmSvHLyw4xX/KgO+XP/smeF1xjC6KHoDJ7t2JBMQiZUK9DHVvdNKF4RdLTn\n QF+x4i6S08iSuGIm04IdemBh80xSfIhrZp+MxUsZ+2/tCIb6l8FJ7cjsEWHwLnUr+Fu3\n KtgWvDbpQMxmL6DBKHFNyclxokLZZWONTgRU2/DUEkjwNc/Lv6jqT/VvNlEIa2KK4NgL\n NKGO2nsRW679zSkP5JDBcvlbSWV2+IURD3I3Lplv6apnoZG6mjSjym+cp5jlHuXcsDkf Xg==",
        "From": "<skori@marvell.com>",
        "To": "Sunil Kumar Kori <skori@marvell.com>, Rakesh Kudurumalla\n <rkudurumalla@marvell.com>",
        "CC": "<dev@dpdk.org>",
        "Subject": "[PATCH v7 08/12] app/graph: add neigh command line interfaces",
        "Date": "Wed, 27 Sep 2023 17:24:08 +0530",
        "Message-ID": "<20230927115412.55018-9-skori@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230927115412.55018-1-skori@marvell.com>",
        "References": "<20230926105742.2638594-13-skori@marvell.com>\n <20230927115412.55018-1-skori@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "Rh_4LJ9XXfV88_Z3_PQC0ujaRDWg8G_Y",
        "X-Proofpoint-ORIG-GUID": "Rh_4LJ9XXfV88_Z3_PQC0ujaRDWg8G_Y",
        "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-27_06,2023-09-27_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          | 360 +++++++++++++++++++++++++++++++++++++\n app/graph/neigh.h          |  17 ++\n app/graph/neigh_priv.h     |  49 +++++\n doc/guides/tools/graph.rst |  12 ++\n 8 files changed, 446 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 c3261a2162..39fe0b984f 100644\n--- a/app/graph/meson.build\n+++ b/app/graph/meson.build\n@@ -17,5 +17,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..90f62feb70\n--- /dev/null\n+++ b/app/graph/neigh.c\n@@ -0,0 +1,360 @@\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+ip6_rewrite_node_add(struct neigh_ipv6_config *v6_config)\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+\tint16_t portid = 0;\n+\tint rc;\n+\n+\tportid = ethdev_portid_by_ip6(v6_config->ip, NULL);\n+\tif (portid < 0) {\n+\t\tprintf(\"Invalid portid found to add neigh\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tmemset(data, 0, len);\n+\n+\t/* Copy dst mac */\n+\trte_memcpy((void *)&data[0], (void *)&v6_config->mac, RTE_ETHER_ADDR_LEN);\n+\n+\t/* Copy src mac */\n+\trc = rte_eth_macaddr_get(portid, &smac);\n+\tif (rc < 0)\n+\t\treturn rc;\n+\n+\trte_memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN);\n+\n+\treturn rte_node_ip6_rewrite_add(portid, data, len, portid);\n+\n+\n+}\n+\n+static int\n+ip4_rewrite_node_add(struct neigh_ipv4_config *v4_config)\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+\tint16_t portid = 0;\n+\tint rc;\n+\n+\tportid = ethdev_portid_by_ip4(v4_config->ip, 0);\n+\tif (portid < 0) {\n+\t\tprintf(\"Invalid portid found to add  neigh\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tmemset(data, 0, len);\n+\n+\t/* Copy dst mac */\n+\trte_memcpy((void *)&data[0], (void *)&v4_config->mac, RTE_ETHER_ADDR_LEN);\n+\n+\t/* Copy src mac */\n+\trc = rte_eth_macaddr_get(portid, &smac);\n+\tif (rc < 0) {\n+\t\tprintf(\"Cannot get MAC address: err=%d, port=%d\\n\", rc, portid);\n+\t\treturn rc;\n+\t}\n+\n+\trte_memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN);\n+\n+\treturn rte_node_ip4_rewrite_add(portid, data, len, portid);\n+}\n+\n+\n+static int\n+neigh_ip4_add(uint32_t ip, uint64_t mac)\n+{\n+\tstruct neigh_ipv4_config *v4_config;\n+\tint rc = -EINVAL;\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+\t/* FIXME: Get graph status here and then update table */\n+\trc = ip4_rewrite_node_add(v4_config);\n+\tif (rc)\n+\t\tgoto free;\n+\n+\tTAILQ_INSERT_TAIL(&neigh4, v4_config, next);\n+\treturn 0;\n+free:\n+\tfree(v4_config);\n+\treturn rc;\n+}\n+\n+static int\n+neigh_ip6_add(uint8_t *ip, uint64_t mac)\n+{\n+\tstruct neigh_ipv6_config *v6_config;\n+\tint rc = -EINVAL;\n+\tint j;\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+\t/* FIXME: Get graph status here and then update table */\n+\trc =  ip6_rewrite_node_add(v6_config);\n+\tif (rc)\n+\t\tgoto free;\n+\n+\tTAILQ_INSERT_TAIL(&neigh6, v6_config, next);\n+\treturn 0;\n+free:\n+\tfree(v6_config);\n+\treturn rc;\n+}\n+\n+int\n+neigh_ip4_add_to_rewrite(void)\n+{\n+\tstruct neigh_ipv4_config *neigh;\n+\tint rc;\n+\n+\tTAILQ_FOREACH(neigh, &neigh4, next) {\n+\t\trc = ip4_rewrite_node_add(neigh);\n+\t\tif (rc)\n+\t\t\treturn rc;\n+\t}\n+\treturn 0;\n+}\n+\n+int\n+neigh_ip6_add_to_rewrite(void)\n+{\n+\tstruct neigh_ipv6_config *neigh;\n+\tint rc;\n+\n+\n+\tTAILQ_FOREACH(neigh, &neigh6, next) {\n+\t\trc = ip6_rewrite_node_add(neigh);\n+\t\tif (rc < 0)\n+\t\t\treturn rc;\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 9a4a9f9191..9ec801aa64 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+     - Yes\n+     - Yes\n+   * - neigh add ipv6 <ip> <mac>\n+     - Command to add a neighbour information into ``ipv6_rewrite`` node.\n+     - Yes\n+     - Yes\n+   * - help neigh\n+     - Command to dump neigh help message\n+     - Yes\n+     - Yes\n \n Runtime configuration\n ---------------------\n",
    "prefixes": [
        "v7",
        "08/12"
    ]
}