uint32_t i;
int ret;
- if (ids == NULL || size < cnt_stats)
+ if (ids == NULL && values == NULL)
return cnt_stats;
+ if (ids == NULL)
+ if (size < cnt_stats)
+ return cnt_stats;
+
/* Update tqp stats by read register */
ret = hns3_update_tqp_stats(hw);
if (ret) {
return -EINVAL;
}
+ if (ids == NULL && values != NULL) {
+ for (i = 0; i < cnt_stats; i++)
+ memcpy(&values[i], &values_copy[i].value,
+ sizeof(values[i]));
+
+ rte_free(values_copy);
+ return cnt_stats;
+ }
+
for (i = 0; i < size; i++) {
if (ids[i] >= cnt_stats) {
hns3_err(hw, "ids[%u] (%" PRIx64 ") is invalid, "
uint64_t len;
uint32_t i;
- if (ids == NULL || xstats_names == NULL)
+ if (xstats_names == NULL)
return cnt_stats;
+ if (ids == NULL) {
+ if (size < cnt_stats)
+ return cnt_stats;
+
+ return hns3_dev_xstats_get_names(dev, xstats_names, cnt_stats);
+ }
+
len = cnt_stats * sizeof(struct rte_eth_xstat_name);
names_copy = rte_zmalloc("hns3_xstats_names", len, 0);
if (names_copy == NULL) {