get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 67840,
    "url": "https://patches.dpdk.org/api/patches/67840/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200405085613.1336841-19-jerinj@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": "<20200405085613.1336841-19-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200405085613.1336841-19-jerinj@marvell.com",
    "date": "2020-04-05T08:56:02",
    "name": "[v4,18/29] node: add ethdev Rx and Tx node ctrl API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4cec1c1536e1a6100ed80afa523f6d49aee6e242",
    "submitter": {
        "id": 1188,
        "url": "https://patches.dpdk.org/api/people/1188/?format=api",
        "name": "Jerin Jacob Kollanukkaran",
        "email": "jerinj@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/20200405085613.1336841-19-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 9203,
            "url": "https://patches.dpdk.org/api/series/9203/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=9203",
            "date": "2020-04-05T08:55:44",
            "name": "graph: introduce graph subsystem",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/9203/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/67840/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/67840/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 1EC6FA0577;\n\tSun,  5 Apr 2020 11:00:22 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 33C411C0CE;\n\tSun,  5 Apr 2020 10:57:25 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id B83671BEE3\n for <dev@dpdk.org>; Sun,  5 Apr 2020 10:57:23 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n 0358goxk019798; Sun, 5 Apr 2020 01:57:22 -0700",
            "from sc-exch04.marvell.com ([199.233.58.184])\n by mx0b-0016f401.pphosted.com with ESMTP id 306srm29vu-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Sun, 05 Apr 2020 01:57:22 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH04.marvell.com\n (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Sun, 5 Apr 2020 01:57:19 -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; Sun, 5 Apr 2020 01:57:20 -0700",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n by maili.marvell.com (Postfix) with ESMTP id A73193F7040;\n Sun,  5 Apr 2020 01:57:16 -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=WvgZ0Y/P4rxi0ULjl61HEgsJgl5ePRX3iFa3Dhqs3gs=;\n b=EZ/fbPzWkp0TYBWHlOJIrFWIQhwL5yolNEvd6m7sc2z2uU0PPiupmtjBk+e4SQQxPDdE\n 1tOTCmkMYq6nST0otyNiJVNKPqBW1dxoSzRsV3rS8ix6tgpG0N+1u72IA1RuaiygXhbn\n qr/KAlYrscHwkgNH+o+buQa6fc4uy15GnT3n7sUm/pnMgpWRG7jBXyduo2qWsZpnHiai\n ekVJhmEW2Xe49daoMDvizl6N68SW7Z4vLo/AoGpHU5fo7EcILTDrXPZVNsuYjYdi9jJL\n lm1ixdXM9VQ51TKwqvcoBPp40b6GMKnjvzC/tNegL6qRvrxM1ELNZdLPpmQnVH4dPRTu og==",
        "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>",
        "Date": "Sun, 5 Apr 2020 14:26:02 +0530",
        "Message-ID": "<20200405085613.1336841-19-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-04_19:2020-04-03,\n 2020-04-04 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v4 18/29] node: add ethdev Rx and Tx node ctrl API",
        "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 ctrl api to setup ethdev_rx and ethdev_tx node.\nThis ctrl api clones 'N' number of ethdev_rx and ethdev_tx\nnodes with specific (port, queue) pairs updated in their context.\nAll the ethdev ports and queues are setup before this api\nis called.\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 doc/api/doxy-api-index.md            |   2 +\n lib/librte_node/Makefile             |   6 +-\n lib/librte_node/ethdev_ctrl.c        | 100 +++++++++++++++++++++++++++\n lib/librte_node/meson.build          |   5 +-\n lib/librte_node/node_private.h       |  74 ++++++++++++++++++++\n lib/librte_node/rte_node_eth_api.h   |  70 +++++++++++++++++++\n lib/librte_node/rte_node_version.map |   1 +\n 7 files changed, 255 insertions(+), 3 deletions(-)\n create mode 100644 lib/librte_node/ethdev_ctrl.c\n create mode 100644 lib/librte_node/rte_node_eth_api.h",
    "diff": "diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md\nindex fd2ff64d7..1784674df 100644\n--- a/doc/api/doxy-api-index.md\n+++ b/doc/api/doxy-api-index.md\n@@ -161,6 +161,8 @@ The public API headers are grouped by topics:\n     [table_action]     (@ref rte_table_action.h)\n   * [graph]            (@ref rte_graph.h):\n     [graph_worker]     (@ref rte_graph_worker.h)\n+  * graph_nodes:\n+    [eth_node]         (@ref rte_node_eth_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 7428f6c43..ea5fa77f7 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\n+LDLIBS += -lrte_eal -lrte_graph -lrte_mbuf -lrte_ethdev -lrte_mempool\n \n EXPORT_MAP := rte_node_version.map\n \n@@ -20,5 +20,9 @@ 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 SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ethdev_tx.c\n+SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ethdev_ctrl.c\n+\n+# install header files\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/ethdev_ctrl.c b/lib/librte_node/ethdev_ctrl.c\nnew file mode 100644\nindex 000000000..b2ac5e2c4\n--- /dev/null\n+++ b/lib/librte_node/ethdev_ctrl.c\n@@ -0,0 +1,100 @@\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+\n+#include \"rte_node_eth_api.h\"\n+\n+#include \"ethdev_rx_priv.h\"\n+#include \"ethdev_tx_priv.h\"\n+#include \"node_private.h\"\n+\n+static struct ethdev_ctrl {\n+\tuint16_t nb_graphs;\n+} ctrl;\n+\n+int\n+rte_node_eth_config(struct rte_node_ethdev_config *conf, uint16_t nb_confs,\n+\t\t    uint16_t nb_graphs)\n+{\n+\tstruct ethdev_tx_node_main *tx_node_data;\n+\tuint16_t tx_q_used, rx_q_used, port_id;\n+\tstruct rte_node_register *tx_node;\n+\tchar name[RTE_NODE_NAMESIZE];\n+\tstruct rte_mempool *mp;\n+\tuint32_t id;\n+\tint i, j;\n+\n+\ttx_node_data = ethdev_tx_node_data_get();\n+\ttx_node = ethdev_tx_node_get();\n+\tfor (i = 0; i < nb_confs; i++) {\n+\t\tport_id = conf[i].port_id;\n+\n+\t\tif (!rte_eth_dev_is_valid_port(port_id))\n+\t\t\treturn -EINVAL;\n+\n+\t\t/* Check for mbuf minimum private size requirement */\n+\t\tfor (j = 0; j < conf[i].mp_count; j++) {\n+\t\t\tmp = conf[i].mp[j];\n+\t\t\tif (!mp)\n+\t\t\t\tcontinue;\n+\t\t\t/* Check for minimum private space */\n+\t\t\tif (rte_pktmbuf_priv_size(mp) <\n+\t\t\t    RTE_NODE_MBUF_PRIV2_SIZE) {\n+\t\t\t\tnode_err(\"ethdev\",\n+\t\t\t\t\t \"Minimum mbuf priv size requirement not met by mp %s\",\n+\t\t\t\t\t mp->name);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t}\n+\n+\t\trx_q_used = conf[i].num_rx_queues;\n+\t\ttx_q_used = conf[i].num_tx_queues;\n+\t\t/* Check if we have a txq for each worker */\n+\t\tif (tx_q_used < nb_graphs)\n+\t\t\treturn -EINVAL;\n+\n+\t\t/* Create node for each rx port queue pair */\n+\t\tfor (j = 0; j < rx_q_used; j++) {\n+\t\t\tstruct ethdev_rx_node_main *rx_node_data;\n+\t\t\tstruct rte_node_register *rx_node;\n+\t\t\tethdev_rx_node_elem_t *elem;\n+\n+\t\t\trx_node_data = ethdev_rx_get_node_data_get();\n+\t\t\trx_node = ethdev_rx_node_get();\n+\t\t\tsnprintf(name, sizeof(name), \"%u-%u\", port_id, j);\n+\t\t\t/* Clone a new rx node with same edges as parent */\n+\t\t\tid = rte_node_clone(rx_node->id, name);\n+\t\t\tif (id == RTE_NODE_ID_INVALID)\n+\t\t\t\treturn -EIO;\n+\n+\t\t\t/* Add it to list of ethdev rx nodes for lookup */\n+\t\t\telem = malloc(sizeof(ethdev_rx_node_elem_t));\n+\t\t\tmemset(elem, 0, sizeof(ethdev_rx_node_elem_t));\n+\t\t\telem->ctx.port_id = port_id;\n+\t\t\telem->ctx.queue_id = j;\n+\t\t\telem->nid = id;\n+\t\t\telem->next = rx_node_data->head;\n+\t\t\trx_node_data->head = elem;\n+\n+\t\t\tnode_dbg(\"ethdev\", \"Rx node %s-%s: is at %u\",\n+\t\t\t\t rx_node->name, name, id);\n+\t\t}\n+\n+\t\t/* Create a per port tx node from base node */\n+\t\tsnprintf(name, sizeof(name), \"%u\", port_id);\n+\t\t/* Clone a new node with same edges as parent */\n+\t\tid = rte_node_clone(tx_node->id, name);\n+\t\ttx_node_data->nodes[port_id] = id;\n+\n+\t\tnode_dbg(\"ethdev\", \"Tx node %s-%s: is at %u\", tx_node->name,\n+\t\t\t name, id);\n+\t}\n+\n+\tctrl.nb_graphs = nb_graphs;\n+\treturn 0;\n+}\ndiff --git a/lib/librte_node/meson.build b/lib/librte_node/meson.build\nindex 505c76abd..af2eb2d91 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')\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 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', 'mbuf', 'ethdev']\n+deps += ['graph', 'mbuf', 'lpm', 'ethdev', 'mempool', 'cryptodev']\ndiff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h\nindex f30902a94..141448546 100644\n--- a/lib/librte_node/node_private.h\n+++ b/lib/librte_node/node_private.h\n@@ -6,7 +6,9 @@\n #define __NODE_PRIVATE_H__\n \n #include <rte_common.h>\n+#include <rte_crypto.h>\n #include <rte_log.h>\n+#include <rte_mbuf.h>\n \n extern int rte_node_logtype;\n #define NODE_LOG(level, node_name, ...)                                        \\\n@@ -19,4 +21,76 @@ extern int rte_node_logtype;\n #define node_info(node_name, ...) NODE_LOG(INFO, node_name, __VA_ARGS__)\n #define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Node mbuf private data to store next hop, ttl and checksum.\n+ */\n+struct rte_node_mbuf_priv1 {\n+\tunion {\n+\t\t/* IP4 rewrite */\n+\t\tstruct {\n+\t\t\tuint16_t nh;\n+\t\t\tuint16_t ttl;\n+\t\t\tuint32_t cksum;\n+\t\t};\n+\n+\t\tuint64_t u;\n+\t};\n+};\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Node mbuf private data to store crypto operation.\n+ */\n+struct rte_node_mbuf_priv2 {\n+\tunion {\n+\t\t/* Sym crypto */\n+\t\tstruct {\n+\t\t\tstruct rte_crypto_op op;\n+\t\t};\n+\t};\n+} __rte_cache_aligned;\n+\n+#define RTE_NODE_MBUF_PRIV2_SIZE sizeof(struct rte_node_mbuf_priv2)\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Get mbuf_priv1 pointer from rte_mbuf.\n+ *\n+ * @param\n+ *   Pointer to the rte_mbuf.\n+ *\n+ * @return\n+ *   Pointer to the mbuf_priv1.\n+ */\n+static __rte_always_inline struct rte_node_mbuf_priv1 *\n+rte_node_mbuf_priv1(struct rte_mbuf *m)\n+{\n+\treturn (struct rte_node_mbuf_priv1 *)&m->udata64;\n+}\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Get mbuf_priv2 pointer from rte_mbuf.\n+ *\n+ * @param\n+ *   Pointer to the rte_mbuf.\n+ *\n+ * @return\n+ *   Pointer to the mbuf_priv2.\n+ */\n+static __rte_always_inline struct rte_node_mbuf_priv2 *\n+rte_node_mbuf_priv2(struct rte_mbuf *m)\n+{\n+\treturn (struct rte_node_mbuf_priv2 *)rte_mbuf_to_priv(m);\n+}\n+\n #endif /* __NODE_PRIVATE_H__ */\ndiff --git a/lib/librte_node/rte_node_eth_api.h b/lib/librte_node/rte_node_eth_api.h\nnew file mode 100644\nindex 000000000..39b31b45b\n--- /dev/null\n+++ b/lib/librte_node/rte_node_eth_api.h\n@@ -0,0 +1,70 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2020 Marvell International Ltd.\n+ */\n+\n+#ifndef __INCLUDE_RTE_NODE_ETH_API_H__\n+#define __INCLUDE_RTE_NODE_ETH_API_H__\n+\n+/**\n+ * @file rte_node_eth_api.h\n+ *\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * This API allows to setup ethdev_rx and ethdev_tx nodes\n+ * and its queue associations.\n+ *\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <rte_common.h>\n+#include <rte_mempool.h>\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Port config for ethdev_rx and ethdev_tx node.\n+ */\n+struct rte_node_ethdev_config {\n+\tuint16_t port_id;\n+\t/**< Port identifier */\n+\tuint16_t num_rx_queues;\n+\t/**< Number of Rx queues. */\n+\tuint16_t num_tx_queues;\n+\t/**< Number of Tx queues. */\n+\tstruct rte_mempool **mp;\n+\t/**< Array of mempools associated to Rx queue. */\n+\tuint16_t mp_count;\n+\t/**< Size of mp array. */\n+};\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Initializes ethdev nodes.\n+ *\n+ * @param cfg\n+ *   Array of ethdev config that identifies which port's\n+ *   ethdev_rx and ethdev_tx nodes need to be created\n+ *   and queue association.\n+ * @param cnt\n+ *   Size of cfg array.\n+ * @param nb_graphs\n+ *   Number of graphs that will be used.\n+ *\n+ * @return\n+ *   0 on successful initialization, negative otherwise.\n+ */\n+__rte_experimental\n+int rte_node_eth_config(struct rte_node_ethdev_config *cfg,\n+\t\t\tuint16_t cnt, uint16_t nb_graphs);\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* __INCLUDE_RTE_NODE_ETH_API_H__ */\ndiff --git a/lib/librte_node/rte_node_version.map b/lib/librte_node/rte_node_version.map\nindex f87163bb9..c6c71bd02 100644\n--- a/lib/librte_node/rte_node_version.map\n+++ b/lib/librte_node/rte_node_version.map\n@@ -1,6 +1,7 @@\n EXPERIMENTAL {\n \tglobal:\n \n+\trte_node_eth_config;\n \trte_node_logtype;\n \tlocal: *;\n };\n",
    "prefixes": [
        "v4",
        "18/29"
    ]
}