get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68976,
    "url": "https://patches.dpdk.org/api/patches/68976/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200421033215.20584-2-huwei013@chinasoftinc.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20200421033215.20584-2-huwei013@chinasoftinc.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200421033215.20584-2-huwei013@chinasoftinc.com",
    "date": "2020-04-21T03:32:14",
    "name": "[1/2] net/hns3: modify the format for firmware version",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "b34597666467c06e3dd15057ed00335865ce1da2",
    "submitter": {
        "id": 1537,
        "url": "https://patches.dpdk.org/api/people/1537/?format=api",
        "name": "Wei Hu (Xavier)",
        "email": "huwei013@chinasoftinc.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200421033215.20584-2-huwei013@chinasoftinc.com/mbox/",
    "series": [
        {
            "id": 9524,
            "url": "https://patches.dpdk.org/api/series/9524/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=9524",
            "date": "2020-04-21T03:32:13",
            "name": "updates for hns3 PMD driver",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/9524/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/68976/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/68976/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 9EF80A0561;\n\tTue, 21 Apr 2020 05:32:33 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 99BBB1D65E;\n\tTue, 21 Apr 2020 05:32:30 +0200 (CEST)",
            "from mail.chinasoftinc.com (unknown [114.113.233.8])\n by dpdk.org (Postfix) with ESMTP id 9C00C1D5B9\n for <dev@dpdk.org>; Tue, 21 Apr 2020 05:32:26 +0200 (CEST)",
            "from localhost.localdomain (114.119.4.74) by INCCAS002.ito.icss\n (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Tue, 21 Apr 2020\n 11:32:20 +0800"
        ],
        "From": "\"Wei Hu (Xavier)\" <huwei013@chinasoftinc.com>",
        "To": "<dev@dpdk.org>",
        "Date": "Tue, 21 Apr 2020 11:32:14 +0800",
        "Message-ID": "<20200421033215.20584-2-huwei013@chinasoftinc.com>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20200421033215.20584-1-huwei013@chinasoftinc.com>",
        "References": "<20200421033215.20584-1-huwei013@chinasoftinc.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[114.119.4.74]",
        "Subject": "[dpdk-dev] [PATCH 1/2] net/hns3: modify the format for firmware\n\tversion",
        "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": "From: \"Wei Hu (Xavier)\" <xavier.huwei@huawei.com>\n\nThis patch modifies the print format for firmware version in the log, It\nreplaces \"0x%08x\" with \"%lu.%lu.%lu.%lu\" in the format control string.\nBy the way, this patch adds \".fw_version_get\" ops implemation for hns3 VF\nPMD driver.\n\nSigned-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>\n---\n drivers/net/hns3/hns3_cmd.c       | 14 ++++++++++++--\n drivers/net/hns3/hns3_cmd.h       |  8 ++++++++\n drivers/net/hns3/hns3_dcb.c       | 14 ++++++++++++--\n drivers/net/hns3/hns3_ethdev.c    | 11 ++++++++++-\n drivers/net/hns3/hns3_ethdev_vf.c | 26 ++++++++++++++++++++++++++\n 5 files changed, 68 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c\nindex c7993634e..cbb09887c 100644\n--- a/drivers/net/hns3/hns3_cmd.c\n+++ b/drivers/net/hns3/hns3_cmd.c\n@@ -490,6 +490,7 @@ hns3_cmd_init_queue(struct hns3_hw *hw)\n int\n hns3_cmd_init(struct hns3_hw *hw)\n {\n+\tuint32_t version;\n \tint ret;\n \n \trte_spinlock_lock(&hw->cmq.csq.lock);\n@@ -518,13 +519,22 @@ hns3_cmd_init(struct hns3_hw *hw)\n \t}\n \trte_atomic16_clear(&hw->reset.disable_cmd);\n \n-\tret = hns3_cmd_query_firmware_version(hw, &hw->fw_version);\n+\tret = hns3_cmd_query_firmware_version(hw, &version);\n \tif (ret) {\n \t\tPMD_INIT_LOG(ERR, \"firmware version query failed %d\", ret);\n \t\tgoto err_cmd_init;\n \t}\n \n-\tPMD_INIT_LOG(INFO, \"The firmware version is %08x\", hw->fw_version);\n+\thw->fw_version = version;\n+\tPMD_INIT_LOG(INFO, \"The firmware version is %lu.%lu.%lu.%lu\",\n+\t\t     hns3_get_field(version, HNS3_FW_VERSION_BYTE3_M,\n+\t\t\t\t    HNS3_FW_VERSION_BYTE3_S),\n+\t\t     hns3_get_field(version, HNS3_FW_VERSION_BYTE2_M,\n+\t\t\t\t    HNS3_FW_VERSION_BYTE2_S),\n+\t\t     hns3_get_field(version, HNS3_FW_VERSION_BYTE1_M,\n+\t\t\t\t    HNS3_FW_VERSION_BYTE1_S),\n+\t\t     hns3_get_field(version, HNS3_FW_VERSION_BYTE0_M,\n+\t\t\t\t    HNS3_FW_VERSION_BYTE0_S));\n \n \treturn 0;\n \ndiff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h\nindex 26d410396..da770ac95 100644\n--- a/drivers/net/hns3/hns3_cmd.h\n+++ b/drivers/net/hns3/hns3_cmd.h\n@@ -253,6 +253,14 @@ struct hns3_rx_priv_buff_cmd {\n \tuint8_t rsv[6];\n };\n \n+#define HNS3_FW_VERSION_BYTE3_S\t\t24\n+#define HNS3_FW_VERSION_BYTE3_M\t\tGENMASK(31, 24)\n+#define HNS3_FW_VERSION_BYTE2_S\t\t16\n+#define HNS3_FW_VERSION_BYTE2_M\t\tGENMASK(23, 16)\n+#define HNS3_FW_VERSION_BYTE1_S\t\t8\n+#define HNS3_FW_VERSION_BYTE1_M\t\tGENMASK(15, 8)\n+#define HNS3_FW_VERSION_BYTE0_S\t\t0\n+#define HNS3_FW_VERSION_BYTE0_M\t\tGENMASK(7, 0)\n struct hns3_query_version_cmd {\n \tuint32_t firmware;\n \tuint32_t firmware_rsv[5];\ndiff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c\nindex 3fde222dc..ada6fc634 100644\n--- a/drivers/net/hns3/hns3_dcb.c\n+++ b/drivers/net/hns3/hns3_dcb.c\n@@ -787,6 +787,7 @@ hns3_dcb_pri_dwrr_cfg(struct hns3_hw *hw)\n {\n \tstruct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);\n \tstruct hns3_pf *pf = &hns->pf;\n+\tuint32_t version;\n \tint ret;\n \n \tif (pf->tx_sch_mode != HNS3_FLAG_TC_BASE_SCH_MODE)\n@@ -801,8 +802,17 @@ hns3_dcb_pri_dwrr_cfg(struct hns3_hw *hw)\n \n \tret = hns3_dcb_ets_tc_dwrr_cfg(hw);\n \tif (ret == -EOPNOTSUPP) {\n-\t\thns3_warn(hw, \"fw %08x does't support ets tc weight cmd\",\n-\t\t\t  hw->fw_version);\n+\t\tversion = hw->fw_version;\n+\t\thns3_warn(hw,\n+\t\t\t  \"fw %lu.%lu.%lu.%lu does't support ets tc weight cmd\",\n+\t\t\t  hns3_get_field(version, HNS3_FW_VERSION_BYTE3_M,\n+\t\t\t\t\t HNS3_FW_VERSION_BYTE3_S),\n+\t\t\t  hns3_get_field(version, HNS3_FW_VERSION_BYTE2_M,\n+\t\t\t\t\t HNS3_FW_VERSION_BYTE2_S),\n+\t\t\t  hns3_get_field(version, HNS3_FW_VERSION_BYTE1_M,\n+\t\t\t\t\t HNS3_FW_VERSION_BYTE1_S),\n+\t\t\t  hns3_get_field(version, HNS3_FW_VERSION_BYTE0_M,\n+\t\t\t\t\t HNS3_FW_VERSION_BYTE0_S));\n \t\tret = 0;\n \t}\n \ndiff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c\nindex 3e3a8c5f4..c314d3711 100644\n--- a/drivers/net/hns3/hns3_ethdev.c\n+++ b/drivers/net/hns3/hns3_ethdev.c\n@@ -2508,9 +2508,18 @@ hns3_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,\n {\n \tstruct hns3_adapter *hns = eth_dev->data->dev_private;\n \tstruct hns3_hw *hw = &hns->hw;\n+\tuint32_t version = hw->fw_version;\n \tint ret;\n \n-\tret = snprintf(fw_version, fw_size, \"0x%08x\", hw->fw_version);\n+\tret = snprintf(fw_version, fw_size, \"%lu.%lu.%lu.%lu\",\n+\t\t       hns3_get_field(version, HNS3_FW_VERSION_BYTE3_M,\n+\t\t\t\t      HNS3_FW_VERSION_BYTE3_S),\n+\t\t       hns3_get_field(version, HNS3_FW_VERSION_BYTE2_M,\n+\t\t\t\t      HNS3_FW_VERSION_BYTE2_S),\n+\t\t       hns3_get_field(version, HNS3_FW_VERSION_BYTE1_M,\n+\t\t\t\t      HNS3_FW_VERSION_BYTE1_S),\n+\t\t       hns3_get_field(version, HNS3_FW_VERSION_BYTE0_M,\n+\t\t\t\t      HNS3_FW_VERSION_BYTE0_S));\n \tret += 1; /* add the size of '\\0' */\n \tif (fw_size < (uint32_t)ret)\n \t\treturn ret;\ndiff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c\nindex 391079b8e..93631872d 100644\n--- a/drivers/net/hns3/hns3_ethdev_vf.c\n+++ b/drivers/net/hns3/hns3_ethdev_vf.c\n@@ -1763,6 +1763,31 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)\n \thns3_warn(hw, \"Close port %d finished\", hw->data->port_id);\n }\n \n+static int\n+hns3vf_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,\n+\t\t      size_t fw_size)\n+{\n+\tstruct hns3_adapter *hns = eth_dev->data->dev_private;\n+\tstruct hns3_hw *hw = &hns->hw;\n+\tuint32_t version = hw->fw_version;\n+\tint ret;\n+\n+\tret = snprintf(fw_version, fw_size, \"%lu.%lu.%lu.%lu\",\n+\t\t       hns3_get_field(version, HNS3_FW_VERSION_BYTE3_M,\n+\t\t\t\t      HNS3_FW_VERSION_BYTE3_S),\n+\t\t       hns3_get_field(version, HNS3_FW_VERSION_BYTE2_M,\n+\t\t\t\t      HNS3_FW_VERSION_BYTE2_S),\n+\t\t       hns3_get_field(version, HNS3_FW_VERSION_BYTE1_M,\n+\t\t\t\t      HNS3_FW_VERSION_BYTE1_S),\n+\t\t       hns3_get_field(version, HNS3_FW_VERSION_BYTE0_M,\n+\t\t\t\t      HNS3_FW_VERSION_BYTE0_S));\n+\tret += 1; /* add the size of '\\0' */\n+\tif (fw_size < (uint32_t)ret)\n+\t\treturn ret;\n+\telse\n+\t\treturn 0;\n+}\n+\n static int\n hns3vf_dev_link_update(struct rte_eth_dev *eth_dev,\n \t\t       __rte_unused int wait_to_complete)\n@@ -2347,6 +2372,7 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = {\n \t.xstats_get_by_id   = hns3_dev_xstats_get_by_id,\n \t.xstats_get_names_by_id = hns3_dev_xstats_get_names_by_id,\n \t.dev_infos_get      = hns3vf_dev_infos_get,\n+\t.fw_version_get     = hns3vf_fw_version_get,\n \t.rx_queue_setup     = hns3_rx_queue_setup,\n \t.tx_queue_setup     = hns3_tx_queue_setup,\n \t.rx_queue_release   = hns3_dev_rx_queue_release,\n",
    "prefixes": [
        "1/2"
    ]
}