[PATCH net-next 3/5] net/mlx5e: Report TX csum netdev stats

From: Tariq Toukan

Date: Wed Feb 04 2026 - 14:34:41 EST


From: Gal Pressman <gal@xxxxxxxxxx>

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@xxxxxxxxxx>
Reviewed-by: Dragos Tatulea <dtatulea@xxxxxxxxxx>
Signed-off-by: Tariq Toukan <tariqt@xxxxxxxxxx>
---
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 774a2e32d5f9..8c4ab3f81bbc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -5558,6 +5558,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,
@@ -5605,6 +5609,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];
@@ -5635,6 +5641,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;
}
}

@@ -5657,6 +5666,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