Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/75923/?format=api
http://patchwork.dpdk.org/api/patches/75923/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20200825115305.58490-3-huwei013@chinasoftinc.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": "<20200825115305.58490-3-huwei013@chinasoftinc.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200825115305.58490-3-huwei013@chinasoftinc.com", "date": "2020-08-25T11:52:56", "name": "[02/11] net/hns3: get dev specifications from firmware", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "037721f070c8672d7aa9649ac377e2286cd1ba10", "submitter": { "id": 1537, "url": "http://patchwork.dpdk.org/api/people/1537/?format=api", "name": "Wei Hu (Xavier)", "email": "huwei013@chinasoftinc.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/20200825115305.58490-3-huwei013@chinasoftinc.com/mbox/", "series": [ { "id": 11778, "url": "http://patchwork.dpdk.org/api/series/11778/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=11778", "date": "2020-08-25T11:52:54", "name": "updates for hns3 PMD driver", "version": 1, "mbox": "http://patchwork.dpdk.org/series/11778/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/75923/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/75923/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 E284AA04B1;\n\tTue, 25 Aug 2020 13:53:43 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2D1B61C1FC;\n\tTue, 25 Aug 2020 13:53:32 +0200 (CEST)", "from mail.chinasoftinc.com (unknown [114.113.233.8])\n by dpdk.org (Postfix) with ESMTP id A0E12E07\n for <dev@dpdk.org>; Tue, 25 Aug 2020 13:53:27 +0200 (CEST)", "from localhost.localdomain (65.49.108.226) by INCCAS002.ito.icss\n (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Tue, 25 Aug 2020\n 19:53:21 +0800" ], "From": "\"Wei Hu (Xavier)\" <huwei013@chinasoftinc.com>", "To": "<dev@dpdk.org>", "CC": "<ferruh.yigit@intel.com>, <xavier.huwei@huawei.com>", "Date": "Tue, 25 Aug 2020 19:52:56 +0800", "Message-ID": "<20200825115305.58490-3-huwei013@chinasoftinc.com>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200825115305.58490-1-huwei013@chinasoftinc.com>", "References": "<20200825115305.58490-1-huwei013@chinasoftinc.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Originating-IP": "[65.49.108.226]", "Subject": "[dpdk-dev] [PATCH 02/11] net/hns3: get dev specifications from\n\tfirmware", "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 adds getting PF/VF device specifications from firmware.\n\nSigned-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>\nSigned-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>\n---\n drivers/net/hns3/hns3_cmd.h | 15 ++++++++\n drivers/net/hns3/hns3_dcb.c | 1 -\n drivers/net/hns3/hns3_dcb.h | 2 +\n drivers/net/hns3/hns3_ethdev.c | 61 ++++++++++++++++++++++++++++++-\n drivers/net/hns3/hns3_ethdev.h | 6 +++\n drivers/net/hns3/hns3_ethdev_vf.c | 59 +++++++++++++++++++++++++++++-\n 6 files changed, 141 insertions(+), 3 deletions(-)", "diff": "diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h\nindex a13b799f4..65aa8bad8 100644\n--- a/drivers/net/hns3/hns3_cmd.h\n+++ b/drivers/net/hns3/hns3_cmd.h\n@@ -93,6 +93,8 @@ enum hns3_opcode_type {\n \tHNS3_OPC_QUERY_32_BIT_REG = 0x0041,\n \tHNS3_OPC_QUERY_64_BIT_REG = 0x0042,\n \n+\tHNS3_OPC_QUERY_DEV_SPECS = 0x0050,\n+\n \t/* MAC command */\n \tHNS3_OPC_CONFIG_MAC_MODE = 0x0301,\n \tHNS3_OPC_QUERY_LINK_STATUS = 0x0307,\n@@ -805,6 +807,19 @@ struct hns3_reset_cmd {\n \tuint8_t rsv[22];\n };\n \n+#define HNS3_QUERY_DEV_SPECS_BD_NUM\t\t4\n+struct hns3_dev_specs_0_cmd {\n+\tuint32_t rsv0;\n+\tuint32_t mac_entry_num;\n+\tuint32_t mng_entry_num;\n+\tuint16_t rss_ind_tbl_size;\n+\tuint16_t rss_key_size;\n+\tuint16_t intr_ql_max;\n+\tuint8_t max_non_tso_bd_num;\n+\tuint8_t rsv1;\n+\tuint32_t max_tm_rate;\n+};\n+\n #define HNS3_MAX_TQP_NUM_PER_FUNC\t64\n #define HNS3_DEFAULT_TX_BUF\t\t0x4000 /* 16k bytes */\n #define HNS3_TOTAL_PKT_BUF\t\t0x108000 /* 1.03125M bytes */\ndiff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c\nindex 02628b6b6..c1be49e0f 100644\n--- a/drivers/net/hns3/hns3_dcb.c\n+++ b/drivers/net/hns3/hns3_dcb.c\n@@ -19,7 +19,6 @@\n #define HNS3_SHAPER_BS_U_DEF\t5\n #define HNS3_SHAPER_BS_S_DEF\t20\n #define BW_MAX_PERCENT\t\t100\n-#define HNS3_ETHER_MAX_RATE\t100000\n \n /*\n * hns3_shaper_para_calc: calculate ir parameter for the shaper\ndiff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h\nindex 9c2c5f21c..1636c5ae8 100644\n--- a/drivers/net/hns3/hns3_dcb.h\n+++ b/drivers/net/hns3/hns3_dcb.h\n@@ -5,6 +5,8 @@\n #ifndef _HNS3_DCB_H_\n #define _HNS3_DCB_H_\n \n+#define HNS3_ETHER_MAX_RATE\t\t100000\n+\n /* MAC Pause */\n #define HNS3_TX_MAC_PAUSE_EN_MSK\tBIT(0)\n #define HNS3_RX_MAC_PAUSE_EN_MSK\tBIT(1)\ndiff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c\nindex 44fd69fa1..951f26d42 100644\n--- a/drivers/net/hns3/hns3_ethdev.c\n+++ b/drivers/net/hns3/hns3_ethdev.c\n@@ -2809,6 +2809,51 @@ hns3_parse_speed(int speed_cmd, uint32_t *speed)\n \treturn 0;\n }\n \n+static void\n+hns3_set_default_dev_specifications(struct hns3_hw *hw)\n+{\n+\thw->max_non_tso_bd_num = HNS3_MAX_NON_TSO_BD_PER_PKT;\n+\thw->rss_ind_tbl_size = HNS3_RSS_IND_TBL_SIZE;\n+\thw->rss_key_size = HNS3_RSS_KEY_SIZE;\n+\thw->max_tm_rate = HNS3_ETHER_MAX_RATE;\n+}\n+\n+static void\n+hns3_parse_dev_specifications(struct hns3_hw *hw, struct hns3_cmd_desc *desc)\n+{\n+\tstruct hns3_dev_specs_0_cmd *req0;\n+\n+\treq0 = (struct hns3_dev_specs_0_cmd *)desc[0].data;\n+\n+\thw->max_non_tso_bd_num = req0->max_non_tso_bd_num;\n+\thw->rss_ind_tbl_size = rte_le_to_cpu_16(req0->rss_ind_tbl_size);\n+\thw->rss_key_size = rte_le_to_cpu_16(req0->rss_key_size);\n+\thw->max_tm_rate = rte_le_to_cpu_32(req0->max_tm_rate);\n+}\n+\n+static int\n+hns3_query_dev_specifications(struct hns3_hw *hw)\n+{\n+\tstruct hns3_cmd_desc desc[HNS3_QUERY_DEV_SPECS_BD_NUM];\n+\tint ret;\n+\tint i;\n+\n+\tfor (i = 0; i < HNS3_QUERY_DEV_SPECS_BD_NUM - 1; i++) {\n+\t\thns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_QUERY_DEV_SPECS,\n+\t\t\t\t\t true);\n+\t\tdesc[i].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT);\n+\t}\n+\thns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_QUERY_DEV_SPECS, true);\n+\n+\tret = hns3_cmd_send(hw, desc, HNS3_QUERY_DEV_SPECS_BD_NUM);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\thns3_parse_dev_specifications(hw, desc);\n+\n+\treturn 0;\n+}\n+\n static int\n hns3_get_capability(struct hns3_hw *hw)\n {\n@@ -2832,11 +2877,25 @@ hns3_get_capability(struct hns3_hw *hw)\n \tret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN,\n \t\t\t\t HNS3_PCI_REVISION_ID);\n \tif (ret != HNS3_PCI_REVISION_ID_LEN) {\n-\t\tPMD_INIT_LOG(ERR, \"failed to read pci revision id: %d\", ret);\n+\t\tPMD_INIT_LOG(ERR, \"failed to read pci revision id, ret = %d\",\n+\t\t\t ret);\n \t\treturn -EIO;\n \t}\n \thw->revision = revision;\n \n+\tif (revision < PCI_REVISION_ID_HIP09_A) {\n+\t\thns3_set_default_dev_specifications(hw);\n+\t\treturn 0;\n+\t}\n+\n+\tret = hns3_query_dev_specifications(hw);\n+\tif (ret) {\n+\t\tPMD_INIT_LOG(ERR,\n+\t\t\t \"failed to query dev specifications, ret = %d\",\n+\t\t\t ret);\n+\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \ndiff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h\nindex 1914e588d..1810cf0ed 100644\n--- a/drivers/net/hns3/hns3_ethdev.h\n+++ b/drivers/net/hns3/hns3_ethdev.h\n@@ -381,6 +381,8 @@ struct hns3_hw {\n \tuint16_t rss_size_max; /* HW defined max RSS task queue */\n \tuint16_t num_tx_desc; /* desc num of per tx queue */\n \tuint16_t num_rx_desc; /* desc num of per rx queue */\n+\tuint32_t mng_entry_num; /* number of manager table entry */\n+\tuint32_t mac_entry_num; /* number of mac-vlan table entry */\n \n \tstruct rte_ether_addr mc_addrs[HNS3_MC_MACADDR_NUM];\n \tint mc_addrs_num; /* Multicast mac addresses number */\n@@ -388,6 +390,8 @@ struct hns3_hw {\n \t/* The configuration info of RSS */\n \tstruct hns3_rss_conf rss_info;\n \tbool rss_dis_flag; /* disable rss flag. true: disable, false: enable */\n+\tuint16_t rss_ind_tbl_size;\n+\tuint16_t rss_key_size;\n \n \tuint8_t num_tc; /* Total number of enabled TCs */\n \tuint8_t hw_tc_map;\n@@ -406,6 +410,8 @@ struct hns3_hw {\n \tuint16_t tx_qnum_per_tc; /* TX queue number per TC */\n \n \tuint32_t capability;\n+\tuint32_t max_tm_rate;\n+\tuint8_t max_non_tso_bd_num; /* max BD number of one non-TSO packet */\n \n \tstruct hns3_port_base_vlan_config port_base_vlan_cfg;\n \t/*\ndiff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c\nindex 60b576b02..19a077209 100644\n--- a/drivers/net/hns3/hns3_ethdev_vf.c\n+++ b/drivers/net/hns3/hns3_ethdev_vf.c\n@@ -1068,6 +1068,49 @@ hns3vf_interrupt_handler(void *param)\n \thns3vf_enable_irq0(hw);\n }\n \n+static void\n+hns3vf_set_default_dev_specifications(struct hns3_hw *hw)\n+{\n+\thw->max_non_tso_bd_num = HNS3_MAX_NON_TSO_BD_PER_PKT;\n+\thw->rss_ind_tbl_size = HNS3_RSS_IND_TBL_SIZE;\n+\thw->rss_key_size = HNS3_RSS_KEY_SIZE;\n+}\n+\n+static void\n+hns3vf_parse_dev_specifications(struct hns3_hw *hw, struct hns3_cmd_desc *desc)\n+{\n+\tstruct hns3_dev_specs_0_cmd *req0;\n+\n+\treq0 = (struct hns3_dev_specs_0_cmd *)desc[0].data;\n+\n+\thw->max_non_tso_bd_num = req0->max_non_tso_bd_num;\n+\thw->rss_ind_tbl_size = rte_le_to_cpu_16(req0->rss_ind_tbl_size);\n+\thw->rss_key_size = rte_le_to_cpu_16(req0->rss_key_size);\n+}\n+\n+static int\n+hns3vf_query_dev_specifications(struct hns3_hw *hw)\n+{\n+\tstruct hns3_cmd_desc desc[HNS3_QUERY_DEV_SPECS_BD_NUM];\n+\tint ret;\n+\tint i;\n+\n+\tfor (i = 0; i < HNS3_QUERY_DEV_SPECS_BD_NUM - 1; i++) {\n+\t\thns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_QUERY_DEV_SPECS,\n+\t\t\t\t\t true);\n+\t\tdesc[i].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT);\n+\t}\n+\thns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_QUERY_DEV_SPECS, true);\n+\n+\tret = hns3_cmd_send(hw, desc, HNS3_QUERY_DEV_SPECS_BD_NUM);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\thns3vf_parse_dev_specifications(hw, desc);\n+\n+\treturn 0;\n+}\n+\n static int\n hns3vf_get_capability(struct hns3_hw *hw)\n {\n@@ -1083,11 +1126,25 @@ hns3vf_get_capability(struct hns3_hw *hw)\n \tret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN,\n \t\t\t\t HNS3_PCI_REVISION_ID);\n \tif (ret != HNS3_PCI_REVISION_ID_LEN) {\n-\t\tPMD_INIT_LOG(ERR, \"failed to read pci revision id: %d\", ret);\n+\t\tPMD_INIT_LOG(ERR, \"failed to read pci revision id, ret = %d\",\n+\t\t\t ret);\n \t\treturn -EIO;\n \t}\n \thw->revision = revision;\n \n+\tif (revision < PCI_REVISION_ID_HIP09_A) {\n+\t\thns3vf_set_default_dev_specifications(hw);\n+\t\treturn 0;\n+\t}\n+\n+\tret = hns3vf_query_dev_specifications(hw);\n+\tif (ret) {\n+\t\tPMD_INIT_LOG(ERR,\n+\t\t\t \"failed to query dev specifications, ret = %d\",\n+\t\t\t ret);\n+\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \n", "prefixes": [ "02/11" ] }{ "id": 75923, "url": "