MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_eth_xstats_get

Function rte_eth_xstats_get

dpdk/lib/ethdev/rte_ethdev.c:3627–3675  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3625}
3626
3627int
3628rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats,
3629 unsigned int n)
3630{
3631 struct rte_eth_dev *dev;
3632 unsigned int count, i;
3633 signed int xcount = 0;
3634 int ret;
3635
3636 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
3637 if (xstats == NULL && n > 0)
3638 return -EINVAL;
3639 dev = &rte_eth_devices[port_id];
3640
3641 count = eth_dev_get_xstats_basic_count(dev);
3642
3643 /* implemented by the driver */
3644 if (dev->dev_ops->xstats_get != NULL) {
3645 /* Retrieve the xstats from the driver at the end of the
3646 * xstats struct.
3647 */
3648 xcount = (*dev->dev_ops->xstats_get)(dev,
3649 (n > count) ? xstats + count : NULL,
3650 (n > count) ? n - count : 0);
3651
3652 if (xcount < 0)
3653 return eth_err(port_id, xcount);
3654 }
3655
3656 if (n < count + xcount || xstats == NULL)
3657 return count + xcount;
3658
3659 /* now fill the xstats structure */
3660 ret = eth_basic_stats_get(port_id, xstats);
3661 if (ret < 0)
3662 return ret;
3663 count = ret;
3664
3665 for (i = 0; i < count; i++)
3666 xstats[i].id = i;
3667 /* add an offset to driver-specific stats */
3668 for ( ; i < count + xcount; i++)
3669 xstats[i].id += count;
3670
3671 for (i = 0; i < n; i++)
3672 rte_eth_trace_xstats_get(port_id, xstats[i]);
3673
3674 return count + xcount;
3675}
3676
3677/* reset ethdev extended statistics */
3678int

Callers 8

rte_eth_xstats_get_by_idFunction · 0.85
__fs_xstats_getFunction · 0.85
hn_vf_xstats_getFunction · 0.85
nic_xstats_displayFunction · 0.85
print_statsFunction · 0.85

Calls 3

eth_errFunction · 0.85
eth_basic_stats_getFunction · 0.85

Tested by

no test coverage detected