| 307 | } |
| 308 | |
| 309 | static int |
| 310 | cpfl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) |
| 311 | { |
| 312 | struct cpfl_vport *cpfl_vport = dev->data->dev_private; |
| 313 | struct idpf_vport *vport = &cpfl_vport->base; |
| 314 | struct virtchnl2_vport_stats *pstats = NULL; |
| 315 | int ret; |
| 316 | |
| 317 | ret = idpf_vc_stats_query(vport, &pstats); |
| 318 | if (ret == 0) { |
| 319 | uint8_t crc_stats_len = (dev->data->dev_conf.rxmode.offloads & |
| 320 | RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? 0 : |
| 321 | RTE_ETHER_CRC_LEN; |
| 322 | |
| 323 | idpf_vport_stats_update(&vport->eth_stats_offset, pstats); |
| 324 | stats->ipackets = pstats->rx_unicast + pstats->rx_multicast + |
| 325 | pstats->rx_broadcast; |
| 326 | stats->opackets = pstats->tx_broadcast + pstats->tx_multicast + |
| 327 | pstats->tx_unicast; |
| 328 | stats->imissed = pstats->rx_discards; |
| 329 | stats->ierrors = pstats->rx_errors; |
| 330 | stats->oerrors = pstats->tx_errors + pstats->tx_discards; |
| 331 | stats->ibytes = pstats->rx_bytes; |
| 332 | stats->ibytes -= stats->ipackets * crc_stats_len; |
| 333 | stats->obytes = pstats->tx_bytes; |
| 334 | |
| 335 | dev->data->rx_mbuf_alloc_failed = cpfl_get_mbuf_alloc_failed_stats(dev); |
| 336 | stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed; |
| 337 | } else { |
| 338 | PMD_DRV_LOG(ERR, "Get statistics failed"); |
| 339 | } |
| 340 | return ret; |
| 341 | } |
| 342 | |
| 343 | static void |
| 344 | cpfl_reset_mbuf_alloc_failed_stats(struct rte_eth_dev *dev) |
nothing calls this directly
no test coverage detected