From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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" -- 2.33.0