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 E72BAA050B; Sat, 16 Apr 2022 03:13:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B5864067C; Sat, 16 Apr 2022 03:13:38 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 2F10C40042 for ; Sat, 16 Apr 2022 03:13:35 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KgFYf4ZgszfYpJ; Sat, 16 Apr 2022 09:12:54 +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; Sat, 16 Apr 2022 09:13:34 +0800 From: Chengwen Feng To: , , , , , , CC: Subject: [PATCH 1/3] ethdev: fix telemetry xstats return null with some PMDs Date: Sat, 16 Apr 2022 09:07:45 +0800 Message-ID: <20220416010747.40714-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220416010747.40714-1-fengchengwen@huawei.com> References: <20220416010747.40714-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: dggems703-chm.china.huawei.com (10.3.19.180) 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 Currently the telemetry xstats uses rte_eth_xstats_get() to retrieve the number of elements. But the value to be returned when the parameter 'xstats' is NULL is not specified, some PMDs (eg. hns3/ipn3ke/mvpp2/ axgbe) return zero while others return the required number of elements. This patch uses rte_eth_xstats_get_names() instead of rte_eth_xstats_get() because it returns the required number of elements when the parameter 'xstats_name' is NULL. Fixes: c190daedb9b1 ("ethdev: add telemetry callbacks") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- lib/ethdev/rte_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 29a3d80466..615383bde2 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -5558,7 +5558,7 @@ eth_dev_handle_port_xstats(const char *cmd __rte_unused, if (!rte_eth_dev_is_valid_port(port_id)) return -1; - num_xstats = rte_eth_xstats_get(port_id, NULL, 0); + num_xstats = rte_eth_xstats_get_names(port_id, NULL, 0); if (num_xstats < 0) return -1; -- 2.33.0