[dpdk-dev] [PATCH v12 1/6] lib: add information metrics library
Pattan, Reshma
reshma.pattan at intel.com
Tue Mar 28 16:14:18 CEST 2017
Hi,
Few nits below.
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Remy Horton
> Sent: Monday, March 27, 2017 9:22 PM
> To: dev at dpdk.org
> Cc: Thomas Monjalon <thomas.monjalon at 6wind.com>
> Subject: [dpdk-dev] [PATCH v12 1/6] lib: add information metrics library
>
> diff --git a/doc/guides/rel_notes/release_17_02.rst
> b/doc/guides/rel_notes/release_17_02.rst
> index 357965a..8bd706f 100644
> --- a/doc/guides/rel_notes/release_17_02.rst
> +++ b/doc/guides/rel_notes/release_17_02.rst
> @@ -368,6 +368,7 @@ The libraries prepended with a plus sign were
> incremented in this version.
> librte_mbuf.so.2
> librte_mempool.so.2
> librte_meter.so.1
> + + librte_metrics.so.1
This change should go in release_17_05.rst.
> a/lib/librte_metrics/Makefile b/lib/librte_metrics/Makefile new file mode
> 100644 index 0000000..8d6e23a
> --- /dev/null
> +++ b/lib/librte_metrics/Makefile
> @@ -0,0 +1,51 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2016 Intel Corporation. All rights reserved.
> +# All rights reserved.
> +#
Year 2017, and same for some other files too.
> +
> +include $(RTE_SDK)/mk/rte.vars.mk
> +
> +# library name
> +LIB = librte_metrics.a
> +
> +CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
How about adding -O3 to flags?
>int
>rte_metrics_update_values(int port_id,
> uint16_t key,
> const uint64_t *values,
> uint32_t count)
>{
How about adding Null check of values .
> +int
> +rte_metrics_get_names(struct rte_metric_name *names,
> + uint16_t capacity)
> +{
> + struct rte_metrics_data_s *stats;
> + const struct rte_memzone *memzone;
> + uint16_t idx_name;
> + int return_value;
> +
> + memzone = rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME);
> + /* If not allocated, fail silently */
> + if (memzone == NULL)
> + return 0;
> +
> + stats = memzone->addr;
> + rte_spinlock_lock(&stats->lock);
> + if (names != NULL) {
You can check names == NULL at memzone check and return instead of doing that inside lock?
> +
> +int
> +rte_metrics_get_values(int port_id,
> + struct rte_metric_value *values,
> + uint16_t capacity)
> +{
> + struct rte_metrics_meta_s *entry;
> + struct rte_metrics_data_s *stats;
> + const struct rte_memzone *memzone;
> + uint16_t idx_name;
> + int return_value;
> +
> + if (port_id != RTE_METRICS_GLOBAL &&
> + (port_id < 0 || port_id > RTE_MAX_ETHPORTS))
> + return -EINVAL;
> +
> + memzone = rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME);
> + /* If not allocated, fail silently */
> + if (memzone == NULL)
> + return 0;
> + stats = memzone->addr;
> + rte_spinlock_lock(&stats->lock);
> +
> + if (values != NULL) {
Can we have values == NULL check along with memzone and return? Then remove this if check here?
> + * - -ENOMEM: Error, maximum metrics reached */ int
> +rte_metrics_reg_name(const char *name);
> +
> +/**
> + * Register a set of metrics.
> + *
> + * This is a bulk version of rte_metrics_reg_metrics() and aside from
Is that rte_metrics_reg_name().
> + *
> + * @return
> + * - -ERANGE if count exceeds metric set size
> + * - -EIO if upable to access shared metrics memory
Typo unable
Thanks,
Reshma
More information about the dev
mailing list