get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 105703,
    "url": "http://patches.dpdk.org/api/patches/105703/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220110052627.22577-1-rohit.raj@nxp.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": "<20220110052627.22577-1-rohit.raj@nxp.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220110052627.22577-1-rohit.raj@nxp.com",
    "date": "2022-01-10T05:26:26",
    "name": "[v5,1/2] eal: add API for bus close",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "411023793c2751c38ad65e96b6dcb82dc37ee9e3",
    "submitter": {
        "id": 1845,
        "url": "http://patches.dpdk.org/api/people/1845/?format=api",
        "name": "Rohit Raj",
        "email": "rohit.raj@nxp.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/20220110052627.22577-1-rohit.raj@nxp.com/mbox/",
    "series": [
        {
            "id": 21104,
            "url": "http://patches.dpdk.org/api/series/21104/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=21104",
            "date": "2022-01-10T05:26:26",
            "name": "[v5,1/2] eal: add API for bus close",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/21104/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/105703/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/105703/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 07307A0351;\n\tMon, 10 Jan 2022 06:26:31 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 803E040E0F;\n\tMon, 10 Jan 2022 06:26:31 +0100 (CET)",
            "from inva021.nxp.com (inva021.nxp.com [92.121.34.21])\n by mails.dpdk.org (Postfix) with ESMTP id 415844013F\n for <dev@dpdk.org>; Mon, 10 Jan 2022 06:26:30 +0100 (CET)",
            "from inva021.nxp.com (localhost [127.0.0.1])\n by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id F2B14201138;\n Mon, 10 Jan 2022 06:26:29 +0100 (CET)",
            "from aprdc01srsp001v.ap-rdc01.nxp.com\n (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16])\n by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 90E01201137;\n Mon, 10 Jan 2022 06:26:29 +0100 (CET)",
            "from lsv03196.swis.in-blr01.nxp.com (lsv03196.swis.in-blr01.nxp.com\n [92.120.146.192])\n by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 64EC3183AC4C;\n Mon, 10 Jan 2022 13:26:28 +0800 (+08)"
        ],
        "From": "rohit.raj@nxp.com",
        "To": "Bruce Richardson <bruce.richardson@intel.com>,\n Ray Kinsella <mdr@ashroe.eu>, Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,\n Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,\n Dmitry Malloy <dmitrym@microsoft.com>,\n Pallavi Kadam <pallavi.kadam@intel.com>",
        "Cc": "dev@dpdk.org, nipun.gupta@nxp.com, sachin.saxena@nxp.com,\n hemant.agrawal@nxp.com, Rohit Raj <rohit.raj@nxp.com>",
        "Subject": "[PATCH v5 1/2] eal: add API for bus close",
        "Date": "Mon, 10 Jan 2022 10:56:26 +0530",
        "Message-Id": "<20220110052627.22577-1-rohit.raj@nxp.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20201008153048.19369-1-rohit.raj@nxp.com>",
        "References": "<20201008153048.19369-1-rohit.raj@nxp.com>",
        "X-Virus-Scanned": "ClamAV using ClamSMTP",
        "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: Rohit Raj <rohit.raj@nxp.com>\n\nAs per the current code we have API for bus probe, but the\nbus close API is missing. This breaks the multi process\nscenarios as objects are not cleaned while terminating the\nsecondary processes.\n\nThis patch adds a new API rte_bus_close() for cleanup of\nbus objects which were acquired during probe.\n\nSigned-off-by: Rohit Raj <rohit.raj@nxp.com>\n---\n\nRebased on this patch series:\nhttps://patches.dpdk.org/project/dpdk/list/?series=21049\n\nv5:\n* Updated release notes for new feature and API change.\n* Added support for error checking while closing bus.\n* Added experimental banner for new API.\n* Squashed changes related to freebsd and windows into single patch.\n* Discarded patch to fix a bug which is already fixed on latest\n  release.\n\nv4:\n* Added comments to clarify responsibility of rte_bus_close.\n* Added support for rte_bus_close on freebsd.\n* Added support for rte_bus_close on windows.\n\nv3:\n* nit: combined nested if statements.\n\nv2:\n* Moved rte_bus_close call to rte_eal_cleanup path.\n\n doc/guides/rel_notes/release_22_03.rst |  8 +++++++\n lib/eal/common/eal_common_bus.c        | 33 +++++++++++++++++++++++++-\n lib/eal/freebsd/eal.c                  |  1 +\n lib/eal/include/rte_bus.h              | 30 ++++++++++++++++++++++-\n lib/eal/linux/eal.c                    |  8 +++++++\n lib/eal/version.map                    |  3 +++\n lib/eal/windows/eal.c                  |  1 +\n 7 files changed, 82 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst\nindex 6d99d1eaa9..7417606a2a 100644\n--- a/doc/guides/rel_notes/release_22_03.rst\n+++ b/doc/guides/rel_notes/release_22_03.rst\n@@ -55,6 +55,11 @@ New Features\n      Also, make sure to start the actual text at the margin.\n      =======================================================\n \n+    * **Added support to close bus.**\n+\n+      Added capability to allow a user to do cleanup of bus objects which\n+      were acquired during bus probe.\n+\n \n Removed Items\n -------------\n@@ -84,6 +89,9 @@ API Changes\n    Also, make sure to start the actual text at the margin.\n    =======================================================\n \n+   * eal: Added new API ``rte_bus_close`` to perform cleanup bus objects which\n+     were acquired during bus probe.\n+\n \n ABI Changes\n -----------\ndiff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c\nindex baa5b532af..2c3c0a90d2 100644\n--- a/lib/eal/common/eal_common_bus.c\n+++ b/lib/eal/common/eal_common_bus.c\n@@ -1,5 +1,5 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright 2016 NXP\n+ * Copyright 2016,2022 NXP\n  */\n \n #include <stdio.h>\n@@ -85,6 +85,37 @@ rte_bus_probe(void)\n \treturn 0;\n }\n \n+/* Close all devices of all buses */\n+int\n+rte_bus_close(void)\n+{\n+\tint ret;\n+\tstruct rte_bus *bus, *vbus = NULL;\n+\n+\tTAILQ_FOREACH(bus, &rte_bus_list, next) {\n+\t\tif (!strcmp(bus->name, \"vdev\")) {\n+\t\t\tvbus = bus;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (bus->close) {\n+\t\t\tret = bus->close();\n+\t\t\tif (ret)\n+\t\t\t\tRTE_LOG(ERR, EAL, \"Bus (%s) close failed.\\n\",\n+\t\t\t\t\tbus->name);\n+\t\t}\n+\t}\n+\n+\tif (vbus && vbus->close) {\n+\t\tret = vbus->close();\n+\t\tif (ret)\n+\t\t\tRTE_LOG(ERR, EAL, \"Bus (%s) close failed.\\n\",\n+\t\t\t\tvbus->name);\n+\t}\n+\n+\treturn 0;\n+}\n+\n /* Dump information of a single bus */\n static int\n bus_dump_one(FILE *f, struct rte_bus *bus)\ndiff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c\nindex a1cd2462db..87d70c6898 100644\n--- a/lib/eal/freebsd/eal.c\n+++ b/lib/eal/freebsd/eal.c\n@@ -984,6 +984,7 @@ rte_eal_cleanup(void)\n {\n \tstruct internal_config *internal_conf =\n \t\teal_get_internal_configuration();\n+\trte_bus_close();\n \trte_service_finalize();\n \trte_mp_channel_cleanup();\n \t/* after this point, any DPDK pointers will become dangling */\ndiff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h\nindex bbbb6efd28..c6211bbd95 100644\n--- a/lib/eal/include/rte_bus.h\n+++ b/lib/eal/include/rte_bus.h\n@@ -1,5 +1,5 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright 2016 NXP\n+ * Copyright 2016,2022 NXP\n  */\n \n #ifndef _RTE_BUS_H_\n@@ -66,6 +66,23 @@ typedef int (*rte_bus_scan_t)(void);\n  */\n typedef int (*rte_bus_probe_t)(void);\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Implementation specific close function which is responsible for resetting all\n+ * detected devices on the bus to a default state, closing UIO nodes or VFIO\n+ * groups and also freeing any memory allocated during rte_bus_probe like\n+ * private resources for device list.\n+ *\n+ * This is called while iterating over each registered bus.\n+ *\n+ * @return\n+ *\t0 for successful close\n+ *\t!0 for any error while closing\n+ */\n+typedef int (*rte_bus_close_t)(void);\n+\n /**\n  * Device iterator to find a device on a bus.\n  *\n@@ -263,6 +280,7 @@ struct rte_bus {\n \tconst char *name;            /**< Name of the bus */\n \trte_bus_scan_t scan;         /**< Scan for devices attached to bus */\n \trte_bus_probe_t probe;       /**< Probe devices on bus */\n+\trte_bus_close_t close;       /**< Close devices on bus */\n \trte_bus_find_device_t find_device; /**< Find a device on the bus */\n \trte_bus_plug_t plug;         /**< Probe single device for drivers */\n \trte_bus_unplug_t unplug;     /**< Remove single device from driver */\n@@ -317,6 +335,16 @@ int rte_bus_scan(void);\n  */\n int rte_bus_probe(void);\n \n+/**\n+ * For each device on the buses, call the device specific close.\n+ *\n+ * @return\n+ *\t 0 for successful close\n+ *\t!0 otherwise\n+ */\n+__rte_experimental\n+int rte_bus_close(void);\n+\n /**\n  * Dump information of all the buses registered with EAL.\n  *\ndiff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c\nindex 60b4924838..5c60131e46 100644\n--- a/lib/eal/linux/eal.c\n+++ b/lib/eal/linux/eal.c\n@@ -1362,6 +1362,14 @@ rte_eal_cleanup(void)\n \n \tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n \t\trte_memseg_walk(mark_freeable, NULL);\n+\n+\t/* Close all the buses and devices/drivers on them */\n+\tif (rte_bus_close()) {\n+\t\trte_eal_init_alert(\"Cannot close devices\");\n+\t\trte_errno = ENOTSUP;\n+\t\treturn -1;\n+\t}\n+\n \trte_service_finalize();\n \trte_mp_channel_cleanup();\n \t/* after this point, any DPDK pointers will become dangling */\ndiff --git a/lib/eal/version.map b/lib/eal/version.map\nindex ab28c22791..39882dbbd5 100644\n--- a/lib/eal/version.map\n+++ b/lib/eal/version.map\n@@ -420,6 +420,9 @@ EXPERIMENTAL {\n \trte_intr_instance_free;\n \trte_intr_type_get;\n \trte_intr_type_set;\n+\n+\t# added in 22.03\n+\trte_bus_close;\n };\n \n INTERNAL {\ndiff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c\nindex 67db7f099a..5915ab6291 100644\n--- a/lib/eal/windows/eal.c\n+++ b/lib/eal/windows/eal.c\n@@ -260,6 +260,7 @@ rte_eal_cleanup(void)\n \tstruct internal_config *internal_conf =\n \t\teal_get_internal_configuration();\n \n+\trte_bus_close();\n \teal_intr_thread_cancel();\n \teal_mem_virt2iova_cleanup();\n \t/* after this point, any DPDK pointers will become dangling */\n",
    "prefixes": [
        "v5",
        "1/2"
    ]
}