get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 24743,
    "url": "http://patches.dpdk.org/api/patches/24743/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1495873329-43303-4-git-send-email-wei.dai@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": "<1495873329-43303-4-git-send-email-wei.dai@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1495873329-43303-4-git-send-email-wei.dai@intel.com",
    "date": "2017-05-27T08:22:05",
    "name": "[dpdk-dev,3/7] ethdev: add support of restoration of port status",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "29293252402506fcb666688dc2bca811ada1c7e3",
    "submitter": {
        "id": 490,
        "url": "http://patches.dpdk.org/api/people/490/?format=api",
        "name": "Wei Dai",
        "email": "wei.dai@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1495873329-43303-4-git-send-email-wei.dai@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/24743/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/24743/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 076C837A0;\n\tSat, 27 May 2017 10:31:29 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 459403777\n\tfor <dev@dpdk.org>; Sat, 27 May 2017 10:31:22 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 May 2017 01:31:22 -0700",
            "from dpdk6.bj.intel.com ([172.16.182.81])\n\tby orsmga001.jf.intel.com with ESMTP; 27 May 2017 01:31:20 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos; i=\"5.38,400,1491289200\"; d=\"scan'208\";\n\ta=\"1135329748\"",
        "From": "Wei Dai <wei.dai@intel.com>",
        "To": "wenzhuo.lu@intel.com, konstantin.ananyev@intel.com, helin.zhang@intel.com,\n\tjingjing.wu@intel.com",
        "Cc": "dev@dpdk.org,\n\tWei Dai <wei.dai@intel.com>",
        "Date": "Sat, 27 May 2017 16:22:05 +0800",
        "Message-Id": "<1495873329-43303-4-git-send-email-wei.dai@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1495873329-43303-1-git-send-email-wei.dai@intel.com>",
        "References": "<1495873329-43303-1-git-send-email-wei.dai@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 3/7] ethdev: add support of restoration of port\n\tstatus",
        "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": "As dev->data->dev_link.link_status may change when the port is\ninitialized again, this patch adds dev->data->restore_link for\nrestoration.\nIn the restoration process, ethdev layer can restore link status\nas up or down by comparing dev->data->restore_link.link_status\nand dev->data->dev_link.link_status.\n\nSigned-off-by: Wei Dai <wei.dai@intel.com>\n---\n lib/librte_ether/rte_ethdev.c | 37 +++++++++++++++++++++++++++++++++++--\n lib/librte_ether/rte_ethdev.h |  1 +\n 2 files changed, 36 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex 97c0044..af8ccf6 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -923,6 +923,28 @@ rte_eth_dev_tx_queue_restore(uint8_t port_id, uint16_t queue_id)\n }\n \n static void\n+rte_eth_dev_link_status_restore(uint8_t port_id)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\tdev = &rte_eth_devices[port_id];\n+\n+\tif (dev->data->in_restoration == 0) {\n+\t\tdev->data->restore_link.link_status =\n+\t\t\tdev->data->dev_link.link_status;\n+\t\treturn;\n+\t}\n+\n+\tif (dev->data->restore_link.link_status\n+\t    != dev->data->dev_link.link_status) {\n+\t\tif (dev->data->restore_link.link_status != 0)\n+\t\t\trte_eth_dev_set_link_up(port_id);\n+\t\telse\n+\t\t\trte_eth_dev_set_link_down(port_id);\n+\t}\n+}\n+\n+static void\n rte_eth_dev_config_restore(uint8_t port_id)\n {\n \tstruct rte_eth_dev *dev;\n@@ -982,6 +1004,7 @@ rte_eth_dev_config_restore(uint8_t port_id)\n \tfor (q = 0; q < dev->data->nb_tx_queues; q++)\n \t\trte_eth_dev_tx_queue_restore(port_id, q);\n \n+\trte_eth_dev_link_status_restore(port_id);\n }\n \n int\n@@ -1014,6 +1037,8 @@ rte_eth_dev_start(uint8_t port_id)\n \tif (dev->data->dev_conf.intr_conf.lsc == 0) {\n \t\tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);\n \t\t(*dev->dev_ops->link_update)(dev, 0);\n+\t\tdev->data->restore_link.link_status =\n+\t\t\tdev->data->dev_link.link_status;\n \t}\n \treturn 0;\n }\n@@ -1043,26 +1068,34 @@ int\n rte_eth_dev_set_link_up(uint8_t port_id)\n {\n \tstruct rte_eth_dev *dev;\n+\tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n \n \tdev = &rte_eth_devices[port_id];\n \n \tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);\n-\treturn (*dev->dev_ops->dev_set_link_up)(dev);\n+\tret = (*dev->dev_ops->dev_set_link_up)(dev);\n+\tif (!ret)\n+\t\tdev->data->restore_link.link_status = 1;\n+\treturn ret;\n }\n \n int\n rte_eth_dev_set_link_down(uint8_t port_id)\n {\n \tstruct rte_eth_dev *dev;\n+\tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n \n \tdev = &rte_eth_devices[port_id];\n \n \tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);\n-\treturn (*dev->dev_ops->dev_set_link_down)(dev);\n+\tret = (*dev->dev_ops->dev_set_link_down)(dev);\n+\tif (!ret)\n+\t\tdev->data->restore_link.link_status = 0;\n+\treturn ret;\n }\n \n void\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex 7a2ce07..9428f57 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -1734,6 +1734,7 @@ struct rte_eth_dev_data {\n \tvoid *dev_private;              /**< PMD-specific private data */\n \n \tstruct rte_eth_link dev_link;\n+\tstruct rte_eth_link restore_link;\n \t/**< Link-level information & status */\n \n \tstruct rte_eth_conf dev_conf;   /**< Configuration applied to device. */\n",
    "prefixes": [
        "dpdk-dev",
        "3/7"
    ]
}