From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9710545610 for ; Fri, 12 Jul 2024 12:53:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90C45402E5; Fri, 12 Jul 2024 12:53:37 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2072.outbound.protection.outlook.com [40.107.212.72]) by mails.dpdk.org (Postfix) with ESMTP id B3BCC40611 for ; Fri, 12 Jul 2024 12:53:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kl9ji0IMTiR0PlSBmWwiPoohfCDEwDZ2dfzC+5P2nnkimxutadjMr314HUJj9w2p4UGQWZfpz06GWwumnD+n+QzeKyCQgB2UQEWOAp2QjFPn46K5bMEwqOA9d2aES5DQT1awti9CmmrV7BzVhAuHJH80JDWicesKLOy8MU28YYNE7PDGfKIzHxO8R0FQMx785FhIRJgRye4T1cld3eoa6HB7ryTmEsUw08rswMopd5tpizDfBtjmvOiUbKFxSyrG5mqYWRq95d8VCahEBIfVDnr2DjI4JhTeVrYr+fJvUplyCF2sMCacDM8mmIYFyAMxY4BwwFjvPIlc1XU4oSh3EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hiCU3rT4EMx0NdDagAZ/jNUVEoeEBcIA5jkMTByrDpA=; b=Zggmlvogp77W0KJt4UOB4ljgq29CE3xQyDgsd15clt5emqpysw9I7to4PxBU+yCMLMbl46kXC9inlEg+b0ul03rLSYkOXdRvBuu6msH7Oel7Q1Do8yWILI9igubJbVJ7NsGhhRrvmDmnnLsqWzGaxvf5X/QEPoNoQJ9T0AFJSPPxYUzlTvc+JcVoejYMgH7o2lrxy2Og92vSJVFJSKVSRzO72pM4Cb4uIP8JYJX7FG3UA5yuWihuGnf65TXy2NYqm4K4ilCrH+aZIvMWsMewXkT6UvwaK3FHznOUJYFNOQPrQL7GhUe++R2JPHkH+2sTb7iv1wdQzR4K5KekhxQnqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hiCU3rT4EMx0NdDagAZ/jNUVEoeEBcIA5jkMTByrDpA=; b=LFv4cs/i+gL0B7SDPwSrPu9G0j/JWtbVecKdSYj0Xba3wBIv+BDzPzXXPQ7HO422C4w85s9UNR3b26P7MxhN9z96O9CLYzfYTPln1OnmY+JdrYBLVcerBtCSimj488NZkQNKHcsxJMh+6y1socU0koTgUGxvov4bWA2mh+SRs5L6Xhs+kYkoIul3FP9NOE9PnKyIwa3oNRsUtO93aMKGvQdRv5hFxp1XVH4PMNdA0FHo4MUPmOnWsAA3XFwI9MH5v6cdoX4O6W88CPGaNH1OMzIbgECcVuoSCC+szIgUeB7lDTqTVd9VrXhnKgyfCaCI5HhULzgIwFsEDQmPTEAqig== Received: from BY5PR13CA0036.namprd13.prod.outlook.com (2603:10b6:a03:180::49) by PH7PR12MB6665.namprd12.prod.outlook.com (2603:10b6:510:1a7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.21; Fri, 12 Jul 2024 10:53:31 +0000 Received: from SJ5PEPF000001D3.namprd05.prod.outlook.com (2603:10b6:a03:180:cafe::38) by BY5PR13CA0036.outlook.office365.com (2603:10b6:a03:180::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23 via Frontend Transport; Fri, 12 Jul 2024 10:53:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by SJ5PEPF000001D3.mail.protection.outlook.com (10.167.242.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Fri, 12 Jul 2024 10:53:31 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 12 Jul 2024 03:53:24 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 12 Jul 2024 03:53:22 -0700 From: Xueming Li To: Robin Jarry CC: Kiran Kumar K , dpdk stable Subject: patch 'graph: fix ID collisions' has been queued to stable release 23.11.2 Date: Fri, 12 Jul 2024 18:45:02 +0800 Message-ID: <20240712104528.308638-77-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240712104528.308638-1-xuemingl@nvidia.com> References: <20240712104528.308638-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D3:EE_|PH7PR12MB6665:EE_ X-MS-Office365-Filtering-Correlation-Id: ed35f3f7-b617-4061-8d6f-08dca260de77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?jDx0Z+Inf6Qgv+zI75P920ZYc3XNAi4VoRiuFShetudgpmvdxUTVbocZ1I/5?= =?us-ascii?Q?Vl4YJqJpZi4/HaNVxsjtV5UvOr3bJRiYBCXsi0671t/0ZtJm2riltXq9khBS?= =?us-ascii?Q?rtGmrqgFiOZPjTSm46S9XxdLYoHFGQKQQlPenMVmX2/7m26xQosVPV/0ghxO?= =?us-ascii?Q?5uFFgf4tAWIvIuZpCK0hD9K7RF9rWkCj7QXQi9iMw00SEM+vL/k8K7DNHz+H?= =?us-ascii?Q?i2mAfcycw0E7ULiiLfQMIkO3MGtGpcXXt5nFY4IgAKCvr1AVgRovVQlKKdJz?= =?us-ascii?Q?Vr5Iigk2EZCOmDJ4hboYq+V61kpgk97oagPMvLNJL/yrogk9do0RijKwottP?= =?us-ascii?Q?emeFwzaK7xxC5/rGzeYSwkekVR9x34oXQSIivBA6t2kvuphask0Z6Q7yjmFB?= =?us-ascii?Q?l9ZFVQ6S9lkYMG1eiHABy33Q+tiuLw0Lw4Y3VCD2XgIF4CVwNl3tVVU39Mv2?= =?us-ascii?Q?M/x0lp16CtbCkyzcIkhcqUmFBltwObowbI0+xTt0TAHXdluzXXR52kY7WABb?= =?us-ascii?Q?ZE9pDyBmo0zuluO/M6qDeHyErexquc5ju1EQxb3xS9GlPTMTn4qhSIRr5zp3?= =?us-ascii?Q?Sx2v3zcpuzmoCAwfaaR/CzCr8RVtLUKf6IvYXhixnXv+F93oyGk7sUg0Lgjm?= =?us-ascii?Q?5Wck3/iaQClEsSU/7Yp0AYC1WnM/Wu94AOmUBpEySGFUduNJZW86KZGr5G5E?= =?us-ascii?Q?3+j+w9AILrh1Q88VaBcVxD2UczfAbyMvONiFd42+jxBYhU9bxmCSQHMTSYQx?= =?us-ascii?Q?hLyH3Qas0kSOZEO/E4GarpFvmGu4abrsnktDsWfCdJtjIhbqNGLBBdhVoJJi?= =?us-ascii?Q?feP4a7OqcU9oRdO7AZVu9Dsgq0I+3Vf+5gpdh8k897V6YmOw6AGi6QNwzSqO?= =?us-ascii?Q?w9GudwV1fqlH4oDVl/xLixv2hb4lZibwlgXBSQY2w3LOdSFcVPZK4u5Pnhvy?= =?us-ascii?Q?VldojkREDU1ZDDLnBuuIYhZRk1OyhK6HwWNWfT/w7B6ZNkomsptaUUf7UTdY?= =?us-ascii?Q?ysrY79NxORXzYFnYcoR9ayILK3VbCdoeWzjn3zPYG8pc3jFQ664tKRt7YRrw?= =?us-ascii?Q?7gRAjsR25KgY/b0TOGe+r1Ui5BiHoktt8gziZ+7e3Ok1OzdiXz6MZecUcHa1?= =?us-ascii?Q?a+bSOMocYg7pL95FLTnEse1b6NR6XmmkQ7pO/4WNjIoh00lg9q1X8BBCfGXl?= =?us-ascii?Q?yNye7ZrPB+DBU7/2E9vHfsL7ya34pzTNkXWbnFZaR2uHLFUnxCJiAmIJTi55?= =?us-ascii?Q?nnVbcbruhtLFOXbatwYzbsXd44IcmeWVuZqrbi7k9TQhpSHXrwxi9ypANSJf?= =?us-ascii?Q?SWRoectVJZBjnylEJMHqExSc/Xpf/VlPtoNrm5jAxWhk7dMHzCjvQcfGU8aX?= =?us-ascii?Q?+FSXVjvHyfmxhVBIf2R073WmlZXZir1l9T843/7brNICrAjQ1Yv/EAF99AvT?= =?us-ascii?Q?Mj7vnzkd3b7GGIfLd/H54IbGZutazScT?= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2024 10:53:31.2392 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed35f3f7-b617-4061-8d6f-08dca260de77 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6665 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 23.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/14/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=be7644791c005967d23efd75a4df700aee2c7a8e Thanks. Xueming Li --- >From be7644791c005967d23efd75a4df700aee2c7a8e Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Tue, 18 Jun 2024 11:23:25 +0200 Subject: [PATCH] graph: fix ID collisions Cc: Xueming Li [ upstream commit d5c8b6bb74a06051232cbbd92d25220606b280c0 ] The graph id is determined based on a global variable that is incremented every time a graph is created, and decremented every time a graph is destroyed. This only works if graphs are destroyed in the reverse order in which they have been created. The following code produces duplicate graph IDs which can lead to use-after-free bugs and other undefined behaviours: a = rte_graph_create(...); // id=0 graph_id=1 b = rte_graph_create(...); // id=1 graph_id=2 rte_graph_destroy(a); // graph_id=1 c = rte_graph_create(...); // id=1 graph_id=2 (duplicate with b) rte_graph_destroy(c); // frees memory still used by b Remove the global counter. Make sure that the graph list is always ordered by increasing graph ids. When creating a new graph, pick a free id which is not allocated. Update unit tests to ensure it works as expected. Fixes: a91fecc19c5c ("graph: implement create and destroy") Signed-off-by: Robin Jarry Acked-by: Kiran Kumar K --- app/test/test_graph.c | 72 ++++++++++++++++++++++++++++++++++++ lib/graph/graph.c | 86 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 141 insertions(+), 17 deletions(-) diff --git a/app/test/test_graph.c b/app/test/test_graph.c index 3dd017ebfb..eb4f9a61e3 100644 --- a/app/test/test_graph.c +++ b/app/test/test_graph.c @@ -695,6 +695,77 @@ test_graph_clone(void) return ret; } +static int +test_graph_id_collisions(void) +{ + static const char *node_patterns[] = {"test_node_source1", "test_node00"}; + struct rte_graph_param gconf = { + .socket_id = SOCKET_ID_ANY, + .nb_node_patterns = 2, + .node_patterns = node_patterns, + }; + rte_graph_t g1, g2, g3, g4; + + g1 = rte_graph_create("worker1", &gconf); + if (g1 == RTE_GRAPH_ID_INVALID) { + printf("Graph 1 creation failed with error = %d\n", rte_errno); + return -1; + } + g2 = rte_graph_create("worker2", &gconf); + if (g2 == RTE_GRAPH_ID_INVALID) { + printf("Graph 2 creation failed with error = %d\n", rte_errno); + return -1; + } + g3 = rte_graph_create("worker3", &gconf); + if (g3 == RTE_GRAPH_ID_INVALID) { + printf("Graph 3 creation failed with error = %d\n", rte_errno); + return -1; + } + if (g1 == g2 || g2 == g3 || g1 == g3) { + printf("Graph ids should be different\n"); + return -1; + } + if (rte_graph_destroy(g2) < 0) { + printf("Graph 2 suppression failed\n"); + return -1; + } + g4 = rte_graph_create("worker4", &gconf); + if (g4 == RTE_GRAPH_ID_INVALID) { + printf("Graph 4 creation failed with error = %d\n", rte_errno); + return -1; + } + if (g1 == g3 || g1 == g4 || g3 == g4) { + printf("Graph ids should be different\n"); + return -1; + } + g2 = rte_graph_clone(g1, "worker2", &gconf); + if (g2 == RTE_GRAPH_ID_INVALID) { + printf("Graph 4 creation failed with error = %d\n", rte_errno); + return -1; + } + if (g1 == g2 || g1 == g3 || g1 == g4 || g2 == g3 || g2 == g4 || g3 == g4) { + printf("Graph ids should be different\n"); + return -1; + } + if (rte_graph_destroy(g1) < 0) { + printf("Graph 1 suppression failed\n"); + return -1; + } + if (rte_graph_destroy(g2) < 0) { + printf("Graph 2 suppression failed\n"); + return -1; + } + if (rte_graph_destroy(g3) < 0) { + printf("Graph 3 suppression failed\n"); + return -1; + } + if (rte_graph_destroy(g4) < 0) { + printf("Graph 4 suppression failed\n"); + return -1; + } + return 0; +} + static int test_graph_model_mcore_dispatch_node_lcore_affinity_set(void) { @@ -976,6 +1047,7 @@ static struct unit_test_suite graph_testsuite = { TEST_CASE(test_lookup_functions), TEST_CASE(test_create_graph), TEST_CASE(test_graph_clone), + TEST_CASE(test_graph_id_collisions), TEST_CASE(test_graph_model_mcore_dispatch_node_lcore_affinity_set), TEST_CASE(test_graph_model_mcore_dispatch_core_bind_unbind), TEST_CASE(test_graph_worker_model_set_get), diff --git a/lib/graph/graph.c b/lib/graph/graph.c index 26f0968a97..8ea2109645 100644 --- a/lib/graph/graph.c +++ b/lib/graph/graph.c @@ -19,11 +19,54 @@ static struct graph_head graph_list = STAILQ_HEAD_INITIALIZER(graph_list); static rte_spinlock_t graph_lock = RTE_SPINLOCK_INITIALIZER; -static rte_graph_t graph_id; - -#define GRAPH_ID_CHECK(id) ID_CHECK(id, graph_id) /* Private functions */ +static struct graph * +graph_from_id(rte_graph_t id) +{ + struct graph *graph; + STAILQ_FOREACH(graph, &graph_list, next) { + if (graph->id == id) + return graph; + } + rte_errno = EINVAL; + return NULL; +} + +static rte_graph_t +graph_next_free_id(void) +{ + struct graph *graph; + rte_graph_t id = 0; + + STAILQ_FOREACH(graph, &graph_list, next) { + if (id < graph->id) + break; + id = graph->id + 1; + } + + return id; +} + +static void +graph_insert_ordered(struct graph *graph) +{ + struct graph *after, *g; + + after = NULL; + STAILQ_FOREACH(g, &graph_list, next) { + if (g->id < graph->id) + after = g; + else if (g->id > graph->id) + break; + } + if (after == NULL) { + STAILQ_INSERT_HEAD(&graph_list, graph, next); + } else { + STAILQ_INSERT_AFTER(&graph_list, after, graph, next); + } +} + struct graph_head * graph_list_head_get(void) { @@ -279,7 +322,8 @@ rte_graph_model_mcore_dispatch_core_bind(rte_graph_t id, int lcore) { struct graph *graph; - GRAPH_ID_CHECK(id); + if (graph_from_id(id) == NULL) + goto fail; if (!rte_lcore_is_enabled(lcore)) SET_ERR_JMP(ENOLINK, fail, "lcore %d not enabled", lcore); @@ -309,7 +353,8 @@ rte_graph_model_mcore_dispatch_core_unbind(rte_graph_t id) { struct graph *graph; - GRAPH_ID_CHECK(id); + if (graph_from_id(id) == NULL) + goto fail; STAILQ_FOREACH(graph, &graph_list, next) if (graph->id == id) break; @@ -406,7 +451,7 @@ rte_graph_create(const char *name, struct rte_graph_param *prm) graph->socket = prm->socket_id; graph->src_node_count = src_node_count; graph->node_count = graph_nodes_count(graph); - graph->id = graph_id; + graph->id = graph_next_free_id(); graph->parent_id = RTE_GRAPH_ID_INVALID; graph->lcore_id = RTE_MAX_LCORE; graph->num_pkt_to_capture = prm->num_pkt_to_capture; @@ -422,8 +467,7 @@ rte_graph_create(const char *name, struct rte_graph_param *prm) goto graph_mem_destroy; /* All good, Lets add the graph to the list */ - graph_id++; - STAILQ_INSERT_TAIL(&graph_list, graph, next); + graph_insert_ordered(graph); graph_spinlock_unlock(); return graph->id; @@ -467,7 +511,6 @@ rte_graph_destroy(rte_graph_t id) graph_cleanup(graph); STAILQ_REMOVE(&graph_list, graph, graph, next); free(graph); - graph_id--; goto done; } graph = tmp; @@ -520,7 +563,7 @@ graph_clone(struct graph *parent_graph, const char *name, struct rte_graph_param graph->parent_id = parent_graph->id; graph->lcore_id = parent_graph->lcore_id; graph->socket = parent_graph->socket; - graph->id = graph_id; + graph->id = graph_next_free_id(); /* Allocate the Graph fast path memory and populate the data */ if (graph_fp_mem_create(graph)) @@ -539,8 +582,7 @@ graph_clone(struct graph *parent_graph, const char *name, struct rte_graph_param goto graph_mem_destroy; /* All good, Lets add the graph to the list */ - graph_id++; - STAILQ_INSERT_TAIL(&graph_list, graph, next); + graph_insert_ordered(graph); graph_spinlock_unlock(); return graph->id; @@ -561,7 +603,8 @@ rte_graph_clone(rte_graph_t id, const char *name, struct rte_graph_param *prm) { struct graph *graph; - GRAPH_ID_CHECK(id); + if (graph_from_id(id) == NULL) + goto fail; STAILQ_FOREACH(graph, &graph_list, next) if (graph->id == id) return graph_clone(graph, name, prm); @@ -587,7 +630,8 @@ rte_graph_id_to_name(rte_graph_t id) { struct graph *graph; - GRAPH_ID_CHECK(id); + if (graph_from_id(id) == NULL) + goto fail; STAILQ_FOREACH(graph, &graph_list, next) if (graph->id == id) return graph->name; @@ -604,7 +648,8 @@ rte_graph_node_get(rte_graph_t gid, uint32_t nid) rte_graph_off_t off; rte_node_t count; - GRAPH_ID_CHECK(gid); + if (graph_from_id(gid) == NULL) + goto fail; STAILQ_FOREACH(graph, &graph_list, next) if (graph->id == gid) { rte_graph_foreach_node(count, off, graph->graph, @@ -729,7 +774,8 @@ graph_scan_dump(FILE *f, rte_graph_t id, bool all) struct graph *graph; RTE_VERIFY(f); - GRAPH_ID_CHECK(id); + if (graph_from_id(id) == NULL) + goto fail; STAILQ_FOREACH(graph, &graph_list, next) { if (all == true) { @@ -758,7 +804,13 @@ rte_graph_list_dump(FILE *f) rte_graph_t rte_graph_max_count(void) { - return graph_id; + struct graph *graph; + rte_graph_t count = 0; + + STAILQ_FOREACH(graph, &graph_list, next) + count++; + + return count; } RTE_LOG_REGISTER_DEFAULT(rte_graph_logtype, INFO); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-07-12 18:40:17.566574511 +0800 +++ 0076-graph-fix-ID-collisions.patch 2024-07-12 18:40:14.206594215 +0800 @@ -1 +1 @@ -From d5c8b6bb74a06051232cbbd92d25220606b280c0 Mon Sep 17 00:00:00 2001 +From be7644791c005967d23efd75a4df700aee2c7a8e Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit d5c8b6bb74a06051232cbbd92d25220606b280c0 ] @@ -27 +29,0 @@ -Cc: stable@dpdk.org @@ -37 +39 @@ -index b8409bc604..2840a25b13 100644 +index 3dd017ebfb..eb4f9a61e3 100644 @@ -40 +42 @@ -@@ -696,6 +696,77 @@ test_graph_clone(void) +@@ -695,6 +695,77 @@ test_graph_clone(void) @@ -118 +120 @@ -@@ -977,6 +1048,7 @@ static struct unit_test_suite graph_testsuite = { +@@ -976,6 +1047,7 @@ static struct unit_test_suite graph_testsuite = {