get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 125662,
    "url": "http://patches.dpdk.org/api/patches/125662/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230331040306.3143693-8-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": "<20230331040306.3143693-8-zhirun.yan@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230331040306.3143693-8-zhirun.yan@intel.com",
    "date": "2023-03-31T04:02:58",
    "name": "[v5,07/15] graph: introduce graph clone API for other worker core",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "1956be1be58fa755347a016d5ecd9bf7a06ed291",
    "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/20230331040306.3143693-8-zhirun.yan@intel.com/mbox/",
    "series": [
        {
            "id": 27590,
            "url": "http://patches.dpdk.org/api/series/27590/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=27590",
            "date": "2023-03-31T04:02:51",
            "name": "graph enhancement for multi-core dispatch",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/27590/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/125662/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/125662/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 4213D4287E;\n\tFri, 31 Mar 2023 06:04:08 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B83FE42D37;\n\tFri, 31 Mar 2023 06:03:32 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by mails.dpdk.org (Postfix) with ESMTP id 9AECF42D2C\n for <dev@dpdk.org>; Fri, 31 Mar 2023 06:03:29 +0200 (CEST)",
            "from fmsmga007.fm.intel.com ([10.253.24.52])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 30 Mar 2023 21:03:29 -0700",
            "from dpdk-zhirun-lmm.sh.intel.com ([10.67.119.68])\n by fmsmga007.fm.intel.com with ESMTP; 30 Mar 2023 21:03:27 -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=1680235409; x=1711771409;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=zTJpYeQM6U0NN7ViwmTuVa7KdfrvCst8+3FJ3am20IA=;\n b=hp+GjHPhgqKGRxzsMiQKUyLWNGQUFGGhpG+UGrjhqWuZD/CF4CbjNhFD\n o3L4NvlqBBiVhqcP/k62oYUWPV0dYsVSNguvHBbwkCV5Ga3QQCTG7NDJC\n 8WvGk87yk6lO4+/sd2jvpdg1aRUuViZiV4ZRxTGDDdPnZXezo5ekYU13s\n vTS+pIn8hxB2qlSwU6tSa2PyaEaNc9MxdbTN04Z33EEbjvDSNVXIQx8vB\n 3Tbffp4FlZF6wJHYzRiD2Qa3Fo71I1njzLkb6xWPP3XeQPx5Ia6tMbXec\n cKlLKKQQ0qEBWJRz7a+vC06JZnLU7cFxdBQKCRj/cw43MaunkLs38FRel A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10665\"; a=\"338849091\"",
            "E=Sophos;i=\"5.98,306,1673942400\"; d=\"scan'208\";a=\"338849091\"",
            "E=McAfee;i=\"6600,9927,10665\"; a=\"687502269\"",
            "E=Sophos;i=\"5.98,306,1673942400\"; d=\"scan'208\";a=\"687502269\""
        ],
        "X-ExtLoop1": "1",
        "From": "Zhirun Yan <zhirun.yan@intel.com>",
        "To": "dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com,\n ndabilpuram@marvell.com, stephen@networkplumber.org",
        "Cc": "cunming.liang@intel.com, haiyue.wang@intel.com,\n Zhirun Yan <zhirun.yan@intel.com>",
        "Subject": "[PATCH v5 07/15] graph: introduce graph clone API for other worker\n core",
        "Date": "Fri, 31 Mar 2023 13:02:58 +0900",
        "Message-Id": "<20230331040306.3143693-8-zhirun.yan@intel.com>",
        "X-Mailer": "git-send-email 2.37.2",
        "In-Reply-To": "<20230331040306.3143693-1-zhirun.yan@intel.com>",
        "References": "<20230330061834.3118201-1-zhirun.yan@intel.com>\n <20230331040306.3143693-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 adds graph API for supporting to clone the graph object for\na specified worker core. The new graph will also clone all nodes.\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.c         | 110 ++++++++++++++++++++++++++++++++++++++\n lib/graph/graph_private.h |   2 +\n lib/graph/rte_graph.h     |  20 +++++++\n lib/graph/version.map     |   1 +\n 4 files changed, 133 insertions(+)",
    "diff": "diff --git a/lib/graph/graph.c b/lib/graph/graph.c\nindex b39a99aac6..90eaad0378 100644\n--- a/lib/graph/graph.c\n+++ b/lib/graph/graph.c\n@@ -398,6 +398,7 @@ rte_graph_create(const char *name, struct rte_graph_param *prm)\n \tgraph->src_node_count = src_node_count;\n \tgraph->node_count = graph_nodes_count(graph);\n \tgraph->id = graph_id;\n+\tgraph->parent_id = RTE_GRAPH_ID_INVALID;\n \tgraph->lcore_id = RTE_MAX_LCORE;\n \tgraph->num_pkt_to_capture = prm->num_pkt_to_capture;\n \tif (prm->pcap_filename)\n@@ -462,6 +463,115 @@ rte_graph_destroy(rte_graph_t id)\n \treturn rc;\n }\n \n+static int\n+clone_name(struct graph *graph, struct graph *parent_graph, const char *name)\n+{\n+\tssize_t sz, rc;\n+\n+#define SZ RTE_GRAPH_NAMESIZE\n+\trc = rte_strscpy(graph->name, parent_graph->name, SZ);\n+\tif (rc < 0)\n+\t\tgoto fail;\n+\tsz = rc;\n+\trc = rte_strscpy(graph->name + sz, \"-\", RTE_MAX((int16_t)(SZ - sz), 0));\n+\tif (rc < 0)\n+\t\tgoto fail;\n+\tsz += rc;\n+\tsz = rte_strscpy(graph->name + sz, name, RTE_MAX((int16_t)(SZ - sz), 0));\n+\tif (sz < 0)\n+\t\tgoto fail;\n+\n+\treturn 0;\n+fail:\n+\trte_errno = E2BIG;\n+\treturn -rte_errno;\n+}\n+\n+static rte_graph_t\n+graph_clone(struct graph *parent_graph, const char *name)\n+{\n+\tstruct graph_node *graph_node;\n+\tstruct graph *graph;\n+\n+\tgraph_spinlock_lock();\n+\n+\t/* Don't allow to clone a node from a cloned graph */\n+\tif (parent_graph->parent_id != RTE_GRAPH_ID_INVALID)\n+\t\tSET_ERR_JMP(EEXIST, fail, \"A cloned graph is not allowed to be cloned\");\n+\n+\t/* Create graph object */\n+\tgraph = calloc(1, sizeof(*graph));\n+\tif (graph == NULL)\n+\t\tSET_ERR_JMP(ENOMEM, fail, \"Failed to calloc cloned graph object\");\n+\n+\t/* Naming ceremony of the new graph. name is node->name + \"-\" + name */\n+\tif (clone_name(graph, parent_graph, name))\n+\t\tgoto free;\n+\n+\t/* Check for existence of duplicate graph */\n+\tif (rte_graph_from_name(graph->name) != RTE_GRAPH_ID_INVALID)\n+\t\tSET_ERR_JMP(EEXIST, free, \"Found duplicate graph %s\",\n+\t\t\t    graph->name);\n+\n+\t/* Clone nodes from parent graph firstly */\n+\tSTAILQ_INIT(&graph->node_list);\n+\tSTAILQ_FOREACH(graph_node, &parent_graph->node_list, next) {\n+\t\tif (graph_node_add(graph, graph_node->node))\n+\t\t\tgoto graph_cleanup;\n+\t}\n+\n+\t/* Just update adjacency list of all nodes in the graph */\n+\tif (graph_adjacency_list_update(graph))\n+\t\tgoto graph_cleanup;\n+\n+\t/* Initialize the graph object */\n+\tgraph->src_node_count = parent_graph->src_node_count;\n+\tgraph->node_count = parent_graph->node_count;\n+\tgraph->parent_id = parent_graph->id;\n+\tgraph->lcore_id = parent_graph->lcore_id;\n+\tgraph->socket = parent_graph->socket;\n+\tgraph->id = graph_id;\n+\n+\t/* Allocate the Graph fast path memory and populate the data */\n+\tif (graph_fp_mem_create(graph))\n+\t\tgoto graph_cleanup;\n+\n+\t/* Call init() of the all the nodes in the graph */\n+\tif (graph_node_init(graph))\n+\t\tgoto graph_mem_destroy;\n+\n+\t/* All good, Lets add the graph to the list */\n+\tgraph_id++;\n+\tSTAILQ_INSERT_TAIL(&graph_list, graph, next);\n+\n+\tgraph_spinlock_unlock();\n+\treturn graph->id;\n+\n+graph_mem_destroy:\n+\tgraph_fp_mem_destroy(graph);\n+graph_cleanup:\n+\tgraph_cleanup(graph);\n+free:\n+\tfree(graph);\n+fail:\n+\tgraph_spinlock_unlock();\n+\treturn RTE_GRAPH_ID_INVALID;\n+}\n+\n+rte_graph_t\n+rte_graph_clone(rte_graph_t id, const char *name)\n+{\n+\tstruct graph *graph;\n+\n+\tGRAPH_ID_CHECK(id);\n+\tSTAILQ_FOREACH(graph, &graph_list, next)\n+\t\tif (graph->id == id)\n+\t\t\treturn graph_clone(graph, name);\n+\n+fail:\n+\treturn RTE_GRAPH_ID_INVALID;\n+}\n+\n rte_graph_t\n rte_graph_from_name(const char *name)\n {\ndiff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h\nindex ad1d058945..d28a5af93e 100644\n--- a/lib/graph/graph_private.h\n+++ b/lib/graph/graph_private.h\n@@ -98,6 +98,8 @@ struct graph {\n \t/**< Circular buffer mask for wrap around. */\n \trte_graph_t id;\n \t/**< Graph identifier. */\n+\trte_graph_t parent_id;\n+\t/**< Parent graph identifier. */\n \tunsigned int lcore_id;\n \t/**< Lcore identifier where the graph prefer to run on. */\n \tsize_t mem_sz;\ndiff --git a/lib/graph/rte_graph.h b/lib/graph/rte_graph.h\nindex c523809d1f..2f86c17de7 100644\n--- a/lib/graph/rte_graph.h\n+++ b/lib/graph/rte_graph.h\n@@ -247,6 +247,26 @@ rte_graph_t rte_graph_create(const char *name, struct rte_graph_param *prm);\n __rte_experimental\n int rte_graph_destroy(rte_graph_t id);\n \n+/**\n+ * Clone Graph.\n+ *\n+ * Clone a graph from static graph (graph created from rte_graph_create). And\n+ * all cloned graphs attached to the parent graph MUST be destroyed together\n+ * for fast schedule design limitation (stop ALL graph walk firstly).\n+ *\n+ * @param id\n+ *   Static graph id to clone from.\n+ * @param name\n+ *   Name of the new graph. The library prepends the parent graph name to the\n+ * user-specified name. The final graph name will be,\n+ * \"parent graph name\" + \"-\" + name.\n+ *\n+ * @return\n+ *   Valid graph id on success, RTE_GRAPH_ID_INVALID otherwise.\n+ */\n+__rte_experimental\n+rte_graph_t rte_graph_clone(rte_graph_t id, const char *name);\n+\n /**\n  * Get graph id from graph name.\n  *\ndiff --git a/lib/graph/version.map b/lib/graph/version.map\nindex 7de6f08f59..aaa86f66ed 100644\n--- a/lib/graph/version.map\n+++ b/lib/graph/version.map\n@@ -7,6 +7,7 @@ EXPERIMENTAL {\n \n \trte_graph_create;\n \trte_graph_destroy;\n+\trte_graph_clone;\n \trte_graph_dump;\n \trte_graph_export;\n \trte_graph_from_name;\n",
    "prefixes": [
        "v5",
        "07/15"
    ]
}