| 379 | } |
| 380 | |
| 381 | static int cpfl_dev_xstats_get(struct rte_eth_dev *dev, |
| 382 | struct rte_eth_xstat *xstats, unsigned int n) |
| 383 | { |
| 384 | struct cpfl_vport *cpfl_vport = dev->data->dev_private; |
| 385 | struct idpf_vport *vport = &cpfl_vport->base; |
| 386 | struct virtchnl2_vport_stats *pstats = NULL; |
| 387 | unsigned int i; |
| 388 | int ret; |
| 389 | |
| 390 | if (n < CPFL_NB_XSTATS) |
| 391 | return CPFL_NB_XSTATS; |
| 392 | |
| 393 | if (!xstats) |
| 394 | return CPFL_NB_XSTATS; |
| 395 | |
| 396 | ret = idpf_vc_stats_query(vport, &pstats); |
| 397 | if (ret) { |
| 398 | PMD_DRV_LOG(ERR, "Get statistics failed"); |
| 399 | return 0; |
| 400 | } |
| 401 | |
| 402 | idpf_vport_stats_update(&vport->eth_stats_offset, pstats); |
| 403 | |
| 404 | /* loop over xstats array and values from pstats */ |
| 405 | for (i = 0; i < CPFL_NB_XSTATS; i++) { |
| 406 | xstats[i].id = i; |
| 407 | xstats[i].value = *(uint64_t *)(((char *)pstats) + |
| 408 | rte_cpfl_stats_strings[i].offset); |
| 409 | } |
| 410 | return CPFL_NB_XSTATS; |
| 411 | } |
| 412 | |
| 413 | static int cpfl_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, |
| 414 | struct rte_eth_xstat_name *xstats_names, |
nothing calls this directly
no test coverage detected