[dpdk-dev] [PATCH v12 1/6] lib: add information metrics library

Remy Horton remy.horton at intel.com
Tue Mar 28 17:00:32 CEST 2017


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.



More information about the dev mailing list