Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/125491/?format=api
http://patches.dpdk.org/api/patches/125491/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230324021622.1369006-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": "<20230324021622.1369006-8-zhirun.yan@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230324021622.1369006-8-zhirun.yan@intel.com", "date": "2023-03-24T02:16:14", "name": "[v2,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/20230324021622.1369006-8-zhirun.yan@intel.com/mbox/", "series": [ { "id": 27532, "url": "http://patches.dpdk.org/api/series/27532/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=27532", "date": "2023-03-24T02:16:07", "name": "graph enhancement for multi-core dispatch", "version": 2, "mbox": "http://patches.dpdk.org/series/27532/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/125491/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/125491/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 A26AB4281E;\n\tFri, 24 Mar 2023 04:17:16 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C0E0542D0D;\n\tFri, 24 Mar 2023 04:16:47 +0100 (CET)", "from mga06.intel.com (mga06b.intel.com [134.134.136.31])\n by mails.dpdk.org (Postfix) with ESMTP id 2C73442D17\n for <dev@dpdk.org>; Fri, 24 Mar 2023 04:16:46 +0100 (CET)", "from fmsmga007.fm.intel.com ([10.253.24.52])\n by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 Mar 2023 20:16:45 -0700", "from dpdk-zhirun-lmm.sh.intel.com ([10.67.119.68])\n by fmsmga007.fm.intel.com with ESMTP; 23 Mar 2023 20:16:43 -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=1679627806; x=1711163806;\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=nTn3+1tro0NhpJlRiDKiXjUih3XJJhOxnG5Oh/Ir915/zqA6EEnqDTI0\n ZoZrR89ugKEdzahT/JKImXg3BsvYA/tJGG9OmOjzvgcnjhtvaaPdgKc5D\n 6VnFpbcLwgUB9aw36fm6T1COTlx/SJD0OArNi2mMf+i5RPpjaFQVfYRZN\n ePSXir3y5sXoTkL7AOLcXqig75/837dH+jfFDxAOIQj9aihObzp6Id1YC\n i6tbhiK1Gk2gFORd8WybcQGCL+tk16Q7LE3xUWoGRAMmUXfSNfvFJnDmm\n 3X/UlGKweF5ZAKztxIaGELY3g7i9SAvgHxvuW5J5Lywgag3m15K4VTqgX g==;", "X-IronPort-AV": [ "E=McAfee;i=\"6600,9927,10658\"; a=\"402266438\"", "E=Sophos;i=\"5.98,286,1673942400\"; d=\"scan'208\";a=\"402266438\"", "E=McAfee;i=\"6600,9927,10658\"; a=\"684998535\"", "E=Sophos;i=\"5.98,286,1673942400\"; d=\"scan'208\";a=\"684998535\"" ], "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 v2 07/15] graph: introduce graph clone API for other worker\n core", "Date": "Fri, 24 Mar 2023 11:16:14 +0900", "Message-Id": "<20230324021622.1369006-8-zhirun.yan@intel.com>", "X-Mailer": "git-send-email 2.37.2", "In-Reply-To": "<20230324021622.1369006-1-zhirun.yan@intel.com>", "References": "<20221117050926.136974-1-zhirun.yan@intel.com>\n <20230324021622.1369006-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": [ "v2", "07/15" ] }{ "id": 125491, "url": "