[PATCH 1/3] ethdev: fix telemetry xstats return null with some PMDs
fengchengwen
fengchengwen at huawei.com
Sun Apr 24 05:44:59 CEST 2022
The root cause is: when the xstats is NULL and n less than required number of
elements is zero, the return value of rte_eth_xstats_get is ambiguous from
rte_ethdev.h's declaration.
But the implementation of rte_eth_xstats_get return required number of elements
when xstats is NULL and n less than required number of elements.
There are two modification schemes:
a) the value of xstats cannot be NULL, and the value of n must be greater than
or equal to the required number, otherwise, an error code is returned.
b) define the behavior as the same as rte_eth_xstats_get_names, which means return
required number of elelement when xstats is NULL and n less than required number
of elements.
I prefer the scheme a because rte_eth_xstats_get and rte_eth_xstats_get_name are
symbiotic, and it's not necessary to both implement the same logic.
Also for scheme a, there is no need to modify the PMD implementation.
What about your opinions ?
On 2022/4/21 14:49, Andrew Rybchenko wrote:
> On 4/16/22 04:38, Stephen Hemminger wrote:
>> On Sat, 16 Apr 2022 09:07:45 +0800
>> Chengwen Feng <fengchengwen at huawei.com> wrote:
>>
>>> Currently the telemetry xstats uses rte_eth_xstats_get() to retrieve
>>> the number of elements. But the value to be returned when the parameter
>>> 'xstats' is NULL is not specified, some PMDs (eg. hns3/ipn3ke/mvpp2/
>>> axgbe) return zero while others return the required number of elements.
>>
>> Lets fix the PMD's this impacts other code as well.
>
> +1
>
> .
More information about the dev
mailing list