[dpdk-dev] [PATCH v2 5/6] rte_sched: allow reading statistics without clearing

Stephen Hemminger stephen at networkplumber.org
Fri Mar 13 00:06:26 CET 2015


On Thu, 12 Mar 2015 19:28:11 +0000
"Dumitrescu, Cristian" <cristian.dumitrescu at intel.com> wrote:

> Hi Stephen,
> 
> Thank you for adding flexibility over clearing the stats or not.
> 
> I have one concern though: why change the stats read API to add a clear parameter rather than keep prototype for the stats functions unchanged and add the flag as part of the port creation parameters in struct rte_sched_port_params? This parameter could be saved into the internal struct rte_sched_port, which is passed (as a pointer) to the stats read functions. In my opinion, this approach is slightly more elegant and it keeps the changes to a minimum.
> 
> int
> rte_sched_queue_read_stats(struct rte_sched_port *port,
> 	uint32_t queue_id,
> 	struct rte_sched_queue_stats *stats,
> 	uint16_t *qlen)
> {
> 	...
> 	if (port->clear_stats_on_read)
> 		memset(...);
> }
> 
> I made this suggestion during the previous round, but I did not get any opinion from you on it yet.
> 
> Regards,
> Cristian

I rejected the config parameter idea because I don't like it is inconsistent
with other statistics in DPDK and in related software. There is not a
config parameter that changes what BSD or Linux kernel API does.

The only reason for keeping the read and clear in one operation is
because you like it, and there are somebody might have built code
that expects it.

Changing the function signature is a nice red flag so that people will
notice at change.



More information about the dev mailing list