get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 73524,
    "url": "https://patches.dpdk.org/api/patches/73524/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200708120329.103200-1-m.bilal@emumba.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": "<20200708120329.103200-1-m.bilal@emumba.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200708120329.103200-1-m.bilal@emumba.com",
    "date": "2020-07-08T12:03:29",
    "name": "EAL: Called remove() of drivers for vdev and pci buses",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "dc8642bf5bca9e83e0bc4f81483561bb68f08a54",
    "submitter": {
        "id": 1639,
        "url": "https://patches.dpdk.org/api/people/1639/?format=api",
        "name": "Muhammad Bilal",
        "email": "m.bilal@emumba.com"
    },
    "delegate": {
        "id": 24651,
        "url": "https://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200708120329.103200-1-m.bilal@emumba.com/mbox/",
    "series": [
        {
            "id": 10889,
            "url": "https://patches.dpdk.org/api/series/10889/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10889",
            "date": "2020-07-08T12:03:29",
            "name": "EAL: Called remove() of drivers for vdev and pci buses",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/10889/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/73524/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/73524/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 24A30A0526;\n\tWed,  8 Jul 2020 14:04:41 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D80391DD1C;\n\tWed,  8 Jul 2020 14:04:39 +0200 (CEST)",
            "from mail-wm1-f66.google.com (mail-wm1-f66.google.com\n [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id CA77E1DBCB\n for <dev@dpdk.org>; Wed,  8 Jul 2020 14:04:38 +0200 (CEST)",
            "by mail-wm1-f66.google.com with SMTP id q15so2736893wmj.2\n for <dev@dpdk.org>; Wed, 08 Jul 2020 05:04:38 -0700 (PDT)",
            "from localhost.localdomain ([182.191.83.208])\n by smtp.gmail.com with ESMTPSA id 207sm6681501wme.13.2020.07.08.05.04.32\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 08 Jul 2020 05:04:37 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=emumba-com.20150623.gappssmtp.com; s=20150623;\n h=from:to:cc:subject:date:message-id:mime-version\n :content-transfer-encoding;\n bh=vwURkGZ0MxEzMUg4cwSkBOTysqIu4vNHrlcX3DlvUjY=;\n b=16VBH5mM4bEf0F7SOL3m5LObJSOgyUG0s8SDUc7V2gIHOe7RyrLTZD26tgIcJHkrkX\n yaQK4pe9XgXyfJ1109TAy3qaHuFhHwCZZ8poAnEW50xadhrIdupjnWURoo06akS0k6LS\n WWAxEORXPrMfZ/JSkyZwpBgcb4PXpALhi+tVbpuFsnzvOxb+UsPJ3CBcNItUXJE6jxt9\n /1rP3OOnKDGnBtFFJvLxt46si4xFdmDPGW0QWZ2XF9MYVI3hLV4wk0vqKiami+I8vp50\n HpwLgjDUGv/xJeqVXueGebcHTA4kCaN68mfWR4xsHy7Pdtzti6ZVC2v5GQJ9V8beiypo\n j3YQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n :content-transfer-encoding;\n bh=vwURkGZ0MxEzMUg4cwSkBOTysqIu4vNHrlcX3DlvUjY=;\n b=sEKWn34hFA1VorbCUNLMubLrIO1LW5Zgao0tTE7vivTTx6ETG01V8OgvMo7pNkEqcp\n ofNZDMvCtzAxruG/7Rs5MjNrveNnwSVHvo1IHU/BQp9+uknm7zJCUJkd0HEwN/GinFd6\n 9wcqQvwQWb/6AzMlJswdeojrK2Erjjg/BcKwM4O/fSg4RlyXRrI+1gveAKjECHcP7z3H\n XWcJCJOMt4xhEguTvtrFeUCUWnOaGl7ZRtYfEe4b4FjIyNt8ySwEabKz8F72sQbh3fNq\n j4STpvTqSWOnqfc4VBf1i2+3UZ/Vu9Wj4QsxlDPdeqcZ5W64+V9KAqWIf0wu5a7i4isj\n kSSQ==",
        "X-Gm-Message-State": "AOAM533C9RgrZmb6kFFp0GruodMh3wxvZqf84EkUgeS1MH4P8OcWJErR\n qb3VnQu1WmvgTdzy3NtVk0y4Uw==",
        "X-Google-Smtp-Source": "\n ABdhPJyLTiBLUPucFh4F6wZf/DEVQ2ufee91e45gCOhxXrJqQ4G5kyNBxjmGfA/JFugx6bpaMX5Djg==",
        "X-Received": "by 2002:a1c:7fd7:: with SMTP id\n a206mr8977671wmd.104.1594209878457;\n Wed, 08 Jul 2020 05:04:38 -0700 (PDT)",
        "From": "Muhammad Bilal <m.bilal@emumba.com>",
        "To": "ferruh.yigit@intel.com,\n\tanatoly.burakov@intel.com",
        "Cc": "vipin.varghese@intel.com, jgrajcia@cisco.com, jerinj@marvell.com,\n dev@dpdk.org, stable@dpdk.org, Muhammad Bilal <m.bilal@emumba.com>",
        "Date": "Wed,  8 Jul 2020 17:03:29 +0500",
        "Message-Id": "<20200708120329.103200-1-m.bilal@emumba.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH] EAL: Called remove() of drivers for vdev and pci\n\tbuses",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "while using memif with app, the resources are not cleaned on exit,\nSo an error occurred on running it second time. The cause of this problem\nis that remove() of memif driver is not called by rte_eal_cleanup() which\nis counterpart of probe() called from rte_eal_init(). This is a case for\nall other divers e.g pci, so to solve this problem I have added the\nfunctionality of calling remove() function of all the driver attached to\ndevices on vdev and pci buses.\n\nBugzilla ID: 353\nSigned-off-by: Muhammad Bilal <m.bilal@emumba.com>\n---\n drivers/bus/pci/pci_common.c           | 23 +++++++++++++++++++++++\n drivers/bus/vdev/vdev.c                | 19 ++++++++++++++++++-\n lib/librte_eal/common/eal_common_bus.c | 18 ++++++++++++++++++\n lib/librte_eal/include/rte_bus.h       | 23 +++++++++++++++++++++++\n lib/librte_eal/linux/eal.c             |  2 ++\n 5 files changed, 84 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c\nindex 245d94f59..203b32a23 100644\n--- a/drivers/bus/pci/pci_common.c\n+++ b/drivers/bus/pci/pci_common.c\n@@ -320,6 +320,28 @@ pci_probe(void)\n \treturn (probed && probed == failed) ? -1 : 0;\n }\n \n+/*\n+ * Scan the content of the PCI bus, and call the remove() function for\n+ * all registered drivers of devices that have already been probed.\n+ */\n+static int\n+pci_remove(void)\n+{\n+\tstruct rte_pci_device *dev = NULL;\n+\tint ret = 0;\n+\n+\tFOREACH_DEVICE_ON_PCIBUS(dev) {\n+\t\tif (rte_dev_is_probed(&dev->device))\n+\t\t\tif (rte_pci_detach_dev(dev) != 0) {\n+\t\t\t\tRTE_LOG(INFO, EAL,\n+\t\t\t\t\t\"failed to detach driver form %s\\n\",\n+\t\t\t\t\tdev->device.name);\n+\t\t\t\tret = -1;\n+\t\t\t}\n+\t}\n+\treturn ret;\n+}\n+\n /* dump one device */\n static int\n pci_dump_one_device(FILE *f, struct rte_pci_device *dev)\n@@ -669,6 +691,7 @@ struct rte_pci_bus rte_pci_bus = {\n \t.bus = {\n \t\t.scan = rte_pci_scan,\n \t\t.probe = pci_probe,\n+\t\t.remove = pci_remove,\n \t\t.find_device = pci_find_device,\n \t\t.plug = pci_plug,\n \t\t.unplug = pci_unplug,\ndiff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c\nindex a89ea2353..692c936b9 100644\n--- a/drivers/bus/vdev/vdev.c\n+++ b/drivers/bus/vdev/vdev.c\n@@ -546,6 +546,22 @@ vdev_unplug(struct rte_device *dev)\n \treturn rte_vdev_uninit(dev->name);\n }\n \n+static int\n+vdev_remove(void)\n+{\n+\tstruct rte_vdev_device *dev;\n+\tint ret = 0;\n+\n+\tTAILQ_FOREACH(dev, &vdev_device_list, next) {\n+\t\tif (vdev_remove_driver(dev) != 0) {\n+\t\t\tVDEV_LOG(INFO, \"driver of %s is not removed\\n\",\n+\t\t\t\tdev->device.name);\n+\t\t\tret = -1;\n+\t\t}\n+\t}\n+\treturn ret;\n+}\n+\n static struct rte_bus rte_vdev_bus = {\n \t.scan = vdev_scan,\n \t.probe = vdev_probe,\n@@ -554,7 +570,8 @@ static struct rte_bus rte_vdev_bus = {\n \t.unplug = vdev_unplug,\n \t.parse = vdev_parse,\n \t.dev_iterate = rte_vdev_dev_iterate,\n-};\n+\t.remove = vdev_remove,\n+\t};\n \n RTE_REGISTER_BUS(vdev, rte_vdev_bus);\n \ndiff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c\nindex baa5b532a..bff95a0ae 100644\n--- a/lib/librte_eal/common/eal_common_bus.c\n+++ b/lib/librte_eal/common/eal_common_bus.c\n@@ -85,6 +85,24 @@ rte_bus_probe(void)\n \treturn 0;\n }\n \n+/* Remove all devices of all buses */\n+int\n+rte_bus_remove(void)\n+{\n+\tint ret;\n+\tstruct rte_bus *bus;\n+\n+\tTAILQ_FOREACH(bus, &rte_bus_list, next) {\n+\t\tif (!strcmp(bus->name, \"vdev\") || !strcmp(bus->name, \"pci\")) {\n+\t\t\tret = bus->remove();\n+\t\t\tif (ret)\n+\t\t\t\tRTE_LOG(INFO, EAL, \"Bus (%s) remove failed.\\n\",\n+\t\t\t\t\tbus->name);\n+\t\t}\n+\t}\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/librte_eal/include/rte_bus.h b/lib/librte_eal/include/rte_bus.h\nindex d3034d0ed..c3e7e62c9 100644\n--- a/lib/librte_eal/include/rte_bus.h\n+++ b/lib/librte_eal/include/rte_bus.h\n@@ -67,6 +67,18 @@ typedef int (*rte_bus_scan_t)(void);\n  */\n typedef int (*rte_bus_probe_t)(void);\n \n+/**\n+ * Implementation specific remove function which is responsible for unlinking\n+ * devices on that bus from attached drivers.\n+ *\n+ * This is called while iterating over each registered bus.\n+ *\n+ * @return\n+ *\t0 for successful remove\n+ *\t!0 for any error while removing\n+ */\n+typedef int (*rte_bus_remove_t)(void);\n+\n /**\n  * Device iterator to find a device on a bus.\n  *\n@@ -248,6 +260,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_remove_t remove;\t /**< remove device 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@@ -301,6 +314,16 @@ int rte_bus_scan(void);\n  */\n int rte_bus_probe(void);\n \n+/**\n+ * For each device on the buses,call the driver-specific remove\n+ * for device uninitialization.\n+ *\n+ * @return\n+ *\t 0 for successful match/probe\n+ *\t!0 otherwise\n+ */\n+int rte_bus_remove(void);\n+\n /**\n  * Dump information of all the buses registered with EAL.\n  *\ndiff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c\nindex f162124a3..89a03d3bb 100644\n--- a/lib/librte_eal/linux/eal.c\n+++ b/lib/librte_eal/linux/eal.c\n@@ -1330,6 +1330,8 @@ mark_freeable(const struct rte_memseg_list *msl, const struct rte_memseg *ms,\n int\n rte_eal_cleanup(void)\n {\n+\t/* Remove devices/drivers from all buses */\n+\trte_bus_remove();\n \t/* if we're in a primary process, we need to mark hugepages as freeable\n \t * so that finalization can release them back to the system.\n \t */\n",
    "prefixes": []
}