From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v3 01/10] rte: change xstats to use integer ids Date: Wed, 08 Jun 2016 11:37:47 +0200 Message-ID: <2437213.nzTWdctYcm@xps13> References: <1464605292-4599-1-git-send-email-remy.horton@intel.com> <1464605292-4599-2-git-send-email-remy.horton@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Remy Horton Return-path: Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id 3CF2095DC for ; Wed, 8 Jun 2016 11:37:49 +0200 (CEST) Received: by mail-wm0-f46.google.com with SMTP id v199so55010928wmv.0 for ; Wed, 08 Jun 2016 02:37:49 -0700 (PDT) In-Reply-To: <1464605292-4599-2-git-send-email-remy.horton@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2016-05-30 11:48, Remy Horton: > struct rte_eth_xstats { > + /* FIXME: Remove name[] once remaining drivers converted */ > char name[RTE_ETH_XSTATS_NAME_SIZE]; What is the plan? This field must be deprecated with an attribute. We cannot have 2 different APIs depending of the driver. What are the remaining drivers to convert? > + uint64_t id; > uint64_t value; > }; > > +/** > + * A name-key lookup element for extended statistics. > + * > + * This structure is used to map between names and ID numbers > + * for extended ethernet statistics. > + */ > +struct rte_eth_xstats_name { > + char name[RTE_ETH_XSTATS_NAME_SIZE]; > + uint64_t id; > +}; This structure and the other one (rte_eth_xstats) are badly named. There is only one stat in each. So they should not have the plural form. rte_eth_xstat and rte_eth_xstat_name would be better. [...] > /** > + * Retrieve names of extended statistics of an Ethernet device. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param ptr_names > + * Block of memory to insert names into. Must be at least limit in size. "xstat_names" would be a better name than "ptr_names". We don't use ptr in the variable names because it doesn't really convey a semantic information. > + * @param limit > + * Capacity of ptr_strings (number of names). We are more used to "size" than "limit". > + * @return > + * If successful, number of statistics; negative on error. > + */ > +int rte_eth_xstats_names(uint8_t port_id, struct rte_eth_xstats_name *ptr_names, Why not rte_eth_xstats_get_names? > + unsigned limit); A (double) indent tab is missing. > + > +/** > + * Retrieve number of extended statistics of an Ethernet device. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @return > + * If successful, number of statistics; negative on error. > + */ > +int rte_eth_xstats_count(uint8_t port_id); This function is useless because we can have the count with rte_eth_xstats_get(p, NULL, 0) By the way it would be more consistent to have the same behaviour in rte_eth_xstats_names().