From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 28 Mar 2017 08:00:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,236,1486454400"; d="scan'208";a="66009996" Received: from rhorton-mobl1.ger.corp.intel.com (HELO [163.33.230.214]) ([163.33.230.214]) by orsmga002.jf.intel.com with ESMTP; 28 Mar 2017 08:00:34 -0700 To: "Pattan, Reshma" , "dev@dpdk.org" 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> Cc: Thomas Monjalon From: Remy Horton Organization: Intel Shannon Limited Message-ID: Date: Tue, 28 Mar 2017 16:00:32 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <3AEA2BF9852C6F48A459DA490692831F0112D6FE@irsmsx110.ger.corp.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 15:00:37 -0000 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.