get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 133895,
    "url": "http://patchwork.dpdk.org/api/patches/133895/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20231106131128.33499-6-fengchengwen@huawei.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": "<20231106131128.33499-6-fengchengwen@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231106131128.33499-6-fengchengwen@huawei.com",
    "date": "2023-11-06T13:11:25",
    "name": "[v3,5/7] app/testpmd: add error recovery usage demo",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "837861e0ccc0a934207253b0d937bc71ea23a788",
    "submitter": {
        "id": 2146,
        "url": "http://patchwork.dpdk.org/api/people/2146/?format=api",
        "name": "fengchengwen",
        "email": "fengchengwen@huawei.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patchwork.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20231106131128.33499-6-fengchengwen@huawei.com/mbox/",
    "series": [
        {
            "id": 30169,
            "url": "http://patchwork.dpdk.org/api/series/30169/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=30169",
            "date": "2023-11-06T13:11:23",
            "name": "fix race-condition of proactive error handling mode",
            "version": 3,
            "mbox": "http://patchwork.dpdk.org/series/30169/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/133895/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/133895/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 31CA5432BA;\n\tMon,  6 Nov 2023 14:15:06 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 0054840A80;\n\tMon,  6 Nov 2023 14:14:22 +0100 (CET)",
            "from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255])\n by mails.dpdk.org (Postfix) with ESMTP id 66819402B6\n for <dev@dpdk.org>; Mon,  6 Nov 2023 14:14:14 +0100 (CET)",
            "from dggpeml100024.china.huawei.com (unknown [172.30.72.57])\n by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SPBYg4tHhz1P7sy;\n Mon,  6 Nov 2023 21:11:03 +0800 (CST)",
            "from localhost.localdomain (10.50.165.33) by\n dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2507.31; Mon, 6 Nov 2023 21:14:11 +0800"
        ],
        "From": "Chengwen Feng <fengchengwen@huawei.com>",
        "To": "<thomas@monjalon.net>, <ferruh.yigit@amd.com>,\n <konstantin.ananyev@huawei.com>, <ajit.khaparde@broadcom.com>, Aman Singh\n <aman.deep.singh@intel.com>, Yuying Zhang <yuying.zhang@intel.com>",
        "CC": "<dev@dpdk.org>, <andrew.rybchenko@oktetlabs.ru>,\n <kalesh-anakkur.purayil@broadcom.com>, <Honnappa.Nagarahalli@arm.com>",
        "Subject": "[PATCH v3 5/7] app/testpmd: add error recovery usage demo",
        "Date": "Mon, 6 Nov 2023 13:11:25 +0000",
        "Message-ID": "<20231106131128.33499-6-fengchengwen@huawei.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20231106131128.33499-1-fengchengwen@huawei.com>",
        "References": "<20230301030610.49468-1-fengchengwen@huawei.com>\n <20231106131128.33499-1-fengchengwen@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.50.165.33]",
        "X-ClientProxiedBy": "dggems703-chm.china.huawei.com (10.3.19.180) To\n dggpeml100024.china.huawei.com (7.185.36.115)",
        "X-CFilter-Loop": "Reflected",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "This patch adds error recovery usage demo which will:\n1. stop packet forwarding when the RTE_ETH_EVENT_ERR_RECOVERING event\n   is received.\n2. restart packet forwarding when the RTE_ETH_EVENT_RECOVERY_SUCCESS\n   event is received.\n3. prompt the ports that fail to recovery and need to be removed when\n   the RTE_ETH_EVENT_RECOVERY_FAILED event is received.\n\nIn addition, a message is added to the printed information, requiring\nno command to be executed during the error recovery.\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\nAcked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>\n---\n app/test-pmd/testpmd.c | 80 ++++++++++++++++++++++++++++++++++++++++++\n app/test-pmd/testpmd.h |  4 ++-\n 2 files changed, 83 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 9e4e99e53b..a45c411398 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -3941,6 +3941,77 @@ rmv_port_callback(void *arg)\n \t\tstart_packet_forwarding(0);\n }\n \n+static int need_start_when_recovery_over;\n+\n+static bool\n+has_port_in_err_recovering(void)\n+{\n+\tstruct rte_port *port;\n+\tportid_t pid;\n+\n+\tRTE_ETH_FOREACH_DEV(pid) {\n+\t\tport = &ports[pid];\n+\t\tif (port->err_recovering)\n+\t\t\treturn true;\n+\t}\n+\n+\treturn false;\n+}\n+\n+static void\n+err_recovering_callback(portid_t port_id)\n+{\n+\tif (!has_port_in_err_recovering())\n+\t\tprintf(\"Please stop executing any commands until recovery result events are received!\\n\");\n+\n+\tports[port_id].err_recovering = 1;\n+\tports[port_id].recover_failed = 0;\n+\n+\t/* To simplify implementation, stop forwarding regardless of whether the port is used. */\n+\tif (!test_done) {\n+\t\tprintf(\"Stop packet forwarding because some ports are in error recovering!\\n\");\n+\t\tstop_packet_forwarding();\n+\t\tneed_start_when_recovery_over = 1;\n+\t}\n+}\n+\n+static void\n+recover_success_callback(portid_t port_id)\n+{\n+\tports[port_id].err_recovering = 0;\n+\tif (has_port_in_err_recovering())\n+\t\treturn;\n+\n+\tif (need_start_when_recovery_over) {\n+\t\tprintf(\"Recovery success! Restart packet forwarding!\\n\");\n+\t\tstart_packet_forwarding(0);\n+\t\tneed_start_when_recovery_over = 0;\n+\t} else {\n+\t\tprintf(\"Recovery success!\\n\");\n+\t}\n+}\n+\n+static void\n+recover_failed_callback(portid_t port_id)\n+{\n+\tstruct rte_port *port;\n+\tportid_t pid;\n+\n+\tports[port_id].err_recovering = 0;\n+\tports[port_id].recover_failed = 1;\n+\tif (has_port_in_err_recovering())\n+\t\treturn;\n+\n+\tneed_start_when_recovery_over = 0;\n+\tprintf(\"The ports:\");\n+\tRTE_ETH_FOREACH_DEV(pid) {\n+\t\tport = &ports[pid];\n+\t\tif (port->recover_failed)\n+\t\t\tprintf(\" %u\", pid);\n+\t}\n+\tprintf(\" recovery failed! Please remove them!\\n\");\n+}\n+\n /* This function is used by the interrupt thread */\n static int\n eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,\n@@ -3996,6 +4067,15 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,\n \t\t}\n \t\tbreak;\n \t}\n+\tcase RTE_ETH_EVENT_ERR_RECOVERING:\n+\t\terr_recovering_callback(port_id);\n+\t\tbreak;\n+\tcase RTE_ETH_EVENT_RECOVERY_SUCCESS:\n+\t\trecover_success_callback(port_id);\n+\t\tbreak;\n+\tcase RTE_ETH_EVENT_RECOVERY_FAILED:\n+\t\trecover_failed_callback(port_id);\n+\t\tbreak;\n \tdefault:\n \t\tbreak;\n \t}\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 9b10a9ea1c..b8a0a4715a 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -342,7 +342,9 @@ struct rte_port {\n \tuint8_t                 member_flag : 1, /**< bonding member port */\n \t\t\t\tbond_flag : 1, /**< port is bond device */\n \t\t\t\tfwd_mac_swap : 1, /**< swap packet MAC before forward */\n-\t\t\t\tupdate_conf : 1; /**< need to update bonding device configuration */\n+\t\t\t\tupdate_conf : 1, /**< need to update bonding device configuration */\n+\t\t\t\terr_recovering : 1, /**< port is in error recovering */\n+\t\t\t\trecover_failed : 1; /**< port recover failed */\n \tstruct port_template    *pattern_templ_list; /**< Pattern templates. */\n \tstruct port_template    *actions_templ_list; /**< Actions templates. */\n \tstruct port_table       *table_list; /**< Flow tables. */\n",
    "prefixes": [
        "v3",
        "5/7"
    ]
}