get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 60200,
    "url": "https://patches.dpdk.org/api/patches/60200/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/78e7874ff668111d2230aa696e141baf0b1865f6.1569850827.git.cloud.wangxiaoyun@huawei.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": "<78e7874ff668111d2230aa696e141baf0b1865f6.1569850827.git.cloud.wangxiaoyun@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/78e7874ff668111d2230aa696e141baf0b1865f6.1569850827.git.cloud.wangxiaoyun@huawei.com",
    "date": "2019-09-30T14:00:51",
    "name": "[v3,13/19] net/hinic: get firmware version",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "c9cebad0b797bcc145debfbed1ad96955473a359",
    "submitter": {
        "id": 1446,
        "url": "https://patches.dpdk.org/api/people/1446/?format=api",
        "name": "Wangxiaoyun (Cloud)",
        "email": "cloud.wangxiaoyun@huawei.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/78e7874ff668111d2230aa696e141baf0b1865f6.1569850827.git.cloud.wangxiaoyun@huawei.com/mbox/",
    "series": [
        {
            "id": 6622,
            "url": "https://patches.dpdk.org/api/series/6622/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6622",
            "date": "2019-09-30T14:00:38",
            "name": "Add advanced features for Huawei hinic pmd",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/6622/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/60200/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/60200/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id BD9021BEB0;\n\tMon, 30 Sep 2019 15:49:31 +0200 (CEST)",
            "from huawei.com (szxga05-in.huawei.com [45.249.212.191])\n\tby dpdk.org (Postfix) with ESMTP id 3D6FC1BEAE\n\tfor <dev@dpdk.org>; Mon, 30 Sep 2019 15:49:30 +0200 (CEST)",
            "from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59])\n\tby Forcepoint Email with ESMTP id CBDDB8C87AC06EEA30D7\n\tfor <dev@dpdk.org>; Mon, 30 Sep 2019 21:49:28 +0800 (CST)",
            "from tester.localdomain (10.175.119.39) by\n\tDGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP\n\tServer id 14.3.439.0; Mon, 30 Sep 2019 21:49:18 +0800"
        ],
        "From": "Xiaoyun wang <cloud.wangxiaoyun@huawei.com>",
        "To": "<ferruh.yigit@intel.com>",
        "CC": "<dev@dpdk.org>, <xuanziyang2@huawei.com>, <shahar.belkar@huawei.com>,\n\t<luoxianjun@huawei.com>, <tanya.brokhman@huawei.com>,\n\t<zhouguoyang@huawei.com>, <wulike1@huawei.com>, Xiaoyun wang\n\t<cloud.wangxiaoyun@huawei.com>",
        "Date": "Mon, 30 Sep 2019 22:00:51 +0800",
        "Message-ID": "<78e7874ff668111d2230aa696e141baf0b1865f6.1569850827.git.cloud.wangxiaoyun@huawei.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<cover.1569850826.git.cloud.wangxiaoyun@huawei.com>",
        "References": "<cover.1569850826.git.cloud.wangxiaoyun@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.175.119.39]",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev] [PATCH v3 13/19] net/hinic: get firmware version",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch adds support for getting firmware version.\n\nSigned-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>\n---\n doc/guides/nics/features/hinic.ini        |  1 +\n doc/guides/nics/hinic.rst                 |  1 +\n drivers/net/hinic/base/hinic_pmd_cmd.h    |  2 ++\n drivers/net/hinic/base/hinic_pmd_niccfg.c | 40 +++++++++++++++++++++++++++++++\n drivers/net/hinic/base/hinic_pmd_niccfg.h | 13 ++++++++++\n drivers/net/hinic/hinic_pmd_ethdev.c      | 23 ++++++++++++++++++\n 6 files changed, 80 insertions(+)",
    "diff": "diff --git a/doc/guides/nics/features/hinic.ini b/doc/guides/nics/features/hinic.ini\nindex a7cb33e..2c9d845 100644\n--- a/doc/guides/nics/features/hinic.ini\n+++ b/doc/guides/nics/features/hinic.ini\n@@ -33,6 +33,7 @@ Basic stats          = Y\n Extended stats       = Y\n Stats per queue      = Y\n Flow director        = Y\n+FW version           = Y\n Linux UIO            = Y\n Linux VFIO           = Y\n BSD nic_uio          = N\ndiff --git a/doc/guides/nics/hinic.rst b/doc/guides/nics/hinic.rst\nindex 9a9fcbe..ed607eb 100644\n--- a/doc/guides/nics/hinic.rst\n+++ b/doc/guides/nics/hinic.rst\n@@ -32,6 +32,7 @@ Features\n - Multicast MAC filter\n - Flow director\n - Set Link down or up\n+- FW version\n \n Prerequisites\n -------------\ndiff --git a/drivers/net/hinic/base/hinic_pmd_cmd.h b/drivers/net/hinic/base/hinic_pmd_cmd.h\nindex 55d4292..e0633bd 100644\n--- a/drivers/net/hinic/base/hinic_pmd_cmd.h\n+++ b/drivers/net/hinic/base/hinic_pmd_cmd.h\n@@ -85,6 +85,8 @@ enum hinic_port_cmd {\n \tHINIC_PORT_CMD_GET_JUMBO_FRAME_SIZE\t= 0x4a,\n \tHINIC_PORT_CMD_SET_JUMBO_FRAME_SIZE,\n \n+\tHINIC_PORT_CMD_GET_MGMT_VERSION\t\t= 0x58,\n+\n \tHINIC_PORT_CMD_GET_PORT_TYPE\t\t= 0x5b,\n \n \tHINIC_PORT_CMD_GET_VPORT_ENABLE\t\t= 0x5c,\ndiff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.c b/drivers/net/hinic/base/hinic_pmd_niccfg.c\nindex 9f23fdd..2dc431e 100644\n--- a/drivers/net/hinic/base/hinic_pmd_niccfg.c\n+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.c\n@@ -1293,6 +1293,46 @@ int hinic_set_rx_mode(void *hwdev, u32 enable)\n \treturn 0;\n }\n \n+/**\n+ * hinic_get_mgmt_version - Get mgmt module version from chip.\n+ *\n+ * @param hwdev\n+ *   The hardware interface of a nic device.\n+ * @param fw\n+ *   Firmware version.\n+ *\n+ * @return\n+ *   0 on success.\n+ *   negative error value otherwise.\n+ */\n+int hinic_get_mgmt_version(void *hwdev, char *fw)\n+{\n+\tstruct hinic_version_info fw_ver;\n+\tu16 out_size = sizeof(fw_ver);\n+\tint err;\n+\n+\tif (!hwdev || !fw) {\n+\t\tPMD_DRV_LOG(ERR, \"Hwdev or fw is NULL\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tmemset(&fw_ver, 0, sizeof(fw_ver));\n+\tfw_ver.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;\n+\n+\terr = l2nic_msg_to_mgmt_sync(hwdev, HINIC_PORT_CMD_GET_MGMT_VERSION,\n+\t\t\t\t     &fw_ver, sizeof(fw_ver), &fw_ver,\n+\t\t\t\t     &out_size);\n+\tif (err || !out_size || fw_ver.mgmt_msg_head.status) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to get mgmt version, err: %d, status: 0x%x, out size: 0x%x\\n\",\n+\t\t\terr, fw_ver.mgmt_msg_head.status, out_size);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tsnprintf(fw, HINIC_MGMT_VERSION_MAX_LEN, \"%s\", fw_ver.ver);\n+\n+\treturn 0;\n+}\n+\n int hinic_set_rx_csum_offload(void *hwdev, u32 en)\n {\n \tstruct hinic_checksum_offload rx_csum_cfg;\ndiff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.h b/drivers/net/hinic/base/hinic_pmd_niccfg.h\nindex beab630..b9e037e 100644\n--- a/drivers/net/hinic/base/hinic_pmd_niccfg.h\n+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.h\n@@ -471,6 +471,17 @@ struct hinic_rx_mode_config {\n \tu32\trx_mode;\n };\n \n+#define HINIC_MGMT_VERSION_MAX_LEN\t32\n+#define HINIC_COMPILE_TIME_LEN\t\t20\n+#define HINIC_FW_VERSION_NAME\t\t16\n+\n+struct hinic_version_info {\n+\tstruct hinic_mgmt_msg_head mgmt_msg_head;\n+\n+\tu8 ver[HINIC_FW_VERSION_NAME];\n+\tu8 time[HINIC_COMPILE_TIME_LEN];\n+};\n+\n /* rss */\n struct nic_rss_indirect_tbl {\n \tu32 group_index;\n@@ -807,6 +818,8 @@ int hinic_get_rss_type(void *hwdev, u32 tmpl_idx,\n \n int hinic_set_rx_mode(void *hwdev, u32 enable);\n \n+int hinic_get_mgmt_version(void *hwdev, char *fw);\n+\n int hinic_set_rx_csum_offload(void *hwdev, u32 en);\n \n int hinic_set_link_status_follow(void *hwdev,\ndiff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c\nindex ea39ff0..48ec467 100644\n--- a/drivers/net/hinic/hinic_pmd_ethdev.c\n+++ b/drivers/net/hinic/hinic_pmd_ethdev.c\n@@ -752,6 +752,27 @@ static void hinic_get_speed_capa(struct rte_eth_dev *dev, uint32_t *speed_capa)\n \treturn 0;\n }\n \n+static int hinic_fw_version_get(struct rte_eth_dev *dev, char *fw_version,\n+\t\t\t\tsize_t fw_size)\n+{\n+\tstruct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n+\tchar fw_ver[HINIC_MGMT_VERSION_MAX_LEN] = {0};\n+\tint err;\n+\n+\terr = hinic_get_mgmt_version(nic_dev->hwdev, fw_ver);\n+\tif (err) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to get fw version\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (fw_size < strlen(fw_ver) + 1)\n+\t\treturn (strlen(fw_ver) + 1);\n+\n+\tsnprintf(fw_version, fw_size, \"%s\", fw_ver);\n+\n+\treturn 0;\n+}\n+\n static int hinic_config_rx_mode(struct hinic_nic_dev *nic_dev, u32 rx_mode_ctrl)\n {\n \tint err;\n@@ -2813,6 +2834,7 @@ static void hinic_dev_close(struct rte_eth_dev *dev)\n static const struct eth_dev_ops hinic_pmd_ops = {\n \t.dev_configure                 = hinic_dev_configure,\n \t.dev_infos_get                 = hinic_dev_infos_get,\n+\t.fw_version_get                = hinic_fw_version_get,\n \t.rx_queue_setup                = hinic_rx_queue_setup,\n \t.tx_queue_setup                = hinic_tx_queue_setup,\n \t.dev_start                     = hinic_dev_start,\n@@ -2849,6 +2871,7 @@ static void hinic_dev_close(struct rte_eth_dev *dev)\n static const struct eth_dev_ops hinic_pmd_vf_ops = {\n \t.dev_configure                 = hinic_dev_configure,\n \t.dev_infos_get                 = hinic_dev_infos_get,\n+\t.fw_version_get                = hinic_fw_version_get,\n \t.rx_queue_setup                = hinic_rx_queue_setup,\n \t.tx_queue_setup                = hinic_tx_queue_setup,\n \t.dev_start                     = hinic_dev_start,\n",
    "prefixes": [
        "v3",
        "13/19"
    ]
}