* DPDK callback to get device statistics. * * @param dev * Pointer to Ethernet device structure. * @param stats * Stats structure output buffer. * * @return * 0 on success, negative error value otherwise. */
| 711 | * 0 on success, negative error value otherwise. |
| 712 | */ |
| 713 | static int |
| 714 | mvneta_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) |
| 715 | { |
| 716 | struct mvneta_priv *priv = dev->data->dev_private; |
| 717 | struct neta_ppio_statistics ppio_stats; |
| 718 | unsigned int ret; |
| 719 | |
| 720 | if (!priv->ppio) |
| 721 | return -EPERM; |
| 722 | |
| 723 | ret = neta_ppio_get_statistics(priv->ppio, &ppio_stats); |
| 724 | if (unlikely(ret)) { |
| 725 | MVNETA_LOG(ERR, "Failed to update port statistics"); |
| 726 | return ret; |
| 727 | } |
| 728 | |
| 729 | stats->ipackets += ppio_stats.rx_packets + |
| 730 | ppio_stats.rx_broadcast_packets + |
| 731 | ppio_stats.rx_multicast_packets - |
| 732 | priv->prev_stats.ipackets; |
| 733 | stats->opackets += ppio_stats.tx_packets + |
| 734 | ppio_stats.tx_broadcast_packets + |
| 735 | ppio_stats.tx_multicast_packets - |
| 736 | priv->prev_stats.opackets; |
| 737 | stats->ibytes += ppio_stats.rx_bytes - priv->prev_stats.ibytes; |
| 738 | stats->obytes += ppio_stats.tx_bytes - priv->prev_stats.obytes; |
| 739 | stats->imissed += ppio_stats.rx_discard + |
| 740 | ppio_stats.rx_overrun - |
| 741 | priv->prev_stats.imissed; |
| 742 | stats->ierrors = ppio_stats.rx_packets_err - |
| 743 | priv->prev_stats.ierrors; |
| 744 | stats->oerrors = ppio_stats.tx_errors - priv->prev_stats.oerrors; |
| 745 | |
| 746 | return 0; |
| 747 | } |
| 748 | |
| 749 | /** |
| 750 | * DPDK callback to clear device statistics. |
no outgoing calls
no test coverage detected