summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-05-07 04:39:00 +0300
committerJakub Kicinski <kuba@kernel.org>2026-05-07 04:39:01 +0300
commitaf770c4d44b0ebe2f1bd2628cf9fd2a8665574df (patch)
tree615e04631f00df2c629ac3785ab2c115f206c091
parentfea3521e043fa1388ec909205687db7d4b0c57ec (diff)
parent32b7e50e284a816389831bef142de4f7d2d691ee (diff)
downloadlinux-af770c4d44b0ebe2f1bd2628cf9fd2a8665574df.tar.xz
Merge branch 'net-mlx5e-report-more-netdev-stats'
Tariq Toukan says: ==================== net/mlx5e: Report more netdev stats This series by Gal extends the set of counters reported in netdev stats, by adding: - hw_gso_packets/bytes - RX HW-GRO stats - TX csum_none - TX queue stop/wake It also aligns the tso_bytes/tso_inner_bytes counters with the netdev stats API and virtio spec definition. ==================== Link: https://patch.msgid.link/20260504183704.272322-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_main.c42
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tx.c4
2 files changed, 44 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 5a46870c4b74..469e066dc432 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -5500,6 +5500,11 @@ static void mlx5e_get_queue_stats_rx(struct net_device *dev, int i,
stats->bytes = rq_stats->bytes + xskrq_stats->bytes;
stats->alloc_fail = rq_stats->buff_alloc_err +
xskrq_stats->buff_alloc_err;
+
+ stats->hw_gro_packets = rq_stats->gro_skbs + xskrq_stats->gro_skbs;
+ stats->hw_gro_wire_packets =
+ rq_stats->gro_packets + xskrq_stats->gro_packets;
+ stats->hw_gro_wire_bytes = rq_stats->gro_bytes + xskrq_stats->gro_bytes;
}
static void mlx5e_get_queue_stats_tx(struct net_device *dev, int i,
@@ -5518,6 +5523,15 @@ 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;
+
+ stats->csum_none = sq_stats->csum_none;
+
+ stats->stop = sq_stats->stopped;
+ stats->wake = sq_stats->wake;
}
static void mlx5e_get_base_stats(struct net_device *dev,
@@ -5532,6 +5546,9 @@ static void mlx5e_get_base_stats(struct net_device *dev,
rx->packets = 0;
rx->bytes = 0;
rx->alloc_fail = 0;
+ rx->hw_gro_packets = 0;
+ rx->hw_gro_wire_packets = 0;
+ rx->hw_gro_wire_bytes = 0;
for (i = priv->channels.params.num_channels; i < priv->stats_nch; i++) {
struct netdev_queue_stats_rx rx_i = {0};
@@ -5541,6 +5558,9 @@ static void mlx5e_get_base_stats(struct net_device *dev,
rx->packets += rx_i.packets;
rx->bytes += rx_i.bytes;
rx->alloc_fail += rx_i.alloc_fail;
+ rx->hw_gro_packets += rx_i.hw_gro_packets;
+ rx->hw_gro_wire_packets += rx_i.hw_gro_wire_packets;
+ rx->hw_gro_wire_bytes += rx_i.hw_gro_wire_bytes;
}
/* always report PTP RX stats from base as there is no
@@ -5552,11 +5572,19 @@ static void mlx5e_get_base_stats(struct net_device *dev,
rx->packets += rq_stats->packets;
rx->bytes += rq_stats->bytes;
+ rx->hw_gro_packets += rq_stats->gro_skbs;
+ rx->hw_gro_wire_packets += rq_stats->gro_packets;
+ rx->hw_gro_wire_bytes += rq_stats->gro_bytes;
}
}
tx->packets = 0;
tx->bytes = 0;
+ tx->hw_gso_packets = 0;
+ tx->hw_gso_bytes = 0;
+ tx->csum_none = 0;
+ tx->stop = 0;
+ tx->wake = 0;
for (i = 0; i < priv->stats_nch; i++) {
struct mlx5e_channel_stats *channel_stats = priv->channel_stats[i];
@@ -5583,6 +5611,13 @@ 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;
+ tx->csum_none += sq_stats->csum_none;
+ tx->stop += sq_stats->stopped;
+ tx->wake += sq_stats->wake;
}
}
@@ -5601,6 +5636,13 @@ 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;
+ tx->csum_none += sq_stats->csum_none;
+ tx->stop += sq_stats->stopped;
+ tx->wake += sq_stats->wake;
}
}
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 9f0272649fa1..0b5e600e4a6a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -164,14 +164,14 @@ mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb)
else
ihs = skb_inner_tcp_all_headers(skb);
stats->tso_inner_packets++;
- stats->tso_inner_bytes += skb->len - ihs;
+ stats->tso_inner_bytes += skb->len;
} else {
if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
ihs = skb_transport_offset(skb) + sizeof(struct udphdr);
else
ihs = skb_tcp_all_headers(skb);
stats->tso_packets++;
- stats->tso_bytes += skb->len - ihs;
+ stats->tso_bytes += skb->len;
}
return ihs;