Show a patch.

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

{
    "id": 209,
    "url": "http://patches.dpdk.org/api/patches/209/",
    "web_url": "http://patches.dpdk.org/patch/209/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20140826020837.898427212@networkplumber.org>",
    "date": "2014-08-26T02:07:47",
    "name": "[dpdk-dev,RFC,01/10] virtio: rearrange resource initialization",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "548f10ca76b8bad854e4a581cdba10344f555561",
    "submitter": {
        "id": 27,
        "url": "http://patches.dpdk.org/api/people/27/",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/patch/209/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/209/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/209/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<stephen@networkplumber.org>",
        "References": "<20140826020746.062748014@networkplumber.org>",
        "X-Mailman-Version": "2.1.15",
        "Date": "Mon, 25 Aug 2014 19:07:47 -0700",
        "X-List-Received-Date": "Tue, 26 Aug 2014 02:04:43 -0000",
        "User-Agent": "quilt/0.63-1",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Content-Type": "text/plain; charset=UTF-8",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<20140826020837.898427212@networkplumber.org>",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:message-id:user-agent:date:from:to:cc:subject\n\t:references:mime-version:content-type:content-disposition;\n\tbh=sjUIBwtbsnJZD0cgSymNLSv5GsDVJUDrcF2N5fdYZk0=;\n\tb=l+CDaG49OrCZTPkcHkeXMenfW+WvpYlD+Hcr/38sGpKU0nXmFAJn4N4ie9k60ko9Kt\n\tb93Uldc86BXtmQNm7ln7oD1jsOxpRigMatsq+/FVa5zFkGWZl58QgGTxpQZjOmlWMBeC\n\t6ke4zvPH8LOBKmIYXnza6Ca144U/116XWBVF9jiMSaOnnLAsmRWciFk1MPbSUhPNRkwq\n\t/PSxAYdHtDyXmZ6l/2Vw2d9ePIGWLLUsMkyxEBKneH9PFUFYgkZXSEnpdNiNkAOY71wi\n\tqNR4XeyJt5o5hRxAtAQxpkAckvxhIL6QUS96R+ByeUhVMGN1Dnlzks/5/J+lqtW14US2\n\tBAFQ==",
        "Received": [
            "from mail-pa0-f45.google.com (mail-pa0-f45.google.com\n\t[209.85.220.45]) by dpdk.org (Postfix) with ESMTP id 08FBF3975\n\tfor <dev@dpdk.org>; Tue, 26 Aug 2014 04:04:42 +0200 (CEST)",
            "by mail-pa0-f45.google.com with SMTP id eu11so22279702pac.18\n\tfor <dev@dpdk.org>; Mon, 25 Aug 2014 19:08:39 -0700 (PDT)",
            "from localhost (static-50-53-65-80.bvtn.or.frontiernet.net.\n\t[50.53.65.80]) by mx.google.com with ESMTPSA id\n\tbn4sm1179483pbc.40.2014.08.25.19.08.38 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 25 Aug 2014 19:08:39 -0700 (PDT)"
        ],
        "Subject": "[dpdk-dev] [RFC 01/10] virtio: rearrange resource initialization",
        "X-Received": "by 10.70.118.9 with SMTP id ki9mr33461355pdb.104.1409018919860; \n\tMon, 25 Aug 2014 19:08:39 -0700 (PDT)",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Precedence": "list",
        "X-Gm-Message-State": "ALoCoQmurgkZho3leJdz7ooPvgZ9O9QzyNvB2YnrPSLI1NgFjHWbeSgU7lUvNwO6hNbn2eVMlqbc",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Cc": "dev@dpdk.org",
        "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>",
        "MIME-Version": "1.0",
        "To": "Ouyang Changchun <changchun.ouyang@intel.com>",
        "Content-Disposition": "inline; filename=virtio-linux-portio.patch"
    },
    "content": "For clarity make the setup of PCI resources for Linux\ninto a function rather than block of code #ifdef'd in middle\nof dev_init.\n\n---\n lib/librte_pmd_virtio/virtio_ethdev.c |   76 +++++++++++++++++++---------------\n 1 file changed, 43 insertions(+), 33 deletions(-)",
    "diff": "--- a/lib/librte_pmd_virtio/virtio_ethdev.c\t2014-08-25 19:00:03.622515574 -0700\n+++ b/lib/librte_pmd_virtio/virtio_ethdev.c\t2014-08-25 19:00:03.622515574 -0700\n@@ -706,6 +706,41 @@ virtio_has_msix(const struct rte_pci_add\n \n \treturn (d != NULL);\n }\n+\n+/* Extract I/O port numbers from sysfs */\n+static int virtio_resource_init(struct rte_pci_device *pci_dev)\n+{\n+\tchar dirname[PATH_MAX];\n+\tchar filename[PATH_MAX];\n+\tunsigned long start, size;\n+\n+\tif (get_uio_dev(&pci_dev->addr, dirname, sizeof(dirname)) < 0)\n+\t\treturn -1;\n+\n+\t/* get portio size */\n+\tsnprintf(filename, sizeof(filename),\n+\t\t     \"%s/portio/port0/size\", dirname);\n+\tif (parse_sysfs_value(filename, &size) < 0) {\n+\t\tPMD_INIT_LOG(ERR, \"%s(): cannot parse size\",\n+\t\t\t     __func__);\n+\t\treturn -1;\n+\t}\n+\n+\t/* get portio start */\n+\tsnprintf(filename, sizeof(filename),\n+\t\t \"%s/portio/port0/start\", dirname);\n+\tif (parse_sysfs_value(filename, &start) < 0) {\n+\t\tPMD_INIT_LOG(ERR, \"%s(): cannot parse portio start\",\n+\t\t\t     __func__);\n+\t\treturn -1;\n+\t}\n+\tpci_dev->mem_resource[0].addr = (void *)(uintptr_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 #else\n static int\n virtio_has_msix(const struct rte_pci_addr *loc __rte_unused)\n@@ -713,6 +748,12 @@ virtio_has_msix(const struct rte_pci_add\n \t/* nic_uio does not enable interrupts, return 0 (false). */\n \treturn 0;\n }\n+\n+static int virtio_resource_init(struct rte_pci_device *pci_dev __rte_unused)\n+{\n+\t/* no setup required */\n+\treturn 0;\n+}\n #endif\n \n /*\n@@ -749,40 +790,9 @@ eth_virtio_dev_init(__rte_unused struct\n \t\treturn 0;\n \n \tpci_dev = eth_dev->pci_dev;\n+\tif (virtio_resource_init(pci_dev) < 0)\n+\t\treturn -1;\n \n-#ifdef RTE_EXEC_ENV_LINUXAPP\n-\t{\n-\t\tchar dirname[PATH_MAX];\n-\t\tchar filename[PATH_MAX];\n-\t\tunsigned long start, size;\n-\n-\t\tif (get_uio_dev(&pci_dev->addr, dirname, sizeof(dirname)) < 0)\n-\t\t\treturn -1;\n-\n-\t\t/* get portio size */\n-\t\tsnprintf(filename, sizeof(filename),\n-\t\t\t     \"%s/portio/port0/size\", dirname);\n-\t\tif (parse_sysfs_value(filename, &size) < 0) {\n-\t\t\tPMD_INIT_LOG(ERR, \"%s(): cannot parse size\",\n-\t\t\t\t     __func__);\n-\t\t\treturn -1;\n-\t\t}\n-\n-\t\t/* get portio start */\n-\t\tsnprintf(filename, sizeof(filename),\n-\t\t\t     \"%s/portio/port0/start\", dirname);\n-\t\tif (parse_sysfs_value(filename, &start) < 0) {\n-\t\t\tPMD_INIT_LOG(ERR, \"%s(): cannot parse portio start\",\n-\t\t\t\t     __func__);\n-\t\t\treturn -1;\n-\t\t}\n-\t\tpci_dev->mem_resource[0].addr = (void *)(uintptr_t)start;\n-\t\tpci_dev->mem_resource[0].len =  (uint64_t)size;\n-\t\tPMD_INIT_LOG(DEBUG,\n-\t\t\t     \"PCI Port IO found start=0x%lx with size=0x%lx\",\n-\t\t\t     start, size);\n-\t}\n-#endif\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 \n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "01/10"
    ]
}