get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 9537,
    "url": "http://patches.dpdk.org/api/patches/9537/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1450098032-21198-12-git-send-email-sshukla@mvista.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": "<1450098032-21198-12-git-send-email-sshukla@mvista.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1450098032-21198-12-git-send-email-sshukla@mvista.com",
    "date": "2015-12-14T13:00:30",
    "name": "[dpdk-dev,[PATCH,v2] 11/13] virtio_ioport: armv7/v8: mmap virtio iopci bar region",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c66e623310a35492392ca2ca6216c5d63a72a608",
    "submitter": {
        "id": 383,
        "url": "http://patches.dpdk.org/api/people/383/?format=api",
        "name": "Santosh Shukla",
        "email": "sshukla@mvista.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1450098032-21198-12-git-send-email-sshukla@mvista.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/9537/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/9537/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 CCED858D4;\n\tMon, 14 Dec 2015 14:01:19 +0100 (CET)",
            "from mail-pf0-f181.google.com (mail-pf0-f181.google.com\n\t[209.85.192.181]) by dpdk.org (Postfix) with ESMTP id 6200B567C\n\tfor <dev@dpdk.org>; Mon, 14 Dec 2015 14:01:18 +0100 (CET)",
            "by pff63 with SMTP id 63so11007839pff.2\n\tfor <dev@dpdk.org>; Mon, 14 Dec 2015 05:01:17 -0800 (PST)",
            "from santosh-Latitude-E5530-non-vPro.mvista.com ([110.172.16.5])\n\tby smtp.gmail.com with ESMTPSA id\n\t9sm42506405pfn.51.2015.12.14.05.01.14\n\t(version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tMon, 14 Dec 2015 05:01:16 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=mvista-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=dk8s1rpjzR03o/0kquzv5cYlJ3BD64szWXSLQQVdhkA=;\n\tb=Pd/KDN7/sDH1aWGOmaMNVj5hgFMurLalGNONQp2ThLUPRGu5b8t6zBWHkP7Zk4IRVl\n\t6joJ2MVq5yrWpI0bgaDhXrRaVF1VmtTq/N9bI7EIZL0BxWsIiWi5YKdJ1rwa6ILV1t7t\n\tA+ohxCMUITIEtiDep06FvyJ5XD3dq0zzKd60cDr+9M1ymmwQNxVM57FMS3usC/qvzsHV\n\tZe/8jfUufr6jpJUfqp0dMHedghmTOxjwUSY9H6nxL7JYXfJBCF+yGL26ClMsSO6QISh7\n\tB7pP3OjS7SmmlaKnhA+Wlo8DRdGAbq6FdwG2uPjM3ZNH3nKL2NDqw1w2n0qMiYLwtHSj\n\tMkVA==",
        "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=dk8s1rpjzR03o/0kquzv5cYlJ3BD64szWXSLQQVdhkA=;\n\tb=lPRahi3wpLf3RNVAZ3AckgcyUt5fbOz6Lj8ynZRTfvskm8w71+5v6QAdjCiETvEHpO\n\tOUahd6LLj4tJ9OPCWCivg2xoWZF0kHXfVtrVZ3sWJ4P8DA+zB8DMHmds7Il1M5D4DCXR\n\tv9dleoa0nhl+b+y+jbStwiDP3mdHK47Ia3mXKZPP8SVFEwnrsb7D25eKMRxB5lX1oiCW\n\t9ICHp1uZ+BcT51CvPUN8jpubSerIW+H7FWkdYdFObvFt6/odteFmT65UvIB27c2oC0Wj\n\tE8FzUzWBKTzY0b9IT6f2EJeYOE5J+50kT3t87C8imgDJBMp8sA448v6v5QWOWJmAl4Ma\n\t4F0w==",
        "X-Gm-Message-State": "ALoCoQk2gf5J9QUoCZE252Tfh6SabWvGwAc6+QafTdgzF7Atpt7y5Pw+X69TCJJkW06f4KUI9AskT/vmaiYA2sLMpTTVCqWJCA==",
        "X-Received": "by 10.98.68.198 with SMTP id m67mr13526669pfi.148.1450098077785; \n\tMon, 14 Dec 2015 05:01:17 -0800 (PST)",
        "From": "Santosh Shukla <sshukla@mvista.com>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 14 Dec 2015 18:30:30 +0530",
        "Message-Id": "<1450098032-21198-12-git-send-email-sshukla@mvista.com>",
        "X-Mailer": "git-send-email 1.7.9.5",
        "In-Reply-To": "<1450098032-21198-1-git-send-email-sshukla@mvista.com>",
        "References": "<1450098032-21198-1-git-send-email-sshukla@mvista.com>",
        "Cc": "Rakesh Krishnamurthy <rakeshk@mvista.com>,\n\tRizwan Ansari <ransari@mvista.com>",
        "Subject": "[dpdk-dev] [ [PATCH v2] 11/13] virtio_ioport: armv7/v8: mmap virtio\n\tiopci bar region",
        "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": "Introducing module to mmap iopci bar region. Applicable for linuxapp for non-x86\narchs, Tested for arm64/ThunderX platform for linux. For that adding two global\napi.\n- virtio_ioport_init\n- virtio_ioport_unmap\n\nSigned-off-by: Santosh Shukla <sshukla@mvista.com>\nSigned-off-by: Rizwan Ansari <ransari@mvista.com>\nSigned-off-by: Rakesh Krishnamurthy <rakeshk@mvista.com>\n---\n drivers/net/virtio/Makefile        |    1 +\n drivers/net/virtio/virtio_ioport.c |  163 ++++++++++++++++++++++++++++++++++++\n drivers/net/virtio/virtio_ioport.h |   42 ++++++++++\n 3 files changed, 206 insertions(+)\n create mode 100644 drivers/net/virtio/virtio_ioport.c\n create mode 100644 drivers/net/virtio/virtio_ioport.h",
    "diff": "diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile\nindex 25a842d..5cba6d3 100644\n--- a/drivers/net/virtio/Makefile\n+++ b/drivers/net/virtio/Makefile\n@@ -50,6 +50,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtqueue.c\n SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_pci.c\n SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx.c\n SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ethdev.c\n+SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ioport.c\n SRCS-$(CONFIG_RTE_VIRTIO_INC_VECTOR) += virtio_rxtx_simple.c\n \n # this lib depends upon:\ndiff --git a/drivers/net/virtio/virtio_ioport.c b/drivers/net/virtio/virtio_ioport.c\nnew file mode 100644\nindex 0000000..ffeb8e9\n--- /dev/null\n+++ b/drivers/net/virtio/virtio_ioport.c\n@@ -0,0 +1,163 @@\n+/*\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2015 Cavium Networks. All rights reserved.\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 Intel Corporation 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+\n+#include \"virtio_ioport.h\"\n+\n+#if defined(RTE_EXEC_ENV_LINUXAPP) && (defined(RTE_ARCH_ARM) || \\\n+\t\tdefined(RTE_ARCH_ARM64))\n+\n+#include <sys/types.h>\n+#include <sys/stat.h>\n+#include <fcntl.h>\n+#include <errno.h>\n+#include <unistd.h>\n+#include <sys/mman.h>\n+#include <exec-env/rte_virt_ioport.h>\n+\n+#include \"virtio_logs.h\"\n+\n+/* start address of first pci_iobar slot (user-space virtual-addres) */\n+void *ioport_map;\n+/**\n+ * ioport map count,\n+ * Use-case: virtio-net-pci.\n+ * Keeps track of number of virtio-net-pci device mapped/unmapped. Max device\n+ * support by linux kernel is 31, so ioport_map_cnt can not be greater than 31.\n+ */\n+static int ioport_map_cnt;\n+\n+static int\n+virtio_map_ioport(void **resource_addr)\n+{\n+\tint fd;\n+\tint ret = 0;\n+\n+\t/* avoid -Werror=unused-parameter, keep compiler happy */\n+\t(void)resource_addr;\n+\tfd = open(VIRT_IOPORT_DEV, O_RDWR);\n+\tif (fd < 0) {\n+\t\tPMD_INIT_LOG(ERR, \"device file %s open error: %d\\n\",\n+\t\t\t     DEV_NAME, fd);\n+\t\tret = -1;\n+\t\tgoto out;\n+\t}\n+\n+\tioport_map = mmap(NULL, PCI_VIRT_IOPORT_SIZE,\n+\t\t\tPROT_EXEC | PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0);\n+\n+\tif (ioport_map == MAP_FAILED) {\n+\t\tPMD_INIT_LOG(ERR, \"mmap: failed to map bar Address=%p\\n\",\n+\t\t\t\t*resource_addr);\n+\t\tret = -ENOMEM;\n+\t\tgoto out1;\n+\t}\n+\n+\tPMD_INIT_LOG(INFO, \"First pci_iobar mapped at %p\\n\", ioport_map);\n+\n+out1:\n+\tclose(fd);\n+out:\n+\treturn ret;\n+}\n+\n+static int\n+virtio_set_ioport_addr(void **resource_addr, unsigned long offset)\n+{\n+\tint ret = 0;\n+\n+\tif (ioport_map_cnt >= PCI_VIRT_IOPORT_MAX) {\n+\t\tret = -1;\n+\t\tPMD_INIT_LOG(ERR,\n+\t\t\t     \"ioport_map_cnt(%d) greater than\"\n+\t\t\t     \"PCI_VIRT_IOPORT_MAX(%d)\\n\",\n+\t\t\t     ioport_map_cnt, PCI_VIRT_IOPORT_MAX);\n+\t\treturn ret;\n+\t}\n+\t*resource_addr = (void *)((char *)ioport_map + (ioport_map_cnt)*offset);\n+\tioport_map_cnt++;\n+\n+\tPMD_INIT_LOG(DEBUG, \"pci.resource_addr %p ioport_map_cnt %d\\n\",\n+\t\t\t*resource_addr, ioport_map_cnt);\n+\treturn ret;\n+}\n+\n+int virtio_ioport_init(struct rte_pci_resource *mem_resource)\n+{\n+\tint ret = 0;\n+\n+\t/**\n+\t * Map the all IOBAR entry from /proc/ioport to 4k page_size only once.\n+\t * Later virtio_set_ioport_addr() func will update correct bar_addr for\n+\t * each ioport (i.e..pci_dev->mem_resource[0].addr)\n+\t */\n+\tif (!ioport_map) {\n+\t\tret = virtio_map_ioport(&mem_resource->addr);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tPMD_INIT_LOG(INFO, \"ioport_map %p\\n\", ioport_map);\n+\t}\n+\n+\tret = virtio_set_ioport_addr(&mem_resource->addr, mem_resource->len);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tPMD_INIT_LOG(INFO, \"resource_addr %p resource_len :%ld\\n\",\n+\t\t\tmem_resource->addr, (unsigned long)mem_resource->len);\n+\treturn ret;\n+}\n+\n+void virtio_ioport_unmap(void)\n+{\n+\t/* unmap ioport memory */\n+\tioport_map_cnt--;\n+\tif (!ioport_map_cnt)\n+\t\tmunmap(ioport_map, PCI_VIRT_IOPORT_SIZE);\n+\n+\tPMD_INIT_LOG(DEBUG, \"unmapping ioport_mem %d\\n\", ioport_map_cnt);\n+}\n+\n+#else /* !LINUXAPP && !ARM/64 */\n+\n+int virtio_ioport_init(struct rte_pci_resource *mem_resource)\n+{\n+\t(void)mem_resource;\n+\treturn 0;\n+}\n+\n+void virtio_ioport_unmap(void)\n+{\n+\treturn;\n+}\n+\n+#endif /* LINUXAPP, ARM/64 */\ndiff --git a/drivers/net/virtio/virtio_ioport.h b/drivers/net/virtio/virtio_ioport.h\nnew file mode 100644\nindex 0000000..bf79551\n--- /dev/null\n+++ b/drivers/net/virtio/virtio_ioport.h\n@@ -0,0 +1,42 @@\n+/*\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2015 Cavium Networks. All rights reserved.\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 Intel Corporation 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 _VIRTIO_IOPORT_H_\n+#define _VIRTIO_IOPORT_H_\n+\n+#include <rte_pci.h>\n+\n+int virtio_ioport_init(struct rte_pci_resource *mem_resource);\n+void virtio_ioport_unmap(void);\n+\n+#endif /* _VIRTIO_IOPORT_H_ */\n",
    "prefixes": [
        "dpdk-dev",
        "[PATCH",
        "v2"
    ]
}