Jakub Kicinski <[email protected]> writes:

> Real devices should implement qstats. Devices which support
> pause or FEC configuration should also report the relevant stats.
>
> nsim was missing FEC stats completely, some of the qstats
> and pause stats required toggling a debugfs knob.
>
> Note that the tests which used pause always initialize the setting
> so they shouldn't be affected by the different starting value.
>
> Signed-off-by: Jakub Kicinski <[email protected]>

Reviewed-by: Petr Machata <[email protected]>

Just:

> @@ -330,6 +331,49 @@ static const struct net_device_ops nsim_vf_netdev_ops = {
>       .ndo_set_features       = nsim_set_features,
>  };
>  
> +/* We don't have true par-queue stats, yet, so do some random fakery here. */

per

> +static void nsim_get_queue_stats_rx(struct net_device *dev, int idx,
> +                                 struct netdev_queue_stats_rx *stats)
> +{
> +     struct rtnl_link_stats64 rtstats = {};
> +
> +     nsim_get_stats64(dev, &rtstats);
> +
> +     stats->packets = rtstats.rx_packets - !!rtstats.rx_packets;

This is just to make sure that per-queue stats are lower than the
overall rtstats I presume?

> +     stats->bytes = rtstats.rx_bytes;
> +}
> +
> +static void nsim_get_queue_stats_tx(struct net_device *dev, int idx,
> +                                 struct netdev_queue_stats_tx *stats)
> +{
> +     struct rtnl_link_stats64 rtstats = {};
> +
> +     nsim_get_stats64(dev, &rtstats);
> +
> +     stats->packets = rtstats.tx_packets - !!rtstats.tx_packets;
> +     stats->bytes = rtstats.tx_bytes;
> +}

Reply via email to