get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 87090,
    "url": "http://patches.dpdk.org/api/patches/87090/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1611310732-51975-4-git-send-email-oulijun@huawei.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": "<1611310732-51975-4-git-send-email-oulijun@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1611310732-51975-4-git-send-email-oulijun@huawei.com",
    "date": "2021-01-22T10:18:41",
    "name": "[03/14] net/hns3: use array instead of switch-case",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "fd87e6c5111741de833b19d6e18c6f2003b342a2",
    "submitter": {
        "id": 1675,
        "url": "http://patches.dpdk.org/api/people/1675/?format=api",
        "name": "Lijun Ou",
        "email": "oulijun@huawei.com"
    },
    "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/1611310732-51975-4-git-send-email-oulijun@huawei.com/mbox/",
    "series": [
        {
            "id": 14903,
            "url": "http://patches.dpdk.org/api/series/14903/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=14903",
            "date": "2021-01-22T10:18:38",
            "name": "Misc updates for hns3",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/14903/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/87090/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/87090/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 69C5AA0A0A;\n\tFri, 22 Jan 2021 11:20:46 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 36EFD140F59;\n\tFri, 22 Jan 2021 11:19:31 +0100 (CET)",
            "from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191])\n by mails.dpdk.org (Postfix) with ESMTP id B0B6B140F0C\n for <dev@dpdk.org>; Fri, 22 Jan 2021 11:19:17 +0100 (CET)",
            "from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58])\n by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DMZvy0BWRzjBy6;\n Fri, 22 Jan 2021 18:18:06 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id\n 14.3.498.0; Fri, 22 Jan 2021 18:19:10 +0800"
        ],
        "From": "Lijun Ou <oulijun@huawei.com>",
        "To": "<thomas@monjalon.net>, <ferruh.yigit@intel.com>",
        "CC": "<dev@dpdk.org>, <linuxarm@openeuler.org>",
        "Date": "Fri, 22 Jan 2021 18:18:41 +0800",
        "Message-ID": "<1611310732-51975-4-git-send-email-oulijun@huawei.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1611310732-51975-1-git-send-email-oulijun@huawei.com>",
        "References": "<1611310732-51975-1-git-send-email-oulijun@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.69.192.56]",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev] [PATCH 03/14] net/hns3: use array instead of switch-case",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Heres uses errno array instead of switch-case for refactor\nthe hns3_cmd_convert_err_code function.\nBesides, we add a type for ROH(RDMA Over HCCS) check\ncmdq return error in Kunpeng930 NIC hardware.\n\nSigned-off-by: Lijun Ou <oulijun@huawei.com>\n---\n drivers/net/hns3/hns3_cmd.c | 54 ++++++++++++++++++++++-----------------------\n drivers/net/hns3/hns3_cmd.h |  1 +\n 2 files changed, 27 insertions(+), 28 deletions(-)",
    "diff": "diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c\nindex f58f4f7..4c301cb 100644\n--- a/drivers/net/hns3/hns3_cmd.c\n+++ b/drivers/net/hns3/hns3_cmd.c\n@@ -247,34 +247,32 @@ hns3_is_special_opcode(uint16_t opcode)\n static int\n hns3_cmd_convert_err_code(uint16_t desc_ret)\n {\n-\tswitch (desc_ret) {\n-\tcase HNS3_CMD_EXEC_SUCCESS:\n-\t\treturn 0;\n-\tcase HNS3_CMD_NO_AUTH:\n-\t\treturn -EPERM;\n-\tcase HNS3_CMD_NOT_SUPPORTED:\n-\t\treturn -EOPNOTSUPP;\n-\tcase HNS3_CMD_QUEUE_FULL:\n-\t\treturn -EXFULL;\n-\tcase HNS3_CMD_NEXT_ERR:\n-\t\treturn -ENOSR;\n-\tcase HNS3_CMD_UNEXE_ERR:\n-\t\treturn -ENOTBLK;\n-\tcase HNS3_CMD_PARA_ERR:\n-\t\treturn -EINVAL;\n-\tcase HNS3_CMD_RESULT_ERR:\n-\t\treturn -ERANGE;\n-\tcase HNS3_CMD_TIMEOUT:\n-\t\treturn -ETIME;\n-\tcase HNS3_CMD_HILINK_ERR:\n-\t\treturn -ENOLINK;\n-\tcase HNS3_CMD_QUEUE_ILLEGAL:\n-\t\treturn -ENXIO;\n-\tcase HNS3_CMD_INVALID:\n-\t\treturn -EBADR;\n-\tdefault:\n-\t\treturn -EREMOTEIO;\n-\t}\n+\tstatic const struct {\n+\t\tuint16_t imp_errcode;\n+\t\tint linux_errcode;\n+\t} hns3_cmdq_status[] = {\n+\t\t{HNS3_CMD_EXEC_SUCCESS, 0},\n+\t\t{HNS3_CMD_NO_AUTH, -EPERM},\n+\t\t{HNS3_CMD_NOT_SUPPORTED, -EOPNOTSUPP},\n+\t\t{HNS3_CMD_QUEUE_FULL, -EXFULL},\n+\t\t{HNS3_CMD_NEXT_ERR, -ENOSR},\n+\t\t{HNS3_CMD_UNEXE_ERR, -ENOTBLK},\n+\t\t{HNS3_CMD_PARA_ERR, -EINVAL},\n+\t\t{HNS3_CMD_RESULT_ERR, -ERANGE},\n+\t\t{HNS3_CMD_TIMEOUT, -ETIME},\n+\t\t{HNS3_CMD_HILINK_ERR, -ENOLINK},\n+\t\t{HNS3_CMD_QUEUE_ILLEGAL, -ENXIO},\n+\t\t{HNS3_CMD_INVALID, -EBADR},\n+\t\t{HNS3_CMD_ROH_CHECK_FAIL, -EINVAL}\n+\t};\n+\n+\tuint32_t i;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(hns3_cmdq_status); i++)\n+\t\tif (hns3_cmdq_status[i].imp_errcode == desc_ret)\n+\t\t\treturn hns3_cmdq_status[i].linux_errcode;\n+\n+\treturn -EREMOTEIO;\n }\n \n static int\ndiff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h\nindex e40293b..6152f6e 100644\n--- a/drivers/net/hns3/hns3_cmd.h\n+++ b/drivers/net/hns3/hns3_cmd.h\n@@ -52,6 +52,7 @@ enum hns3_cmd_return_status {\n \tHNS3_CMD_HILINK_ERR     = 9,\n \tHNS3_CMD_QUEUE_ILLEGAL  = 10,\n \tHNS3_CMD_INVALID        = 11,\n+\tHNS3_CMD_ROH_CHECK_FAIL = 12\n };\n \n enum hns3_cmd_status {\n",
    "prefixes": [
        "03/14"
    ]
}