On Wed, 25 Oct 2017 22:37:35 -0700, Felix Manlunas wrote:
> +static const char lio_vf_rep_stats_strings[][ETH_GSTRING_LEN] = {
> +     "rx_packets",
> +     "tx_packets",
> +     "rx_bytes",
> +     "tx_bytes",
> +     "rx_dropped",
> +     "tx_dropped",
> +};
> +
> [...]
> +
> +static void
> +lio_vf_rep_get_ethtool_stats(struct net_device *ndev,
> +                          struct ethtool_stats *stats,
> +                          u64 *data)
> +{
> +     struct rtnl_link_stats64 *stats_ptr, net_stats;
> +     int i = 0;
> +
> +     stats_ptr = dev_get_stats(ndev, &net_stats);
> +
> +     data[i++] = stats_ptr->rx_packets;
> +     data[i++] = stats_ptr->tx_packets;
> +     data[i++] = stats_ptr->rx_bytes;
> +     data[i++] = stats_ptr->tx_bytes;
> +     data[i++] = stats_ptr->rx_dropped;
> +     data[i++] = stats_ptr->tx_dropped;
> +}

Duplicating basic netdev stats in ethtool is discouraged these days.

Reply via email to