Show a patch.

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

{
    "id": 217,
    "url": "https://patches.dpdk.org/api/patches/217/",
    "web_url": "https://patches.dpdk.org/patch/217/",
    "project": {
        "id": 1,
        "url": "https://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": "<20140826020856.221149388@networkplumber.org>",
    "date": "2014-08-26T02:07:55",
    "name": "[dpdk-dev,RFC,09/10] virtio: fix how states are handled during initialization",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "dcdfdcb01e6b81b1a78f86d31b0ade1f6e370513",
    "submitter": {
        "id": 27,
        "url": "https://patches.dpdk.org/api/people/27/",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/217/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/217/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/217/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Cc": "dev@dpdk.org",
        "Date": "Mon, 25 Aug 2014 19:07:55 -0700",
        "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=RF/dphg1iGNb9vn/a3uSRy3QoGgDe9f8+Ujm1igUg/k=;\n\tb=eTWS9x/79BhutEecVQW4Pij1Y35vD12e2ne+sdfCrJi39qdGtnw8DCNVmB8kAxKViO\n\tOyaCySERBIaLGqPGiNY6+nTEpErnYYDQfuT0k5NJlHjADubsasIZGOO1XiakKQygWMK3\n\tmnBYTPBwKu1fOnHt9XUysyCotBhPN1cCKofQYdkq7f1eynoa+9VAHNJb3ofz0gnVXKfL\n\tA1q+BMHNRs+Xkrt/GwBxO2OXhsp3oUkRcVjJREbIZ86zlzVK5/UF2cvA2oW75YSLMWur\n\tSdAeuTstUaF3CQo6P1e5z3IZ4FQtCeFXX8H5CdQ6JWsEdtTxzKNXfsYnQC7+Gn3GvyX0\n\tdhEA==",
        "Precedence": "list",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<20140826020746.062748014@networkplumber.org>",
        "Content-Disposition": "inline; filename=virtio-state.patch",
        "X-Gm-Message-State": "ALoCoQmH9JsoHwVVSJ/NaPu+vn0Xq3gU3x0w5t0teHT0/eJMIKyHcHWfHkC2PM8N2NwLdDYEFaRE",
        "Content-Type": "text/plain; charset=UTF-8",
        "To": "Ouyang Changchun <changchun.ouyang@intel.com>",
        "User-Agent": "quilt/0.63-1",
        "MIME-Version": "1.0",
        "Received": [
            "from mail-pd0-f169.google.com (mail-pd0-f169.google.com\n\t[209.85.192.169]) by dpdk.org (Postfix) with ESMTP id 41C93B399\n\tfor <dev@dpdk.org>; Tue, 26 Aug 2014 04:05:01 +0200 (CEST)",
            "by mail-pd0-f169.google.com with SMTP id y10so21565337pdj.14\n\tfor <dev@dpdk.org>; Mon, 25 Aug 2014 19:08:58 -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\taq1sm1110239pbc.96.2014.08.25.19.08.57 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 25 Aug 2014 19:08:57 -0700 (PDT)"
        ],
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Message-Id": "<20140826020856.221149388@networkplumber.org>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [RFC 09/10] virtio: fix how states are handled during\n\tinitialization",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "X-List-Received-Date": "Tue, 26 Aug 2014 02:05:01 -0000",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Return-Path": "<stephen@networkplumber.org>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Received": "by 10.70.52.199 with SMTP id v7mr20237196pdo.49.1409018938397;\n\tMon, 25 Aug 2014 19:08:58 -0700 (PDT)",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "Change order of initialiazation to match Linux kernel.\nDon't blow away control queue by doing reset when stopped.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n\n\n---\n lib/librte_pmd_virtio/virtio_ethdev.c |   50 ++++++++++------------------------\n lib/librte_pmd_virtio/virtio_rxtx.c   |    2 +\n 2 files changed, 18 insertions(+), 34 deletions(-)",
    "diff": "--- a/lib/librte_pmd_virtio/virtio_ethdev.c\t2014-08-25 19:00:11.062556360 -0700\n+++ b/lib/librte_pmd_virtio/virtio_ethdev.c\t2014-08-25 19:00:12.122562032 -0700\n@@ -394,9 +394,11 @@ virtio_dev_cq_queue_setup(struct rte_eth\n static void\n virtio_dev_close(struct rte_eth_dev *dev)\n {\n-\tPMD_INIT_LOG(DEBUG, \"virtio_dev_close\");\n+\tstruct virtio_hw *hw = dev->data->dev_private;\n \n-\tvirtio_dev_stop(dev);\n+\tvtpci_irq_config(hw, VIRTIO_MSI_NO_VECTOR);\n+\tvtpci_reset(hw);\n+\tvirtio_dev_free_mbufs(dev);\n }\n \n /*\n@@ -811,6 +813,9 @@ eth_virtio_dev_init(__rte_unused struct\n \tif (rte_eal_process_type() == RTE_PROC_SECONDARY)\n \t\treturn 0;\n \n+\t/* Tell the host we've noticed this device. */\n+\tvtpci_set_status(hw, VIRTIO_CONFIG_STATUS_ACK);\n+\n \tpci_dev = eth_dev->pci_dev;\n \tif (virtio_resource_init(pci_dev) < 0)\n \t\treturn -1;\n@@ -821,9 +826,6 @@ eth_virtio_dev_init(__rte_unused struct\n \t/* Reset the device although not necessary at startup */\n \tvtpci_reset(hw);\n \n-\t/* Tell the host we've noticed this device. */\n-\tvtpci_set_status(hw, VIRTIO_CONFIG_STATUS_ACK);\n-\n \t/* Tell the host we've known how to drive the device. */\n \tvtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);\n \tvirtio_negotiate_features(hw);\n@@ -912,6 +914,9 @@ eth_virtio_dev_init(__rte_unused struct\n \t/* Setup interrupt callback  */\n \trte_intr_callback_register(&pci_dev->intr_handle,\n \t\t\t\t   virtio_interrupt_handler, eth_dev);\n+\n+\tvirtio_dev_cq_start(eth_dev);\n+\n \treturn 0;\n }\n \n@@ -982,19 +987,8 @@ virtio_dev_configure(struct rte_eth_dev\n static int\n virtio_dev_start(struct rte_eth_dev *dev)\n {\n-\tuint16_t nb_queues, i;\n \tstruct virtio_hw *hw = dev->data->dev_private;\n-\n-\t/* Tell the host we've noticed this device. */\n-\tvtpci_set_status(hw, VIRTIO_CONFIG_STATUS_ACK);\n-\n-\t/* Tell the host we've known how to drive the device. */\n-\tvtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);\n-\n-\tvirtio_dev_cq_start(dev);\n-\n-\t/* Do final configuration before rx/tx engine starts */\n-\tvirtio_dev_rxtx_start(dev);\n+\tuint16_t nb_queues;\n \n \t/* check if lsc interrupt feature is enabled */\n \tif (dev->data->dev_conf.intr_conf.lsc) {\n@@ -1024,18 +1018,8 @@ virtio_dev_start(struct rte_eth_dev *dev\n \t\t\treturn -EINVAL;\n \t}\n \n-\tPMD_INIT_LOG(DEBUG, \"nb_queues=%d\", nb_queues);\n-\n-\tfor (i = 0; i < nb_queues; i++)\n-\t\tvirtqueue_notify(dev->data->rx_queues[i]);\n-\n-\tPMD_INIT_LOG(DEBUG, \"Notified backend at initialization\");\n-\n-\tfor (i = 0; i < dev->data->nb_rx_queues; i++)\n-\t\tVIRTQUEUE_DUMP((struct virtqueue *)dev->data->rx_queues[i]);\n-\n-\tfor (i = 0; i < dev->data->nb_tx_queues; i++)\n-\t\tVIRTQUEUE_DUMP((struct virtqueue *)dev->data->tx_queues[i]);\n+\t/* Do final configuration before rx/tx engine starts */\n+\tvirtio_dev_rxtx_start(dev);\n \n \treturn 0;\n }\n@@ -1089,12 +1073,10 @@ static void virtio_dev_free_mbufs(struct\n static void\n virtio_dev_stop(struct rte_eth_dev *dev)\n {\n-\tstruct virtio_hw *hw = dev->data->dev_private;\n+\tif (dev->data->dev_conf.intr_conf.lsc)\n+\t\trte_intr_disable(&dev->pci_dev->intr_handle);\n \n-\t/* reset the NIC */\n-\tvtpci_irq_config(hw, 0);\n-\tvtpci_reset(hw);\n-\tvirtio_dev_free_mbufs(dev);\n+\tmemset(&dev->data->dev_link, 0, sizeof(struct rte_eth_link));\n }\n \n static int\n--- a/lib/librte_pmd_virtio/virtio_rxtx.c\t2014-08-25 19:00:11.062556360 -0700\n+++ b/lib/librte_pmd_virtio/virtio_rxtx.c\t2014-08-25 19:00:11.062556360 -0700\n@@ -350,6 +350,8 @@ virtio_dev_rxtx_start(struct rte_eth_dev\n \tfor (i = 0; i < dev->data->nb_rx_queues; i++) {\n \t\tvirtio_dev_vring_start(dev->data->rx_queues[i], VTNET_RQ);\n \t\tVIRTQUEUE_DUMP((struct virtqueue *)dev->data->rx_queues[i]);\n+\n+\t\tvirtqueue_notify(dev->data->rx_queues[i]);\n \t}\n \n \t/* Start tx vring. */\n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "09/10"
    ]
}