get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 23639,
    "url": "http://patches.dpdk.org/api/patches/23639/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1492151805-14086-1-git-send-email-yuanhan.liu@linux.intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1492151805-14086-1-git-send-email-yuanhan.liu@linux.intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1492151805-14086-1-git-send-email-yuanhan.liu@linux.intel.com",
    "date": "2017-04-14T06:36:45",
    "name": "[dpdk-dev] net/virtio: fix link status always being up",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "0175bd2dd6ea2eada929cdcf2bc5096191cc159c",
    "submitter": {
        "id": 307,
        "url": "http://patches.dpdk.org/api/people/307/?format=api",
        "name": "Yuanhan Liu",
        "email": "yuanhan.liu@linux.intel.com"
    },
    "delegate": {
        "id": 355,
        "url": "http://patches.dpdk.org/api/users/355/?format=api",
        "username": "yliu",
        "first_name": "Yuanhan",
        "last_name": "Liu",
        "email": "yuanhan.liu@linux.intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1492151805-14086-1-git-send-email-yuanhan.liu@linux.intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/23639/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/23639/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 AC5FF37B2;\n\tFri, 14 Apr 2017 08:39:43 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 0ADF8378B;\n\tFri, 14 Apr 2017 08:39:41 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t13 Apr 2017 23:39:40 -0700",
            "from yliu-dev.sh.intel.com ([10.239.67.162])\n\tby orsmga005.jf.intel.com with ESMTP; 13 Apr 2017 23:39:39 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.37,197,1488873600\"; d=\"scan'208\";a=\"87380779\"",
        "From": "Yuanhan Liu <yuanhan.liu@linux.intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>,\n\tYuanhan Liu <yuanhan.liu@linux.intel.com>, stable@dpdk.org",
        "Date": "Fri, 14 Apr 2017 14:36:45 +0800",
        "Message-Id": "<1492151805-14086-1-git-send-email-yuanhan.liu@linux.intel.com>",
        "X-Mailer": "git-send-email 1.9.0",
        "Subject": "[dpdk-dev] [PATCH] net/virtio: fix link status always being up",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <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": "The virtio port link status will always be UP, even the port is stopped:\n\n    testpmd> port stop 0\n    Stopping ports...\n    Checking link statuses...\n    Port 0 Link Up - speed 10000 Mbps - full-duplex\n    Done\n\nThe link status is queried by link_update callback when LSC is disabled.\nWhich in turn queries the \"status\" field.  However, the \"status\" is\nread-only. I couldn't think of some proper ways to change the status\nwithout doing device reset.\n\nInstead of doing (the heavy) reset at stop, this patch introduced a flag,\nwhich is set to 1 and 0 on start and stop, respectively. When it's set to\n0, the link status is set to DOWN unconditionally.\n\nFixes: a85786dc816f (\"virtio: fix states handling during initialization\")\n\nCc: stable@dpdk.org\nSigned-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>\n---\n drivers/net/virtio/virtio_ethdev.c | 7 ++++++-\n drivers/net/virtio/virtio_pci.h    | 1 +\n 2 files changed, 7 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 78cb3e8..b2f9570 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -1768,6 +1768,7 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,\n \t\ttxvq = dev->data->tx_queues[i];\n \t\tVIRTQUEUE_DUMP(txvq->vq);\n \t}\n+\thw->started = 1;\n \n \treturn 0;\n }\n@@ -1823,6 +1824,7 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)\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 \tstruct rte_intr_conf *intr_conf = &dev->data->dev_conf.intr_conf;\n \n@@ -1831,6 +1833,7 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)\n \tif (intr_conf->lsc || intr_conf->rxq)\n \t\trte_intr_disable(dev->intr_handle);\n \n+\thw->started = 0;\n \tmemset(&link, 0, sizeof(link));\n \tvirtio_dev_atomic_write_link_status(dev, &link);\n }\n@@ -1847,7 +1850,9 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)\n \tlink.link_duplex = ETH_LINK_FULL_DUPLEX;\n \tlink.link_speed  = SPEED_10G;\n \n-\tif (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {\n+\tif (hw->started == 0) {\n+\t\tlink.link_status = ETH_LINK_DOWN;\n+\t} else if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {\n \t\tPMD_INIT_LOG(DEBUG, \"Get link status from hw\");\n \t\tvtpci_read_dev_config(hw,\n \t\t\t\toffsetof(struct virtio_net_config, status),\ndiff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h\nindex 0362acd..e7290d7 100644\n--- a/drivers/net/virtio/virtio_pci.h\n+++ b/drivers/net/virtio/virtio_pci.h\n@@ -253,6 +253,7 @@ struct virtio_hw {\n \tuint64_t    req_guest_features;\n \tuint64_t    guest_features;\n \tuint32_t    max_queue_pairs;\n+\tuint16_t    started;\n \tuint16_t\tmax_mtu;\n \tuint16_t    vtnet_hdr_size;\n \tuint8_t\t    vlan_strip;\n",
    "prefixes": [
        "dpdk-dev"
    ]
}