Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/126787/?format=api
http://patches.dpdk.org/api/patches/126787/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230509060347.1237884-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": "<20230509060347.1237884-8-zhirun.yan@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230509060347.1237884-8-zhirun.yan@intel.com", "date": "2023-05-09T06:03:39", "name": "[v6,07/15] graph: introduce graph clone API for other worker core", "commit_ref": null, "pull_url": null, "state": "changes-requested", "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/20230509060347.1237884-8-zhirun.yan@intel.com/mbox/", "series": [ { "id": 27966, "url": "http://patches.dpdk.org/api/series/27966/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=27966", "date": "2023-05-09T06:03:32", "name": "graph enhancement for multi-core dispatch", "version": 6, "mbox": "http://patches.dpdk.org/series/27966/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/126787/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/126787/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 1CCB442AA0;\n\tTue, 9 May 2023 08:04:55 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id AD44E42D49;\n\tTue, 9 May 2023 08:04:18 +0200 (CEST)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n by mails.dpdk.org (Postfix) with ESMTP id 95AA442D49\n for <dev@dpdk.org>; Tue, 9 May 2023 08:04:16 +0200 (CEST)", "from fmsmga007.fm.intel.com ([10.253.24.52])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 May 2023 23:04:16 -0700", "from dpdk-zhirun-lmm.sh.intel.com ([10.67.119.94])\n by fmsmga007.fm.intel.com with ESMTP; 08 May 2023 23:04:13 -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=1683612256; x=1715148256;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=GAQmg3QG4gBd6WQCq26PhelJv+TA+Ue4KLt1x4hN/MI=;\n b=YTGiCxW3nUiByy9Iy+NaN7S2M0825YVsvIzFDn1y9l1X2NfZkIc9z424\n dc3FSmQ1WR38mf1bXrPf0OdQekGJo06dQ0TZj5EJe1cFOm4b87QDnf+DL\n nIiRHxtiPLzlzZM/tAqCDFL9StbHu4Px1nGLBF1LgFwmQ7ru2Q7WziyXB\n xConC/cxyCucwfi01ALbzWi0bzZMryr0pMcKZ5vYW1v9jO9WCPgJPZTRx\n SUkSg7lUQid3Nj20DUh5gUBP7Yvw5dF6p5GukKSCiUm7fW5XrUUvF8Ey9\n ZO9vstTvm/thVSH67D9TZiujVythflTGRKI2nusP9LDs6atk66Ohk9sqO w==;", "X-IronPort-AV": [ "E=McAfee;i=\"6600,9927,10704\"; a=\"351983117\"", "E=Sophos;i=\"5.99,261,1677571200\"; d=\"scan'208\";a=\"351983117\"", "E=McAfee;i=\"6600,9927,10704\"; a=\"701700304\"", "E=Sophos;i=\"5.99,261,1677571200\"; d=\"scan'208\";a=\"701700304\"" ], "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,\n pbhagavatula@marvell.com", "Cc": "cunming.liang@intel.com, haiyue.wang@intel.com,\n Zhirun Yan <zhirun.yan@intel.com>", "Subject": "[PATCH v6 07/15] graph: introduce graph clone API for other worker\n core", "Date": "Tue, 9 May 2023 15:03:39 +0900", "Message-Id": "<20230509060347.1237884-8-zhirun.yan@intel.com>", "X-Mailer": "git-send-email 2.37.2", "In-Reply-To": "<20230509060347.1237884-1-zhirun.yan@intel.com>", "References": "<20230331040306.3143693-1-zhirun.yan@intel.com>\n <20230509060347.1237884-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 b8ef86da45..2629c79103 100644\n--- a/lib/graph/graph.c\n+++ b/lib/graph/graph.c\n@@ -404,6 +404,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@@ -468,6 +469,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 f63b339d81..52ca30ed56 100644\n--- a/lib/graph/graph_private.h\n+++ b/lib/graph/graph_private.h\n@@ -99,6 +99,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": [ "v6", "07/15" ] }{ "id": 126787, "url": "