get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68209,
    "url": "http://patches.dpdk.org/api/patches/68209/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200411141428.1987768-20-jerinj@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": "<20200411141428.1987768-20-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200411141428.1987768-20-jerinj@marvell.com",
    "date": "2020-04-11T14:14:18",
    "name": "[v5,19/29] node: add generic ipv4 lookup node",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "445a45f5385db67170ed66d86d54a15163a6341c",
    "submitter": {
        "id": 1188,
        "url": "http://patches.dpdk.org/api/people/1188/?format=api",
        "name": "Jerin Jacob Kollanukkaran",
        "email": "jerinj@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/20200411141428.1987768-20-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 9314,
            "url": "http://patches.dpdk.org/api/series/9314/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=9314",
            "date": "2020-04-11T14:13:59",
            "name": "graph: introduce graph subsystem",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/9314/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/68209/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/68209/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 699D7A059F;\n\tSat, 11 Apr 2020 16:18:23 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C7C8B1D152;\n\tSat, 11 Apr 2020 16:15:52 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id CE9521C1D0\n for <dev@dpdk.org>; Sat, 11 Apr 2020 16:15:49 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n 03BEFeqk021963; Sat, 11 Apr 2020 07:15:47 -0700",
            "from sc-exch04.marvell.com ([199.233.58.184])\n by mx0a-0016f401.pphosted.com with ESMTP id 30bb8q8n72-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Sat, 11 Apr 2020 07:15:47 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH04.marvell.com\n (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Sat, 11 Apr 2020 07:15:46 -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.2;\n Sat, 11 Apr 2020 07:15:45 -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.2 via Frontend\n Transport; Sat, 11 Apr 2020 07:15:45 -0700",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n by maili.marvell.com (Postfix) with ESMTP id AD60F3F7040;\n Sat, 11 Apr 2020 07:15:41 -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=pfpt0818;\n bh=0L8SACijcRI80rLxlGBB5QukrrrdDP3TTpYYqE92SZw=;\n b=snnzai44MHWU02Xgp4CTTqtS4W0UIrTYCERhqcc12/tyudDxoxKklnNWo0cIh6GrEDIw\n vXrLNfTDG71qmLeoLI0LaWhLbGTnJeqaI3CtrBs9jpf3GBVaOXwRj+d/r4vslDF1YU7f\n pZmqyxlYCU3SQjgGshFMtpJGRwth1g21CAa+Z+ie0fAyDErlA5JkAVj3HpgAVa4LxDE2\n peTx0utntwyQxcYXrnLRrMJAZsfC2rukYou3nCVawMSu8U9RE/Pad6i0YUfojfHjw5vU\n gGy/bzkCwEhqoh8DKSPjl3++Es9wLW4hX+u89j3vAybHFm5Ra5awKM4Fgc8uRL0gWNNq VA==",
        "From": "<jerinj@marvell.com>",
        "To": "John McNamara <john.mcnamara@intel.com>, Marko Kovacevic\n <marko.kovacevic@intel.com>, Nithin Dabilpuram <ndabilpuram@marvell.com>,\n Pavan Nikhilesh <pbhagavatula@marvell.com>",
        "CC": "<dev@dpdk.org>, <thomas@monjalon.net>, <david.marchand@redhat.com>,\n <mdr@ashroe.eu>, <mattias.ronnblom@ericsson.com>,\n <kirankumark@marvell.com>, <xiao.w.wang@intel.com>, <amo@semihalf.com>",
        "Date": "Sat, 11 Apr 2020 19:44:18 +0530",
        "Message-ID": "<20200411141428.1987768-20-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200411141428.1987768-1-jerinj@marvell.com>",
        "References": "<20200405085613.1336841-1-jerinj@marvell.com>\n <20200411141428.1987768-1-jerinj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676\n definitions=2020-04-11_04:2020-04-09,\n 2020-04-11 signatures=0",
        "Subject": "[dpdk-dev]  [PATCH v5 19/29] node: add generic ipv4 lookup node",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Pavan Nikhilesh <pbhagavatula@marvell.com>\n\nAdd IPv4 lookup process function for ip4_lookup node.\nThis node performs LPM lookup using simple RTE_LPM API on every packet\nreceived and forwards it to a next node that is identified by lookup\nresult.\n\nSigned-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>\nSigned-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>\n---\n doc/api/doxy-api-index.md          |   1 +\n lib/librte_node/Makefile           |   4 +-\n lib/librte_node/ip4_lookup.c       | 128 +++++++++++++++++++++++++++++\n lib/librte_node/meson.build        |   5 +-\n lib/librte_node/rte_node_ip4_api.h |  40 +++++++++\n 5 files changed, 175 insertions(+), 3 deletions(-)\n create mode 100644 lib/librte_node/ip4_lookup.c\n create mode 100644 lib/librte_node/rte_node_ip4_api.h",
    "diff": "diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md\nindex 1784674df..3908fddde 100644\n--- a/doc/api/doxy-api-index.md\n+++ b/doc/api/doxy-api-index.md\n@@ -163,6 +163,7 @@ The public API headers are grouped by topics:\n     [graph_worker]     (@ref rte_graph_worker.h)\n   * graph_nodes:\n     [eth_node]         (@ref rte_node_eth_api.h),\n+    [ip4_node]         (@ref rte_node_ip4_api.h)\n \n - **basic**:\n   [approx fraction]    (@ref rte_approx.h),\ndiff --git a/lib/librte_node/Makefile b/lib/librte_node/Makefile\nindex ea5fa77f7..ad3f2e349 100644\n--- a/lib/librte_node/Makefile\n+++ b/lib/librte_node/Makefile\n@@ -11,7 +11,7 @@ CFLAGS += -O3 -DALLOW_EXPERIMENTAL_API\n CFLAGS += $(WERROR_FLAGS)\n # Strict-aliasing rules are violated by uint8_t[] to context size casts.\n CFLAGS += -fno-strict-aliasing\n-LDLIBS += -lrte_eal -lrte_graph -lrte_mbuf -lrte_ethdev -lrte_mempool\n+LDLIBS += -lrte_eal -lrte_graph -lrte_mbuf -lrte_lpm -lrte_ethdev -lrte_mempool\n \n EXPORT_MAP := rte_node_version.map\n \n@@ -21,8 +21,10 @@ SRCS-$(CONFIG_RTE_LIBRTE_NODE) += log.c\n SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ethdev_rx.c\n SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ethdev_tx.c\n SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ethdev_ctrl.c\n+SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ip4_lookup.c\n \n # install header files\n+SYMLINK-$(CONFIG_RTE_LIBRTE_NODE)-include += rte_node_ip4_api.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_NODE)-include += rte_node_eth_api.h\n \n include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c\nnew file mode 100644\nindex 000000000..988bc5e0c\n--- /dev/null\n+++ b/lib/librte_node/ip4_lookup.c\n@@ -0,0 +1,128 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2020 Marvell International Ltd.\n+ */\n+\n+#include <arpa/inet.h>\n+#include <sys/socket.h>\n+\n+#include <rte_debug.h>\n+#include <rte_ethdev.h>\n+#include <rte_ether.h>\n+#include <rte_graph.h>\n+#include <rte_graph_worker.h>\n+#include <rte_ip.h>\n+#include <rte_lpm.h>\n+#include <rte_mbuf.h>\n+#include <rte_tcp.h>\n+#include <rte_udp.h>\n+\n+#include \"rte_node_ip4_api.h\"\n+\n+#include \"node_private.h\"\n+\n+#define IPV4_L3FWD_LPM_MAX_RULES 1024\n+#define IPV4_L3FWD_LPM_NUMBER_TBL8S (1 << 8)\n+\n+/* IP4 Lookup global data struct */\n+struct ip4_lookup_node_main {\n+\tstruct rte_lpm *lpm_tbl[RTE_MAX_NUMA_NODES];\n+};\n+\n+static uint16_t\n+ip4_lookup_node_process(struct rte_graph *graph, struct rte_node *node,\n+\t\t\tvoid **objs, uint16_t nb_objs)\n+{\n+\tstruct rte_ipv4_hdr *ipv4_hdr;\n+\tvoid **to_next, **from;\n+\tuint16_t last_spec = 0;\n+\tstruct rte_mbuf *mbuf;\n+\trte_edge_t next_index;\n+\tstruct rte_lpm *lpm;\n+\tuint16_t held = 0;\n+\tuint32_t drop_nh;\n+\tint i, rc;\n+\n+\t/* Speculative next */\n+\tnext_index = RTE_NODE_IP4_LOOKUP_NEXT_REWRITE;\n+\t/* Drop node */\n+\tdrop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16;\n+\n+\t/* Get socket specific LPM from ctx */\n+\tlpm = *((struct rte_lpm **)node->ctx);\n+\tfrom = objs;\n+\n+\t/* Get stream for the speculated next node */\n+\tto_next = rte_node_next_stream_get(graph, node, next_index, nb_objs);\n+\tfor (i = 0; i < nb_objs; i++) {\n+\t\tuint32_t next_hop;\n+\t\tuint16_t next;\n+\n+\t\tmbuf = (struct rte_mbuf *)objs[i];\n+\n+\t\t/* Extract DIP of mbuf0 */\n+\t\tipv4_hdr = rte_pktmbuf_mtod_offset(mbuf, struct rte_ipv4_hdr *,\n+\t\t\t\tsizeof(struct rte_ether_hdr));\n+\t\t/* Extract cksum, ttl as ipv4 hdr is in cache */\n+\t\tnode_mbuf_priv1(mbuf)->cksum = ipv4_hdr->hdr_checksum;\n+\t\tnode_mbuf_priv1(mbuf)->ttl = ipv4_hdr->time_to_live;\n+\n+\t\trc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr),\n+\t\t\t\t    &next_hop);\n+\t\tnext_hop = (rc == 0) ? next_hop : drop_nh;\n+\n+\t\tnode_mbuf_priv1(mbuf)->nh = (uint16_t)next_hop;\n+\t\tnext_hop = next_hop >> 16;\n+\t\tnext = (uint16_t)next_hop;\n+\n+\t\tif (unlikely(next_index != next)) {\n+\t\t\t/* Copy things successfully speculated till now */\n+\t\t\trte_memcpy(to_next, from, last_spec * sizeof(from[0]));\n+\t\t\tfrom += last_spec;\n+\t\t\tto_next += last_spec;\n+\t\t\theld += last_spec;\n+\t\t\tlast_spec = 0;\n+\n+\t\t\trte_node_enqueue_x1(graph, node, next, from[0]);\n+\t\t\tfrom += 1;\n+\t\t} else {\n+\t\t\tlast_spec += 1;\n+\t\t}\n+\t}\n+\n+\t/* !!! Home run !!! */\n+\tif (likely(last_spec == nb_objs)) {\n+\t\trte_node_next_stream_move(graph, node, next_index);\n+\t\treturn nb_objs;\n+\t}\n+\theld += last_spec;\n+\trte_memcpy(to_next, from, last_spec * sizeof(from[0]));\n+\trte_node_next_stream_put(graph, node, next_index, held);\n+\n+\treturn nb_objs;\n+}\n+\n+static int\n+ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)\n+{\n+\tRTE_SET_USED(graph);\n+\tRTE_SET_USED(node);\n+\n+\tnode_dbg(\"ip4_lookup\", \"Initialized ip4_lookup node\");\n+\n+\treturn 0;\n+}\n+\n+static struct rte_node_register ip4_lookup_node = {\n+\t.process = ip4_lookup_node_process,\n+\t.name = \"ip4_lookup\",\n+\n+\t.init = ip4_lookup_node_init,\n+\n+\t.nb_edges = RTE_NODE_IP4_LOOKUP_NEXT_MAX,\n+\t.next_nodes = {\n+\t\t[RTE_NODE_IP4_LOOKUP_NEXT_REWRITE] = \"ip4_rewrite\",\n+\t\t[RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP] = \"pkt_drop\",\n+\t},\n+};\n+\n+RTE_NODE_REGISTER(ip4_lookup_node);\ndiff --git a/lib/librte_node/meson.build b/lib/librte_node/meson.build\nindex af2eb2d91..702d21a24 100644\n--- a/lib/librte_node/meson.build\n+++ b/lib/librte_node/meson.build\n@@ -1,8 +1,9 @@\n # SPDX-License-Identifier: BSD-3-Clause\n # Copyright(C) 2020 Marvell International Ltd.\n \n-sources = files('null.c', 'log.c', 'ethdev_rx.c', 'ethdev_tx.c', 'ethdev_ctrl.c')\n-headers = files('rte_node_eth_api.h')\n+sources = files('null.c', 'log.c', 'ethdev_rx.c', 'ethdev_tx.c', 'ip4_lookup.c',\n+\t\t'ethdev_ctrl.c')\n+headers = files('rte_node_ip4_api.h', 'rte_node_eth_api.h')\n allow_experimental_apis = true\n # Strict-aliasing rules are violated by uint8_t[] to context size casts.\n cflags += '-fno-strict-aliasing'\ndiff --git a/lib/librte_node/rte_node_ip4_api.h b/lib/librte_node/rte_node_ip4_api.h\nnew file mode 100644\nindex 000000000..0b9ba48a2\n--- /dev/null\n+++ b/lib/librte_node/rte_node_ip4_api.h\n@@ -0,0 +1,40 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2020 Marvell International Ltd.\n+ */\n+\n+#ifndef __INCLUDE_RTE_NODE_IP4_API_H__\n+#define __INCLUDE_RTE_NODE_IP4_API_H__\n+\n+/**\n+ * @file rte_node_ip4_api.h\n+ *\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * This API allows to do control path functions of ip4_* nodes\n+ * like ip4_lookup, ip4_rewrite.\n+ *\n+ */\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <rte_common.h>\n+\n+/**\n+ * IP4 lookup next nodes.\n+ */\n+enum rte_node_ip4_lookup_next {\n+\tRTE_NODE_IP4_LOOKUP_NEXT_REWRITE,\n+\t/**< Rewrite node. */\n+\tRTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP,\n+\t/**< Packet drop node. */\n+\tRTE_NODE_IP4_LOOKUP_NEXT_MAX,\n+\t/**< Number of next nodes of lookup node. */\n+};\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* __INCLUDE_RTE_NODE_IP4_API_H__ */\n",
    "prefixes": [
        "v5",
        "19/29"
    ]
}