List comments

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

[
    {
        "id": 463,
        "web_url": "https://patches.dpdk.org/comment/463/",
        "msgid": "<F52918179C57134FAEC9EA62FA2F96251183B1F2@shsmsx102.ccr.corp.intel.com>",
        "date": "2014-08-26T07:14:31",
        "subject": "Re: [dpdk-dev] [RFC 01/10] virtio: rearrange resource initialization",
        "submitter": {
            "id": 31,
            "url": "https://patches.dpdk.org/api/people/31/",
            "name": "Ouyang Changchun",
            "email": "changchun.ouyang@intel.com"
        },
        "content": "Acked-by: Changchun Ouyang <Changchun.ouyang@intel.com>\r\n\r\n> -----Original Message-----\r\n> From: Stephen Hemminger [mailto:stephen@networkplumber.org]\r\n> Sent: Tuesday, August 26, 2014 10:08 AM\r\n> To: Ouyang, Changchun\r\n> Cc: dev@dpdk.org\r\n> Subject: [RFC 01/10] virtio: rearrange resource initialization\r\n> \r\n> For clarity make the setup of PCI resources for Linux into a function rather\r\n> than block of code #ifdef'd in middle of dev_init.\r\n> \r\n> ---\r\n>  lib/librte_pmd_virtio/virtio_ethdev.c |   76 +++++++++++++++++++----------\r\n> -----\r\n>  1 file changed, 43 insertions(+), 33 deletions(-)\r\n> \r\n> --- a/lib/librte_pmd_virtio/virtio_ethdev.c\t2014-08-25\r\n> 19:00:03.622515574 -0700\r\n> +++ b/lib/librte_pmd_virtio/virtio_ethdev.c\t2014-08-25\r\n> 19:00:03.622515574 -0700\r\n> @@ -706,6 +706,41 @@ virtio_has_msix(const struct rte_pci_add\r\n> \r\n>  \treturn (d != NULL);\r\n>  }\r\n> +\r\n> +/* Extract I/O port numbers from sysfs */ static int\r\n> +virtio_resource_init(struct rte_pci_device *pci_dev) {\r\n> +\tchar dirname[PATH_MAX];\r\n> +\tchar filename[PATH_MAX];\r\n> +\tunsigned long start, size;\r\n> +\r\n> +\tif (get_uio_dev(&pci_dev->addr, dirname, sizeof(dirname)) < 0)\r\n> +\t\treturn -1;\r\n> +\r\n> +\t/* get portio size */\r\n> +\tsnprintf(filename, sizeof(filename),\r\n> +\t\t     \"%s/portio/port0/size\", dirname);\r\n> +\tif (parse_sysfs_value(filename, &size) < 0) {\r\n> +\t\tPMD_INIT_LOG(ERR, \"%s(): cannot parse size\",\r\n> +\t\t\t     __func__);\r\n> +\t\treturn -1;\r\n> +\t}\r\n> +\r\n> +\t/* get portio start */\r\n> +\tsnprintf(filename, sizeof(filename),\r\n> +\t\t \"%s/portio/port0/start\", dirname);\r\n> +\tif (parse_sysfs_value(filename, &start) < 0) {\r\n> +\t\tPMD_INIT_LOG(ERR, \"%s(): cannot parse portio start\",\r\n> +\t\t\t     __func__);\r\n> +\t\treturn -1;\r\n> +\t}\r\n> +\tpci_dev->mem_resource[0].addr = (void *)(uintptr_t)start;\r\n> +\tpci_dev->mem_resource[0].len =  (uint64_t)size;\r\n> +\tPMD_INIT_LOG(DEBUG,\r\n> +\t\t     \"PCI Port IO found start=0x%lx with size=0x%lx\",\r\n> +\t\t     start, size);\r\n> +\treturn 0;\r\n> +}\r\n>  #else\r\n>  static int\r\n>  virtio_has_msix(const struct rte_pci_addr *loc __rte_unused) @@ -713,6\r\n> +748,12 @@ virtio_has_msix(const struct rte_pci_add\r\n>  \t/* nic_uio does not enable interrupts, return 0 (false). */\r\n>  \treturn 0;\r\n>  }\r\n> +\r\n> +static int virtio_resource_init(struct rte_pci_device *pci_dev\r\n> +__rte_unused) {\r\n> +\t/* no setup required */\r\n> +\treturn 0;\r\n> +}\r\n>  #endif\r\n> \r\n>  /*\r\n> @@ -749,40 +790,9 @@ eth_virtio_dev_init(__rte_unused struct\r\n>  \t\treturn 0;\r\n> \r\n>  \tpci_dev = eth_dev->pci_dev;\r\n> +\tif (virtio_resource_init(pci_dev) < 0)\r\n> +\t\treturn -1;\r\n> \r\n> -#ifdef RTE_EXEC_ENV_LINUXAPP\r\n> -\t{\r\n> -\t\tchar dirname[PATH_MAX];\r\n> -\t\tchar filename[PATH_MAX];\r\n> -\t\tunsigned long start, size;\r\n> -\r\n> -\t\tif (get_uio_dev(&pci_dev->addr, dirname, sizeof(dirname))\r\n> < 0)\r\n> -\t\t\treturn -1;\r\n> -\r\n> -\t\t/* get portio size */\r\n> -\t\tsnprintf(filename, sizeof(filename),\r\n> -\t\t\t     \"%s/portio/port0/size\", dirname);\r\n> -\t\tif (parse_sysfs_value(filename, &size) < 0) {\r\n> -\t\t\tPMD_INIT_LOG(ERR, \"%s(): cannot parse size\",\r\n> -\t\t\t\t     __func__);\r\n> -\t\t\treturn -1;\r\n> -\t\t}\r\n> -\r\n> -\t\t/* get portio start */\r\n> -\t\tsnprintf(filename, sizeof(filename),\r\n> -\t\t\t     \"%s/portio/port0/start\", dirname);\r\n> -\t\tif (parse_sysfs_value(filename, &start) < 0) {\r\n> -\t\t\tPMD_INIT_LOG(ERR, \"%s(): cannot parse portio\r\n> start\",\r\n> -\t\t\t\t     __func__);\r\n> -\t\t\treturn -1;\r\n> -\t\t}\r\n> -\t\tpci_dev->mem_resource[0].addr = (void *)(uintptr_t)start;\r\n> -\t\tpci_dev->mem_resource[0].len =  (uint64_t)size;\r\n> -\t\tPMD_INIT_LOG(DEBUG,\r\n> -\t\t\t     \"PCI Port IO found start=0x%lx with size=0x%lx\",\r\n> -\t\t\t     start, size);\r\n> -\t}\r\n> -#endif\r\n>  \thw->use_msix = virtio_has_msix(&pci_dev->addr);\r\n>  \thw->io_base = (uint32_t)(uintptr_t)pci_dev-\r\n> >mem_resource[0].addr;\r\n>",
        "headers": {
            "Thread-Index": "AQHPwNK/VppuR5sBVEyjUKd9gNM0e5vidxTQ",
            "Cc": "\"dev@dpdk.org\" <dev@dpdk.org>",
            "X-MS-Has-Attach": "",
            "Date": "Tue, 26 Aug 2014 07:14:31 +0000",
            "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
            "In-Reply-To": "<20140826020837.898427212@networkplumber.org>",
            "Message-ID": "<F52918179C57134FAEC9EA62FA2F96251183B1F2@shsmsx102.ccr.corp.intel.com>",
            "X-BeenThere": "dev@dpdk.org",
            "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
            "Accept-Language": "zh-CN, en-US",
            "References": "<20140826020746.062748014@networkplumber.org>\n\t<20140826020837.898427212@networkplumber.org>",
            "X-MS-TNEF-Correlator": "",
            "Return-Path": "<changchun.ouyang@intel.com>",
            "x-originating-ip": "[10.239.127.40]",
            "MIME-Version": "1.0",
            "Received": [
                "from mga03.intel.com (mga03.intel.com [143.182.124.21])\n\tby dpdk.org (Postfix) with ESMTP id 4C9FC1FE\n\tfor <dev@dpdk.org>; Tue, 26 Aug 2014 09:10:37 +0200 (CEST)",
                "from azsmga001.ch.intel.com ([10.2.17.19])\n\tby azsmga101.ch.intel.com with ESMTP; 26 Aug 2014 00:14:34 -0700",
                "from fmsmsx108.amr.corp.intel.com ([10.18.124.206])\n\tby azsmga001.ch.intel.com with ESMTP; 26 Aug 2014 00:14:34 -0700",
                "from fmsmsx101.amr.corp.intel.com (10.19.9.52) by\n\tFMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP\n\tServer (TLS) id 14.3.195.1; Tue, 26 Aug 2014 00:14:33 -0700",
                "from shsmsx151.ccr.corp.intel.com (10.239.6.50) by\n\tFMSMSX101.amr.corp.intel.com (10.19.9.52) with Microsoft SMTP Server\n\t(TLS) id 14.3.195.1; Tue, 26 Aug 2014 00:14:33 -0700",
                "from shsmsx102.ccr.corp.intel.com ([169.254.2.246]) by\n\tSHSMSX151.ccr.corp.intel.com ([169.254.3.174]) with mapi id\n\t14.03.0195.001; Tue, 26 Aug 2014 15:14:31 +0800"
            ],
            "From": "\"Ouyang, Changchun\" <changchun.ouyang@intel.com>",
            "Precedence": "list",
            "List-Post": "<mailto:dev@dpdk.org>",
            "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
            "Content-Transfer-Encoding": "base64",
            "Subject": "Re: [dpdk-dev] [RFC 01/10] virtio: rearrange resource initialization",
            "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
            "X-List-Received-Date": "Tue, 26 Aug 2014 07:10:38 -0000",
            "To": "Stephen Hemminger <stephen@networkplumber.org>",
            "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
            "Content-Language": "en-US",
            "Content-Type": "text/plain; charset=\"utf-8\"",
            "X-Mailman-Version": "2.1.15",
            "X-ExtLoop1": "1",
            "Thread-Topic": "[RFC 01/10] virtio: rearrange resource initialization",
            "X-IronPort-AV": "E=Sophos;i=\"5.04,402,1406617200\"; d=\"scan'208\";a=\"472634374\""
        }
    }
]