get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 113942,
    "url": "http://patches.dpdk.org/api/patches/113942/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220713115002.8959-4-liudongdong3@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": "<20220713115002.8959-4-liudongdong3@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220713115002.8959-4-liudongdong3@huawei.com",
    "date": "2022-07-13T11:50:00",
    "name": "[3/5] net/hns3: adjust code for dump file",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d1edc5a891f84648e7bf5994d13bbecf4983d807",
    "submitter": {
        "id": 2718,
        "url": "http://patches.dpdk.org/api/people/2718/?format=api",
        "name": "Dongdong Liu",
        "email": "liudongdong3@huawei.com"
    },
    "delegate": {
        "id": 3961,
        "url": "http://patches.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220713115002.8959-4-liudongdong3@huawei.com/mbox/",
    "series": [
        {
            "id": 23982,
            "url": "http://patches.dpdk.org/api/series/23982/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=23982",
            "date": "2022-07-13T11:49:57",
            "name": "some bugfixes and clean code for hns3",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/23982/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/113942/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/113942/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 97970A0032;\n\tWed, 13 Jul 2022 13:51:30 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 5062D42B8F;\n\tWed, 13 Jul 2022 13:51:15 +0200 (CEST)",
            "from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189])\n by mails.dpdk.org (Postfix) with ESMTP id DE53A42B76;\n Wed, 13 Jul 2022 13:51:05 +0200 (CEST)",
            "from kwepemi500017.china.huawei.com (unknown [172.30.72.57])\n by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LjbX148VKzFq2Q;\n Wed, 13 Jul 2022 19:49:53 +0800 (CST)",
            "from localhost.localdomain (10.28.79.22) by\n kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2375.24; Wed, 13 Jul 2022 19:50:48 +0800"
        ],
        "From": "Dongdong Liu <liudongdong3@huawei.com>",
        "To": "<dev@dpdk.org>, <ferruh.yigit@xilinx.com>,\n <andrew.rybchenko@oktetlabs.ru>, <thomas@monjalon.net>",
        "CC": "<stable@dpdk.org>, Dongdong Liu <liudongdong3@huawei.com>, Min Hu\n <humin29@huawei.com>, Yisen Zhuang <yisen.zhuang@huawei.com>",
        "Subject": "[PATCH 3/5] net/hns3: adjust code for dump file",
        "Date": "Wed, 13 Jul 2022 19:50:00 +0800",
        "Message-ID": "<20220713115002.8959-4-liudongdong3@huawei.com>",
        "X-Mailer": "git-send-email 2.22.0",
        "In-Reply-To": "<20220713115002.8959-1-liudongdong3@huawei.com>",
        "References": "<20220713115002.8959-1-liudongdong3@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.28.79.22]",
        "X-ClientProxiedBy": "dggems702-chm.china.huawei.com (10.3.19.179) To\n kwepemi500017.china.huawei.com (7.221.188.110)",
        "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": "Rename the function name with prefix hns3_ to keep the same code\nstyle with other files and adjust some code to make it more readable.\n\nSigned-off-by: Dongdong Liu <liudongdong3@huawei.com>\nSigned-off-by: Min Hu (Connor) <humin29@huawei.com>\n---\n drivers/net/hns3/hns3_dump.c | 289 +++++++++++++++++++----------------\n 1 file changed, 154 insertions(+), 135 deletions(-)",
    "diff": "diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c\nindex 1738d3cd4e..5ce0530ef6 100644\n--- a/drivers/net/hns3/hns3_dump.c\n+++ b/drivers/net/hns3/hns3_dump.c\n@@ -2,6 +2,8 @@\n  * Copyright(C) 2022 HiSilicon Limited\n  */\n \n+#include <rte_malloc.h>\n+\n #include \"hns3_common.h\"\n #include \"hns3_logs.h\"\n #include \"hns3_regs.h\"\n@@ -9,7 +11,7 @@\n #include \"hns3_dump.h\"\n \n static const char *\n-get_adapter_state_name(enum hns3_adapter_state state)\n+hns3_get_adapter_state_name(enum hns3_adapter_state state)\n {\n \tconst struct {\n \t\tenum hns3_adapter_state state;\n@@ -37,7 +39,7 @@ get_adapter_state_name(enum hns3_adapter_state state)\n }\n \n static const char *\n-get_io_func_hint_name(uint32_t hint)\n+hns3_get_io_func_hint_name(uint32_t hint)\n {\n \tswitch (hint) {\n \tcase HNS3_IO_FUNC_HINT_NONE:\n@@ -56,7 +58,7 @@ get_io_func_hint_name(uint32_t hint)\n }\n \n static void\n-get_dev_mac_info(FILE *file, struct hns3_adapter *hns)\n+hns3_get_dev_mac_info(FILE *file, struct hns3_adapter *hns)\n {\n \tstruct hns3_hw *hw = &hns->hw;\n \tstruct hns3_pf *pf = &hns->pf;\n@@ -78,7 +80,7 @@ get_dev_mac_info(FILE *file, struct hns3_adapter *hns)\n }\n \n static void\n-get_dev_feature_capability(FILE *file, struct hns3_hw *hw)\n+hns3_get_dev_feature_capability(FILE *file, struct hns3_hw *hw)\n {\n \tconst struct {\n \t\tenum hns3_dev_cap cap;\n@@ -106,9 +108,9 @@ get_dev_feature_capability(FILE *file, struct hns3_hw *hw)\n }\n \n static const char *\n-get_fdir_tuple_name(uint32_t index)\n+hns3_get_fdir_tuple_name(uint32_t index)\n {\n-\tstatic const char * const tuple_name[] = {\n+\tconst char * const tuple_name[] = {\n \t\t\"outer_dst_mac\",\n \t\t\"outer_src_mac\",\n \t\t\"outer_vlan_1st_tag\",\n@@ -147,12 +149,10 @@ get_fdir_tuple_name(uint32_t index)\n }\n \n static void\n-get_fdir_basic_info(FILE *file, struct hns3_pf *pf)\n+hns3_get_fdir_basic_info(FILE *file, struct hns3_pf *pf)\n {\n-#define TMPBUF_SIZE\t\t2048\n-#define PERLINE_TUPLE_NAMES\t4\n+#define HNS3_PERLINE_TUPLE_NAME_LEN\t4\n \tstruct hns3_fd_cfg *fdcfg = &pf->fdir.fd_cfg;\n-\tchar tmpbuf[TMPBUF_SIZE] = {0};\n \tuint32_t i, count = 0;\n \n \tfprintf(file, \"  - Fdir Info:\\n\");\n@@ -175,21 +175,19 @@ get_fdir_basic_info(FILE *file, struct hns3_pf *pf)\n \tfor (i = 0; i < MAX_TUPLE; i++) {\n \t\tif (!(fdcfg->key_cfg[HNS3_FD_STAGE_1].tuple_active & BIT(i)))\n \t\t\tcontinue;\n-\t\tif (count % PERLINE_TUPLE_NAMES == 0)\n+\t\tif (count % HNS3_PERLINE_TUPLE_NAME_LEN == 0)\n \t\t\tfprintf(file, \"\\t      \");\n-\t\tfprintf(file, \" %s\", get_fdir_tuple_name(i));\n+\t\tfprintf(file, \" %s\", hns3_get_fdir_tuple_name(i));\n \t\tcount++;\n-\t\tif (count % PERLINE_TUPLE_NAMES == 0)\n+\t\tif (count % HNS3_PERLINE_TUPLE_NAME_LEN == 0)\n \t\t\tfprintf(file, \"\\n\");\n \t}\n-\tif (count % PERLINE_TUPLE_NAMES)\n+\tif (count % HNS3_PERLINE_TUPLE_NAME_LEN)\n \t\tfprintf(file, \"\\n\");\n-\n-\tfprintf(file, \"%s\", tmpbuf);\n }\n \n static void\n-get_device_basic_info(FILE *file, struct rte_eth_dev *dev)\n+hns3_get_device_basic_info(FILE *file, struct rte_eth_dev *dev)\n {\n \tstruct hns3_adapter *hns = dev->data->dev_private;\n \tstruct hns3_hw *hw = &hns->hw;\n@@ -209,7 +207,7 @@ get_device_basic_info(FILE *file, struct rte_eth_dev *dev)\n \t\t\"\\t  -- dev_flags: lsc=%d\\n\"\n \t\t\"\\t  -- intr_conf: lsc=%u rxq=%u\\n\",\n \t\tdev->data->name,\n-\t\tget_adapter_state_name(hw->adapter_state),\n+\t\thns3_get_adapter_state_name(hw->adapter_state),\n \t\tdev->data->nb_rx_queues, dev->data->nb_tx_queues,\n \t\thw->total_tqps_num, hw->tqps_num, hw->intr_tqps_num,\n \t\thw->rss_size_max, hw->alloc_rss_size, hw->tx_qnum_per_tc,\n@@ -217,15 +215,15 @@ get_device_basic_info(FILE *file, struct rte_eth_dev *dev)\n \t\thw->tso_mode, hw->max_non_tso_bd_num,\n \t\thw->max_tm_rate,\n \t\thw->set_link_down ? \"Yes\" : \"No\",\n-\t\tget_io_func_hint_name(hns->rx_func_hint),\n-\t\tget_io_func_hint_name(hns->tx_func_hint),\n+\t\thns3_get_io_func_hint_name(hns->rx_func_hint),\n+\t\thns3_get_io_func_hint_name(hns->tx_func_hint),\n \t\t!!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC),\n \t\tdev->data->dev_conf.intr_conf.lsc,\n \t\tdev->data->dev_conf.intr_conf.rxq);\n }\n \n static struct hns3_rx_queue *\n-get_rx_queue(struct rte_eth_dev *dev)\n+hns3_get_rx_queue(struct rte_eth_dev *dev)\n {\n \tstruct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \tstruct hns3_rx_queue *rxq;\n@@ -250,7 +248,7 @@ get_rx_queue(struct rte_eth_dev *dev)\n }\n \n static struct hns3_tx_queue *\n-get_tx_queue(struct rte_eth_dev *dev)\n+hns3_get_tx_queue(struct rte_eth_dev *dev)\n {\n \tstruct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \tstruct hns3_tx_queue *txq;\n@@ -275,7 +273,7 @@ get_tx_queue(struct rte_eth_dev *dev)\n }\n \n static void\n-get_rxtx_fake_queue_info(FILE *file, struct rte_eth_dev *dev)\n+hns3_get_rxtx_fake_queue_info(FILE *file, struct rte_eth_dev *dev)\n {\n \tstruct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \tstruct hns3_rx_queue *rxq;\n@@ -317,10 +315,10 @@ get_rxtx_fake_queue_info(FILE *file, struct rte_eth_dev *dev)\n }\n \n static void\n-get_queue_enable_state(struct hns3_hw *hw, uint32_t *queue_state,\n-\t\t\tuint32_t nb_queues, bool is_rxq)\n+hns3_get_queue_enable_state(struct hns3_hw *hw, uint32_t *queue_state,\n+\t\t\t    uint32_t nb_queues, bool is_rxq)\n {\n-#define STATE_SIZE (sizeof(*queue_state) * CHAR_BIT)\n+#define HNS3_QUEUE_NUM_PER_STATS (sizeof(*queue_state) * HNS3_UINT8_BIT)\n \tuint32_t queue_en_reg;\n \tuint32_t reg_offset;\n \tuint32_t state;\n@@ -333,28 +331,28 @@ get_queue_enable_state(struct hns3_hw *hw, uint32_t *queue_state,\n \t\tif (hns3_dev_get_support(hw, INDEP_TXRX))\n \t\t\tstate = state && hns3_read_dev(hw, reg_offset +\n \t\t\t\t\t\t       queue_en_reg);\n-\t\thns3_set_bit(queue_state[i / STATE_SIZE],\n-\t\t\t\ti % STATE_SIZE, state);\n+\t\thns3_set_bit(queue_state[i / HNS3_QUEUE_NUM_PER_STATS],\n+\t\t\t\ti % HNS3_QUEUE_NUM_PER_STATS, state);\n \t}\n }\n \n static void\n-print_queue_state_perline(FILE *file, const uint32_t *queue_state,\n-\t\t\t  uint32_t nb_queues, uint32_t line_num)\n+hns3_print_queue_state_perline(FILE *file, const uint32_t *queue_state,\n+\t\t\t       uint32_t nb_queues, uint32_t line_num)\n {\n-#define NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT)\n-\tuint32_t qid = line_num * NUM_QUEUE_PER_LINE;\n-\tuint32_t j;\n+#define HNS3_NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT)\n+\tuint32_t id = line_num * HNS3_NUM_QUEUE_PER_LINE;\n+\tuint32_t i;\n \n-\tfor (j = 0; j < NUM_QUEUE_PER_LINE; j++) {\n-\t\tfprintf(file, \"%1lx\", hns3_get_bit(queue_state[line_num], j));\n+\tfor (i = 0; i < HNS3_NUM_QUEUE_PER_LINE; i++) {\n+\t\tfprintf(file, \"%1lx\", hns3_get_bit(queue_state[line_num], i));\n \n-\t\tif (qid % CHAR_BIT == CHAR_BIT - 1) {\n+\t\tif (id % HNS3_UINT8_BIT == HNS3_UINT8_BIT - 1) {\n \t\t\tfprintf(file, \"%s\",\n-\t\t\t\tj == NUM_QUEUE_PER_LINE - 1 ? \"\\n\" : \":\");\n+\t\t\t\ti == HNS3_NUM_QUEUE_PER_LINE - 1 ? \"\\n\" : \":\");\n \t\t}\n-\t\tqid++;\n-\t\tif (qid >= nb_queues) {\n+\t\tid++;\n+\t\tif (id >= nb_queues) {\n \t\t\tfprintf(file, \"\\n\");\n \t\t\tbreak;\n \t\t}\n@@ -362,66 +360,83 @@ print_queue_state_perline(FILE *file, const uint32_t *queue_state,\n }\n \n static void\n-display_queue_enable_state(FILE *file, const uint32_t *queue_state,\n-\t\t\t   uint32_t nb_queues, bool is_rxq)\n+hns3_display_queue_enable_state(FILE *file, const uint32_t *queue_state,\n+\t\t\t\tuint32_t nb_queues, bool is_rxq)\n {\n-#define NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT)\n+#define HNS3_NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT)\n \tuint32_t i;\n \n-\tif (nb_queues == 0) {\n-\t\tfprintf(file, \"\\t       %s queue number is 0\\n\",\n-\t\t\t\tis_rxq ? \"Rx\" : \"Tx\");\n-\t\treturn;\n-\t}\n-\n \tfprintf(file, \"\\t       %s queue id | enable state bitMap\\n\",\n-\t\t\tis_rxq ? \"rx\" : \"tx\");\n+\t\t\tis_rxq ? \"Rx\" : \"Tx\");\n \n-\tfor (i = 0; i < (nb_queues - 1) / NUM_QUEUE_PER_LINE + 1; i++) {\n-\t\tuint32_t line_end = (i + 1) * NUM_QUEUE_PER_LINE - 1;\n-\t\tuint32_t line_start = i * NUM_QUEUE_PER_LINE;\n+\tfor (i = 0; i < (nb_queues - 1) / HNS3_NUM_QUEUE_PER_LINE + 1; i++) {\n+\t\tuint32_t line_end = (i + 1) * HNS3_NUM_QUEUE_PER_LINE - 1;\n+\t\tuint32_t line_start = i * HNS3_NUM_QUEUE_PER_LINE;\n \t\tfprintf(file, \"\\t       %04u - %04u | \", line_start,\n \t\t\tnb_queues - 1 > line_end ? line_end : nb_queues - 1);\n \n-\n-\t\tprint_queue_state_perline(file, queue_state, nb_queues, i);\n+\t\thns3_print_queue_state_perline(file, queue_state, nb_queues, i);\n \t}\n }\n \n static void\n-get_rxtx_queue_enable_state(FILE *file, struct rte_eth_dev *dev)\n+hns3_get_rxtx_queue_enable_state(FILE *file, struct rte_eth_dev *dev)\n {\n-#define MAX_TQP_NUM 1280\n-#define QUEUE_BITMAP_SIZE (MAX_TQP_NUM / 32)\n \tstruct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\tuint32_t rx_queue_state[QUEUE_BITMAP_SIZE] = {0};\n-\tuint32_t tx_queue_state[QUEUE_BITMAP_SIZE] = {0};\n+\tuint32_t *rx_queue_state;\n+\tuint32_t *tx_queue_state;\n \tuint32_t nb_rx_queues;\n \tuint32_t nb_tx_queues;\n+\tuint32_t bitmap_size;\n \n \tnb_rx_queues = dev->data->nb_rx_queues;\n \tnb_tx_queues = dev->data->nb_tx_queues;\n+\tif (nb_rx_queues == 0) {\n+\t\tfprintf(file, \"\\t  -- Rx queue number is 0\\n\");\n+\t\treturn;\n+\t}\n+\tif (nb_tx_queues == 0) {\n+\t\tfprintf(file, \"\\t  -- Tx queue number is 0\\n\");\n+\t\treturn;\n+\t}\n+\n+\tbitmap_size = (hw->tqps_num * sizeof(uint32_t) + HNS3_UINT32_BIT) /\n+\t\t\tHNS3_UINT32_BIT;\n+\trx_queue_state = (uint32_t *)rte_zmalloc(NULL, bitmap_size, 0);\n+\tif (rx_queue_state == NULL) {\n+\t\thns3_err(hw, \"Failed to allocate memory for rx queue state!\");\n+\t\treturn;\n+\t}\n+\n+\ttx_queue_state = (uint32_t *)rte_zmalloc(NULL, bitmap_size, 0);\n+\tif (tx_queue_state == NULL) {\n+\t\thns3_err(hw, \"Failed to allocate memory for tx queue state!\");\n+\t\trte_free(rx_queue_state);\n+\t\treturn;\n+\t}\n \n \tfprintf(file, \"\\t  -- enable state:\\n\");\n-\tget_queue_enable_state(hw, rx_queue_state, nb_rx_queues, true);\n-\tdisplay_queue_enable_state(file, rx_queue_state, nb_rx_queues,\n+\thns3_get_queue_enable_state(hw, rx_queue_state, nb_rx_queues, true);\n+\thns3_display_queue_enable_state(file, rx_queue_state, nb_rx_queues,\n \t\t\t\t\t true);\n \n-\tget_queue_enable_state(hw, tx_queue_state, nb_tx_queues, false);\n-\tdisplay_queue_enable_state(file, tx_queue_state, nb_tx_queues,\n+\thns3_get_queue_enable_state(hw, tx_queue_state, nb_tx_queues, false);\n+\thns3_display_queue_enable_state(file, tx_queue_state, nb_tx_queues,\n \t\t\t\t\t false);\n+\trte_free(rx_queue_state);\n+\trte_free(tx_queue_state);\n }\n \n static void\n-get_rxtx_queue_info(FILE *file, struct rte_eth_dev *dev)\n+hns3_get_rxtx_queue_info(FILE *file, struct rte_eth_dev *dev)\n {\n \tstruct hns3_rx_queue *rxq;\n \tstruct hns3_tx_queue *txq;\n \n-\trxq = get_rx_queue(dev);\n+\trxq = hns3_get_rx_queue(dev);\n \tif (rxq == NULL)\n \t\treturn;\n-\ttxq = get_tx_queue(dev);\n+\ttxq = hns3_get_tx_queue(dev);\n \tif (txq == NULL)\n \t\treturn;\n \tfprintf(file, \"  - Rx/Tx Queue Info:\\n\");\n@@ -434,12 +449,12 @@ get_rxtx_queue_info(FILE *file, struct rte_eth_dev *dev)\n \t\ttxq->port_id, txq->nb_tx_desc,\n \t\ttxq->tx_push_enable ? \"enabled\" : \"disabled\");\n \n-\tget_rxtx_fake_queue_info(file, dev);\n-\tget_rxtx_queue_enable_state(file, dev);\n+\thns3_get_rxtx_fake_queue_info(file, dev);\n+\thns3_get_rxtx_queue_enable_state(file, dev);\n }\n \n static int\n-get_vlan_filter_cfg(FILE *file, struct hns3_hw *hw)\n+hns3_get_vlan_filter_cfg(FILE *file, struct hns3_hw *hw)\n {\n #define HNS3_FILTER_TYPE_VF\t\t0\n #define HNS3_FILTER_TYPE_PORT\t\t1\n@@ -484,7 +499,7 @@ get_vlan_filter_cfg(FILE *file, struct hns3_hw *hw)\n }\n \n static int\n-get_vlan_rx_offload_cfg(FILE *file, struct hns3_hw *hw)\n+hns3_get_vlan_rx_offload_cfg(FILE *file, struct hns3_hw *hw)\n {\n \tstruct hns3_vport_vtag_rx_cfg_cmd *req;\n \tstruct hns3_cmd_desc desc;\n@@ -506,8 +521,8 @@ get_vlan_rx_offload_cfg(FILE *file, struct hns3_hw *hw)\n \tret = hns3_cmd_send(hw, &desc, 1);\n \tif (ret != 0) {\n \t\thns3_err(hw,\n-\t\t\t\"NIC IMP exec ret=%d desc_num=%d optcode=0x%x!\",\n-\t\t\tret, 1, rte_le_to_cpu_16(desc.opcode));\n+\t\t\t \"NIC firmware exec ret=%d optcode=0x%x!\", ret,\n+\t\t\t rte_le_to_cpu_16(desc.opcode));\n \t\treturn ret;\n \t}\n \n@@ -536,7 +551,7 @@ get_vlan_rx_offload_cfg(FILE *file, struct hns3_hw *hw)\n }\n \n static void\n-parse_tx_vlan_cfg(FILE *file, struct hns3_vport_vtag_tx_cfg_cmd *req)\n+hns3_parse_tx_vlan_cfg(FILE *file, struct hns3_vport_vtag_tx_cfg_cmd *req)\n {\n #define VLAN_VID_MASK 0x0fff\n #define VLAN_PRIO_SHIFT 13\n@@ -574,7 +589,7 @@ parse_tx_vlan_cfg(FILE *file, struct hns3_vport_vtag_tx_cfg_cmd *req)\n }\n \n static int\n-get_vlan_tx_offload_cfg(FILE *file, struct hns3_hw *hw)\n+hns3_get_vlan_tx_offload_cfg(FILE *file, struct hns3_hw *hw)\n {\n \tstruct hns3_vport_vtag_tx_cfg_cmd *req;\n \tstruct hns3_cmd_desc desc;\n@@ -595,50 +610,50 @@ get_vlan_tx_offload_cfg(FILE *file, struct hns3_hw *hw)\n \tret = hns3_cmd_send(hw, &desc, 1);\n \tif (ret != 0) {\n \t\thns3_err(hw,\n-\t\t\t\"NIC IMP exec ret=%d desc_num=%d optcode=0x%x!\",\n+\t\t\t\"NIC firmware exec ret=%d desc_num=%d optcode=0x%x!\",\n \t\t\tret, 1, rte_le_to_cpu_16(desc.opcode));\n \t\treturn ret;\n \t}\n \n-\tparse_tx_vlan_cfg(file, req);\n+\thns3_parse_tx_vlan_cfg(file, req);\n \n \treturn 0;\n }\n \n static void\n-get_port_pvid_info(FILE *file, struct hns3_hw *hw)\n+hns3_get_port_pvid_info(FILE *file, struct hns3_hw *hw)\n {\n-\tfprintf(file, \"\\t  -- pvid status: %s\\n\",\n-\t\thw->port_base_vlan_cfg.state ? \"on\" : \"off\");\n+\tfprintf(file, \"  - pvid status: %s\\n\",\n+\t\thw->port_base_vlan_cfg.state ? \"On\" : \"Off\");\n }\n \n static void\n-get_vlan_config_info(FILE *file, struct hns3_hw *hw)\n+hns3_get_vlan_config_info(FILE *file, struct hns3_hw *hw)\n {\n \tint ret;\n \n \tfprintf(file, \"  - VLAN Config Info:\\n\");\n-\tret = get_vlan_filter_cfg(file, hw);\n+\tret = hns3_get_vlan_filter_cfg(file, hw);\n \tif (ret < 0)\n \t\treturn;\n \n-\tret = get_vlan_rx_offload_cfg(file, hw);\n+\tret = hns3_get_vlan_rx_offload_cfg(file, hw);\n \tif (ret < 0)\n \t\treturn;\n \n-\tret = get_vlan_tx_offload_cfg(file, hw);\n+\tret = hns3_get_vlan_tx_offload_cfg(file, hw);\n \tif (ret < 0)\n \t\treturn;\n }\n \n static void\n-get_tm_conf_shaper_info(FILE *file, struct hns3_tm_conf *conf)\n+hns3_get_tm_conf_shaper_info(FILE *file, struct hns3_tm_conf *conf)\n {\n \tstruct hns3_shaper_profile_list *shaper_profile_list =\n \t\t&conf->shaper_profile_list;\n \tstruct hns3_tm_shaper_profile *shaper_profile;\n \n-\tif (!conf->nb_shaper_profile)\n+\tif (conf->nb_shaper_profile == 0)\n \t\treturn;\n \n \tfprintf(file, \"  shaper_profile:\\n\");\n@@ -652,9 +667,9 @@ get_tm_conf_shaper_info(FILE *file, struct hns3_tm_conf *conf)\n }\n \n static void\n-get_tm_conf_port_node_info(FILE *file, struct hns3_tm_conf *conf)\n+hns3_get_tm_conf_port_node_info(FILE *file, struct hns3_tm_conf *conf)\n {\n-\tif (!conf->root)\n+\tif (conf->root == NULL)\n \t\treturn;\n \n \tfprintf(file,\n@@ -666,14 +681,14 @@ get_tm_conf_port_node_info(FILE *file, struct hns3_tm_conf *conf)\n }\n \n static void\n-get_tm_conf_tc_node_info(FILE *file, struct hns3_tm_conf *conf)\n+hns3_get_tm_conf_tc_node_info(FILE *file, struct hns3_tm_conf *conf)\n {\n \tstruct hns3_tm_node_list *tc_list = &conf->tc_list;\n \tstruct hns3_tm_node *tc_node[HNS3_MAX_TC_NUM];\n \tstruct hns3_tm_node *tm_node;\n \tuint32_t tidx;\n \n-\tif (!conf->nb_tc_node)\n+\tif (conf->nb_tc_node == 0)\n \t\treturn;\n \n \tfprintf(file, \"  tc_node:\\n\");\n@@ -700,25 +715,27 @@ get_tm_conf_tc_node_info(FILE *file, struct hns3_tm_conf *conf)\n }\n \n static void\n-get_tm_conf_queue_format_info(FILE *file, struct hns3_tm_node **queue_node,\n-\t\t\t      uint32_t *queue_node_tc,  uint32_t nb_tx_queues)\n+hns3_get_tm_conf_queue_format_info(FILE *file, struct hns3_tm_node **queue_node,\n+\t\t\t\t   uint32_t *queue_node_tc,\n+\t\t\t\t   uint32_t nb_tx_queues)\n {\n-#define PERLINE_QUEUES\t32\n-#define PERLINE_STRIDE\t8\n-#define LINE_BUF_SIZE\t1024\n-\tuint32_t i, j, line_num, start_queue, end_queue;\n+#define HNS3_PERLINE_QUEUES\t32\n+#define HNS3_PERLINE_STRIDE\t8\n+\tuint32_t i, j, line_num, start_queue_id, end_queue_id;\n \n-\tline_num = (nb_tx_queues + PERLINE_QUEUES - 1) / PERLINE_QUEUES;\n+\tline_num = (nb_tx_queues + HNS3_PERLINE_QUEUES - 1) /\n+\t\tHNS3_PERLINE_QUEUES;\n \tfor (i = 0; i < line_num; i++) {\n-\t\tstart_queue = i * PERLINE_QUEUES;\n-\t\tend_queue = (i + 1) * PERLINE_QUEUES - 1;\n-\t\tif (end_queue > nb_tx_queues - 1)\n-\t\t\tend_queue = nb_tx_queues - 1;\n-\t\tfprintf(file, \"    %04u - %04u | \", start_queue, end_queue);\n-\t\tfor (j = start_queue; j < nb_tx_queues; j++) {\n-\t\t\tif (j >= end_queue + 1)\n+\t\tstart_queue_id = i * HNS3_PERLINE_QUEUES;\n+\t\tend_queue_id = (i + 1) * HNS3_PERLINE_QUEUES - 1;\n+\t\tif (end_queue_id > nb_tx_queues - 1)\n+\t\t\tend_queue_id = nb_tx_queues - 1;\n+\t\tfprintf(file, \"    %04u - %04u | \", start_queue_id,\n+\t\t\tend_queue_id);\n+\t\tfor (j = start_queue_id; j < nb_tx_queues; j++) {\n+\t\t\tif (j >= end_queue_id + 1)\n \t\t\t\tbreak;\n-\t\t\tif (j > start_queue && j % PERLINE_STRIDE == 0)\n+\t\t\tif (j > start_queue_id && j % HNS3_PERLINE_STRIDE == 0)\n \t\t\t\tfprintf(file, \":\");\n \t\t\tfprintf(file, \"%u\",\n \t\t\t\tqueue_node[j] ? queue_node_tc[j] :\n@@ -729,8 +746,8 @@ get_tm_conf_queue_format_info(FILE *file, struct hns3_tm_node **queue_node,\n }\n \n static void\n-get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf,\n-\t\t\t    uint32_t nb_tx_queues)\n+hns3_get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf,\n+\t\t\t\t uint32_t nb_tx_queues)\n {\n \tstruct hns3_tm_node_list *queue_list = &conf->queue_list;\n \tuint32_t nb_queue_node = conf->nb_leaf_nodes_max + 1;\n@@ -738,7 +755,7 @@ get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf,\n \tuint32_t queue_node_tc[nb_queue_node];\n \tstruct hns3_tm_node *tm_node;\n \n-\tif (!conf->nb_queue_node)\n+\tif (conf->nb_queue_node == 0)\n \t\treturn;\n \n \tfprintf(file,\n@@ -757,12 +774,12 @@ get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf,\n \t\tnb_tx_queues = RTE_MAX(nb_tx_queues, tm_node->id + 1);\n \t}\n \n-\tget_tm_conf_queue_format_info(file, queue_node, queue_node_tc,\n+\thns3_get_tm_conf_queue_format_info(file, queue_node, queue_node_tc,\n \t\t\t\t      nb_tx_queues);\n }\n \n static void\n-get_tm_conf_info(FILE *file, struct rte_eth_dev *dev)\n+hns3_get_tm_conf_info(FILE *file, struct rte_eth_dev *dev)\n {\n \tstruct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \tstruct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n@@ -780,10 +797,10 @@ get_tm_conf_info(FILE *file, struct rte_eth_dev *dev)\n \t\tconf->nb_shaper_profile, conf->nb_tc_node, conf->nb_queue_node,\n \t\tconf->committed);\n \n-\tget_tm_conf_shaper_info(file, conf);\n-\tget_tm_conf_port_node_info(file, conf);\n-\tget_tm_conf_tc_node_info(file, conf);\n-\tget_tm_conf_queue_node_info(file, conf, dev->data->nb_tx_queues);\n+\thns3_get_tm_conf_shaper_info(file, conf);\n+\thns3_get_tm_conf_port_node_info(file, conf);\n+\thns3_get_tm_conf_tc_node_info(file, conf);\n+\thns3_get_tm_conf_queue_node_info(file, conf, dev->data->nb_tx_queues);\n }\n \n static void\n@@ -815,7 +832,7 @@ hns3_fc_mode_to_rxtx_pause(enum hns3_fc_mode fc_mode, bool *rx_pause,\n }\n \n static bool\n-is_link_fc_mode(struct hns3_adapter *hns)\n+hns3_is_link_fc_mode(struct hns3_adapter *hns)\n {\n \tstruct hns3_hw *hw = &hns->hw;\n \tstruct hns3_pf *pf = &hns->pf;\n@@ -830,21 +847,21 @@ is_link_fc_mode(struct hns3_adapter *hns)\n }\n \n static void\n-get_link_fc_info(FILE *file, struct rte_eth_dev *dev)\n+hns3_get_link_fc_info(FILE *file, struct rte_eth_dev *dev)\n {\n \tstruct hns3_adapter *hns = dev->data->dev_private;\n \tstruct hns3_hw *hw = &hns->hw;\n-\tstruct rte_eth_fc_conf fc_conf;\n+\tstruct rte_eth_fc_conf cur_fc_conf;\n \tbool rx_pause1;\n \tbool tx_pause1;\n \tbool rx_pause2;\n \tbool tx_pause2;\n \tint ret;\n \n-\tif (!is_link_fc_mode(hns))\n+\tif (!hns3_is_link_fc_mode(hns))\n \t\treturn;\n \n-\tret = hns3_flow_ctrl_get(dev, &fc_conf);\n+\tret = hns3_flow_ctrl_get(dev, &cur_fc_conf);\n \tif (ret)  {\n \t\tfprintf(file, \"get device flow control info fail!\\n\");\n \t\treturn;\n@@ -852,7 +869,7 @@ get_link_fc_info(FILE *file, struct rte_eth_dev *dev)\n \n \thns3_fc_mode_to_rxtx_pause(hw->requested_fc_mode,\n \t\t\t\t   &rx_pause1, &tx_pause1);\n-\thns3_fc_mode_to_rxtx_pause((enum hns3_fc_mode)fc_conf.mode,\n+\thns3_fc_mode_to_rxtx_pause((enum hns3_fc_mode)cur_fc_conf.mode,\n \t\t\t\t   &rx_pause2, &tx_pause2);\n \n \tfprintf(file,\n@@ -867,15 +884,14 @@ get_link_fc_info(FILE *file, struct rte_eth_dev *dev)\n \t\t\"\\t       Pause time:\t0x%x\\n\",\n \t\trx_pause1 ? \"On\" : \"Off\", tx_pause1 ? \"On\" : \"Off\",\n \t\trx_pause2 ? \"On\" : \"Off\", tx_pause2 ? \"On\" : \"Off\",\n-\t\tfc_conf.autoneg == RTE_ETH_LINK_AUTONEG ? \"On\" : \"Off\",\n-\t\tfc_conf.pause_time);\n+\t\tcur_fc_conf.autoneg == RTE_ETH_LINK_AUTONEG ? \"On\" : \"Off\",\n+\t\tcur_fc_conf.pause_time);\n }\n \n static void\n-get_flow_ctrl_info(FILE *file, struct rte_eth_dev *dev)\n+hns3_get_flow_ctrl_info(FILE *file, struct rte_eth_dev *dev)\n {\n-\tstruct hns3_adapter *hns = dev->data->dev_private;\n-\tstruct hns3_hw *hw = &hns->hw;\n+\tstruct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \n \tfprintf(file, \"  - Flow Ctrl Info:\\n\");\n \tfprintf(file,\n@@ -885,7 +901,7 @@ get_flow_ctrl_info(FILE *file, struct rte_eth_dev *dev)\n \t\thw->current_fc_status,\n \t\thw->requested_fc_mode);\n \n-\tget_link_fc_info(file, dev);\n+\thns3_get_link_fc_info(file, dev);\n }\n \n int\n@@ -894,20 +910,23 @@ hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file)\n \tstruct hns3_adapter *hns = dev->data->dev_private;\n \tstruct hns3_hw *hw = &hns->hw;\n \n-\tget_device_basic_info(file, dev);\n-\tget_dev_feature_capability(file, hw);\n-\tget_rxtx_queue_info(file, dev);\n-\tget_port_pvid_info(file, hw);\n+\thns3_get_device_basic_info(file, dev);\n+\thns3_get_dev_feature_capability(file, hw);\n+\thns3_get_rxtx_queue_info(file, dev);\n+\thns3_get_port_pvid_info(file, hw);\n \n-\t/* VF only supports dumping basic info and feaure capability */\n+\t/*\n+\t * VF only supports dumping basic info, feature capability and queue\n+\t * info.\n+\t */\n \tif (hns->is_vf)\n \t\treturn 0;\n \n-\tget_dev_mac_info(file, hns);\n-\tget_vlan_config_info(file, hw);\n-\tget_fdir_basic_info(file, &hns->pf);\n-\tget_tm_conf_info(file, dev);\n-\tget_flow_ctrl_info(file, dev);\n+\thns3_get_dev_mac_info(file, hns);\n+\thns3_get_vlan_config_info(file, hw);\n+\thns3_get_fdir_basic_info(file, &hns->pf);\n+\thns3_get_tm_conf_info(file, dev);\n+\thns3_get_flow_ctrl_info(file, dev);\n \n \treturn 0;\n }\n",
    "prefixes": [
        "3/5"
    ]
}