get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2526,
    "url": "https://patches.dpdk.org/api/patches/2526/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1422326164-13697-10-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": "<1422326164-13697-10-git-send-email-changchun.ouyang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1422326164-13697-10-git-send-email-changchun.ouyang@intel.com",
    "date": "2015-01-27T02:35:49",
    "name": "[dpdk-dev,v2,09/24] virtio: Fix how states are handled during initialization",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "62b2f6dab46c13c20be94a59474ec46c67789f37",
    "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/1422326164-13697-10-git-send-email-changchun.ouyang@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2526/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2526/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 8BF335ACC;\n\tTue, 27 Jan 2015 03:37:51 +0100 (CET)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 924D05A9E\n\tfor <dev@dpdk.org>; Tue, 27 Jan 2015 03:36:52 +0100 (CET)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga102.fm.intel.com with ESMTP; 26 Jan 2015 18:36:32 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga001.fm.intel.com with ESMTP; 26 Jan 2015 18:36:32 -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 t0R2aTFe015098;\n\tTue, 27 Jan 2015 10:36:29 +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 t0R2aR6P013793; Tue, 27 Jan 2015 10:36:29 +0800",
            "(from couyang@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t0R2aRfg013789; \n\tTue, 27 Jan 2015 10:36:27 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.09,471,1418112000\"; d=\"scan'208\";a=\"656921531\"",
        "From": "Ouyang Changchun <changchun.ouyang@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 27 Jan 2015 10:35:49 +0800",
        "Message-Id": "<1422326164-13697-10-git-send-email-changchun.ouyang@intel.com>",
        "X-Mailer": "git-send-email 1.7.12.2",
        "In-Reply-To": "<1422326164-13697-1-git-send-email-changchun.ouyang@intel.com>",
        "References": "<1421298930-15210-1-git-send-email-changchun.ouyang@intel.com>\n\t<1422326164-13697-1-git-send-email-changchun.ouyang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 09/24] virtio: Fix how states are handled\n\tduring initialization",
        "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": "Change order of initialiazation to match Linux kernel.\nDon't blow away control queue by doing reset when stopped.\n\nCalling dev_stop then dev_start would not work.\nDev_stop was calling virtio reset and that would clear all queues\nand clear all feature negotiation.\nResolved by only doing reset on device removal.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\nSigned-off-by: Changchun Ouyang <changchun.ouyang@intel.com>\n---\n lib/librte_pmd_virtio/virtio_ethdev.c | 58 ++++++++++++++++++++---------------\n lib/librte_pmd_virtio/virtio_pci.c    | 10 ++----\n lib/librte_pmd_virtio/virtio_pci.h    |  3 +-\n 3 files changed, 37 insertions(+), 34 deletions(-)",
    "diff": "diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c\nindex 0d41e7f..47dd33d 100644\n--- a/lib/librte_pmd_virtio/virtio_ethdev.c\n+++ b/lib/librte_pmd_virtio/virtio_ethdev.c\n@@ -398,9 +398,14 @@ virtio_dev_cq_queue_setup(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx,\n static void\n virtio_dev_close(struct rte_eth_dev *dev)\n {\n+\tstruct virtio_hw *hw = dev->data->dev_private;\n+\n \tPMD_INIT_LOG(DEBUG, \"virtio_dev_close\");\n \n-\tvirtio_dev_stop(dev);\n+\t/* reset the NIC */\n+\tvtpci_irq_config(hw, VIRTIO_MSI_NO_VECTOR);\n+\tvtpci_reset(hw);\n+\tvirtio_dev_free_mbufs(dev);\n }\n \n static void\n@@ -889,6 +894,9 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv,\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@@ -899,9 +907,6 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv,\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@@ -990,6 +995,9 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv,\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@@ -1044,7 +1052,6 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n {\n \tconst struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;\n \tstruct virtio_hw *hw = dev->data->dev_private;\n-\tint ret;\n \n \tPMD_INIT_LOG(DEBUG, \"configure\");\n \n@@ -1055,11 +1062,12 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \n \thw->vlan_strip = rxmode->hw_vlan_strip;\n \n-\tret = vtpci_irq_config(hw, 0);\n-\tif (ret != 0)\n+\tif (vtpci_irq_config(hw, 0) == VIRTIO_MSI_NO_VECTOR) {\n \t\tPMD_DRV_LOG(ERR, \"failed to set config vector\");\n+\t\treturn -EBUSY;\n+\t}\n \n-\treturn ret;\n+\treturn 0;\n }\n \n \n@@ -1069,17 +1077,6 @@ virtio_dev_start(struct rte_eth_dev *dev)\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-\n \t/* check if lsc interrupt feature is enabled */\n \tif (dev->data->dev_conf.intr_conf.lsc) {\n \t\tif (!vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {\n@@ -1096,8 +1093,16 @@ virtio_dev_start(struct rte_eth_dev *dev)\n \t/* Initialize Link state */\n \tvirtio_dev_link_update(dev, 0);\n \n+\t/* On restart after stop do not touch queues */\n+\tif (hw->started)\n+\t\treturn 0;\n+\n \tvtpci_reinit_complete(hw);\n \n+\t/* Do final configuration before rx/tx engine starts */\n+\tvirtio_dev_rxtx_start(dev);\n+\thw->started = 1;\n+\n \t/*Notify the backend\n \t *Otherwise the tap backend might already stop its queue due to fullness.\n \t *vhost backend will have no chance to be waked up\n@@ -1168,17 +1173,20 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)\n }\n \n /*\n- * Stop device: disable rx and tx functions to allow for reconfiguring.\n+ * Stop device: disable interrupt and mark link down\n  */\n static void\n virtio_dev_stop(struct rte_eth_dev *dev)\n {\n-\tstruct virtio_hw *hw = dev->data->dev_private;\n+\tstruct rte_eth_link link;\n \n-\t/* reset the NIC */\n-\tvtpci_irq_config(hw, 0);\n-\tvtpci_reset(hw);\n-\tvirtio_dev_free_mbufs(dev);\n+\tPMD_INIT_LOG(DEBUG, \"stop\");\n+\n+\tif (dev->data->dev_conf.intr_conf.lsc)\n+\t\trte_intr_disable(&dev->pci_dev->intr_handle);\n+\n+\tmemset(&link, 0, sizeof(link));\n+\tvirtio_dev_atomic_write_link_status(dev, &link);\n }\n \n static int\ndiff --git a/lib/librte_pmd_virtio/virtio_pci.c b/lib/librte_pmd_virtio/virtio_pci.c\nindex 6d51032..b099e4f 100644\n--- a/lib/librte_pmd_virtio/virtio_pci.c\n+++ b/lib/librte_pmd_virtio/virtio_pci.c\n@@ -137,15 +137,9 @@ vtpci_isr(struct virtio_hw *hw)\n \n \n /* Enable one vector (0) for Link State Intrerrupt */\n-int\n+uint16_t\n vtpci_irq_config(struct virtio_hw *hw, uint16_t vec)\n {\n \tVIRTIO_WRITE_REG_2(hw, VIRTIO_MSI_CONFIG_VECTOR, vec);\n-\tvec = VIRTIO_READ_REG_2(hw, VIRTIO_MSI_CONFIG_VECTOR);\n-\tif (vec == VIRTIO_MSI_NO_VECTOR) {\n-\t\tPMD_DRV_LOG(ERR, \"failed to set config vector\");\n-\t\treturn -EBUSY;\n-\t}\n-\n-\treturn 0;\n+\treturn VIRTIO_READ_REG_2(hw, VIRTIO_MSI_CONFIG_VECTOR);\n }\ndiff --git a/lib/librte_pmd_virtio/virtio_pci.h b/lib/librte_pmd_virtio/virtio_pci.h\nindex 6d93fac..0a4b578 100644\n--- a/lib/librte_pmd_virtio/virtio_pci.h\n+++ b/lib/librte_pmd_virtio/virtio_pci.h\n@@ -170,6 +170,7 @@ struct virtio_hw {\n \tuint16_t    vtnet_hdr_size;\n \tuint8_t\t    vlan_strip;\n \tuint8_t\t    use_msix;\n+\tuint8_t     started;\n \tuint8_t     mac_addr[ETHER_ADDR_LEN];\n };\n \n@@ -266,6 +267,6 @@ void vtpci_read_dev_config(struct virtio_hw *, uint64_t, void *, int);\n \n uint8_t vtpci_isr(struct virtio_hw *);\n \n-int vtpci_irq_config(struct virtio_hw *, uint16_t);\n+uint16_t vtpci_irq_config(struct virtio_hw *, uint16_t);\n \n #endif /* _VIRTIO_PCI_H_ */\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "09/24"
    ]
}