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 CCA67A00C4; Thu, 5 May 2022 10:09:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2708842852; Thu, 5 May 2022 10:08:40 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id E7D0840C35 for ; Thu, 5 May 2022 10:08:31 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Kv5qG6nbpzGpWM; Thu, 5 May 2022 16:05:46 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 5 May 2022 16:08:30 +0800 From: Chengwen Feng To: , , , , , , CC: , , Subject: [PATCH v3 08/10] ethdev: support auto-filled flag when telemetry stats Date: Thu, 5 May 2022 16:02:31 +0800 Message-ID: <20220505080233.12737-9-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220505080233.12737-1-fengchengwen@huawei.com> References: <20220416010747.40714-1-fengchengwen@huawei.com> <20220505080233.12737-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500024.china.huawei.com (7.185.36.10) 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 supports auto-filled queue xstats when telemetry stats. Fixes: f30e69b41f94 ("ethdev: add device flag to bypass auto-filled queue xstats") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- lib/ethdev/rte_ethdev.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index f26a9bac6d..76037e635b 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -5499,6 +5499,7 @@ eth_dev_handle_port_stats(const char *cmd __rte_unused, struct rte_tel_data *d) { struct rte_eth_stats stats; + struct rte_eth_dev *dev; int port_id, ret; if (params == NULL || strlen(params) == 0 || !isdigit(*params)) @@ -5507,6 +5508,7 @@ eth_dev_handle_port_stats(const char *cmd __rte_unused, port_id = atoi(params); if (!rte_eth_dev_is_valid_port(port_id)) return -1; + dev = &rte_eth_devices[port_id]; ret = rte_eth_stats_get(port_id, &stats); if (ret < 0) @@ -5521,11 +5523,13 @@ eth_dev_handle_port_stats(const char *cmd __rte_unused, ADD_DICT_STAT(stats, ierrors); ADD_DICT_STAT(stats, oerrors); ADD_DICT_STAT(stats, rx_nombuf); - eth_dev_add_port_queue_stats(d, stats.q_ipackets, "q_ipackets"); - eth_dev_add_port_queue_stats(d, stats.q_opackets, "q_opackets"); - eth_dev_add_port_queue_stats(d, stats.q_ibytes, "q_ibytes"); - eth_dev_add_port_queue_stats(d, stats.q_obytes, "q_obytes"); - eth_dev_add_port_queue_stats(d, stats.q_errors, "q_errors"); + if (dev->data->dev_flags & RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS) { + eth_dev_add_port_queue_stats(d, stats.q_ipackets, "q_ipackets"); + eth_dev_add_port_queue_stats(d, stats.q_opackets, "q_opackets"); + eth_dev_add_port_queue_stats(d, stats.q_ibytes, "q_ibytes"); + eth_dev_add_port_queue_stats(d, stats.q_obytes, "q_obytes"); + eth_dev_add_port_queue_stats(d, stats.q_errors, "q_errors"); + } return 0; } -- 2.33.0