Re: [PATCH v3 01/10] rte: change xstats to use integer ids
From: Thomas Monjalon <hidden>
Date: 2016-06-08 09:37:49
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().