From: Gal Pressman <gal@nvidia.com>
Report TX checksum statistics via the netdev queue stats API by mapping
the existing csum_none and csum_partial counters to the csum_none and
needs_csum fields.
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index f20fec154d47..e2f98b1f8636 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -5488,6 +5488,10 @@ static void mlx5e_get_queue_stats_tx(struct net_device *dev, int i,
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;
+
+ stats->csum_none = sq_stats->csum_none;
+ stats->needs_csum =
+ sq_stats->csum_partial + sq_stats->csum_partial_inner;
}
static void mlx5e_get_base_stats(struct net_device *dev,
@@ -5538,6 +5542,8 @@ static void mlx5e_get_base_stats(struct net_device *dev,
tx->bytes = 0;
tx->hw_gso_packets = 0;
tx->hw_gso_bytes = 0;
+ tx->csum_none = 0;
+ tx->needs_csum = 0;
for (i = 0; i < priv->stats_nch; i++) {
struct mlx5e_channel_stats *channel_stats = priv->channel_stats[i];
@@ -5568,6 +5574,9 @@ static void mlx5e_get_base_stats(struct net_device *dev,
sq_stats->tso_inner_packets;
tx->hw_gso_bytes += sq_stats->tso_bytes +
sq_stats->tso_inner_bytes;
+ tx->csum_none += sq_stats->csum_none;
+ tx->needs_csum += sq_stats->csum_partial +
+ sq_stats->csum_partial_inner;
}
}
@@ -5590,6 +5599,9 @@ static void mlx5e_get_base_stats(struct net_device *dev,
sq_stats->tso_inner_packets;
tx->hw_gso_bytes += sq_stats->tso_bytes +
sq_stats->tso_inner_bytes;
+ tx->csum_none += sq_stats->csum_none;
+ tx->needs_csum += sq_stats->csum_partial +
+ sq_stats->csum_partial_inner;
}
}
}
--
2.44.0
On Mon, 9 Mar 2026 11:55:17 +0200 Tariq Toukan wrote:
> Report TX checksum statistics via the netdev queue stats API by mapping
> the existing csum_none and csum_partial counters to the csum_none and
> needs_csum fields.
-
name: tx-needs-csum
doc: |
Number of packets that required the device to calculate the checksum.
This counter includes the number of GSO wire packets for which device
calculated the L4 checksum.
type: uint
Looking at drivers currently implementing this it seems like the idea
was to avoid having to increment two counters in the drivers, given
that TSO always implies csum offload
On 11/03/2026 5:18, Jakub Kicinski wrote: > On Mon, 9 Mar 2026 11:55:17 +0200 Tariq Toukan wrote: >> Report TX checksum statistics via the netdev queue stats API by mapping >> the existing csum_none and csum_partial counters to the csum_none and >> needs_csum fields. > > - > name: tx-needs-csum > doc: | > Number of packets that required the device to calculate the checksum. > This counter includes the number of GSO wire packets for which device > calculated the L4 checksum. > type: uint Yea, we count GSO packets as one, so not a direct fit. > > Looking at drivers currently implementing this it seems like the idea > was to avoid having to increment two counters in the drivers, given > that TSO always implies csum offload I don't think I understand what you're trying to say here.
On Thu, 12 Mar 2026 11:50:10 +0200 Gal Pressman wrote: > > Looking at drivers currently implementing this it seems like the idea > > was to avoid having to increment two counters in the drivers, given > > that TSO always implies csum offload > > I don't think I understand what you're trying to say here. The existing drivers seem to do something like: tx->needs_csum += just_csum + tso_segs; IOW for packets that need tso/uso they don't increment any csum stat on the fastpath.
© 2016 - 2026 Red Hat, Inc.