From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 7AD3F567F for ; Tue, 28 Mar 2017 16:14:21 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP; 28 Mar 2017 07:14:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,236,1486454400"; d="scan'208";a="81495524" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by fmsmga005.fm.intel.com with ESMTP; 28 Mar 2017 07:14:19 -0700 Received: from irsmsx110.ger.corp.intel.com ([169.254.15.151]) by IRSMSX106.ger.corp.intel.com ([169.254.8.202]) with mapi id 14.03.0319.002; Tue, 28 Mar 2017 15:14:19 +0100 From: "Pattan, Reshma" To: "Horton, Remy" , "dev@dpdk.org" CC: Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH v12 1/6] lib: add information metrics library Thread-Index: AQHSpzfgxZP6HFEr7UGRhp3/wJzC/6Gp9e9w Date: Tue, 28 Mar 2017 14:14:18 +0000 Message-ID: <3AEA2BF9852C6F48A459DA490692831F0112D6FE@irsmsx110.ger.corp.intel.com> References: <1490646097-27803-1-git-send-email-remy.horton@intel.com> <1490646097-27803-2-git-send-email-remy.horton@intel.com> In-Reply-To: <1490646097-27803-2-git-send-email-remy.horton@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGQ5ZjAxMTctYWQ1Yi00MWFiLThlMjQtZmI4YzY2NzAzZWI2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Ik4xUFZOdmxUMGpZUGpWNVp4RGxFTFQ1YTVGdnByVGZaQW1VYllZTksyYms9In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v12 1/6] lib: add information metrics library 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: Tue, 28 Mar 2017 14:14:22 -0000 Hi, Few nits below. > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Remy Horton > Sent: Monday, March 27, 2017 9:22 PM > To: dev@dpdk.org > Cc: Thomas Monjalon > Subject: [dpdk-dev] [PATCH v12 1/6] lib: add information metrics library >=20 > 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.=20 > 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 =3D librte_metrics.a > + > +CFLAGS +=3D $(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 =3D rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME); > + /* If not allocated, fail silently */ > + if (memzone =3D=3D NULL) > + return 0; > + > + stats =3D memzone->addr; > + rte_spinlock_lock(&stats->lock); > + if (names !=3D NULL) { You can check names =3D=3D NULL at memzone check and return instead of doin= g 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 !=3D RTE_METRICS_GLOBAL && > + (port_id < 0 || port_id > RTE_MAX_ETHPORTS)) > + return -EINVAL; > + > + memzone =3D rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME); > + /* If not allocated, fail silently */ > + if (memzone =3D=3D NULL) > + return 0; > + stats =3D memzone->addr; > + rte_spinlock_lock(&stats->lock); > + > + if (values !=3D NULL) { Can we have values =3D=3D NULL check along with memzone and return? Then r= emove 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