From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id D65021B6D3 for ; Tue, 24 Oct 2017 00:20:58 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 69E4C20D48; Mon, 23 Oct 2017 18:20:58 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Mon, 23 Oct 2017 18:20:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=Ln5Pd40dt/9fcznlnKEHs82pLi 2MXOdBcNBBuJOH4Ks=; b=T7aqekwcx2GtLfaOvFUUsx6I2KMDKACi5KUZTWgRSY yrW8FJT7oXU6pfCvr3QFsE6gJrUBMCXaEkAgEwnQPIJloSdanCvVTt8vdhNhTT6n kY5OWzSCjSZ3CJRI32KraqYRxiqcY+Qw+wg+hCZMMsR/lpx9kQyp0Ne+4HX2AeBE M= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Ln5Pd4 0dt/9fcznlnKEHs82pLi2MXOdBcNBBuJOH4Ks=; b=VExLAmnTyOgh/GdwKsWMYb 5G5y5TXL0IYREp0dag1lduxddxFIAS2r0AwL/9ZCJ5csrRjnuz9GNQL/zbMFSRuV colBPeP/HYfJ+lfM+EC9fO+/bzZQTPGrNPgVV2liUQ9bi3EXYjabqD4u+0ChE08N lAuHkJqk2Msg1LC0c0yHOKmDQp5wKm8k57PK5AGCgILuiu2oD6K045vghIMyKw2S KTmdeyzaOyj6ASeVa4KzQ4bWwpKjYGsU0JkWSQxRHTwRynxYrkqiCfBEmjhIE630 SrcOZ0jiQSCw00x/vRySLiafQR/+to7WyQpQTiGZxvIlJMT5S2QV/YnC5MM/pw+Q == X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 1EF7F24A6F; Mon, 23 Oct 2017 18:20:58 -0400 (EDT) From: Thomas Monjalon To: Ferruh Yigit Cc: dev@dpdk.org, Ivan Malov , Harry Van Haaren , Lee Daly Date: Tue, 24 Oct 2017 00:20:56 +0200 Message-ID: <5793948.vro8kvxJTo@xps> In-Reply-To: <20171020000351.57868-2-ferruh.yigit@intel.com> References: <20171020000351.57868-1-ferruh.yigit@intel.com> <20171020000351.57868-2-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH 2/3] ethdev: fix xstats get by id APIS X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 22:20:59 -0000 20/10/2017 02:03, Ferruh Yigit: > ethdev xstat get by id APIs: > rte_eth_xstats_get_names_by_id() > rte_eth_xstats_get_by_id() > > Works on ids calculated as "basic stats + device specific stats" > > When an application asking for id less than "basic stats count", it is > indeed asking basic stats nothing specific to device stats. > > The dev_ops PMDs implements xstats_get_names_by_id and xstats_get_by_id > works on device specific ids. > > This patch adds a check if all stats requested by ids can be provided > via device and if so converts ids to device specific ones. > > This conversion wasn't required before commit 8c49d5f1c219, because > _by_id dev_ops were always used to get whole stats instead of specific > ids. > > Fixes: 8c49d5f1c219 ("ethdev: rework xstats retrieve by id") It would be easier to understand if starting with a statement of bug. > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -1644,6 +1644,7 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id, > uint64_t *ids) > { > struct rte_eth_xstat_name *xstats_names_copy; > + unsigned int all_ids_from_pmd = 1; This variable would be better renamed as "no_basic_stat_requested". > + ids_copy[i] = ids[i] - basic_count; This line may deserve a comment.