From patchwork Thu Apr 28 13:15:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 110448 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 04EB6A034C; Thu, 28 Apr 2022 15:22:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7EC6442834; Thu, 28 Apr 2022 15:22:12 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 02C9342828 for ; Thu, 28 Apr 2022 15:22:02 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Kpx6F4gyPzGpRj; Thu, 28 Apr 2022 21:19:17 +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, 28 Apr 2022 21:21:55 +0800 From: Chengwen Feng To: , , , , , , CC: Subject: [PATCH v2 5/9] net/axgbe: adjust retval when xstats is null of get xstats Date: Thu, 28 Apr 2022 21:15:56 +0800 Message-ID: <20220428131600.41032-6-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220428131600.41032-1-fengchengwen@huawei.com> References: <20220416010747.40714-1-fengchengwen@huawei.com> <20220428131600.41032-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) 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 Many user (e.g. telemetry) invokes rte_eth_xstats_get(port_id, NULL, 0) to retrieve the required number of elements, but currently axgbe PMD returns zero when xstats is NULL. This patch adjusts that the return value was the required number of elements when stats is NULL. Fixes: 9d1ef6b2e731 ("net/axgbe: add xstats") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- drivers/net/axgbe/axgbe_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 951da5cc26..f6a3a52430 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -1014,7 +1014,7 @@ axgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, unsigned int i; if (!stats) - return 0; + return AXGBE_XSTATS_COUNT; axgbe_read_mmc_stats(pdata);