]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
nfp: include all ring counters in interface stats
authorJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 12 Jun 2018 04:33:36 +0000 (21:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Jun 2018 22:18:28 +0000 (15:18 -0700)
We are gathering software statistics on per-ring basis.
.ndo_get_stats64 handler adds the rings up.  Unfortunately
we are currently only adding up active rings, which means
that if user decreases the number of active rings the
statistics from deactivated rings will no longer be counted
and total interface statistics may go backwards.

Always sum all possible rings, the stats are allocated
statically for max number of rings, so we don't have to
worry about them being removed.  We could add the stats
up when user changes the ring count, but it seems unnecessary..
Adding up inactive rings will be very quick since no datapath
will be touching them.

Fixes: 164d1e9e5d52 ("nfp: add support for ethtool .set_channels")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/nfp_net_common.c

index 75110c8d6a9034ff049d9ff8cf5e9105618fcb76..ed27176c2bce0e7398695ae10fd9bb7461622769 100644 (file)
@@ -3121,7 +3121,7 @@ static void nfp_net_stat64(struct net_device *netdev,
        struct nfp_net *nn = netdev_priv(netdev);
        int r;
 
-       for (r = 0; r < nn->dp.num_r_vecs; r++) {
+       for (r = 0; r < nn->max_r_vecs; r++) {
                struct nfp_net_r_vector *r_vec = &nn->r_vecs[r];
                u64 data[3];
                unsigned int start;