get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2321,
    "url": "https://patches.dpdk.org/api/patches/2321/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1421298930-15210-18-git-send-email-changchun.ouyang@intel.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": "<1421298930-15210-18-git-send-email-changchun.ouyang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1421298930-15210-18-git-send-email-changchun.ouyang@intel.com",
    "date": "2015-01-15T05:15:25",
    "name": "[dpdk-dev,17/22] virtio: Use port IO to get PCI resource.",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a9b1290b10041813c97dd8d7e671a9cebb99f615",
    "submitter": {
        "id": 31,
        "url": "https://patches.dpdk.org/api/people/31/?format=api",
        "name": "Ouyang Changchun",
        "email": "changchun.ouyang@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1421298930-15210-18-git-send-email-changchun.ouyang@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2321/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2321/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 30DD95A7F;\n\tThu, 15 Jan 2015 06:17:06 +0100 (CET)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 32CAD5A1F\n\tfor <dev@dpdk.org>; Thu, 15 Jan 2015 06:16:22 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga103.fm.intel.com with ESMTP; 14 Jan 2015 21:11:03 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga002.fm.intel.com with ESMTP; 14 Jan 2015 21:16:15 -0800",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id t0F5GD4f001895;\n\tThu, 15 Jan 2015 13:16:13 +0800",
            "from shecgisg004.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid t0F5GBtm015363; Thu, 15 Jan 2015 13:16:13 +0800",
            "(from couyang@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t0F5GAJI015359; \n\tThu, 15 Jan 2015 13:16:10 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.09,401,1418112000\"; d=\"scan'208\";a=\"662128078\"",
        "From": "Ouyang Changchun <changchun.ouyang@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Thu, 15 Jan 2015 13:15:25 +0800",
        "Message-Id": "<1421298930-15210-18-git-send-email-changchun.ouyang@intel.com>",
        "X-Mailer": "git-send-email 1.7.12.2",
        "In-Reply-To": "<1421298930-15210-1-git-send-email-changchun.ouyang@intel.com>",
        "References": "<1421298930-15210-1-git-send-email-changchun.ouyang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 17/22] virtio: Use port IO to get PCI resource.",
        "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": "Make virtio not require UIO for some security reasons, this is to match 6Wind's virtio-net-pmd.\n\nSigned-off-by: Changchun Ouyang <changchun.ouyang@intel.com>\n---\n config/common_linuxapp                  |  2 +\n lib/librte_eal/common/include/rte_pci.h |  4 ++\n lib/librte_eal/linuxapp/eal/eal_pci.c   |  5 +-\n lib/librte_pmd_virtio/virtio_ethdev.c   | 91 ++++++++++++++++++++++++++++++++-\n 4 files changed, 100 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/config/common_linuxapp b/config/common_linuxapp\nindex 6243d4b..a3227a2 100644\n--- a/config/common_linuxapp\n+++ b/config/common_linuxapp\n@@ -125,6 +125,8 @@ CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n\n CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n\n CONFIG_RTE_EAL_IGB_UIO=y\n CONFIG_RTE_EAL_VFIO=y\n+# Only for VIRTIO PMD currently\n+CONFIG_RTE_EAL_PORT_IO=n\n \n #\n # Special configurations in PCI Config Space for high performance\ndiff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h\nindex 66ed793..19abc1f 100644\n--- a/lib/librte_eal/common/include/rte_pci.h\n+++ b/lib/librte_eal/common/include/rte_pci.h\n@@ -193,6 +193,10 @@ struct rte_pci_driver {\n \n /** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */\n #define RTE_PCI_DRV_NEED_MAPPING 0x0001\n+/** Device needs port IO(done with /proc/ioports) */\n+#ifdef RTE_EAL_PORT_IO\n+#define RTE_PCI_DRV_PORT_IO 0x0002\n+#endif\n /** Device driver must be registered several times until failure - deprecated */\n #pragma GCC poison RTE_PCI_DRV_MULTIPLE\n /** Device needs to be unbound even if no module is provided */\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c\nindex b5f5410..5db0059 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c\n@@ -574,7 +574,10 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d\n \t\t\t/* map resources for devices that use igb_uio */\n \t\t\tret = pci_map_device(dev);\n \t\t\tif (ret != 0)\n-\t\t\t\treturn ret;\n+#ifdef RTE_EAL_PORT_IO\n+\t\t\t\tif ((dr->drv_flags & RTE_PCI_DRV_PORT_IO) == 0)\n+#endif\n+\t\t\t\t\treturn ret;\n \t\t} else if (dr->drv_flags & RTE_PCI_DRV_FORCE_UNBIND &&\n \t\t           rte_eal_process_type() == RTE_PROC_PRIMARY) {\n \t\t\t/* unbind current driver */\ndiff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c\nindex 1ec29e1..15324c9 100644\n--- a/lib/librte_pmd_virtio/virtio_ethdev.c\n+++ b/lib/librte_pmd_virtio/virtio_ethdev.c\n@@ -961,6 +961,71 @@ static int virtio_resource_init(struct rte_pci_device *pci_dev)\n \t\t     start, size);\n \treturn 0;\n }\n+\n+#ifdef RTE_EAL_PORT_IO\n+/* Extract port I/O numbers from proc/ioports */\n+static int virtio_resource_init_by_portio(struct rte_pci_device *pci_dev)\n+{\n+\tuint16_t start, end;\n+\tint size;\n+\tFILE *fp;\n+\tchar *line = NULL;\n+\tchar pci_id[16];\n+\tint found = 0;\n+\tsize_t linesz;\n+\n+\tsnprintf(pci_id, sizeof(pci_id), PCI_PRI_FMT,\n+\t\t pci_dev->addr.domain,\n+\t\t pci_dev->addr.bus,\n+\t\t pci_dev->addr.devid,\n+\t\t pci_dev->addr.function);\n+\n+\tfp = fopen(\"/proc/ioports\", \"r\");\n+\tif (fp == NULL) {\n+\t\tPMD_INIT_LOG(ERR, \"%s(): can't open ioports\", __func__);\n+\t\treturn -1;\n+\t}\n+\n+\twhile (getdelim(&line, &linesz, '\\n', fp) > 0) {\n+\t\tchar *ptr = line;\n+\t\tchar *left;\n+\t\tint n;\n+\n+\t\tn = strcspn(ptr, \":\");\n+\t\tptr[n] = 0;\n+\t\tleft = &ptr[n+1];\n+\n+\t\twhile (*left && isspace(*left))\n+\t\t\tleft++;\n+\n+\t\tif (!strncmp(left, pci_id, strlen(pci_id))) {\n+\t\t\tfound = 1;\n+\n+\t\t\twhile (*ptr && isspace(*ptr))\n+\t\t\t\tptr++;\n+\n+\t\t\tsscanf(ptr, \"%04hx-%04hx\", &start, &end);\n+\t\t\tsize = end - start + 1;\n+\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tfree(line);\n+\tfclose(fp);\n+\n+\tif (!found)\n+\t\treturn -1;\n+\n+\tpci_dev->mem_resource[0].addr = (void *)(uintptr_t)(uint32_t)start;\n+\tpci_dev->mem_resource[0].len =  (uint64_t)size;\n+\tPMD_INIT_LOG(DEBUG,\n+\t\t     \"PCI Port IO found start=0x%lx with size=0x%lx\",\n+\t\t     start, size);\n+\treturn 0;\n+}\n+#endif\n+\n #else\n static int\n virtio_has_msix(const struct rte_pci_addr *loc __rte_unused)\n@@ -974,6 +1039,14 @@ static int virtio_resource_init(struct rte_pci_device *pci_dev __rte_unused)\n \t/* no setup required */\n \treturn 0;\n }\n+\n+#ifdef RTE_EAL_PORT_IO\n+static int virtio_resource_init_by_portio(struct rte_pci_device *pci_dev)\n+{\n+\t/* no setup required */\n+\treturn 0;\n+}\n+#endif\n #endif\n \n /*\n@@ -1039,7 +1112,10 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv,\n \n \tpci_dev = eth_dev->pci_dev;\n \tif (virtio_resource_init(pci_dev) < 0)\n-\t\treturn -1;\n+#ifdef RTE_EAL_PORT_IO\n+\t\tif (virtio_resource_init_by_portio(pci_dev) < 0)\n+#endif\n+\t\t\treturn -1;\n \n \thw->use_msix = virtio_has_msix(&pci_dev->addr);\n \thw->io_base = (uint32_t)(uintptr_t)pci_dev->mem_resource[0].addr;\n@@ -1132,6 +1208,18 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv,\n \treturn 0;\n }\n \n+#ifdef RTE_EAL_PORT_IO\n+static struct eth_driver rte_virtio_pmd = {\n+\t{\n+\t\t.name = \"rte_virtio_pmd\",\n+\t\t.id_table = pci_id_virtio_map,\n+\t\t.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_PORT_IO |\n+\t\t\tRTE_PCI_DRV_INTR_LSC,\n+\t},\n+\t.eth_dev_init = eth_virtio_dev_init,\n+\t.dev_private_size = sizeof(struct virtio_hw),\n+};\n+#else\n static struct eth_driver rte_virtio_pmd = {\n \t{\n \t\t.name = \"rte_virtio_pmd\",\n@@ -1141,6 +1229,7 @@ static struct eth_driver rte_virtio_pmd = {\n \t.eth_dev_init = eth_virtio_dev_init,\n \t.dev_private_size = sizeof(struct virtio_hw),\n };\n+#endif\n \n /*\n  * Driver initialization routine.\n",
    "prefixes": [
        "dpdk-dev",
        "17/22"
    ]
}