get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 65799,
    "url": "http://patches.dpdk.org/api/patches/65799/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200213155226.1024939-3-thomas@monjalon.net/",
    "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": "<20200213155226.1024939-3-thomas@monjalon.net>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200213155226.1024939-3-thomas@monjalon.net",
    "date": "2020-02-13T15:52:26",
    "name": "[2/2] app/testpmd: fix hot-unplug detaching",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "bee985260f1e334287ae04ebb8be5e8c546b045d",
    "submitter": {
        "id": 685,
        "url": "http://patches.dpdk.org/api/people/685/?format=api",
        "name": "Thomas Monjalon",
        "email": "thomas@monjalon.net"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200213155226.1024939-3-thomas@monjalon.net/mbox/",
    "series": [
        {
            "id": 8529,
            "url": "http://patches.dpdk.org/api/series/8529/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8529",
            "date": "2020-02-13T15:52:24",
            "name": "app/testpmd: fix detach",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/8529/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/65799/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/65799/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id E64BBA0542;\n\tThu, 13 Feb 2020 16:52:53 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9D2091C08C;\n\tThu, 13 Feb 2020 16:52:38 +0100 (CET)",
            "from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com\n [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 603981C06D;\n Thu, 13 Feb 2020 16:52:36 +0100 (CET)",
            "from compute1.internal (compute1.nyi.internal [10.202.2.41])\n by mailout.nyi.internal (Postfix) with ESMTP id BBFAD21F76;\n Thu, 13 Feb 2020 10:52:35 -0500 (EST)",
            "from mailfrontend1 ([10.202.2.162])\n by compute1.internal (MEProxy); Thu, 13 Feb 2020 10:52:35 -0500",
            "from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])\n by mail.messagingengine.com (Postfix) with ESMTPA id C14BB328005E;\n Thu, 13 Feb 2020 10:52:34 -0500 (EST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=\n from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding; s=mesmtp; bh=HYsnGajw6N\n w1FIahplUpZHRLskO6bPk7TXaFJ+xs7CU=; b=hiiFKeZyKrREpHetL4uO4u0lS2\n Byt0+nXSLTv8fLNdrAW37ddCXxr3p8jziCLe68EPPVuPx2b57Qi3Pi9P9GcrbuNq\n g2PKRV3q7+C/WyMpEOq9r2t3hiD+wZcy2RbSUJWD6CeM08FpW5ZePcxxAPW3iiRm\n B6/jEHDv4oHP/w23s=",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n messagingengine.com; h=cc:content-transfer-encoding:date:from\n :in-reply-to:message-id:mime-version:references:subject:to\n :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=\n fm2; bh=HYsnGajw6Nw1FIahplUpZHRLskO6bPk7TXaFJ+xs7CU=; b=BT8STHQV\n sQV6h7btx2Z/iAYK0glgQXK5QbsG+CItu4XW6ZikrtZGWnGAgDwR7giHwNrlskDT\n uTM1b0fEFMwARLmhX+1NrHckq9hK0jg5dqgJr83o8dm37VVanxy/+WuKkx/XXsvF\n RQoa04UzLYwcc+hMamnhvEnpZwUwRbOq859UpkaKiHTsQdePN7nagX8fXf9wDhxT\n dnR6BhKOeKq19voZMPQ21JyTVEWPLMq0KP3Z7iaXz8b2QLg3UXPrvslDHbbxLMxH\n G/xsGYQVW1BI5nZar0HTm2kDF33E6uxSQvm2YC5qXPyb29HJGMSTwSeZraY3KJ4L\n 0O7ZwZW+g5d8Iw=="
        ],
        "X-ME-Sender": "<xms:w3BFXht9SEsmLHPT7b8kej8sZaMMlPX4fBBIKtTdmjontssc68f5cg>",
        "X-ME-Proxy-Cause": "\n gggruggvucftvghtrhhoucdtuddrgedugedrieekgdekvdcutefuodetggdotefrodftvf\n curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu\n uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc\n fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs\n ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph\n epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr\n rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth",
        "X-ME-Proxy": "<xmx:w3BFXm1lO75rzQZ7-3OKpuWInvDvo3oMF0qWIPNJqBeLnO8vYTXUFA>\n <xmx:w3BFXnkK0KIN-pW53LZH8gyixspXdH3TIH_4FtMe1gGtSYHofxZKFA>\n <xmx:w3BFXnQhfzocBHph0x0m7OEEGJZvri5TYVhPsVA9v6F4NC4AgS4-sg>\n <xmx:w3BFXkKWJljwmC_Yv-MvJiZBP2xdOxnbYjhC37fbI1AZFuNC5VIzIQ>",
        "From": "Thomas Monjalon <thomas@monjalon.net>",
        "To": "dev@dpdk.org",
        "Cc": "matan@mellanox.com, ferruh.yigit@intel.com, stable@dpdk.org,\n Wenzhuo Lu <wenzhuo.lu@intel.com>, Jingjing Wu <jingjing.wu@intel.com>,\n Bernard Iremonger <bernard.iremonger@intel.com>",
        "Date": "Thu, 13 Feb 2020 16:52:26 +0100",
        "Message-Id": "<20200213155226.1024939-3-thomas@monjalon.net>",
        "X-Mailer": "git-send-email 2.25.0",
        "In-Reply-To": "<20200213155226.1024939-1-thomas@monjalon.net>",
        "References": "<20200213155226.1024939-1-thomas@monjalon.net>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 2/2] app/testpmd: fix hot-unplug detaching",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "There is a possible race condition in the hotplug path\nin rmv_port_callback(). If a port is created between\nclose_port(port_id) and detach_port_device(port_id),\nthen the port_id will have been reallocated to a different\ndevice which will be wrongly detached.\n\nSince a check was added in detach_port_device() for\nmanual detach case, the hotplug path was even more broken.\nIt became impossible to run because the new check prevented\nto run detach_port_device() after the port is closed.\n\nThe solution for both issues is to not rely on the port_id\nfor detaching the rte_device.\nThe function detach_port_device() is split to allow calling\ndetach_device() directly with the rte_device pointer, saved\nbefore closing the port.\n\nFixes: 43d0e304980a (\"app/testpmd: fix invalid port detaching\")\nCc: stable@dpdk.org\n\nSigned-off-by: Thomas Monjalon <thomas@monjalon.net>\n---\n app/test-pmd/testpmd.c | 48 ++++++++++++++++++++++++------------------\n 1 file changed, 28 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 11203cb03d..035836adfb 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -2633,32 +2633,17 @@ setup_attached_port(portid_t pi)\n \tprintf(\"Done\\n\");\n }\n \n-void\n-detach_port_device(portid_t port_id)\n+static void\n+detach_device(struct rte_device *dev)\n {\n-\tstruct rte_device *dev;\n \tportid_t sibling;\n \n-\tprintf(\"Removing a device...\\n\");\n-\n-\tif (port_id_is_invalid(port_id, ENABLED_WARN))\n-\t\treturn;\n-\n-\tdev = rte_eth_devices[port_id].device;\n \tif (dev == NULL) {\n \t\tprintf(\"Device already removed\\n\");\n \t\treturn;\n \t}\n \n-\tif (ports[port_id].port_status != RTE_PORT_CLOSED) {\n-\t\tif (ports[port_id].port_status != RTE_PORT_STOPPED) {\n-\t\t\tprintf(\"Port not stopped\\n\");\n-\t\t\treturn;\n-\t\t}\n-\t\tprintf(\"Port was not closed\\n\");\n-\t\tif (ports[port_id].flow_list)\n-\t\t\tport_flow_flush(port_id);\n-\t}\n+\tprintf(\"Removing a device...\\n\");\n \n \tif (rte_dev_remove(dev) < 0) {\n \t\tTESTPMD_LOG(ERR, \"Failed to detach device %s\\n\", dev->name);\n@@ -2676,13 +2661,31 @@ detach_port_device(portid_t port_id)\n \n \tremove_invalid_ports();\n \n-\tprintf(\"Device of port %u is detached\\n\", port_id);\n+\tprintf(\"Device is detached\\n\");\n \tprintf(\"Now total ports is %d\\n\", nb_ports);\n \tprintf(\"Done\\n\");\n \treturn;\n }\n \n void\n+detach_port_device(portid_t port_id)\n+{\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+\tif (ports[port_id].port_status != RTE_PORT_CLOSED) {\n+\t\tif (ports[port_id].port_status != RTE_PORT_STOPPED) {\n+\t\t\tprintf(\"Port not stopped\\n\");\n+\t\t\treturn;\n+\t\t}\n+\t\tprintf(\"Port was not closed\\n\");\n+\t\tif (ports[port_id].flow_list)\n+\t\t\tport_flow_flush(port_id);\n+\t}\n+\n+\tdetach_device(rte_eth_devices[port_id].device);\n+}\n+\n void\n detach_devargs(char *identifier)\n {\n@@ -2873,6 +2876,7 @@ rmv_port_callback(void *arg)\n \tint need_to_start = 0;\n \tint org_no_link_check = no_link_check;\n \tportid_t port_id = (intptr_t)arg;\n+\tstruct rte_device *dev;\n \n \tRTE_ETH_VALID_PORTID_OR_RET(port_id);\n \n@@ -2883,8 +2887,12 @@ rmv_port_callback(void *arg)\n \tno_link_check = 1;\n \tstop_port(port_id);\n \tno_link_check = org_no_link_check;\n+\n+\t/* Save rte_device pointer before closing ethdev port */\n+\tdev = rte_eth_devices[port_id].device;\n \tclose_port(port_id);\n-\tdetach_port_device(port_id);\n+\tdetach_device(dev); /* might be already removed or have more ports */\n+\n \tif (need_to_start)\n \t\tstart_packet_forwarding(0);\n }\n",
    "prefixes": [
        "2/2"
    ]
}