]> git.droids-corp.org - dpdk.git/commit
net/hns3: fix xstats get return if xstats is null
authorChengwen Feng <fengchengwen@huawei.com>
Fri, 13 May 2022 02:53:51 +0000 (10:53 +0800)
committerAndrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Fri, 20 May 2022 14:45:42 +0000 (16:45 +0200)
commite15401f362779dba8623b4ee3db388fdf79dca7f
treecc52028a06e84d96b4af9ed5996d6001a4de65db
parentb8fcb65c084c84650372fbf460b1740e7a801dc8
net/hns3: fix xstats get return if xstats is null

Many user (e.g. telemetry) invokes rte_eth_xstats_get(port_id, NULL, 0)
to retrieve the required number of elements, but currently hns3 PMD
returns zero when xstats is null.

Dedicated check for xstats vs null is not required, since ethdev layer
guarantees that it may be null only if number of entries n is 0 (which
is definitely smaller than total xstats count).

Fixes: 8839c5e202f3 ("net/hns3: support device stats")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
drivers/net/hns3/hns3_stats.c