| 338 | } |
| 339 | |
| 340 | static int idpf_dev_xstats_get(struct rte_eth_dev *dev, |
| 341 | struct rte_eth_xstat *xstats, unsigned int n) |
| 342 | { |
| 343 | struct idpf_vport *vport = |
| 344 | (struct idpf_vport *)dev->data->dev_private; |
| 345 | struct virtchnl2_vport_stats *pstats = NULL; |
| 346 | unsigned int i; |
| 347 | int ret; |
| 348 | |
| 349 | if (n < IDPF_NB_XSTATS) |
| 350 | return IDPF_NB_XSTATS; |
| 351 | |
| 352 | if (!xstats) |
| 353 | return 0; |
| 354 | |
| 355 | ret = idpf_vc_stats_query(vport, &pstats); |
| 356 | if (ret) { |
| 357 | PMD_DRV_LOG(ERR, "Get statistics failed"); |
| 358 | return 0; |
| 359 | } |
| 360 | |
| 361 | idpf_vport_stats_update(&vport->eth_stats_offset, pstats); |
| 362 | |
| 363 | /* loop over xstats array and values from pstats */ |
| 364 | for (i = 0; i < IDPF_NB_XSTATS; i++) { |
| 365 | xstats[i].id = i; |
| 366 | xstats[i].value = *(uint64_t *)(((char *)pstats) + |
| 367 | rte_idpf_stats_strings[i].offset); |
| 368 | } |
| 369 | return IDPF_NB_XSTATS; |
| 370 | } |
| 371 | |
| 372 | static int idpf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, |
| 373 | struct rte_eth_xstat_name *xstats_names, |
nothing calls this directly
no test coverage detected