get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2371,
    "url": "https://patches.dpdk.org/api/patches/2371/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1421664027-17971-7-git-send-email-mukawa@igel.co.jp/",
    "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": "<1421664027-17971-7-git-send-email-mukawa@igel.co.jp>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1421664027-17971-7-git-send-email-mukawa@igel.co.jp",
    "date": "2015-01-19T10:40:22",
    "name": "[dpdk-dev,v4,06/11] eal/linux/pci: Add functions for unmapping igb_uio resources",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "809bac644147e485202fa779b237c1d4fd0c15f1",
    "submitter": {
        "id": 64,
        "url": "https://patches.dpdk.org/api/people/64/?format=api",
        "name": "Tetsuya Mukawa",
        "email": "mukawa@igel.co.jp"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1421664027-17971-7-git-send-email-mukawa@igel.co.jp/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2371/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2371/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 4679A5AC8;\n\tMon, 19 Jan 2015 11:41:28 +0100 (CET)",
            "from mail-pd0-f174.google.com (mail-pd0-f174.google.com\n\t[209.85.192.174]) by dpdk.org (Postfix) with ESMTP id 518F05AA6\n\tfor <dev@dpdk.org>; Mon, 19 Jan 2015 11:41:19 +0100 (CET)",
            "by mail-pd0-f174.google.com with SMTP id ft15so6746140pdb.5\n\tfor <dev@dpdk.org>; Mon, 19 Jan 2015 02:41:18 -0800 (PST)",
            "from localhost.localdomain (napt.igel.co.jp. [219.106.231.132])\n\tby mx.google.com with ESMTPSA id\n\ta13sm11337588pdm.44.2015.01.19.02.41.17\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tMon, 19 Jan 2015 02:41:18 -0800 (PST)"
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=X6K47lWvORkiUDRqM2w4s5jEXWop3hLyhdX5/r/JqaA=;\n\tb=LIFtoesbk/ZBmQAVDZ78gIEa0qa4nujgCRemVoeqhA2pYDYfL3TR3lJ/JZWnWDazGl\n\tw53RhaGKrRraII0Hl12xDYMF86Aq+R0Te7RMORLVQeSfRnSRNz73rxMpA3iq05IklhjB\n\t/wJWY3D39owhL9OUizFeJWVfUDk8btaZHvngvgZrBynH0NMgk8b4zogngNnRMLeeBCuT\n\tGmILyVP32Rf4J5CDn+8jYBiDCs9NmPb+6o8ijjNrG0L1lvjvrxgC5WXS3Zc2kyl00Q4x\n\tFuNiyNEB6WTzxM4o7VZOeRVefBI6iuqNkZW5NHEer/Thid+A+mW8ONNOxwnwn3Wdyc4x\n\tadYQ==",
        "X-Gm-Message-State": "ALoCoQkvsKmmTusOYFoPAXOhJZXSgft4H3sJQV1oezopJPo/lh7QNwHL848DZMMPg6+DJUimY+WK",
        "X-Received": "by 10.68.65.16 with SMTP id t16mr33322895pbs.163.1421664078649; \n\tMon, 19 Jan 2015 02:41:18 -0800 (PST)",
        "From": "Tetsuya Mukawa <mukawa@igel.co.jp>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 19 Jan 2015 19:40:22 +0900",
        "Message-Id": "<1421664027-17971-7-git-send-email-mukawa@igel.co.jp>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1421664027-17971-1-git-send-email-mukawa@igel.co.jp>",
        "References": "<1418106629-22227-2-git-send-email-mukawa@igel.co.j>\n\t<1421664027-17971-1-git-send-email-mukawa@igel.co.jp>",
        "Subject": "[dpdk-dev] [PATCH v4 06/11] eal/linux/pci: Add functions for\n\tunmapping igb_uio resources",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The patch adds functions for unmapping igb_uio resources. The patch is only\nfor Linux and igb_uio environment. VFIO and BSD are not supported.\n\nv4:\n- Add paramerter checking.\n- Add header file to determine if hotplug can be enabled.\n\nSigned-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>\n---\n lib/librte_eal/common/Makefile                  |  1 +\n lib/librte_eal/common/include/rte_dev_hotplug.h | 44 +++++++++++++++++\n lib/librte_eal/linuxapp/eal/eal_pci.c           | 38 +++++++++++++++\n lib/librte_eal/linuxapp/eal/eal_pci_init.h      |  8 +++\n lib/librte_eal/linuxapp/eal/eal_pci_uio.c       | 65 +++++++++++++++++++++++++\n 5 files changed, 156 insertions(+)\n create mode 100644 lib/librte_eal/common/include/rte_dev_hotplug.h",
    "diff": "diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile\nindex 52c1a5f..db7cc93 100644\n--- a/lib/librte_eal/common/Makefile\n+++ b/lib/librte_eal/common/Makefile\n@@ -41,6 +41,7 @@ INC += rte_eal_memconfig.h rte_malloc_heap.h\n INC += rte_hexdump.h rte_devargs.h rte_dev.h\n INC += rte_common_vect.h\n INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h\n+INC += rte_dev_hotplug.h\n \n ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y)\n INC += rte_warnings.h\ndiff --git a/lib/librte_eal/common/include/rte_dev_hotplug.h b/lib/librte_eal/common/include/rte_dev_hotplug.h\nnew file mode 100644\nindex 0000000..b333e0f\n--- /dev/null\n+++ b/lib/librte_eal/common/include/rte_dev_hotplug.h\n@@ -0,0 +1,44 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2015 IGEL Co.,LTd.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of IGEL Co.,Ltd. nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef _RTE_DEV_HOTPLUG_H_\n+#define _RTE_DEV_HOTPLUG_H_\n+\n+/*\n+ * determine if hotplug can be enabled on the system\n+ */\n+#if defined(RTE_LIBRTE_EAL_HOTPLUG) && defined(RTE_LIBRTE_EAL_LINUXAPP)\n+#define ENABLE_HOTPLUG\n+#endif /* RTE_LIBRTE_EAL_HOTPLUG & RTE_LIBRTE_EAL_LINUXAPP */\n+\n+#endif /* _RTE_DEV_HOTPLUG_H_ */\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c\nindex 3d2d93c..52c464c 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c\n@@ -137,6 +137,25 @@ pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size)\n \treturn mapaddr;\n }\n \n+#ifdef ENABLE_HOTPLUG\n+/* unmap a particular resource */\n+void\n+pci_unmap_resource(void *requested_addr, size_t size)\n+{\n+\tif (requested_addr == NULL)\n+\t\treturn;\n+\n+\t/* Unmap the PCI memory resource of device */\n+\tif (munmap(requested_addr, size)) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): cannot munmap(%p, 0x%lx): %s\\n\",\n+\t\t\t__func__, requested_addr, (unsigned long)size,\n+\t\t\tstrerror(errno));\n+\t} else\n+\t\tRTE_LOG(DEBUG, EAL, \"  PCI memory mapped at %p\\n\",\n+\t\t\t\trequested_addr);\n+}\n+#endif /* ENABLE_HOTPLUG */\n+\n /* parse the \"resource\" sysfs file */\n #define IORESOURCE_MEM  0x00000200\n \n@@ -510,6 +529,25 @@ pci_map_device(struct rte_pci_device *dev)\n \treturn 0;\n }\n \n+#ifdef ENABLE_HOTPLUG\n+static void\n+pci_unmap_device(struct rte_pci_device *dev)\n+{\n+\tif (dev == NULL)\n+\t\treturn;\n+\n+\t/* try unmapping the NIC resources using VFIO if it exists */\n+#ifdef VFIO_PRESENT\n+\tif (pci_vfio_is_enabled()) {\n+\t\tRTE_LOG(ERR, EAL, \"%s() doesn't support vfio yet.\\n\",\n+\t\t\t\t__func__);\n+\t\treturn;\n+\t}\n+#endif\n+\tpci_uio_unmap_resource(dev);\n+}\n+#endif /* ENABLE_HOTPLUG */\n+\n /*\n  * If vendor/device ID match, call the devinit() function of the\n  * driver.\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci_init.h b/lib/librte_eal/linuxapp/eal/eal_pci_init.h\nindex 1070eb8..5152a0b 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci_init.h\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci_init.h\n@@ -34,6 +34,7 @@\n #ifndef EAL_PCI_INIT_H_\n #define EAL_PCI_INIT_H_\n \n+#include <rte_dev_hotplug.h>\n #include \"eal_vfio.h\"\n \n struct pci_map {\n@@ -71,6 +72,13 @@ void *pci_map_resource(void *requested_addr, int fd, off_t offset,\n /* map IGB_UIO resource prototype */\n int pci_uio_map_resource(struct rte_pci_device *dev);\n \n+#ifdef ENABLE_HOTPLUG\n+void pci_unmap_resource(void *requested_addr, size_t size);\n+\n+/* unmap IGB_UIO resource prototype */\n+void pci_uio_unmap_resource(struct rte_pci_device *dev);\n+#endif /* ENABLE_HOTPLUG */\n+\n #ifdef VFIO_PRESENT\n \n #define VFIO_MAX_GROUPS 64\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\nindex 1da3507..81830d1 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\n@@ -404,6 +404,71 @@ pci_uio_map_resource(struct rte_pci_device *dev)\n \treturn 0;\n }\n \n+#ifdef ENABLE_HOTPLUG\n+static void\n+pci_uio_unmap(struct mapped_pci_resource *uio_res)\n+{\n+\tint i;\n+\n+\tif (uio_res == NULL)\n+\t\treturn;\n+\n+\tfor (i = 0; i != uio_res->nb_maps; i++)\n+\t\tpci_unmap_resource(uio_res->maps[i].addr,\n+\t\t\t\t(size_t)uio_res->maps[i].size);\n+}\n+\n+static struct mapped_pci_resource *\n+pci_uio_find_resource(struct rte_pci_device *dev)\n+{\n+\tstruct mapped_pci_resource *uio_res;\n+\n+\tif (dev == NULL)\n+\t\treturn NULL;\n+\n+\tTAILQ_FOREACH(uio_res, pci_res_list, next) {\n+\n+\t\t/* skip this element if it doesn't match our PCI address */\n+\t\tif (!eal_compare_pci_addr(&uio_res->pci_addr, &dev->addr))\n+\t\t\treturn uio_res;\n+\t}\n+\treturn NULL;\n+}\n+\n+/* unmap the PCI resource of a PCI device in virtual memory */\n+void\n+pci_uio_unmap_resource(struct rte_pci_device *dev)\n+{\n+\tstruct mapped_pci_resource *uio_res;\n+\n+\tif (dev == NULL)\n+\t\treturn;\n+\n+\t/* find an entry for the device */\n+\tuio_res = pci_uio_find_resource(dev);\n+\tif (uio_res == NULL)\n+\t\treturn;\n+\n+\t/* secondary processes - just free maps */\n+\tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n+\t\treturn pci_uio_unmap(uio_res);\n+\n+\tTAILQ_REMOVE(pci_res_list, uio_res, next);\n+\n+\t/* unmap all resources */\n+\tpci_uio_unmap(uio_res);\n+\n+\t/* free uio resource */\n+\trte_free(uio_res);\n+\n+\t/* close fd if in primary process */\n+\tclose(dev->intr_handle.fd);\n+\n+\tdev->intr_handle.fd = -1;\n+\tdev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN;\n+}\n+#endif /* ENABLE_HOTPLUG */\n+\n /*\n  * parse a sysfs file containing one integer value\n  * different to the eal version, as it needs to work with 64-bit values\n",
    "prefixes": [
        "dpdk-dev",
        "v4",
        "06/11"
    ]
}