From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id C361A1B206 for ; Wed, 11 Oct 2017 20:33:03 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 11 Oct 2017 11:33:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,362,1503385200"; d="scan'208";a="909004872" Received: from unknown (HELO [10.241.225.21]) ([10.241.225.21]) by FMSMGA003.fm.intel.com with ESMTP; 11 Oct 2017 11:33:02 -0700 To: Lee Daly , thomas@monjalon.net Cc: dev@dpdk.org References: <20171011072208.137243-1-lee.daly@intel.com> From: Ferruh Yigit Message-ID: <4936d1b1-c689-7247-4672-621da7075b3a@intel.com> Date: Wed, 11 Oct 2017 19:33:02 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171011072208.137243-1-lee.daly@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] ethdev: fix xstats retrieve by id API 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: Wed, 11 Oct 2017 18:33:04 -0000 On 10/11/2017 8:22 AM, Lee Daly wrote: > From: Lee > > Fix xstats functions, rte_eth_xstats_get_names_by_id() > and rte_eth_xstats_get_by_id(), in current implementation > ethdev level reads all xstat values and filters out > the ones requested by the application. This behavior doesn't > benefit from PMD ops and doesn't provide the benefit the > API was created in the first place for. APIs are also unnecessarily > complicated. Both APIs have different returns for the same params. > > In this fix, instead of reading all the stats and finding the > requested value, drivers can provide ops to get selected xstats. > API no longer crashes with certain params, > > rte_eth_get_by_id returned seg fault with > "ids = NULL && values != NULL && n rte_eth_get_names_by_id returned seg fault with > "ids = NULL && values != NULL && n=0” > These now return max number of stats available, matching the other API. > > rte_eth_get_by_id returned seg fault with > "ids != NULL && values = NULL && n This now returns -22,(EINVAL). > > Standardized variable/parameter names between the 2 APIs. > > Overall code complexity reduced. Fixes: 79c913a42f0e ("ethdev: retrieve xstats by ID") Cc: kubax.kozak@intel.com > > Signed-off-by: Lee Please use full name: Signed-off-by: Lee Daly <...> > @@ -2472,7 +2472,7 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id, > * - A negative value on error (invalid port id). > */ > int rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids, > - uint64_t *values, unsigned int n); > + uint64_t *values, unsigned int size); Function doxygen comment also should be updated to reflect this, otherwise giving a warning. > > /** > * Gets the ID of a statistic from its name. > Except above issues: Reviewed-by: Ferruh Yigit Can you please send a new version addressing above issues, feel free to keep review tag. Thanks, ferruh