get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 10431,
    "url": "https://patches.dpdk.org/api/patches/10431/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1454853068-14621-5-git-send-email-sshukla@mvista.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": "<1454853068-14621-5-git-send-email-sshukla@mvista.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1454853068-14621-5-git-send-email-sshukla@mvista.com",
    "date": "2016-02-07T13:51:08",
    "name": "[dpdk-dev,v7,4/4] eal/linux: vfio: add pci ioport support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "de248e8764bcc156deecebe2ffef57c7eb214fb9",
    "submitter": {
        "id": 383,
        "url": "https://patches.dpdk.org/api/people/383/?format=api",
        "name": "Santosh Shukla",
        "email": "sshukla@mvista.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1454853068-14621-5-git-send-email-sshukla@mvista.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/10431/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/10431/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 34B009A8D;\n\tSun,  7 Feb 2016 14:51:37 +0100 (CET)",
            "from mail-pa0-f42.google.com (mail-pa0-f42.google.com\n\t[209.85.220.42]) by dpdk.org (Postfix) with ESMTP id 8EDD19A8D\n\tfor <dev@dpdk.org>; Sun,  7 Feb 2016 14:51:35 +0100 (CET)",
            "by mail-pa0-f42.google.com with SMTP id yy13so59685684pab.3\n\tfor <dev@dpdk.org>; Sun, 07 Feb 2016 05:51:35 -0800 (PST)",
            "from santosh-Latitude-E5530-non-vPro.mvista.com ([106.216.141.181])\n\tby smtp.gmail.com with ESMTPSA id\n\tr87sm36763174pfa.61.2016.02.07.05.51.31\n\t(version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSun, 07 Feb 2016 05:51:34 -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=vxb2C2GPBPoTknqZT8Q1g6p9VhLr9T2piFqkbXiRqMg=;\n\tb=NhLXi9lFd6jsIsS1kaMtpO3jH7EIgMVzhsdrFGhsFRPAhW4VvxwChv3utUFqbMca1S\n\tcQqlLQBe5fMYfy1S4VY0BvH+7XOwfMxFpit5vp8uyYufPwKfw00Fs5XxsIKJWDnnj2TS\n\tDQJa9agXDRmuIT8fE257GzftLcFMDjCIs7i4VNC/UortrEq1ufSaukM7xDn3d0PZHDk/\n\tAkuyDFWXzvRXlqA+8wBg+X8BadhCZwLYkBKz95rEPZ1iqJx60MA4Rexz3OiMgAUiGb4I\n\tP+T1OFzOCyRJC9bhH9Xg5pcKKg8Svf236jaECv9P8+rMzteippuLTal3JquiUOSjN2vs\n\txnTg==",
        "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=vxb2C2GPBPoTknqZT8Q1g6p9VhLr9T2piFqkbXiRqMg=;\n\tb=be2MHDmVGaojU7fTCQ7g8UFMtYIBsr0sgpfyViYEZ02IqeqXMylkIyGe7WgU4+0Wp0\n\thQE+jQGASeWhCrU0NbNH57crs+OJjeMSNjqFDYcAD67ZswiVCdlZ7PVDnlNTk6ZDOXRG\n\tVYAHDpRazKl8HMatEkSxaAoVeE2z4L1owi12kQ7uGnYS1PzT287ZBEHi3EajP1pZPElm\n\tdA8LZXPD4tFKuifeebVoSr8yBZndnAgyCHl+MyRSF1mN79ddxonMExnnhCsp9wG/koge\n\tecnqGbtT1pp7+bxABN64fbaWQoJd3LUJTdNytsKdS6KWgMV7O28mG4+iXRC/HtWc+fIM\n\tnG5A==",
        "X-Gm-Message-State": "AG10YOQckZBJgvlnBkUwmqGg8JrHEdpqzL17CQmarUWp0IeasjTh6t9zSH4+y4vmsUlFnmvk",
        "X-Received": "by 10.66.227.73 with SMTP id ry9mr34970458pac.120.1454853094959; \n\tSun, 07 Feb 2016 05:51:34 -0800 (PST)",
        "From": "Santosh Shukla <sshukla@mvista.com>",
        "To": "dev@dpdk.org",
        "Date": "Sun,  7 Feb 2016 19:21:08 +0530",
        "Message-Id": "<1454853068-14621-5-git-send-email-sshukla@mvista.com>",
        "X-Mailer": "git-send-email 1.7.9.5",
        "In-Reply-To": "<1454853068-14621-1-git-send-email-sshukla@mvista.com>",
        "References": "<1454853068-14621-1-git-send-email-sshukla@mvista.com>",
        "Subject": "[dpdk-dev] [PATCH v7 4/4] eal/linux: vfio: add pci ioport support",
        "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": "Include vfio map/unmap/rd/wr support for pci ioport.\n\nSigned-off-by: Santosh Shukla <sshukla@mvista.com>\n---\nv7:\n\n- This is enhancement patch for vfio map/rd/wr, rebased on top of David(s) -\n    \"Rework ioport for virtio\" patchset. For more information about api, refer\n    patch [1].\n[1]  http://dpdk.org/dev/patchwork/patch/10426/\n\n lib/librte_eal/linuxapp/eal/eal_pci_vfio.c |   48 ++++++++++++++++++++--------\n 1 file changed, 34 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c\nindex 4832313..d83ece5 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c\n@@ -74,6 +74,7 @@ EAL_REGISTER_TAILQ(rte_vfio_tailq)\n #define VFIO_GROUP_FMT \"/dev/vfio/%u\"\n #define VFIO_NOIOMMU_GROUP_FMT \"/dev/vfio/noiommu-%u\"\n #define VFIO_GET_REGION_ADDR(x) ((uint64_t) x << 40ULL)\n+#define VFIO_GET_REGION_IDX(x) (x >> 40)\n \n /* per-process VFIO config */\n static struct vfio_config vfio_cfg;\n@@ -999,37 +1000,56 @@ int\n pci_vfio_ioport_map(struct rte_pci_device *dev, int bar,\n \t\t    struct rte_pci_ioport *p)\n {\n-\tRTE_SET_USED(dev);\n-\tRTE_SET_USED(bar);\n-\tRTE_SET_USED(p);\n-\treturn -1;\n+\tif (bar < VFIO_PCI_BAR0_REGION_INDEX ||\n+\t    bar > VFIO_PCI_BAR5_REGION_INDEX) {\n+\t\tRTE_LOG(ERR, EAL, \"invalid bar (%d)!\\n\", bar);\n+\t\treturn -1;\n+\t}\n+\n+\tp = rte_zmalloc(\"VFIO_IOPORT\", sizeof(*p), 0);\n+\tif (p == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"cannot alloc vfio ioport mem\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tp->dev = dev;\n+\tp->offset = VFIO_GET_REGION_ADDR(bar);\n+\treturn 0;\n }\n \n void\n pci_vfio_ioport_read(struct rte_pci_ioport *p,\n \t\t     void *data, size_t len, off_t offset)\n {\n-\tRTE_SET_USED(p);\n-\tRTE_SET_USED(data);\n-\tRTE_SET_USED(len);\n-\tRTE_SET_USED(offset);\n+\tconst struct rte_intr_handle *intr_handle = &p->dev->intr_handle;\n+\tif (pread64(intr_handle->vfio_dev_fd, data,\n+\t\t    len, p->offset + offset) <= 0)\n+\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\"Can't read from PCI bar (%\" PRIu64 \") : offset (%x)\\n\",\n+\t\t\tVFIO_GET_REGION_IDX(p->offset), (int)offset);\n }\n \n void\n pci_vfio_ioport_write(struct rte_pci_ioport *p,\n \t\t      const void *data, size_t len, off_t offset)\n {\n-\tRTE_SET_USED(p);\n-\tRTE_SET_USED(data);\n-\tRTE_SET_USED(len);\n-\tRTE_SET_USED(offset);\n+\tconst struct rte_intr_handle *intr_handle = &p->dev->intr_handle;\n+\tif (pwrite64(intr_handle->vfio_dev_fd, data,\n+\t\t     len, p->offset + offset) <= 0)\n+\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\"Can't write to PCI bar (%\" PRIu64 \") : offset (%x)\\n\",\n+\t\t\tVFIO_GET_REGION_IDX(p->offset), (int)offset);\n }\n \n int\n pci_vfio_ioport_unmap(struct rte_pci_ioport *p)\n {\n-\tRTE_SET_USED(p);\n-\treturn -1;\n+\tif (p == NULL)\n+\t\treturn -1;\n+\telse {\n+\t\trte_free(p);\n+\t\treturn 0;\n+\t}\n }\n \n int\n",
    "prefixes": [
        "dpdk-dev",
        "v7",
        "4/4"
    ]
}