[dpdk-dev] [PATCH v2] net/vhost: add pmd xstats

Van Haaren, Harry harry.van.haaren at intel.com
Fri Sep 9 10:40:45 CEST 2016


Hi Zhiyong,

> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Zhiyong Yang
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v2] net/vhost: add pmd xstats
> 
> +struct vhost_xstats {
> +	uint64_t stat[16];
> +};

Perhaps we could create an enum to access the stat array?

enum VHOST_STAT {
   ...
   VHOST_STAT_64_PKT,
   ...
};

> +	{"broadcast_packets",
> +			offsetof(struct vhost_queue, xstats.stat[8])},

I think the "magic number" 8 here could be from the enum, and would be more clear which statistic is being accessed.

> +		if (pkt_len == 64) {
> +			xstats_update->stat[1]++;

Similarly, incrementing the counters would be more representative if it looked like

xstats_update->stat[VHOST_STAT_64_PKT]++;   /* or similar */

-Harry


More information about the dev mailing list