get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 67838,
    "url": "http://patches.dpdk.org/api/patches/67838/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200405085613.1336841-17-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": "<20200405085613.1336841-17-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200405085613.1336841-17-jerinj@marvell.com",
    "date": "2020-04-05T08:56:00",
    "name": "[v4,16/29] node: add ethdev Rx node",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "298409b0cf088de27e93cfd86f4d1c356d7b0311",
    "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/20200405085613.1336841-17-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 9203,
            "url": "http://patches.dpdk.org/api/series/9203/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=9203",
            "date": "2020-04-05T08:55:44",
            "name": "graph: introduce graph subsystem",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/9203/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/67838/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/67838/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 84E4BA0577;\n\tSun,  5 Apr 2020 10:59:50 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 81C771BEE6;\n\tSun,  5 Apr 2020 10:57:16 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id D2AAF1BED0\n for <dev@dpdk.org>; Sun,  5 Apr 2020 10:57:14 +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 0358uTep029756; Sun, 5 Apr 2020 01:57:12 -0700",
            "from sc-exch03.marvell.com ([199.233.58.183])\n by mx0a-0016f401.pphosted.com with ESMTP id 306qkqtmrs-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Sun, 05 Apr 2020 01:57:12 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com\n (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Sun, 5 Apr 2020 01:57:11 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Sun, 5 Apr 2020 01:57:11 -0700",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n by maili.marvell.com (Postfix) with ESMTP id BF5C83F7040;\n Sun,  5 Apr 2020 01:57:08 -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=AGctlAXPWT48C+I1N9EHMcKOkeDzA1aa7iVkYuo0BNw=;\n b=C1UIWk5vOm8UTyf5B2MYWgTzGIOAE3c2oliirfHi+5yx7WiBrx5B4O5S2Bmy3xdB1+gC\n v5yg/fj+kfJvAwbg2nF6UzXj4mjgG11GP6HgnIv2e52feffl5P9FppdJVxgi4OAda/0O\n 5nXTHXp2EY6l4qvuvIDCUKKjNyA+5cs2jXj3Tk0pn+GdyCA2+D/95A4Y3Z/ccsVEFJxH\n yO3zj9qeXUZ9NLxTWcX/tTL0ow3eGdU6QJAmuDFL0srRPSnooCA9C0YHDPbVpD4t9XMr\n 1CSD+E38/yekW6a/DRMelDxr934XX+TUal19mQO+YgrNdYc0+twzyeIRHaxlTWaK+HmD Vw==",
        "From": "<jerinj@marvell.com>",
        "To": "Nithin Dabilpuram <ndabilpuram@marvell.com>, Pavan Nikhilesh\n <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>",
        "Date": "Sun, 5 Apr 2020 14:26:00 +0530",
        "Message-ID": "<20200405085613.1336841-17-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200405085613.1336841-1-jerinj@marvell.com>",
        "References": "<20200331192945.2466880-1-jerinj@marvell.com>\n <20200405085613.1336841-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-05_01:2020-04-03,\n 2020-04-05 signatures=0",
        "Subject": "[dpdk-dev]  [PATCH v4 16/29] node: add ethdev Rx 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: Nithin Dabilpuram <ndabilpuram@marvell.com>\n\nAdd source rte_node ethdev_rx process function and register\nit. This node is a source node that will be called periodically\nand when called, performs rte_eth_rx_burst() on a specific\n(port, queue) pair and enqueue them as stream of objects to\nnext node.\n\nSigned-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>\nSigned-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>\nSigned-off-by: Kiran Kumar K <kirankumark@marvell.com>\n---\n lib/librte_node/Makefile         |   3 +-\n lib/librte_node/ethdev_rx.c      | 221 +++++++++++++++++++++++++++++++\n lib/librte_node/ethdev_rx_priv.h |  81 +++++++++++\n lib/librte_node/meson.build      |   4 +-\n 4 files changed, 306 insertions(+), 3 deletions(-)\n create mode 100644 lib/librte_node/ethdev_rx.c\n create mode 100644 lib/librte_node/ethdev_rx_priv.h",
    "diff": "diff --git a/lib/librte_node/Makefile b/lib/librte_node/Makefile\nindex dbc8e1d44..314149385 100644\n--- a/lib/librte_node/Makefile\n+++ b/lib/librte_node/Makefile\n@@ -11,12 +11,13 @@ 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\n+LDLIBS += -lrte_eal -lrte_graph -lrte_ethdev\n \n EXPORT_MAP := rte_node_version.map\n \n # all source are stored in SRCS-y\n SRCS-$(CONFIG_RTE_LIBRTE_NODE) += null.c\n SRCS-$(CONFIG_RTE_LIBRTE_NODE) += log.c\n+SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ethdev_rx.c\n \n include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/lib/librte_node/ethdev_rx.c b/lib/librte_node/ethdev_rx.c\nnew file mode 100644\nindex 000000000..5cc736598\n--- /dev/null\n+++ b/lib/librte_node/ethdev_rx.c\n@@ -0,0 +1,221 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2020 Marvell International Ltd.\n+ */\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_mbuf.h>\n+\n+#include \"ethdev_rx_priv.h\"\n+#include \"node_private.h\"\n+\n+static struct ethdev_rx_node_main ethdev_rx_main;\n+\n+static __rte_always_inline uint16_t\n+ethdev_rx_node_process_inline(struct rte_graph *graph, struct rte_node *node,\n+\t\t\t      uint16_t port, uint16_t queue)\n+{\n+\tuint16_t count, next_index = ETHDEV_RX_NEXT_IP4_LOOKUP;\n+\n+\t/* Get pkts from port */\n+\tcount = rte_eth_rx_burst(port, queue, (struct rte_mbuf **)node->objs,\n+\t\t\t\t RTE_GRAPH_BURST_SIZE);\n+\n+\tif (!count)\n+\t\treturn 0;\n+\tnode->idx = count;\n+\t/* Enqueue to next node */\n+\trte_node_next_stream_move(graph, node, next_index);\n+\n+\treturn count;\n+}\n+\n+static __rte_always_inline uint16_t\n+ethdev_rx_node_process(struct rte_graph *graph, struct rte_node *node,\n+\t\t       void **objs, uint16_t cnt)\n+{\n+\tethdev_rx_node_ctx_t *ctx = (ethdev_rx_node_ctx_t *)node->ctx;\n+\tuint16_t n_pkts = 0;\n+\n+\tRTE_SET_USED(objs);\n+\tRTE_SET_USED(cnt);\n+\n+\tn_pkts = ethdev_rx_node_process_inline(graph, node, ctx->port_id,\n+\t\t\t\t\t       ctx->queue_id);\n+\treturn n_pkts;\n+}\n+\n+static inline uint32_t\n+l3_ptype(uint16_t etype, uint32_t ptype)\n+{\n+\tptype = ptype & ~RTE_PTYPE_L3_MASK;\n+\tif (etype == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4))\n+\t\tptype |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;\n+\telse if (etype == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6))\n+\t\tptype |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;\n+\treturn ptype;\n+}\n+\n+/* Callback for soft ptype parsing */\n+static uint16_t\n+eth_pkt_parse_cb(uint16_t port, uint16_t queue, struct rte_mbuf **mbufs,\n+\t\t uint16_t nb_pkts, uint16_t max_pkts, void *user_param)\n+{\n+\tstruct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3;\n+\tstruct rte_ether_hdr *eth_hdr;\n+\tuint16_t etype, n_left;\n+\tstruct rte_mbuf **pkts;\n+\n+\tRTE_SET_USED(port);\n+\tRTE_SET_USED(queue);\n+\tRTE_SET_USED(max_pkts);\n+\tRTE_SET_USED(user_param);\n+\n+\tpkts = mbufs;\n+\tn_left = nb_pkts;\n+\twhile (n_left >= 12) {\n+\n+\t\t/* Prefetch next-next mbufs */\n+\t\trte_prefetch0(pkts[8]);\n+\t\trte_prefetch0(pkts[9]);\n+\t\trte_prefetch0(pkts[10]);\n+\t\trte_prefetch0(pkts[11]);\n+\n+\t\t/* Prefetch next mbuf data */\n+\t\trte_prefetch0(\n+\t\t\trte_pktmbuf_mtod(pkts[4], struct rte_ether_hdr *));\n+\t\trte_prefetch0(\n+\t\t\trte_pktmbuf_mtod(pkts[5], struct rte_ether_hdr *));\n+\t\trte_prefetch0(\n+\t\t\trte_pktmbuf_mtod(pkts[6], struct rte_ether_hdr *));\n+\t\trte_prefetch0(\n+\t\t\trte_pktmbuf_mtod(pkts[7], struct rte_ether_hdr *));\n+\n+\t\tmbuf0 = pkts[0];\n+\t\tmbuf1 = pkts[1];\n+\t\tmbuf2 = pkts[2];\n+\t\tmbuf3 = pkts[3];\n+\t\tpkts += 4;\n+\t\tn_left -= 4;\n+\n+\t\t/* Extract ptype of mbuf0 */\n+\t\teth_hdr = rte_pktmbuf_mtod(mbuf0, struct rte_ether_hdr *);\n+\t\tetype = eth_hdr->ether_type;\n+\t\tmbuf0->packet_type = l3_ptype(etype, 0);\n+\n+\t\t/* Extract ptype of mbuf1 */\n+\t\teth_hdr = rte_pktmbuf_mtod(mbuf1, struct rte_ether_hdr *);\n+\t\tetype = eth_hdr->ether_type;\n+\t\tmbuf1->packet_type = l3_ptype(etype, 0);\n+\n+\t\t/* Extract ptype of mbuf2 */\n+\t\teth_hdr = rte_pktmbuf_mtod(mbuf2, struct rte_ether_hdr *);\n+\t\tetype = eth_hdr->ether_type;\n+\t\tmbuf2->packet_type = l3_ptype(etype, 0);\n+\n+\t\t/* Extract ptype of mbuf3 */\n+\t\teth_hdr = rte_pktmbuf_mtod(mbuf3, struct rte_ether_hdr *);\n+\t\tetype = eth_hdr->ether_type;\n+\t\tmbuf3->packet_type = l3_ptype(etype, 0);\n+\t}\n+\n+\twhile (n_left > 0) {\n+\t\tmbuf0 = pkts[0];\n+\n+\t\tpkts += 1;\n+\t\tn_left -= 1;\n+\n+\t\t/* Extract ptype of mbuf0 */\n+\t\teth_hdr = rte_pktmbuf_mtod(mbuf0, struct rte_ether_hdr *);\n+\t\tetype = eth_hdr->ether_type;\n+\t\tmbuf0->packet_type = l3_ptype(etype, 0);\n+\t}\n+\n+\treturn nb_pkts;\n+}\n+\n+#define MAX_PTYPES 16\n+static int\n+ethdev_ptype_setup(uint16_t port, uint16_t queue)\n+{\n+\tuint8_t l3_ipv4 = 0, l3_ipv6 = 0;\n+\tuint32_t ptypes[MAX_PTYPES];\n+\tint i, rc;\n+\n+\t/* Check IPv4 & IPv6 ptype support */\n+\trc = rte_eth_dev_get_supported_ptypes(port, RTE_PTYPE_L3_MASK, ptypes,\n+\t\t\t\t\t      MAX_PTYPES);\n+\tfor (i = 0; i < rc; i++) {\n+\t\tif (ptypes[i] & RTE_PTYPE_L3_IPV4)\n+\t\t\tl3_ipv4 = 1;\n+\t\tif (ptypes[i] & RTE_PTYPE_L3_IPV6)\n+\t\t\tl3_ipv6 = 1;\n+\t}\n+\n+\tif (!l3_ipv4 || !l3_ipv6) {\n+\t\tnode_info(\"ethdev_rx\",\n+\t\t\t  \"Enabling ptype callback for required ptypes on port %u\\n\",\n+\t\t\t  port);\n+\n+\t\tif (!rte_eth_add_rx_callback(port, queue, eth_pkt_parse_cb,\n+\t\t\t\t\t     NULL)) {\n+\t\t\tnode_err(\"ethdev_rx\",\n+\t\t\t\t \"Failed to add rx ptype cb: port=%d, queue=%d\\n\",\n+\t\t\t\t port, queue);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+ethdev_rx_node_init(const struct rte_graph *graph, struct rte_node *node)\n+{\n+\tethdev_rx_node_ctx_t *ctx = (ethdev_rx_node_ctx_t *)node->ctx;\n+\tethdev_rx_node_elem_t *elem = ethdev_rx_main.head;\n+\n+\tRTE_SET_USED(graph);\n+\n+\twhile (elem) {\n+\t\tif (elem->nid == node->id) {\n+\t\t\t/* Update node specific context */\n+\t\t\tmemcpy(ctx, &elem->ctx, sizeof(ethdev_rx_node_ctx_t));\n+\t\t\tbreak;\n+\t\t}\n+\t\telem = elem->next;\n+\t}\n+\n+\tRTE_VERIFY(elem != NULL);\n+\n+\t/* Check and setup ptype */\n+\treturn ethdev_ptype_setup(ctx->port_id, ctx->queue_id);\n+}\n+\n+struct ethdev_rx_node_main *\n+ethdev_rx_get_node_data_get(void)\n+{\n+\treturn &ethdev_rx_main;\n+}\n+\n+static struct rte_node_register ethdev_rx_node_base = {\n+\t.process = ethdev_rx_node_process,\n+\t.flags = RTE_NODE_SOURCE_F,\n+\t.name = \"ethdev_rx\",\n+\n+\t.init = ethdev_rx_node_init,\n+\n+\t.nb_edges = ETHDEV_RX_NEXT_MAX,\n+\t.next_nodes = {[ETHDEV_RX_NEXT_IP4_LOOKUP] = \"ip4_lookup\"},\n+};\n+\n+struct rte_node_register *\n+ethdev_rx_node_get(void)\n+{\n+\treturn &ethdev_rx_node_base;\n+}\n+\n+RTE_NODE_REGISTER(ethdev_rx_node_base);\ndiff --git a/lib/librte_node/ethdev_rx_priv.h b/lib/librte_node/ethdev_rx_priv.h\nnew file mode 100644\nindex 000000000..2d7195a36\n--- /dev/null\n+++ b/lib/librte_node/ethdev_rx_priv.h\n@@ -0,0 +1,81 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2020 Marvell International Ltd.\n+ */\n+#ifndef __INCLUDE_ETHDEV_RX_PRIV_H__\n+#define __INCLUDE_ETHDEV_RX_PRIV_H__\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <rte_common.h>\n+\n+struct ethdev_rx_node_elem;\n+struct ethdev_rx_node_ctx;\n+typedef struct ethdev_rx_node_elem ethdev_rx_node_elem_t;\n+typedef struct ethdev_rx_node_ctx ethdev_rx_node_ctx_t;\n+\n+/**\n+ * @internal\n+ *\n+ * Ethernet device Rx node context structure.\n+ */\n+struct ethdev_rx_node_ctx {\n+\tuint16_t port_id;  /**< Port identifier of the Rx node. */\n+\tuint16_t queue_id; /**< Queue identifier of the Rx node. */\n+};\n+\n+/**\n+ * @internal\n+ *\n+ * Ethernet device Rx node list element structure.\n+ */\n+struct ethdev_rx_node_elem {\n+\tstruct ethdev_rx_node_elem *next;\n+\t/**< Pointer to the next Rx node element. */\n+\tstruct ethdev_rx_node_ctx ctx;\n+\t/**< Rx node context. */\n+\trte_node_t nid;\n+\t/**< Node identifier of the Rx node. */\n+};\n+\n+enum ethdev_rx_next_nodes {\n+\tETHDEV_RX_NEXT_IP4_LOOKUP,\n+\tETHDEV_RX_NEXT_MAX,\n+};\n+\n+/**\n+ * @internal\n+ *\n+ * Ethernet Rx node main structure.\n+ */\n+struct ethdev_rx_node_main {\n+\tethdev_rx_node_elem_t *head;\n+\t/**< Pointer to the head Rx node element. */\n+};\n+\n+/**\n+ * @internal\n+ *\n+ * Get the Ethernet Rx node data.\n+ *\n+ * @return\n+ *   Pointer to Ethernet Rx node data.\n+ */\n+struct ethdev_rx_node_main *ethdev_rx_get_node_data_get(void);\n+\n+/**\n+ * @internal\n+ *\n+ * Get the Ethernet Rx node.\n+ *\n+ * @retrun\n+ *   Pointer to the Ethernet Rx node.\n+ */\n+struct rte_node_register *ethdev_rx_node_get(void);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* __INCLUDE_ETHDEV_RX_PRIV_H__ */\ndiff --git a/lib/librte_node/meson.build b/lib/librte_node/meson.build\nindex a97813ad4..94caa6c23 100644\n--- a/lib/librte_node/meson.build\n+++ b/lib/librte_node/meson.build\n@@ -1,8 +1,8 @@\n # SPDX-License-Identifier: BSD-3-Clause\n # Copyright(C) 2020 Marvell International Ltd.\n \n-sources = files('null.c', 'log.c')\n+sources = files('null.c', 'log.c', 'ethdev_rx.c')\n allow_experimental_apis = true\n # Strict-aliasing rules are violated by uint8_t[] to context size casts.\n cflags += '-fno-strict-aliasing'\n-deps += ['graph']\n+deps += ['graph', 'ethdev']\n",
    "prefixes": [
        "v4",
        "16/29"
    ]
}