Show a patch.

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

{
    "id": 41946,
    "url": "http://patches.dpdk.org/api/patches/41946/?format=api",
    "web_url": "http://patches.dpdk.org/patch/41946/",
    "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"
    },
    "msgid": "<1530267871-7161-9-git-send-email-jia.guo@intel.com>",
    "date": "2018-06-29T10:24:30",
    "name": "[V4,8/9] app/testpmd: show example to handle hot unplug",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "42ea60c9c2317113ebf6e41f6468d31e0e3febce",
    "submitter": {
        "id": 507,
        "url": "http://patches.dpdk.org/api/people/507/?format=api",
        "name": "Guo, Jia",
        "email": "jia.guo@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/patch/41946/mbox/",
    "series": [
        {
            "id": 314,
            "url": "http://patches.dpdk.org/api/series/314/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=314",
            "date": "2018-06-29T10:24:22",
            "name": "hot plug failure handle mechanism",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/314/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41946/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/41946/checks/",
    "tags": {},
    "headers": {
        "X-Mailer": "git-send-email 2.7.4",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "From": "Jeff Guo <jia.guo@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Date": "Fri, 29 Jun 2018 18:24:30 +0800",
        "X-Mailman-Version": "2.1.15",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "Cc": "jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org,\n\tjia.guo@intel.com, helin.zhang@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, bernard.iremonger@intel.com",
        "Errors-To": "dev-bounces@dpdk.org",
        "References": "<1530267871-7161-1-git-send-email-jia.guo@intel.com>",
        "Precedence": "list",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,285,1526367600\"; d=\"scan'208\";a=\"241324461\"",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 405281B55E;\n\tFri, 29 Jun 2018 12:27:17 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 8716B1B546\n\tfor <dev@dpdk.org>; Fri, 29 Jun 2018 12:27:15 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jun 2018 03:27:15 -0700",
            "from jeffguo-z170x-ud5.sh.intel.com (HELO localhost.localdomain)\n\t([10.67.104.10])\n\tby fmsmga005.fm.intel.com with ESMTP; 29 Jun 2018 03:27:12 -0700"
        ],
        "Content-Type": "text/plain; charset=UTF-8",
        "X-Amp-File-Uploaded": "False",
        "Subject": "[dpdk-dev] [PATCH V4 8/9] app/testpmd: show example to handle hot\n\tunplug",
        "In-Reply-To": "<1530267871-7161-1-git-send-email-jia.guo@intel.com>",
        "MIME-Version": "1.0",
        "Message-Id": "<1530267871-7161-9-git-send-email-jia.guo@intel.com>",
        "X-ExtLoop1": "1",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Original-To": "patchwork@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---\nv4->v3:\nremove some unused code\n---\n app/test-pmd/testpmd.c | 13 +++++++++----\n 1 file changed, 9 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 24c1998..42ed196 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -2196,6 +2196,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 +2209,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 +2742,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": [
        "V4",
        "8/9"
    ]
}