get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41392,
    "url": "http://patchwork.dpdk.org/api/patches/41392/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1529668268-7462-5-git-send-email-jia.guo@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<1529668268-7462-5-git-send-email-jia.guo@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1529668268-7462-5-git-send-email-jia.guo@intel.com",
    "date": "2018-06-22T11:51:08",
    "name": "[v2,4/4] app/testpmd: show example to handle hot unplug",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "bf652e75f14587e208ab9662b45a2ff38c94fb61",
    "submitter": {
        "id": 507,
        "url": "http://patchwork.dpdk.org/api/people/507/?format=api",
        "name": "Guo, Jia",
        "email": "jia.guo@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1529668268-7462-5-git-send-email-jia.guo@intel.com/mbox/",
    "series": [
        {
            "id": 205,
            "url": "http://patchwork.dpdk.org/api/series/205/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=205",
            "date": "2018-06-22T11:51:04",
            "name": "hot plug failure handle mechanism",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/205/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/41392/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/41392/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9609F1BB71;\n\tFri, 22 Jun 2018 13:48:14 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 22E101BB4F\n\tfor <dev@dpdk.org>; Fri, 22 Jun 2018 13:48:12 +0200 (CEST)",
            "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t22 Jun 2018 04:48:12 -0700",
            "from jeffguo-s2600wt2.sh.intel.com (HELO localhost.localdomain)\n\t([10.67.110.10])\n\tby fmsmga007.fm.intel.com with ESMTP; 22 Jun 2018 04:48:10 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,256,1526367600\"; d=\"scan'208\";a=\"49078365\"",
        "From": "Jeff Guo <jia.guo@intel.com>",
        "To": "stephen@networkplumber.org, bruce.richardson@intel.com,\n\tferruh.yigit@intel.com, konstantin.ananyev@intel.com,\n\tgaetan.rivet@6wind.com, jingjing.wu@intel.com, thomas@monjalon.net,\n\tmotih@mellanox.com, matan@mellanox.com, harry.van.haaren@intel.com,\n\tqi.z.zhang@intel.com, shaopeng.he@intel.com",
        "Cc": "jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org,\n\tjia.guo@intel.com, helin.zhang@intel.com",
        "Date": "Fri, 22 Jun 2018 19:51:08 +0800",
        "Message-Id": "<1529668268-7462-5-git-send-email-jia.guo@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1529668268-7462-1-git-send-email-jia.guo@intel.com>",
        "References": "<1498711073-42917-1-git-send-email-jia.guo@intel.com>\n\t<1529668268-7462-1-git-send-email-jia.guo@intel.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 4/4] app/testpmd: show example to handle hot\n\tunplug",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Use testpmd for example, to show how an application smoothly handle\nfailure when device being hot unplug. If app have enabled the device event\nmonitor and register the hot plug event’s callback before running, once\napp detect the removal event, the callback would be called. It will first\nstop the packet forwarding, then stop the port, close the port, and finally\ndetach the port to remove the device out from the device lists.\n\nSigned-off-by: Jeff Guo <jia.guo@intel.com>\n---\nv2->v1(v21):\nrebase testpmd code\n---\n app/test-pmd/testpmd.c | 25 ++++++++++++++++++++-----\n 1 file changed, 20 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 24c1998..286f242 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -1951,9 +1951,10 @@ eth_dev_event_callback_unregister(void)\n void\n attach_port(char *identifier)\n {\n-\tportid_t pi = 0;\n \tunsigned int socket_id;\n \n+\tportid_t pi = rte_eth_dev_count_avail();\n+\n \tprintf(\"Attaching a new port...\\n\");\n \n \tif (identifier == NULL) {\n@@ -2125,16 +2126,25 @@ check_all_ports_link_status(uint32_t port_mask)\n static void\n rmv_event_callback(void *arg)\n {\n+\tstruct rte_eth_dev *dev;\n+\n \tint need_to_start = 0;\n \tint org_no_link_check = no_link_check;\n \tportid_t port_id = (intptr_t)arg;\n \n \tRTE_ETH_VALID_PORTID_OR_RET(port_id);\n+\tdev = &rte_eth_devices[port_id];\n+\n+\tif (dev->state == RTE_ETH_DEV_UNUSED)\n+\t\treturn;\n+\n+\tprintf(\"removing device %s\\n\", dev->device->name);\n \n \tif (!test_done && port_is_forwarding(port_id)) {\n \t\tneed_to_start = 1;\n \t\tstop_packet_forwarding();\n \t}\n+\n \tno_link_check = 1;\n \tstop_port(port_id);\n \tno_link_check = org_no_link_check;\n@@ -2196,6 +2206,9 @@ static void\n eth_dev_event_callback(char *device_name, enum rte_dev_event_type type,\n \t\t\t     __rte_unused void *arg)\n {\n+\tuint16_t port_id;\n+\tint ret;\n+\n \tif (type >= RTE_DEV_EVENT_MAX) {\n \t\tfprintf(stderr, \"%s called upon invalid event %d\\n\",\n \t\t\t__func__, type);\n@@ -2206,9 +2219,12 @@ eth_dev_event_callback(char *device_name, enum rte_dev_event_type type,\n \tcase RTE_DEV_EVENT_REMOVE:\n \t\tRTE_LOG(ERR, EAL, \"The device: %s has been removed!\\n\",\n \t\t\tdevice_name);\n-\t\t/* TODO: After finish failure handle, begin to stop\n-\t\t * packet forward, stop port, close port, detach port.\n-\t\t */\n+\t\tret = rte_eth_dev_get_port_by_name(device_name, &port_id);\n+\t\tif (ret) {\n+\t\t\tprintf(\"can not get port by device %s!\\n\", device_name);\n+\t\t\treturn;\n+\t\t}\n+\t\trmv_event_callback((void *)(intptr_t)port_id);\n \t\tbreak;\n \tcase RTE_DEV_EVENT_ADD:\n \t\tRTE_LOG(ERR, EAL, \"The device: %s has been added!\\n\",\n@@ -2736,7 +2752,6 @@ main(int argc, char** argv)\n \t\t\treturn -1;\n \t\t}\n \t\teth_dev_event_callback_register();\n-\n \t}\n \n \tif (start_port(RTE_PORT_ALL) != 0)\n",
    "prefixes": [
        "v2",
        "4/4"
    ]
}