get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 125580,
    "url": "http://patches.dpdk.org/api/patches/125580/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230329064340.2550530-10-zhirun.yan@intel.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": "<20230329064340.2550530-10-zhirun.yan@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230329064340.2550530-10-zhirun.yan@intel.com",
    "date": "2023-03-29T06:43:34",
    "name": "[v3,09/15] graph: introduce stream moving cross cores",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "746fab0a8bc12e1a8e1b91b0fef7374cb2ca7651",
    "submitter": {
        "id": 1154,
        "url": "http://patches.dpdk.org/api/people/1154/?format=api",
        "name": "Yan, Zhirun",
        "email": "zhirun.yan@intel.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/20230329064340.2550530-10-zhirun.yan@intel.com/mbox/",
    "series": [
        {
            "id": 27571,
            "url": "http://patches.dpdk.org/api/series/27571/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=27571",
            "date": "2023-03-29T06:43:25",
            "name": "graph enhancement for multi-core dispatch",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/27571/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/125580/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/125580/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 466044285E;\n\tWed, 29 Mar 2023 08:44:54 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4CDB342D41;\n\tWed, 29 Mar 2023 08:44:11 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by mails.dpdk.org (Postfix) with ESMTP id A03C442D33\n for <dev@dpdk.org>; Wed, 29 Mar 2023 08:44:09 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Mar 2023 23:44:09 -0700",
            "from dpdk-zhirun-lmm.sh.intel.com ([10.67.119.68])\n by fmsmga002.fm.intel.com with ESMTP; 28 Mar 2023 23:44:07 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1680072249; x=1711608249;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=DI1FtHJtzNilg/DkhVbgOktkZCnYy21ewLN5KHLmOcI=;\n b=RB+tH4bGajlMvg0XQa/s8xrC5RduHLtAz4Ky2BnWOvRAvKPEMnrz/skA\n ikv0MZ1MA0y26FX7Q0PrJZIwrn0ZXwETx8HcRlNA9rVv50YQ49pr6w6Wr\n f91a8es3AERG2Trz83A6n82/SPRB/VZN4eitEDnutHhv7PaBV7SfZuVgC\n Ck1HiP+NpKYAYFpGEAtvczEOWM2jjn5FNrS4TbXHiJH2hp0q/yxu2GiNB\n 4TNcyC+0fPApOPIqPlh4NS66bvvUZesKTwHo2ZX7DOwIjYzkGenZ2AoLs\n dGMfwj40phIrr8vIQiJeextPrAiRqGjEectTbYUktRoueylbRqOZ+zvj3 Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10663\"; a=\"329260484\"",
            "E=Sophos;i=\"5.98,300,1673942400\"; d=\"scan'208\";a=\"329260484\"",
            "E=McAfee;i=\"6600,9927,10663\"; a=\"795105011\"",
            "E=Sophos;i=\"5.98,300,1673942400\"; d=\"scan'208\";a=\"795105011\""
        ],
        "X-ExtLoop1": "1",
        "From": "Zhirun Yan <zhirun.yan@intel.com>",
        "To": "dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com,\n ndabilpuram@marvell.com",
        "Cc": "cunming.liang@intel.com, haiyue.wang@intel.com,\n Zhirun Yan <zhirun.yan@intel.com>",
        "Subject": "[PATCH v3 09/15] graph: introduce stream moving cross cores",
        "Date": "Wed, 29 Mar 2023 15:43:34 +0900",
        "Message-Id": "<20230329064340.2550530-10-zhirun.yan@intel.com>",
        "X-Mailer": "git-send-email 2.37.2",
        "In-Reply-To": "<20230329064340.2550530-1-zhirun.yan@intel.com>",
        "References": "<20230324021622.1369006-1-zhirun.yan@intel.com>\n <20230329064340.2550530-1-zhirun.yan@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "This patch introduces key functions to allow a worker thread to\nenable enqueue and move streams of objects to the next nodes over\ndifferent cores.\n\nSigned-off-by: Haiyue Wang <haiyue.wang@intel.com>\nSigned-off-by: Cunming Liang <cunming.liang@intel.com>\nSigned-off-by: Zhirun Yan <zhirun.yan@intel.com>\n---\n lib/graph/graph_private.h            |  27 +++++\n lib/graph/meson.build                |   2 +-\n lib/graph/rte_graph_model_dispatch.c | 145 +++++++++++++++++++++++++++\n lib/graph/rte_graph_model_dispatch.h |  35 +++++++\n 4 files changed, 208 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h\nindex b66b18ebbc..e1a2a4bfd8 100644\n--- a/lib/graph/graph_private.h\n+++ b/lib/graph/graph_private.h\n@@ -366,4 +366,31 @@ void graph_dump(FILE *f, struct graph *g);\n  */\n void node_dump(FILE *f, struct node *n);\n \n+/**\n+ * @internal\n+ *\n+ * Create the graph schedule work queue. And all cloned graphs attached to the\n+ * parent graph MUST be destroyed together for fast schedule design limitation.\n+ *\n+ * @param _graph\n+ *   The graph object\n+ * @param _parent_graph\n+ *   The parent graph object which holds the run-queue head.\n+ *\n+ * @return\n+ *   - 0: Success.\n+ *   - <0: Graph schedule work queue related error.\n+ */\n+int graph_sched_wq_create(struct graph *_graph, struct graph *_parent_graph);\n+\n+/**\n+ * @internal\n+ *\n+ * Destroy the graph schedule work queue.\n+ *\n+ * @param _graph\n+ *   The graph object\n+ */\n+void graph_sched_wq_destroy(struct graph *_graph);\n+\n #endif /* _RTE_GRAPH_PRIVATE_H_ */\ndiff --git a/lib/graph/meson.build b/lib/graph/meson.build\nindex c729d984b6..e21affa280 100644\n--- a/lib/graph/meson.build\n+++ b/lib/graph/meson.build\n@@ -20,4 +20,4 @@ sources = files(\n )\n headers = files('rte_graph.h', 'rte_graph_worker.h')\n \n-deps += ['eal', 'pcapng']\n+deps += ['eal', 'pcapng', 'mempool', 'ring']\ndiff --git a/lib/graph/rte_graph_model_dispatch.c b/lib/graph/rte_graph_model_dispatch.c\nindex 4a2f99496d..b46dd156ac 100644\n--- a/lib/graph/rte_graph_model_dispatch.c\n+++ b/lib/graph/rte_graph_model_dispatch.c\n@@ -5,6 +5,151 @@\n #include \"graph_private.h\"\n #include \"rte_graph_model_dispatch.h\"\n \n+int\n+graph_sched_wq_create(struct graph *_graph, struct graph *_parent_graph)\n+{\n+\tstruct rte_graph *parent_graph = _parent_graph->graph;\n+\tstruct rte_graph *graph = _graph->graph;\n+\tunsigned int wq_size;\n+\n+\twq_size = GRAPH_SCHED_WQ_SIZE(graph->nb_nodes);\n+\twq_size = rte_align32pow2(wq_size + 1);\n+\n+\tgraph->wq = rte_ring_create(graph->name, wq_size, graph->socket,\n+\t\t\t\t    RING_F_SC_DEQ);\n+\tif (graph->wq == NULL)\n+\t\tSET_ERR_JMP(EIO, fail, \"Failed to allocate graph WQ\");\n+\n+\tgraph->mp = rte_mempool_create(graph->name, wq_size,\n+\t\t\t\t       sizeof(struct graph_sched_wq_node),\n+\t\t\t\t       0, 0, NULL, NULL, NULL, NULL,\n+\t\t\t\t       graph->socket, MEMPOOL_F_SP_PUT);\n+\tif (graph->mp == NULL)\n+\t\tSET_ERR_JMP(EIO, fail_mp,\n+\t\t\t    \"Failed to allocate graph WQ schedule entry\");\n+\n+\tgraph->lcore_id = _graph->lcore_id;\n+\n+\tif (parent_graph->rq == NULL) {\n+\t\tparent_graph->rq = &parent_graph->rq_head;\n+\t\tSLIST_INIT(parent_graph->rq);\n+\t}\n+\n+\tgraph->rq = parent_graph->rq;\n+\tSLIST_INSERT_HEAD(graph->rq, graph, rq_next);\n+\n+\treturn 0;\n+\n+fail_mp:\n+\trte_ring_free(graph->wq);\n+\tgraph->wq = NULL;\n+fail:\n+\treturn -rte_errno;\n+}\n+\n+void\n+graph_sched_wq_destroy(struct graph *_graph)\n+{\n+\tstruct rte_graph *graph = _graph->graph;\n+\n+\tif (graph == NULL)\n+\t\treturn;\n+\n+\trte_ring_free(graph->wq);\n+\tgraph->wq = NULL;\n+\n+\trte_mempool_free(graph->mp);\n+\tgraph->mp = NULL;\n+}\n+\n+static __rte_always_inline bool\n+__graph_sched_node_enqueue(struct rte_node *node, struct rte_graph *graph)\n+{\n+\tstruct graph_sched_wq_node *wq_node;\n+\tuint16_t off = 0;\n+\tuint16_t size;\n+\n+submit_again:\n+\tif (rte_mempool_get(graph->mp, (void **)&wq_node) < 0)\n+\t\tgoto fallback;\n+\n+\tsize = RTE_MIN(node->idx, RTE_DIM(wq_node->objs));\n+\twq_node->node_off = node->off;\n+\twq_node->nb_objs = size;\n+\trte_memcpy(wq_node->objs, &node->objs[off], size * sizeof(void *));\n+\n+\twhile (rte_ring_mp_enqueue_bulk_elem(graph->wq, (void *)&wq_node,\n+\t\t\t\t\t  sizeof(wq_node), 1, NULL) == 0)\n+\t\trte_pause();\n+\n+\toff += size;\n+\tnode->idx -= size;\n+\tif (node->idx > 0)\n+\t\tgoto submit_again;\n+\n+\treturn true;\n+\n+fallback:\n+\tif (off != 0)\n+\t\tmemmove(&node->objs[0], &node->objs[off],\n+\t\t\tnode->idx * sizeof(void *));\n+\n+\treturn false;\n+}\n+\n+bool __rte_noinline\n+__rte_graph_sched_node_enqueue(struct rte_node *node,\n+\t\t\t       struct rte_graph_rq_head *rq)\n+{\n+\tconst unsigned int lcore_id = node->lcore_id;\n+\tstruct rte_graph *graph;\n+\n+\tSLIST_FOREACH(graph, rq, rq_next)\n+\t\tif (graph->lcore_id == lcore_id)\n+\t\t\tbreak;\n+\n+\treturn graph != NULL ? __graph_sched_node_enqueue(node, graph) : false;\n+}\n+\n+void __rte_noinline\n+__rte_graph_sched_wq_process(struct rte_graph *graph)\n+{\n+\tstruct graph_sched_wq_node *wq_node;\n+\tstruct rte_mempool *mp = graph->mp;\n+\tstruct rte_ring *wq = graph->wq;\n+\tuint16_t idx, free_space;\n+\tstruct rte_node *node;\n+\tunsigned int i, n;\n+\tstruct graph_sched_wq_node *wq_nodes[32];\n+\n+\tn = rte_ring_sc_dequeue_burst_elem(wq, wq_nodes, sizeof(wq_nodes[0]),\n+\t\t\t\t\t   RTE_DIM(wq_nodes), NULL);\n+\tif (n == 0)\n+\t\treturn;\n+\n+\tfor (i = 0; i < n; i++) {\n+\t\twq_node = wq_nodes[i];\n+\t\tnode = RTE_PTR_ADD(graph, wq_node->node_off);\n+\t\tRTE_ASSERT(node->fence == RTE_GRAPH_FENCE);\n+\t\tidx = node->idx;\n+\t\tfree_space = node->size - idx;\n+\n+\t\tif (unlikely(free_space < wq_node->nb_objs))\n+\t\t\t__rte_node_stream_alloc_size(graph, node, node->size + wq_node->nb_objs);\n+\n+\t\tmemmove(&node->objs[idx], wq_node->objs, wq_node->nb_objs * sizeof(void *));\n+\t\tmemset(wq_node->objs, 0, wq_node->nb_objs * sizeof(void *));\n+\t\tnode->idx = idx + wq_node->nb_objs;\n+\n+\t\t__rte_node_process(graph, node);\n+\n+\t\twq_node->nb_objs = 0;\n+\t\tnode->idx = 0;\n+\t}\n+\n+\trte_mempool_put_bulk(mp, (void **)wq_nodes, n);\n+}\n+\n int\n rte_graph_model_dispatch_lcore_affinity_set(const char *name, unsigned int lcore_id)\n {\ndiff --git a/lib/graph/rte_graph_model_dispatch.h b/lib/graph/rte_graph_model_dispatch.h\nindex 179624e972..7cbdf2fdcf 100644\n--- a/lib/graph/rte_graph_model_dispatch.h\n+++ b/lib/graph/rte_graph_model_dispatch.h\n@@ -14,12 +14,47 @@\n  *\n  * This API allows to set core affinity with the node.\n  */\n+#include <rte_errno.h>\n+#include <rte_mempool.h>\n+#include <rte_memzone.h>\n+#include <rte_ring.h>\n+\n #include \"rte_graph_worker_common.h\"\n \n #ifdef __cplusplus\n extern \"C\" {\n #endif\n \n+#define GRAPH_SCHED_WQ_SIZE_MULTIPLIER  8\n+#define GRAPH_SCHED_WQ_SIZE(nb_nodes)   \\\n+\t((typeof(nb_nodes))((nb_nodes) * GRAPH_SCHED_WQ_SIZE_MULTIPLIER))\n+\n+/**\n+ * @internal\n+ *\n+ * Schedule the node to the right graph's work queue.\n+ *\n+ * @param node\n+ *   Pointer to the scheduled node object.\n+ * @param rq\n+ *   Pointer to the scheduled run-queue for all graphs.\n+ *\n+ * @return\n+ *   True on success, false otherwise.\n+ */\n+bool __rte_graph_sched_node_enqueue(struct rte_node *node,\n+\t\t\t\t    struct rte_graph_rq_head *rq);\n+\n+/**\n+ * @internal\n+ *\n+ * Process all nodes (streams) in the graph's work queue.\n+ *\n+ * @param graph\n+ *   Pointer to the graph object.\n+ */\n+void __rte_noinline __rte_graph_sched_wq_process(struct rte_graph *graph);\n+\n /**\n  * Set lcore affinity with the node.\n  *\n",
    "prefixes": [
        "v3",
        "09/15"
    ]
}