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 0E998A00C4; Sun, 24 Apr 2022 05:45:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C38C40042; Sun, 24 Apr 2022 05:45:04 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id C2E344003F for ; Sun, 24 Apr 2022 05:45:02 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4KmDSG6N7RzCs38; Sun, 24 Apr 2022 11:40:30 +0800 (CST) Received: from [127.0.0.1] (10.67.100.224) 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; Sun, 24 Apr 2022 11:45:00 +0800 Subject: Re: [PATCH 1/3] ethdev: fix telemetry xstats return null with some PMDs To: Andrew Rybchenko , Stephen Hemminger CC: , , , , , , References: <20220416010747.40714-1-fengchengwen@huawei.com> <20220416010747.40714-2-fengchengwen@huawei.com> <20220415183831.2473346b@hermes.local> From: fengchengwen Message-ID: Date: Sun, 24 Apr 2022 11:44:59 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.100.224] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 The root cause is: when the xstats is NULL and n less than required number of elements is zero, the return value of rte_eth_xstats_get is ambiguous from rte_ethdev.h's declaration. But the implementation of rte_eth_xstats_get return required number of elements when xstats is NULL and n less than required number of elements. There are two modification schemes: a) the value of xstats cannot be NULL, and the value of n must be greater than or equal to the required number, otherwise, an error code is returned. b) define the behavior as the same as rte_eth_xstats_get_names, which means return required number of elelement when xstats is NULL and n less than required number of elements. I prefer the scheme a because rte_eth_xstats_get and rte_eth_xstats_get_name are symbiotic, and it's not necessary to both implement the same logic. Also for scheme a, there is no need to modify the PMD implementation. What about your opinions ? On 2022/4/21 14:49, Andrew Rybchenko wrote: > On 4/16/22 04:38, Stephen Hemminger wrote: >> On Sat, 16 Apr 2022 09:07:45 +0800 >> Chengwen Feng wrote: >> >>> 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. >> >> Lets fix the PMD's this impacts other code as well. > > +1 > > .