On 6/7/2018 9:15 AM, David Marchand wrote: > Testpmd should not expect the xstats names and values arrays to be > aligned: neither the arrays sizes, nor the order in which the values are.
As far as I can see this assumption is everywhere in API implementation: xstats names and values are aligned with same order. The basic stat part of the xstats, implemented in ethdev layer, seems relying on same assumption. Also looks like "xstat size" and "xstat_names size" used interchangeably. And I don't see any case that mentions xstats.id is xstats_name index. cc'ed Harry, to get more information about initial intention. the id value in xstats struct looks like duplication, but other than that, is there any downside of using array index to mach name, value pair? And do we really need another layer of indirection (and complexity) to mach simple name,value key pair in xstats? > > This hid some bugs where pmds would either return wrong values count or > invalid statistics indexes. > > Link: > http://dpdk.org/browse/dpdk/commit/?id=5fd4d049692b2fde8bf49c7461b18180a8fd2545 > Link: http://dpdk.org/dev/patchwork/patch/40705/ > > Signed-off-by: David Marchand <david.march...@6wind.com> > --- > > @stable: when this goes in, I recommend backporting this to all existing > branches, as it makes it easier to show this kind of pmds bugs. <...>