]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/mlx5e: Report hw_gso_packets and hw_gso_bytes netdev stats
authorGal Pressman <gal@nvidia.com>
Mon, 4 May 2026 18:37:01 +0000 (21:37 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 7 May 2026 01:38:57 +0000 (18:38 -0700)
Report hardware GSO statistics via the netdev queue stats API by mapping
the existing TSO counters to hw_gso_packets and hw_gso_bytes fields.

Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260504183704.272322-3-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index 5a46870c4b749e7134323b157ed40282505fc1b3..f3a936d5a62db28d757dd393108fa9aa6a0bedd3 100644 (file)
@@ -5518,6 +5518,10 @@ static void mlx5e_get_queue_stats_tx(struct net_device *dev, int i,
        sq_stats = priv->txq2sq_stats[i];
        stats->packets = sq_stats->packets;
        stats->bytes = sq_stats->bytes;
+
+       stats->hw_gso_packets =
+               sq_stats->tso_packets + sq_stats->tso_inner_packets;
+       stats->hw_gso_bytes = sq_stats->tso_bytes + sq_stats->tso_inner_bytes;
 }
 
 static void mlx5e_get_base_stats(struct net_device *dev,
@@ -5557,6 +5561,8 @@ static void mlx5e_get_base_stats(struct net_device *dev,
 
        tx->packets = 0;
        tx->bytes = 0;
+       tx->hw_gso_packets = 0;
+       tx->hw_gso_bytes = 0;
 
        for (i = 0; i < priv->stats_nch; i++) {
                struct mlx5e_channel_stats *channel_stats = priv->channel_stats[i];
@@ -5583,6 +5589,10 @@ static void mlx5e_get_base_stats(struct net_device *dev,
 
                        tx->packets += sq_stats->packets;
                        tx->bytes += sq_stats->bytes;
+                       tx->hw_gso_packets += sq_stats->tso_packets +
+                                             sq_stats->tso_inner_packets;
+                       tx->hw_gso_bytes += sq_stats->tso_bytes +
+                                           sq_stats->tso_inner_bytes;
                }
        }
 
@@ -5601,6 +5611,10 @@ static void mlx5e_get_base_stats(struct net_device *dev,
 
                        tx->packets += sq_stats->packets;
                        tx->bytes   += sq_stats->bytes;
+                       tx->hw_gso_packets += sq_stats->tso_packets +
+                                             sq_stats->tso_inner_packets;
+                       tx->hw_gso_bytes += sq_stats->tso_bytes +
+                                           sq_stats->tso_inner_bytes;
                }
        }
 }