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