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 B4018A04FD; Wed, 4 May 2022 12:32:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4ACB340C35; Wed, 4 May 2022 12:32:33 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 8EB6B4069F for ; Wed, 4 May 2022 12:32:31 +0200 (CEST) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id F40E782; Wed, 4 May 2022 13:32:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru F40E782 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1651660351; bh=oMUkO2Ga8fJR/E8E/jtKC6rbihiPGx1wtO+TqVqYEus=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=e8DWrtpkyROS0bpZtw6w/iPwHRRTp7WrgY9zttveD9Qlptkgc2CLyO6JWG1t38V22 mugH26OwqAvFWV4cjQkRg+KPBADOcy/c+f2za25QhBNOCJeHnvxhRbWSckz5KLWzQn NaJOX/Gq9ZFDA1V89qikxMdo7X1PWe3z0dNGFAmU= Message-ID: <37b98022-4923-e53d-bef1-e0fbc768a68d@oktetlabs.ru> Date: Wed, 4 May 2022 13:32:30 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v2 1/9] ethdev: define retval when xstats is null of get xstats Content-Language: en-US To: Chengwen Feng , thomas@monjalon.net, ferruh.yigit@xilinx.com, ndabilpuram@marvell.com, kirankumark@marvell.com, skori@marvell.com, skoteshwar@marvell.com Cc: dev@dpdk.org References: <20220416010747.40714-1-fengchengwen@huawei.com> <20220428131600.41032-1-fengchengwen@huawei.com> <20220428131600.41032-2-fengchengwen@huawei.com> From: Andrew Rybchenko Organization: OKTET Labs In-Reply-To: <20220428131600.41032-2-fengchengwen@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 On 4/28/22 16:15, Chengwen Feng wrote: > Currently the value returned when xstats is NULL of rte_eth_xstats_get() > is not specified, some PMDs (eg. hns3/ipn3ke/mvpp2/axgbe) return zero > while others return the required number of elements. > > This patch defines that the return value should be the required number of > elements when xstats is NULL of rte_eth_xstats_get(). > > Fixes: ce757f5c9a4d ("ethdev: new method to retrieve extended statistics") > Cc: stable@dpdk.org > > Signed-off-by: Chengwen Feng > --- > lib/ethdev/rte_ethdev.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h > index 04cff8ee10..0b18297c95 100644 > --- a/lib/ethdev/rte_ethdev.h > +++ b/lib/ethdev/rte_ethdev.h > @@ -3174,7 +3174,7 @@ int rte_eth_xstats_get_names(uint16_t port_id, > * @param xstats > * A pointer to a table of structure of type *rte_eth_xstat* > * to be filled with device statistics ids and values. > - * This parameter can be set to NULL if n is 0. > + * If set to NULL, the function returns the required number of elements. I'm sorry, but I disagree with the patch. First of all it removes limitation when xstats may be NULL. Second, I think that clarification is not required since: if xstats is NULL, n must be 0 as defined above and return value description says: 3183 * - A positive value higher than n: error, the given statistics table 3184 * is too small. The return value corresponds to the size that should 3185 * be given to succeed. The entries in the table are not valid and 3186 * shall not be used by the caller. > * @param n > * The size of the xstats array (number of elements). > * @return