From mboxrd@z Thu Jan 1 00:00:00 1970 From: Remy Horton Subject: Re: [PATCH v12 1/6] lib: add information metrics library Date: Tue, 28 Mar 2017 16:00:32 +0100 Message-ID: References: <1490646097-27803-1-git-send-email-remy.horton@intel.com> <1490646097-27803-2-git-send-email-remy.horton@intel.com> <3AEA2BF9852C6F48A459DA490692831F0112D6FE@irsmsx110.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: Thomas Monjalon To: "Pattan, Reshma" , "dev@dpdk.org" Return-path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 6ED0ECF8A for ; Tue, 28 Mar 2017 17:00:36 +0200 (CEST) In-Reply-To: <3AEA2BF9852C6F48A459DA490692831F0112D6FE@irsmsx110.ger.corp.intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 28/03/2017 15:14, Pattan, Reshma wrote: [..] >> + >> +include $(RTE_SDK)/mk/rte.vars.mk >> + >> +# library name >> +LIB = librte_metrics.a >> + >> +CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) > > How about adding -O3 to flags? Off the top of my mind, I think such flags are added to CFLAGS separately. I think optimisation flags probably shouldn't be set at third-level makefiles such as this one. >> +int >> +rte_metrics_get_names(struct rte_metric_name *names, >> + uint16_t capacity) >> +{ [..] >> + 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? Since the names==NULL case still requires accessing of the protected memory to get the name count, don't see any gain in doing so. >> + >> +int >> +rte_metrics_get_values(int port_id, >> + struct rte_metric_value *values, >> + uint16_t capacity) >> +{ [..] >> + if (values != NULL) { > > Can we have values == NULL check along with memzone and return? Then remove this if check here? Same as rte_metrics_get_names() above. Other changes noted. Will send out v12 either tonight or tomorrow.