From patchwork Thu Apr 14 13:00:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 109722 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 24F64A0508; Thu, 14 Apr 2022 15:01:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 170D940F35; Thu, 14 Apr 2022 15:01:57 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 4B03840E64 for ; Thu, 14 Apr 2022 15:01:55 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4KfKHf0rqrzBrxn for ; Thu, 14 Apr 2022 20:57:34 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Apr 2022 21:01:53 +0800 From: "Min Hu (Connor)" To: CC: "Min Hu (Connor)" , Yisen Zhuang , Lijun Ou Subject: [PATCH 1/5] net/hns3: refactor adapter state dump Date: Thu, 14 Apr 2022 21:00:52 +0800 Message-ID: <20220414130056.37428-2-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220414130056.37428-1-humin29@huawei.com> References: <20220414130056.37428-1-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch refactor adapter state dump. Fixes: 1a03c659cb9d ("net/hns3: dump device basic info") Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev_dump.c | 41 ++++++++++++++++------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c index beffdd9e32..8b7a90a67e 100644 --- a/drivers/net/hns3/hns3_ethdev_dump.c +++ b/drivers/net/hns3/hns3_ethdev_dump.c @@ -13,26 +13,31 @@ #include "hns3_rxtx.h" static const char * -get_adapter_state_name(uint32_t state) -{ - static const char * const state_name[] = { - "UNINITIALIZED", - "INITIALIZED", - "CONFIGURING", - "CONFIGURED", - "STARTING", - "STARTED", - "STOPPING", - "CLOSING", - "CLOSED", - "REMOVED", - "NSTATES" +get_adapter_state_name(enum hns3_adapter_state state) +{ + const struct { + enum hns3_adapter_state state; + const char *name; + } adapter_state_name[] = { + {HNS3_NIC_UNINITIALIZED, "UNINITIALIZED"}, + {HNS3_NIC_INITIALIZED, "INITIALIZED"}, + {HNS3_NIC_CONFIGURING, "CONFIGURING"}, + {HNS3_NIC_CONFIGURED, "CONFIGURED"}, + {HNS3_NIC_STARTING, "STARTING"}, + {HNS3_NIC_STARTED, "STARTED"}, + {HNS3_NIC_STOPPING, "STOPPING"}, + {HNS3_NIC_CLOSING, "CLOSING"}, + {HNS3_NIC_CLOSED, "CLOSED"}, + {HNS3_NIC_REMOVED, "REMOVED"}, + {HNS3_NIC_NSTATES, "NSTATES"}, }; + uint32_t i; - if (state < RTE_DIM(state_name)) - return state_name[state]; - else - return "unknown"; + for (i = 0; i < RTE_DIM(adapter_state_name); i++) + if (state == adapter_state_name[i].state) + return adapter_state_name[i].name; + + return "Unknown"; } static const char * From patchwork Thu Apr 14 13:00:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 109723 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 069BEA0508; Thu, 14 Apr 2022 15:02:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF7F44113D; Thu, 14 Apr 2022 15:01:57 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 4BD3E40E64 for ; Thu, 14 Apr 2022 15:01:56 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KfKLX4hYHzgYdV for ; Thu, 14 Apr 2022 21:00:04 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Apr 2022 21:01:54 +0800 From: "Min Hu (Connor)" To: CC: "Min Hu (Connor)" , Yisen Zhuang , Lijun Ou Subject: [PATCH 2/5] net/hns3: refactor feature capability dump Date: Thu, 14 Apr 2022 21:00:53 +0800 Message-ID: <20220414130056.37428-3-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220414130056.37428-1-humin29@huawei.com> References: <20220414130056.37428-1-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch refactor feature capability dump. Fixes: 14ea9f0a62c6 ("net/hns3: dump device feature capability") Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev.h | 2 +- drivers/net/hns3/hns3_ethdev_dump.c | 40 ++++++++++++++--------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 9a0fa09b57..75a89c3d1c 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -874,7 +874,7 @@ struct hns3_adapter { #define HNS3_DEVARG_MBX_TIME_LIMIT_MS "mbx_time_limit_ms" -enum { +enum hns3_dev_cap { HNS3_DEV_SUPPORT_DCB_B, HNS3_DEV_SUPPORT_COPPER_B, HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B, diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c index 8b7a90a67e..059a4d8644 100644 --- a/drivers/net/hns3/hns3_ethdev_dump.c +++ b/drivers/net/hns3/hns3_ethdev_dump.c @@ -2,15 +2,11 @@ * Copyright(C) 2022 HiSilicon Limited */ -#include -#include -#include -#include - #include "hns3_common.h" #include "hns3_logs.h" #include "hns3_regs.h" #include "hns3_rxtx.h" +#include "hns3_ethdev.h" static const char * get_adapter_state_name(enum hns3_adapter_state state) @@ -84,27 +80,29 @@ get_dev_mac_info(FILE *file, struct hns3_adapter *hns) static void get_dev_feature_capability(FILE *file, struct hns3_hw *hw) { - const char * const caps_name[] = { - "DCB", - "COPPER", - "FD QUEUE REGION", - "PTP", - "TX PUSH", - "INDEP TXRX", - "STASH", - "SIMPLE BD", - "RXD Advanced Layout", - "OUTER UDP CKSUM", - "RAS IMP", - "TM", - "VF VLAN FILTER MOD", + const struct { + enum hns3_dev_cap cap; + const char *name; + } caps_name[] = { + {HNS3_DEV_SUPPORT_DCB_B, "DCB"}, + {HNS3_DEV_SUPPORT_COPPER_B, "COPPER"}, + {HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B, "FD QUEUE REGION"}, + {HNS3_DEV_SUPPORT_PTP_B, "PTP"}, + {HNS3_DEV_SUPPORT_TX_PUSH_B, "TX PUSH"}, + {HNS3_DEV_SUPPORT_INDEP_TXRX_B, "INDEP TXRX"}, + {HNS3_DEV_SUPPORT_STASH_B, "STASH"}, + {HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B, "RXD Advanced Layout"}, + {HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, "OUTER UDP CKSUM"}, + {HNS3_DEV_SUPPORT_RAS_IMP_B, "RAS IMP"}, + {HNS3_DEV_SUPPORT_TM_B, "TM"}, }; uint32_t i; fprintf(file, " - Dev Capability:\n"); for (i = 0; i < RTE_DIM(caps_name); i++) - fprintf(file, "\t -- support %s: %s\n", caps_name[i], - hw->capability & BIT(i) ? "yes" : "no"); + fprintf(file, "\t -- support %s: %s\n", caps_name[i].name, + hns3_get_bit(hw->capability, caps_name[i].cap) ? "Yes" : + "No"); } static const char * From patchwork Thu Apr 14 13:00:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 109724 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id B7380A0508; Thu, 14 Apr 2022 15:02:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 538AD427F6; Thu, 14 Apr 2022 15:02:01 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 0197541156 for ; Thu, 14 Apr 2022 15:01:59 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KfKLZ6zygzgYdV for ; Thu, 14 Apr 2022 21:00:06 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Apr 2022 21:01:56 +0800 From: "Min Hu (Connor)" To: CC: "Min Hu (Connor)" , Yisen Zhuang , Lijun Ou Subject: [PATCH 3/5] net/hns3: refactor queue info dump Date: Thu, 14 Apr 2022 21:00:54 +0800 Message-ID: <20220414130056.37428-4-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220414130056.37428-1-humin29@huawei.com> References: <20220414130056.37428-1-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch refactor queue info dump. Fixes: 6038c8a3f63c ("net/hns3: dump queue info") Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev_dump.c | 133 +++++++++++++--------------- 1 file changed, 62 insertions(+), 71 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c index 059a4d8644..9934e4e1cc 100644 --- a/drivers/net/hns3/hns3_ethdev_dump.c +++ b/drivers/net/hns3/hns3_ethdev_dump.c @@ -224,99 +224,94 @@ get_device_basic_info(FILE *file, struct rte_eth_dev *dev) dev->data->dev_conf.intr_conf.rxq); } -/* - * Note: caller must make sure queue_id < nb_queues - * nb_queues = RTE_MAX(eth_dev->data->nb_rx_queues, - * eth_dev->data->nb_tx_queues) - */ static struct hns3_rx_queue * -get_rx_queue(struct rte_eth_dev *dev, unsigned int queue_id) +get_rx_queue(struct rte_eth_dev *dev) { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; - unsigned int offset; + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_rx_queue *rxq; + uint32_t queue_id; void **rx_queues; - if (queue_id < dev->data->nb_rx_queues) { + for (queue_id = 0; queue_id < dev->data->nb_rx_queues; queue_id++) { rx_queues = dev->data->rx_queues; - offset = queue_id; - } else { - /* - * For kunpeng930, fake queue is not exist. But since the queues - * are usually accessd in pairs, this branch may still exist. - */ - if (hns3_dev_get_support(hw, INDEP_TXRX)) + if (rx_queues == NULL || rx_queues[queue_id] == NULL) { + hns3_err(hw, "detect rx_queues is NULL!\n"); return NULL; + } - rx_queues = hw->fkq_data.rx_queues; - offset = queue_id - dev->data->nb_rx_queues; - } + rxq = (struct hns3_rx_queue *)rx_queues[queue_id]; + if (rxq->rx_deferred_start) + continue; - if (rx_queues != NULL && rx_queues[offset] != NULL) - return rx_queues[offset]; + return rx_queues[queue_id]; + } - hns3_err(hw, "Detect rx_queues is NULL!\n"); return NULL; } -/* - * Note: caller must make sure queue_id < nb_queues - * nb_queues = RTE_MAX(eth_dev->data->nb_rx_queues, - * eth_dev->data->nb_tx_queues) - */ static struct hns3_tx_queue * -get_tx_queue(struct rte_eth_dev *dev, unsigned int queue_id) +get_tx_queue(struct rte_eth_dev *dev) { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; - unsigned int offset; + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_tx_queue *txq; + uint32_t queue_id; void **tx_queues; - if (queue_id < dev->data->nb_tx_queues) { + for (queue_id = 0; queue_id < dev->data->nb_tx_queues; queue_id++) { tx_queues = dev->data->tx_queues; - offset = queue_id; - } else { - /* - * For kunpeng930, fake queue is not exist. But since the queues - * are usually accessd in pairs, this branch may still exist. - */ - if (hns3_dev_get_support(hw, INDEP_TXRX)) + if (tx_queues == NULL || tx_queues[queue_id] == NULL) { + hns3_err(hw, "detect tx_queues is NULL!\n"); return NULL; - tx_queues = hw->fkq_data.tx_queues; - offset = queue_id - dev->data->nb_tx_queues; - } + } - if (tx_queues != NULL && tx_queues[offset] != NULL) - return tx_queues[offset]; + txq = (struct hns3_tx_queue *)tx_queues[queue_id]; + if (txq->tx_deferred_start) + continue; + + return tx_queues[queue_id]; + } - hns3_err(hw, "Detect tx_queues is NULL!\n"); return NULL; } static void get_rxtx_fake_queue_info(FILE *file, struct rte_eth_dev *dev) { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns); + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct hns3_rx_queue *rxq; struct hns3_tx_queue *txq; - unsigned int queue_id; - - if (dev->data->nb_rx_queues != dev->data->nb_tx_queues && - !hns3_dev_get_support(hw, INDEP_TXRX)) { - queue_id = RTE_MIN(dev->data->nb_rx_queues, - dev->data->nb_tx_queues); - rxq = get_rx_queue(dev, queue_id); - if (rxq == NULL) + uint32_t queue_id = 0; + void **rx_queues; + void **tx_queues; + + if (hns3_dev_get_support(hw, INDEP_TXRX)) + return; + + if (dev->data->nb_rx_queues < dev->data->nb_tx_queues) { + rx_queues = hw->fkq_data.rx_queues; + if (rx_queues == NULL || rx_queues[queue_id] == NULL) { + hns3_err(hw, "detect rx_queues is NULL!\n"); return; - txq = get_tx_queue(dev, queue_id); - if (txq == NULL) + } + rxq = (struct hns3_rx_queue *)rx_queues[queue_id]; + + fprintf(file, + "\t -- first fake_queue info:\n" + "\t Rx: port=%u nb_desc=%u free_thresh=%u\n", + rxq->port_id, rxq->nb_rx_desc, rxq->rx_free_thresh); + } else if (dev->data->nb_rx_queues > dev->data->nb_tx_queues) { + tx_queues = hw->fkq_data.tx_queues; + queue_id = 0; + + if (tx_queues == NULL || tx_queues[queue_id] == NULL) { + hns3_err(hw, "detect tx_queues is NULL!\n"); return; + } + txq = (struct hns3_tx_queue *)tx_queues[queue_id]; + fprintf(file, - "\t -- first fake_queue rxtx info:\n" - "\t rx: port=%u nb_desc=%u free_thresh=%u\n" - "\t tx: port=%u nb_desc=%u\n", - rxq->port_id, rxq->nb_rx_desc, rxq->rx_free_thresh, + "\t -- first fake_queue info:\n" + "\t Tx: port=%u nb_desc=%u\n", txq->port_id, txq->nb_tx_desc); } } @@ -422,23 +417,19 @@ get_rxtx_queue_info(FILE *file, struct rte_eth_dev *dev) { struct hns3_rx_queue *rxq; struct hns3_tx_queue *txq; - unsigned int queue_id = 0; - rxq = get_rx_queue(dev, queue_id); + rxq = get_rx_queue(dev); if (rxq == NULL) return; - txq = get_tx_queue(dev, queue_id); + txq = get_tx_queue(dev); if (txq == NULL) return; fprintf(file, " - Rx/Tx Queue Info:\n"); fprintf(file, - "\t -- nb_rx_queues=%u nb_tx_queues=%u, " - "first queue rxtx info:\n" - "\t rx: port=%u nb_desc=%u free_thresh=%u\n" - "\t tx: port=%u nb_desc=%u\n" + "\t -- first queue rxtx info:\n" + "\t Rx: port=%u nb_desc=%u free_thresh=%u\n" + "\t Tx: port=%u nb_desc=%u\n" "\t -- tx push: %s\n", - dev->data->nb_rx_queues, - dev->data->nb_tx_queues, rxq->port_id, rxq->nb_rx_desc, rxq->rx_free_thresh, txq->port_id, txq->nb_tx_desc, txq->tx_push_enable ? "enabled" : "disabled"); From patchwork Thu Apr 14 13:00:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 109725 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 06513A0508; Thu, 14 Apr 2022 15:02:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 231CE41156; Thu, 14 Apr 2022 15:02:03 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 2A1B742800 for ; Thu, 14 Apr 2022 15:02:02 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KfKKy4PszzFpgG for ; Thu, 14 Apr 2022 20:59:34 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Apr 2022 21:02:00 +0800 From: "Min Hu (Connor)" To: CC: "Min Hu (Connor)" , Yisen Zhuang , Lijun Ou Subject: [PATCH 4/5] net/hns3: fix dump TM info Date: Thu, 14 Apr 2022 21:00:55 +0800 Message-ID: <20220414130056.37428-5-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220414130056.37428-1-humin29@huawei.com> References: <20220414130056.37428-1-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org TM info should not be dump when the NIC does not support TM. This patch fixed it. Fixes: e4cfe6bb9114 ("net/hns3: dump TM configuration info") Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev_dump.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c index 9934e4e1cc..1548d231fc 100644 --- a/drivers/net/hns3/hns3_ethdev_dump.c +++ b/drivers/net/hns3/hns3_ethdev_dump.c @@ -709,7 +709,6 @@ get_tm_conf_queue_format_info(FILE *file, struct hns3_tm_node **queue_node, #define PERLINE_STRIDE 8 #define LINE_BUF_SIZE 1024 uint32_t i, j, line_num, start_queue, end_queue; - char tmpbuf[LINE_BUF_SIZE] = {0}; line_num = (nb_tx_queues + PERLINE_QUEUES - 1) / PERLINE_QUEUES; for (i = 0; i < line_num; i++) { @@ -727,7 +726,7 @@ get_tm_conf_queue_format_info(FILE *file, struct hns3_tm_node **queue_node, queue_node[j] ? queue_node_tc[j] : HNS3_MAX_TC_NUM); } - fprintf(file, "%s\n", tmpbuf); + fprintf(file, "\n"); } } @@ -767,9 +766,13 @@ get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf, static void get_tm_conf_info(FILE *file, struct rte_eth_dev *dev) { + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct hns3_tm_conf *conf = &pf->tm_conf; + if (!hns3_dev_get_support(hw, TM)) + return; + fprintf(file, " - TM config info:\n"); fprintf(file, "\t -- nb_leaf_nodes_max=%u nb_nodes_max=%u\n" From patchwork Thu Apr 14 13:00:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 109726 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 6755CA0508; Thu, 14 Apr 2022 15:02:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25B8A42802; Thu, 14 Apr 2022 15:02:06 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 646C542802 for ; Thu, 14 Apr 2022 15:02:03 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KfKLg4whnzgYdV for ; Thu, 14 Apr 2022 21:00:11 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Apr 2022 21:02:01 +0800 From: "Min Hu (Connor)" To: CC: "Min Hu (Connor)" , Yisen Zhuang , Lijun Ou Subject: [PATCH 5/5] net/hns3: fix dump device info Date: Thu, 14 Apr 2022 21:00:56 +0800 Message-ID: <20220414130056.37428-6-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220414130056.37428-1-humin29@huawei.com> References: <20220414130056.37428-1-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Rx/Tx queue info dump and pvid info dump is both supported in PF and VF. This patch fixed it. Fixes: 1a03c659cb9d ("net/hns3: dump device basic info") Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev_dump.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c index 1548d231fc..1bb2ab7556 100644 --- a/drivers/net/hns3/hns3_ethdev_dump.c +++ b/drivers/net/hns3/hns3_ethdev_dump.c @@ -629,8 +629,6 @@ get_vlan_config_info(FILE *file, struct hns3_hw *hw) ret = get_vlan_tx_offload_cfg(file, hw); if (ret < 0) return; - - get_port_pvid_info(file, hw); } static void @@ -898,13 +896,14 @@ hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) get_device_basic_info(file, dev); get_dev_feature_capability(file, hw); + get_rxtx_queue_info(file, dev); + get_port_pvid_info(file, hw); /* VF only supports dumping basic info and feaure capability */ if (hns->is_vf) return 0; get_dev_mac_info(file, hns); - get_rxtx_queue_info(file, dev); get_vlan_config_info(file, hw); get_fdir_basic_info(file, &hns->pf); get_tm_conf_info(file, dev);