net/mlx5e: Allocate set of queue counters per netdev
[deliverable/linux.git] / drivers / net / ethernet / mellanox / mlx5 / core / en_ethtool.c
index 68834b715f6c114c89d6df339cb9cc81a72b8f75..39c19021d154a4ffd20add078ff3522c5083d282 100644 (file)
@@ -165,6 +165,8 @@ static const struct {
        },
 };
 
+#define MLX5E_NUM_Q_CNTRS(priv) (NUM_Q_COUNTERS * (!!priv->q_counter))
+
 static int mlx5e_get_sset_count(struct net_device *dev, int sset)
 {
        struct mlx5e_priv *priv = netdev_priv(dev);
@@ -172,6 +174,7 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset)
        switch (sset) {
        case ETH_SS_STATS:
                return NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS +
+                      MLX5E_NUM_Q_CNTRS(priv) +
                       priv->params.num_channels * NUM_RQ_STATS +
                       priv->params.num_channels * priv->params.num_tc *
                                                   NUM_SQ_STATS;
@@ -200,6 +203,11 @@ static void mlx5e_get_strings(struct net_device *dev,
                        strcpy(data + (idx++) * ETH_GSTRING_LEN,
                               vport_strings[i]);
 
+               /* Q counters */
+               for (i = 0; i < MLX5E_NUM_Q_CNTRS(priv); i++)
+                       strcpy(data + (idx++) * ETH_GSTRING_LEN,
+                              qcounter_stats_strings[i]);
+
                /* PPORT counters */
                for (i = 0; i < NUM_PPORT_COUNTERS; i++)
                        strcpy(data + (idx++) * ETH_GSTRING_LEN,
@@ -240,6 +248,9 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
        for (i = 0; i < NUM_VPORT_COUNTERS; i++)
                data[idx++] = ((u64 *)&priv->stats.vport)[i];
 
+       for (i = 0; i < MLX5E_NUM_Q_CNTRS(priv); i++)
+               data[idx++] = ((u32 *)&priv->stats.qcnt)[i];
+
        for (i = 0; i < NUM_PPORT_COUNTERS; i++)
                data[idx++] = be64_to_cpu(((__be64 *)&priv->stats.pport)[i]);
 
This page took 0.02604 seconds and 5 git commands to generate.