get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 140018,
    "url": "https://patches.dpdk.org/api/patches/140018/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/TYAP286MB06492336688E0855A00ADFF7D8E72@TYAP286MB0649.JPNP286.PROD.OUTLOOK.COM/",
    "project": {
        "id": 1,
        "url": "https://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": "<TYAP286MB06492336688E0855A00ADFF7D8E72@TYAP286MB0649.JPNP286.PROD.OUTLOOK.COM>",
    "list_archive_url": "https://inbox.dpdk.org/dev/TYAP286MB06492336688E0855A00ADFF7D8E72@TYAP286MB0649.JPNP286.PROD.OUTLOOK.COM",
    "date": "2024-05-10T06:47:47",
    "name": "[v2] graph: fix does not return the unique id when create graph",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "01e81fb985f1183c10e3cb1d90c466d3239563c3",
    "submitter": {
        "id": 3305,
        "url": "https://patches.dpdk.org/api/people/3305/?format=api",
        "name": "Gongming Chen",
        "email": "chengongming1900@outlook.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/TYAP286MB06492336688E0855A00ADFF7D8E72@TYAP286MB0649.JPNP286.PROD.OUTLOOK.COM/mbox/",
    "series": [
        {
            "id": 31903,
            "url": "https://patches.dpdk.org/api/series/31903/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=31903",
            "date": "2024-05-10T06:47:47",
            "name": "[v2] graph: fix does not return the unique id when create graph",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/31903/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/140018/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/140018/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 4CF6843FEE;\n\tFri, 10 May 2024 08:48:11 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 3095C402D1;\n\tFri, 10 May 2024 08:48:11 +0200 (CEST)",
            "from JPN01-OS0-obe.outbound.protection.outlook.com\n (mail-os0jpn01olkn2086.outbound.protection.outlook.com [40.92.98.86])\n by mails.dpdk.org (Postfix) with ESMTP id ADAF34025F;\n Fri, 10 May 2024 08:48:09 +0200 (CEST)",
            "from TYAP286MB0649.JPNP286.PROD.OUTLOOK.COM (2603:1096:402:38::13)\n by TYCP286MB3636.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3aa::11) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.49; Fri, 10 May\n 2024 06:48:06 +0000",
            "from TYAP286MB0649.JPNP286.PROD.OUTLOOK.COM\n ([fe80::a92e:74bb:6df2:7ea2]) by TYAP286MB0649.JPNP286.PROD.OUTLOOK.COM\n ([fe80::a92e:74bb:6df2:7ea2%5]) with mapi id 15.20.7544.048; Fri, 10 May 2024\n 06:48:06 +0000"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=OyfBRBesgPF+CcoChx5UnVzhCwoSJceM13tMgWxiiMyrS/pqzOlQ7YzCw+wuw26NjYGmujP2ep1ID7ilx//1aEzpNfmcwSh8y0EOqD8UcfI3eoxLqI7k7BIffDjt/cbJlxdYojBWAqBkj59180Xm+FDPXNLHcp8FKphaJV69ZNB8MHyh8MwtBGwpi2ctw0DeQiWYwPJ6cb8Peqyk2nO9ONa+PGr5FHSZIGvKrRIht4ikcuiST2xrD9/S9sllQDcy5B3/1uHiw6omm26BLJxULrizbwDlfkBmhqw07/Wi3dt1HuKWYAs9GEYcwPBRJhvcLnEiIffmFwQpIkwF+xvGIQ==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector9901;\n 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;\n bh=iO3hd87BMZ9aVzeLAKk8HyYFILfveiEARDG/YvpoeBg=;\n b=IZYKUi72h4Sm1vA/rnStU3Qr8ZJPEz94p2YRmtv2br7Yp9AAk3AoYSGaICkPrQp6k+/8zpFWk0vKSe8/bBVReqq51Xmm+DPpHpk350wd0NcAJvKAQX/HyrOlHUdmdhf+mbOXAzwrlb8GJe4bB7OVVvR9XFmNaC70vScUJypkLaYgvvnxF3u1suCifo+TIqCnwxXZyA19tr3GNBk614tK37RXvbo6rhQPy13zvWexM68Bcf8H0xsCuN1uMsToa2OPVub9C1V9UIUqTcosxgmZASjCiJN/LXxiUf4A/MFp1tCg7DU7AenGeZvvbcSoQWUhXYpU+ZVkjSGxtJplLf2oSw==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=none; dmarc=none;\n dkim=none; arc=none",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;\n s=selector1;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=iO3hd87BMZ9aVzeLAKk8HyYFILfveiEARDG/YvpoeBg=;\n b=dggJHR77wNNh9wYP6AlEgar5Ll4ZoIcnhPSyBkX2z9etlHjqg+NbGI5kt4Kcz+jcDD9cs4Ef0Tp5aEgxvGQkoKTg1goUntj1Xhp1r/eobxR3sncX7jDDERx3RS1B86febRBOzYqhXPXMt6PTbfxJi/5Lz24nYj1V45qLx0s3RH0QXVDjIIdYesNyhp//waYLlu0mi44fgcKucfypO7qJUH+JpjUPmPrjtko3c5DntwY5ibqJr/5UVHeG2X34CA+LoyNIR4PTFqsHlQsRw/I66CZwmZAKf6QSXn8a7QWgDcuSgdWxdxm8zYeLQ1tFD1PRBbR2TSDI9rOiKdfOFCsVFQ==",
        "From": "Gongming Chen <chengongming1900@outlook.com>",
        "To": "jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com,\n yanzhirun_163@163.com",
        "Cc": "dev@dpdk.org, Gongming Chen <chengm11@chinatelecom.cn>, stable@dpdk.org,\n Fan Yin <yinf1@chinatelecom.cn>",
        "Subject": "[PATCH v2] graph: fix does not return the unique id when create graph",
        "Date": "Fri, 10 May 2024 14:47:47 +0800",
        "Message-ID": "\n <TYAP286MB06492336688E0855A00ADFF7D8E72@TYAP286MB0649.JPNP286.PROD.OUTLOOK.COM>",
        "X-Mailer": "git-send-email 2.32.1 (Apple Git-133)",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-TMN": "[zOw9JEcG3WC3Ee0HmKgkYkkdTUl51usv]",
        "X-ClientProxiedBy": "TYCP286CA0314.JPNP286.PROD.OUTLOOK.COM\n (2603:1096:400:38b::18) To TYAP286MB0649.JPNP286.PROD.OUTLOOK.COM\n (2603:1096:402:38::13)",
        "X-Microsoft-Original-Message-ID": "\n <20240510064747.18051-1-chengongming1900@outlook.com>",
        "MIME-Version": "1.0",
        "X-MS-Exchange-MessageSentRepresentingType": "1",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-TrafficTypeDiagnostic": "TYAP286MB0649:EE_|TYCP286MB3636:EE_",
        "X-MS-Office365-Filtering-Correlation-Id": "3d98c6fd-be19-48ba-52d8-08dc70bd2597",
        "X-Microsoft-Antispam": "BCL:0;\n ARA:14566002|461199019|440099019|3412199016|3430499023;",
        "X-Microsoft-Antispam-Message-Info": "\n QxJZ9EZy6Mn7iDcN0S2tJNdIdEIiaaoNkDvZU4xn8ZlfYXA2Wn4FOkEY+rsDMmFoOKk6F/i/ZFkIi8A2QCvmmSreSV+ClvmvWD0G+ZKIIiHwmTMQ6VU6nVsPlgpTY7MjTKLCJYVjanDqcHDGVqmQIxMyoNp0ZaXQGEk8TnqKGmNkmKJqHv8+ab8FRX0Lqb3gNDIOlnkPEUN9sKPHj2mlP/y2lY++74+Y6tinv3RvrCc+zmmfTfMOp8SOw0OAUkEZJ7TnUsxmECUk+eVAoNBI6Lmpppi4qT9jiIl9q0C7EA0TWjYQgf5z5fSCaO26uDHTKlr97WF8sLaPgolJaCdKU79Q1ZdPcYwLhCDXcbk0K26kO9WuBqdsmvvLlBx26Ds92igPGQqE6dDBL7WxYy5f4Njt8stmDQOdYJTJlM6kmUw+peQwMgo4CNmRcl/s6ddie+wCanbf47c99XPcCxrlXe6C576aC9/eEtWYWXxYgcm+G558ciPgOmOOaoTpscIOBY6+/Jr0IHQ3mTo9J3Qmr4jVDBj6uVCkx/CXXUVqIUgVrd9OcbXAUWZoKSPjtVXW",
        "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1",
        "X-MS-Exchange-AntiSpam-MessageData-0": "\n ao1DQwtiAeavPEYXMzQ79xcL9fy2x1UWWNh2hTTlTmO6VFUfsCOnuO5IjQ5NGz5z1/mLwmuuI53WZSgQ+0u0Yj/aEwMYExsQDogCd5P68dqEPaSJY5kRjOUudPOMmaZWRC0+rHaUZEXI9ctQ/n4sjN7ZvDJjQm5ZWGmbsjR+XhWZk1VO1DZi2XCakKXkOvs8hnVmTLXrvgn1G75REUU7dxquIYmT992Yrb0bDqncwEyO6jGHTh3E5ZeoCCb7byBtYL9DQ/31awDpW+0DSX6nlMEHxPOlL0OfOseewtW3pru3orVHSvUCS+iFbG81BCaRtv3pKzg5L0p+LsxHPP2yMhAVUhUQBIgt+y/+G+gmyRUYLO/KcFsoSmFNqe2LwMiQ0lLvUB6pVik43hxmPkPEy5FMgaRJjugAqRa0YfIfAEWOCjtVCvytSbXoFtNIwalvWZOlkVCyDvE2/P0EF0Gt2cUHWYW9PpdpdJn82QOYbIPxQLg4bxMaOTBunswrNEq3GLNFWeLu5kouRMj/rHPBSrPJtIUAJvd7OqmrE4Ky6MWHdMnCDOOGFtOVDTcPgm/epmU+RGhk5wbosKiVWYSaRIHVXgyNI/eOJ+9itTLGD5PI+kuC2HY6YvsVHLnQeknfcvUJmLbL6HXKXDWeiXx0JyF8u+07sdppHXoKkj+7RA1wfoiKURkbtgI9yt7lMVjaXZDUU/TmKQj0SiOX1a09yfnWWxUqfMyGjkbVB9NG15wj6qjWFoCC6HWa8kH/wpPSxOJPN/DagdeHsJ8ajjcq1VNAr2mtg/wg+wyf7DzGbvdEo8Gt5WgEfZD9fLLdlDtjKx0upCIAJZEQyTOxGihd9ZG0NXU09H2h2Mo3RAndJ7w+RUsK8b6WnIsypGEe+bXyRYhgMHHTJrMeQUixuyJYluIZEYIKeno4mhIZgDVP2QXt0sjF74c1fphmFLcpQEIC8PE5Koyp6+H/U3wdh2NTkMBd6qnMFEd0nSRDnnG2motU5va5ZCak/m8GVyIrTlTqj8e9hN2VMTb4F05ws4O3a6h/CaslriScC8Vr2b9QjDdWuuyI+QCKBtsi8uhUzV5YrA8HS795z8vaw/z5WUwQ1qLHlpufNMK3QgGn0sJ1PiWuWDhnWUieS/cX2OryRK/1xHEqTHPi5tij2Ab3t3muJLvF5UAwMChwNvUl64CjLKsuN/E/kh9UgYaulnrFpHSU+mqbGqp8vafDg9GSOFMZPnCKvmaVS8yIkclQjpGlPwAoyVk8IpOrTQ7hISo7i1Gc",
        "X-OriginatorOrg": "outlook.com",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 3d98c6fd-be19-48ba-52d8-08dc70bd2597",
        "X-MS-Exchange-CrossTenant-AuthSource": "TYAP286MB0649.JPNP286.PROD.OUTLOOK.COM",
        "X-MS-Exchange-CrossTenant-AuthAs": "Internal",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "10 May 2024 06:48:06.3829 (UTC)",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "Hosted",
        "X-MS-Exchange-CrossTenant-Id": "84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa",
        "X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg": "\n 00000000-0000-0000-0000-000000000000",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "TYCP286MB3636",
        "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": "From: Gongming Chen <chengm11@chinatelecom.cn>\n\nWhen the order of graph destroy is not the reverse order of create,\nthat is, when it is destroyed at will, the newly created graph id will\nbe the same as the existing graph id, which is not the expected unique\ngraph id. This graph id incorrectly corresponds to multiple graphs.\n\nFixes: a91fecc19c5c (\"graph: implement create and destroy\")\nCc: stable@dpdk.org\n\nReported-by: Fan Yin <yinf1@chinatelecom.cn>\nSigned-off-by: Gongming Chen <chengm11@chinatelecom.cn>\nSigned-off-by: Fan Yin <yinf1@chinatelecom.cn>\n---\n lib/graph/graph.c | 163 ++++++++++++++++++++++++++--------------------\n 1 file changed, 94 insertions(+), 69 deletions(-)",
    "diff": "diff --git a/lib/graph/graph.c b/lib/graph/graph.c\nindex 26f0968a97..b8fecd9c6a 100644\n--- a/lib/graph/graph.c\n+++ b/lib/graph/graph.c\n@@ -19,9 +19,6 @@\n \n static struct graph_head graph_list = STAILQ_HEAD_INITIALIZER(graph_list);\n static rte_spinlock_t graph_lock = RTE_SPINLOCK_INITIALIZER;\n-static rte_graph_t graph_id;\n-\n-#define GRAPH_ID_CHECK(id) ID_CHECK(id, graph_id)\n \n /* Private functions */\n struct graph_head *\n@@ -217,6 +214,46 @@ graph_node_fini(struct graph *graph)\n \t\t\t\t\t\t       graph_node->node->name));\n }\n \n+static struct graph *\n+graph_find_by_id(rte_graph_t id)\n+{\n+\tstruct graph *graph;\n+\n+\tSTAILQ_FOREACH(graph, &graph_list, next)\n+\t\tif (graph->id == id)\n+\t\t\treturn graph;\n+\treturn NULL;\n+}\n+\n+static struct graph *\n+graph_find_by_name(const char *name)\n+{\n+\tstruct graph *graph;\n+\n+\tSTAILQ_FOREACH(graph, &graph_list, next)\n+\t\tif (strncmp(graph->name, name, RTE_GRAPH_NAMESIZE) == 0)\n+\t\t\treturn graph;\n+\treturn NULL;\n+}\n+\n+static rte_graph_t\n+graph_free_id_find(void)\n+{\n+\tstatic rte_graph_t graph_id;\n+\tif (graph_id == RTE_GRAPH_ID_INVALID)\n+\t\tgraph_id++;\n+\n+\trte_graph_t end_id = graph_id;\n+\tdo {\n+\t\tif (!graph_find_by_id(graph_id))\n+\t\t\treturn graph_id++;\n+\t\tif (++graph_id == RTE_GRAPH_ID_INVALID)\n+\t\t\tgraph_id++;\n+\t} while (graph_id != end_id);\n+\n+\treturn RTE_GRAPH_ID_INVALID;\n+}\n+\n static struct rte_graph *\n graph_mem_fixup_node_ctx(struct rte_graph *graph)\n {\n@@ -279,13 +316,12 @@ rte_graph_model_mcore_dispatch_core_bind(rte_graph_t id, int lcore)\n {\n \tstruct graph *graph;\n \n-\tGRAPH_ID_CHECK(id);\n \tif (!rte_lcore_is_enabled(lcore))\n \t\tSET_ERR_JMP(ENOLINK, fail, \"lcore %d not enabled\", lcore);\n \n-\tSTAILQ_FOREACH(graph, &graph_list, next)\n-\t\tif (graph->id == id)\n-\t\t\tbreak;\n+\tgraph = graph_find_by_id(id);\n+\tif (!graph)\n+\t\tgoto fail;\n \n \tif (graph->graph->model != RTE_GRAPH_MODEL_MCORE_DISPATCH)\n \t\tgoto fail;\n@@ -309,15 +345,12 @@ rte_graph_model_mcore_dispatch_core_unbind(rte_graph_t id)\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\tbreak;\n+\tgraph = graph_find_by_id(id);\n+\tif (!graph)\n+\t\treturn;\n \n \tgraph->lcore_id = RTE_MAX_LCORE;\n \tgraph->graph->dispatch.lcore_id = RTE_MAX_LCORE;\n-\n-fail:\n \treturn;\n }\n \n@@ -352,10 +385,8 @@ rte_graph_create(const char *name, struct rte_graph_param *prm)\n \t\tSET_ERR_JMP(EINVAL, fail, \"Graph name should not be NULL\");\n \n \t/* Check for existence of duplicate graph */\n-\tSTAILQ_FOREACH(graph, &graph_list, next)\n-\t\tif (strncmp(name, graph->name, RTE_GRAPH_NAMESIZE) == 0)\n-\t\t\tSET_ERR_JMP(EEXIST, fail, \"Found duplicate graph %s\",\n-\t\t\t\t    name);\n+\tif (graph_find_by_name(name))\n+\t\tSET_ERR_JMP(EEXIST, fail, \"Found duplicate graph %s\", name);\n \n \t/* Create graph object */\n \tgraph = calloc(1, sizeof(*graph));\n@@ -403,10 +434,12 @@ rte_graph_create(const char *name, struct rte_graph_param *prm)\n \tgraph_pcap_enable(prm->pcap_enable);\n \n \t/* Initialize graph object */\n+\tgraph->id = graph_free_id_find();\n+\tif (graph->id == RTE_GRAPH_ID_INVALID)\n+\t\tgoto graph_cleanup;\n \tgraph->socket = prm->socket_id;\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@@ -422,7 +455,6 @@ rte_graph_create(const char *name, struct rte_graph_param *prm)\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@@ -467,7 +499,6 @@ rte_graph_destroy(rte_graph_t id)\n \t\t\tgraph_cleanup(graph);\n \t\t\tSTAILQ_REMOVE(&graph_list, graph, graph, next);\n \t\t\tfree(graph);\n-\t\t\tgraph_id--;\n \t\t\tgoto done;\n \t\t}\n \t\tgraph = tmp;\n@@ -515,12 +546,14 @@ graph_clone(struct graph *parent_graph, const char *name, struct rte_graph_param\n \t\tgoto graph_cleanup;\n \n \t/* Initialize the graph object */\n+\tgraph->id = graph_free_id_find();\n+\tif (graph->id == RTE_GRAPH_ID_INVALID)\n+\t\tgoto graph_cleanup;\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@@ -539,7 +572,6 @@ graph_clone(struct graph *parent_graph, const char *name, struct rte_graph_param\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@@ -561,12 +593,10 @@ rte_graph_clone(rte_graph_t id, const char *name, struct rte_graph_param *prm)\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, prm);\n+\tgraph = graph_find_by_id(id);\n+\tif (graph)\n+\t\treturn graph_clone(graph, name, prm);\n \n-fail:\n \treturn RTE_GRAPH_ID_INVALID;\n }\n \n@@ -575,9 +605,9 @@ rte_graph_from_name(const char *name)\n {\n \tstruct graph *graph;\n \n-\tSTAILQ_FOREACH(graph, &graph_list, next)\n-\t\tif (strncmp(graph->name, name, RTE_GRAPH_NAMESIZE) == 0)\n-\t\t\treturn graph->id;\n+\tgraph = graph_find_by_name(name);\n+\tif (graph)\n+\t\treturn graph->id;\n \n \treturn RTE_GRAPH_ID_INVALID;\n }\n@@ -587,12 +617,10 @@ rte_graph_id_to_name(rte_graph_t id)\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->name;\n+\tgraph = graph_find_by_id(id);\n+\tif (graph)\n+\t\treturn graph->name;\n \n-fail:\n \treturn NULL;\n }\n \n@@ -604,17 +632,13 @@ rte_graph_node_get(rte_graph_t gid, uint32_t nid)\n \trte_graph_off_t off;\n \trte_node_t count;\n \n-\tGRAPH_ID_CHECK(gid);\n-\tSTAILQ_FOREACH(graph, &graph_list, next)\n-\t\tif (graph->id == gid) {\n-\t\t\trte_graph_foreach_node(count, off, graph->graph,\n-\t\t\t\t\t\tnode) {\n-\t\t\t\tif (node->id == nid)\n-\t\t\t\t\treturn node;\n-\t\t\t}\n-\t\t\tbreak;\n+\tgraph = graph_find_by_id(gid);\n+\tif (graph)\n+\t\trte_graph_foreach_node(count, off, graph->graph, node) {\n+\t\t\tif (node->id == nid)\n+\t\t\t\treturn node;\n \t\t}\n-fail:\n+\n \treturn NULL;\n }\n \n@@ -626,15 +650,11 @@ rte_graph_node_get_by_name(const char *graph_name, const char *node_name)\n \trte_graph_off_t off;\n \trte_node_t count;\n \n-\tSTAILQ_FOREACH(graph, &graph_list, next)\n-\t\tif (!strncmp(graph->name, graph_name, RTE_GRAPH_NAMESIZE)) {\n-\t\t\trte_graph_foreach_node(count, off, graph->graph,\n-\t\t\t\t\t\tnode) {\n-\t\t\t\tif (!strncmp(node->name, node_name,\n-\t\t\t\t\t     RTE_NODE_NAMESIZE))\n-\t\t\t\t\treturn node;\n-\t\t\t}\n-\t\t\tbreak;\n+\tgraph = graph_find_by_name(graph_name);\n+\tif (graph)\n+\t\trte_graph_foreach_node(count, off, graph->graph, node) {\n+\t\t\tif (!strncmp(node->name, node_name, RTE_NODE_NAMESIZE))\n+\t\t\t\treturn node;\n \t\t}\n \n \treturn NULL;\n@@ -713,13 +733,10 @@ rte_graph_export(const char *name, FILE *f)\n \tstruct graph *graph;\n \tint rc = ENOENT;\n \n-\tSTAILQ_FOREACH(graph, &graph_list, next) {\n-\t\tif (strncmp(graph->name, name, RTE_GRAPH_NAMESIZE) == 0) {\n-\t\t\trc = graph_to_dot(f, graph);\n-\t\t\tgoto end;\n-\t\t}\n-\t}\n-end:\n+\tgraph = graph_find_by_name(name);\n+\tif (graph)\n+\t\trc = graph_to_dot(f, graph);\n+\n \treturn -rc;\n }\n \n@@ -729,17 +746,16 @@ graph_scan_dump(FILE *f, rte_graph_t id, bool all)\n \tstruct graph *graph;\n \n \tRTE_VERIFY(f);\n-\tGRAPH_ID_CHECK(id);\n \n-\tSTAILQ_FOREACH(graph, &graph_list, next) {\n-\t\tif (all == true) {\n+\tif (all == true) {\n+\t\tSTAILQ_FOREACH(graph, &graph_list, next)\n \t\t\tgraph_dump(f, graph);\n-\t\t} else if (graph->id == id) {\n+\t} else {\n+\t\tgraph = graph_find_by_id(id);\n+\t\tif (graph)\n \t\t\tgraph_dump(f, graph);\n-\t\t\treturn;\n-\t\t}\n \t}\n-fail:\n+\n \treturn;\n }\n \n@@ -758,7 +774,16 @@ rte_graph_list_dump(FILE *f)\n rte_graph_t\n rte_graph_max_count(void)\n {\n-\treturn graph_id;\n+\tstruct graph *graph;\n+\trte_graph_t count = 0;\n+\n+\tgraph_spinlock_lock();\n+\n+\tSTAILQ_FOREACH(graph, &graph_list, next)\n+\t\tcount++;\n+\n+\tgraph_spinlock_unlock();\n+\treturn count;\n }\n \n RTE_LOG_REGISTER_DEFAULT(rte_graph_logtype, INFO);\n",
    "prefixes": [
        "v2"
    ]
}