get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1380,
    "url": "https://patches.dpdk.org/api/patches/1380/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1416474399-16851-18-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": "<1416474399-16851-18-git-send-email-mukawa@igel.co.jp>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1416474399-16851-18-git-send-email-mukawa@igel.co.jp",
    "date": "2014-11-20T09:06:31",
    "name": "[dpdk-dev,17/25] eal/linux/pci: Add functions for unmapping igb_uio resources",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f321214fdb041a9986e2a3410b744e9da2a0a839",
    "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/1416474399-16851-18-git-send-email-mukawa@igel.co.jp/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1380/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1380/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 0A5047F98;\n\tThu, 20 Nov 2014 09:57:41 +0100 (CET)",
            "from mail-pd0-f178.google.com (mail-pd0-f178.google.com\n\t[209.85.192.178]) by dpdk.org (Postfix) with ESMTP id BC75F7F7C\n\tfor <dev@dpdk.org>; Thu, 20 Nov 2014 09:57:30 +0100 (CET)",
            "by mail-pd0-f178.google.com with SMTP id g10so481824pdj.23\n\tfor <dev@dpdk.org>; Thu, 20 Nov 2014 01:07:59 -0800 (PST)",
            "from localhost.localdomain (napt.igel.co.jp. [219.106.231.132])\n\tby mx.google.com with ESMTPSA id\n\ta6sm1432407pbu.64.2014.11.20.01.07.57 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tThu, 20 Nov 2014 01:07:58 -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=lXgZhf+okgJUYcTOzq/SFQtsFj0AZXZELCxKSYQ+GSo=;\n\tb=ca8jBqHeD6I2lBRGzI4lxJ+GLH9nITRyaTEymq6AC94FC9F6ia5oIUkZAbyCxnLUYJ\n\tYtwmFdFPk1t1srFcMbYKzon3gGOlnfLn8mMQX6bPXZCQCfpWqrCVNUz85GAeXY2A29fj\n\tl2I7T9NBgjaYPkQCLBJBc78sBTLuipn/8X8djXExYyGTloLW6vgKhFAgVm7UQiVj7vqV\n\tJZ4M6oaZL2IsBRGbTcoQLG8o5urb+QPwl0waOzgJNuUYTTi6mqcHY+niOf5vAnkxFy1D\n\t/fy1ujcv92iB+XtZ0bFWfB/0yhIU/nBJ4eB6p0u0Ex6Cv+Ep5SS/RjbloU/DIL8TRAIj\n\tWPKA==",
        "X-Gm-Message-State": "ALoCoQnTVts+F4xFdeHgfwWGJ3HAhK1rda5Bj60K4qd5EP8aCY3YYueRJ9UAa1tdiHGwVpi2Bk0n",
        "X-Received": "by 10.66.255.7 with SMTP id am7mr20517725pad.134.1416474479521; \n\tThu, 20 Nov 2014 01:07:59 -0800 (PST)",
        "From": "Tetsuya Mukawa <mukawa@igel.co.jp>",
        "To": "dev@dpdk.org",
        "Date": "Thu, 20 Nov 2014 18:06:31 +0900",
        "Message-Id": "<1416474399-16851-18-git-send-email-mukawa@igel.co.jp>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1416474399-16851-1-git-send-email-mukawa@igel.co.jp>",
        "References": "<1414572576-21371-1-git-send-email-mukawa@igel.co.jp>\n\t<1416474399-16851-1-git-send-email-mukawa@igel.co.jp>",
        "Cc": "nakajima.yoshihiro@lab.ntt.co.jp, menrigh@brocade.com,\n\tmasutani.hitoshi@lab.ntt.co.jp",
        "Subject": "[dpdk-dev] [PATCH 17/25] eal/linux/pci: Add functions for unmapping\n\tigb_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\nSigned-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>\n---\n lib/librte_eal/linuxapp/eal/eal_pci.c              | 32 +++++++++++++\n lib/librte_eal/linuxapp/eal/eal_pci_uio.c          | 56 ++++++++++++++++++++++\n lib/librte_eal/linuxapp/eal/include/eal_pci_init.h |  7 +++\n 3 files changed, 95 insertions(+)",
    "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c\nindex 78df974..d7293c7 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c\n@@ -123,6 +123,22 @@ fail:\n \treturn NULL;\n }\n \n+#if defined(RTE_LIBRTE_EAL_HOTPLUG) && defined(RTE_LIBRTE_EAL_LINUXAPP)\n+/* unmap a particular resource */\n+void\n+pci_unmap_resource(void *requested_addr, size_t size)\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 /* RTE_LIBRTE_EAL_HOTPLUG & RTE_LIBRTE_EAL_LINUXAPP */\n+\n /* parse the \"resource\" sysfs file */\n #define IORESOURCE_MEM  0x00000200\n \n@@ -493,6 +509,22 @@ pci_map_device(struct rte_pci_device *dev)\n \treturn 0;\n }\n \n+#if defined(RTE_LIBRTE_EAL_HOTPLUG) && defined(RTE_LIBRTE_EAL_LINUXAPP)\n+static void\n+pci_unmap_device(struct rte_pci_device *dev)\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 /* RTE_LIBRTE_EAL_HOTPLUG & RTE_LIBRTE_EAL_LINUXAPP */\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_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\nindex f0deeba..ff48eb9 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\n@@ -395,6 +395,62 @@ pci_uio_map_resource(struct rte_pci_device *dev)\n \treturn 0;\n }\n \n+#if defined(RTE_LIBRTE_EAL_HOTPLUG) && defined(RTE_LIBRTE_EAL_LINUXAPP)\n+static void\n+pci_uio_unmap(struct mapped_pci_resource *uio_res)\n+{\n+\tint i;\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+\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+\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 /* RTE_LIBRTE_EAL_HOTPLUG & RTE_LIBRTE_EAL_LINUXAPP */\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\ndiff --git a/lib/librte_eal/linuxapp/eal/include/eal_pci_init.h b/lib/librte_eal/linuxapp/eal/include/eal_pci_init.h\nindex d758bee..ab9c16b 100644\n--- a/lib/librte_eal/linuxapp/eal/include/eal_pci_init.h\n+++ b/lib/librte_eal/linuxapp/eal/include/eal_pci_init.h\n@@ -65,6 +65,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+#if defined(RTE_LIBRTE_EAL_HOTPLUG) && defined(RTE_LIBRTE_EAL_LINUXAPP)\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 /* RTE_LIBRTE_EAL_HOTPLUG & RTE_LIBRTE_EAL_LINUXAPP */\n+\n #ifdef VFIO_PRESENT\n \n #define VFIO_MAX_GROUPS 64\n",
    "prefixes": [
        "dpdk-dev",
        "17/25"
    ]
}