get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 133025,
    "url": "http://patchwork.dpdk.org/api/patches/133025/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20231019173011.1186656-9-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-9-skori@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231019173011.1186656-9-skori@marvell.com",
    "date": "2023-10-19T17:30:07",
    "name": "[v11,08/12] app/graph: support neigh command line interfaces",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "3ce32b3983fba3ee03d5e4b3cab29a695606474d",
    "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-9-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/133025/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/133025/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 CE75E431B0;\n\tThu, 19 Oct 2023 19:31:26 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6787042E0D;\n\tThu, 19 Oct 2023 19:30:39 +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 5E25342DC0\n for <dev@dpdk.org>; Thu, 19 Oct 2023 19:30: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 39JCcSYo008128 for <dev@dpdk.org>; Thu, 19 Oct 2023 10:30:34 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ttshubs7p-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Thu, 19 Oct 2023 10:30:34 -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 Thu, 19 Oct 2023 10:30:32 -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, 19 Oct 2023 10:30:32 -0700",
            "from localhost.localdomain (unknown [10.28.34.25])\n by maili.marvell.com (Postfix) with ESMTP id 806423F7097;\n Thu, 19 Oct 2023 10:30: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=AwvdAJ9HmDFp8ZwNizJyZ+00GE8uA55Tunj3QZDppz4=;\n b=f29BJmoAvA8XXkl7U2Gpqa2kEf8cbqDh6kwB7QonlWPszhAFH/b9Cm1IkPrwhVYsyO5G\n qJOOkmxVEBcZ+3vhGLrAF6EGeMMYTl6IQpyijx0OK0YhFrX3p1URFriwXGOm5Mykl4Z7\n p9HNahvl8wmZn3LZLo1S+3gN4jugdIgqpiUlnjArGlozaaAXeSl95ps6zG0Z9VwH/EQp\n /CxBcgYxof4VnbLOGqAwQ4qC68qBzp1JNnaVjMi9UorGE8EIPqGfcHewf1qf0c4tEyNZ\n yeQUKxJ9GZZE67TM7mrzLI/okUByXCtHghhIiBMYm1u9DhdPTAdyprQ4q9WkYUM64YEh SQ==",
        "From": "<skori@marvell.com>",
        "To": "Sunil Kumar Kori <skori@marvell.com>, Rakesh Kudurumalla\n <rkudurumalla@marvell.com>",
        "CC": "<dev@dpdk.org>",
        "Subject": "[PATCH v11 08/12] app/graph: support neigh command line interfaces",
        "Date": "Thu, 19 Oct 2023 23:00:07 +0530",
        "Message-ID": "<20231019173011.1186656-9-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": "A4irGtoi98FbQir752RVdW_uUh9dsOtw",
        "X-Proofpoint-ORIG-GUID": "A4irGtoi98FbQir752RVdW_uUh9dsOtw",
        "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: Sunil Kumar Kori <skori@marvell.com>\n\nAdds 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          | 358 +++++++++++++++++++++++++++++++++++++\n app/graph/neigh.h          |  17 ++\n app/graph/neigh_priv.h     |  49 +++++\n doc/guides/tools/graph.rst |  11 ++\n 8 files changed, 443 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 1280422388..f564362da1 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 e3f9ee3e0c..c9b09168c1 100644\n--- a/app/graph/ethdev.c\n+++ b/app/graph/ethdev.c\n@@ -166,6 +166,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 413bbefc4e..8fa9d605b9 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..0cee502719\n--- /dev/null\n+++ b/app/graph/neigh.c\n@@ -0,0 +1,358 @@\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;\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+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;\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 56c2eaad26..b1bd2e6048 100644\n--- a/doc/guides/tools/graph.rst\n+++ b/doc/guides/tools/graph.rst\n@@ -130,6 +130,17 @@ file to express the requested use case configuration.\n    | help ipv6_lookup                     | | Command to dump ``ipv6_lookup`` |   Yes   |    Yes   |\n    |                                      | | help message.                   |         |          |\n    +--------------------------------------+-----------------------------------+---------+----------+\n+   | neigh add ipv4 <ip> <mac>            | | Command to add a neighbour      |   Yes   |    Yes   |\n+   |                                      | | information into                |         |          |\n+   |                                      | | ``ipv4_rewrite`` node.          |         |          |\n+   +--------------------------------------+-----------------------------------+---------+----------+\n+   | neigh add ipv6 <ip> <mac>            | | Command to add a neighbour      |   Yes   |    Yes   |\n+   |                                      | | information into                |         |          |\n+   |                                      | | ``ipv6_rewrite`` node.          |         |          |\n+   +--------------------------------------+-----------------------------------+---------+----------+\n+   | help neigh                           | | Command to dump neigh help      |   Yes   |    Yes   |\n+   |                                      | | message.                        |         |          |\n+   +--------------------------------------+-----------------------------------+---------+----------+\n \n Runtime configuration\n ---------------------\n",
    "prefixes": [
        "v11",
        "08/12"
    ]
}