Skip to contentSkip to conversation

net: mana: Set tx_packets to post gso processing packet count

PATCH Applied Shradha Gupta 3 participants 3 messages Jun 17, 2025 – Jun 19, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: mana: Set tx_packets to post gso processing packet count

Allow tx_packets and tx_bytes counter in the driver to represent the packets transmitted post GSO processing.

Currently they are populated as bigger pre-GSO packets and bytes

---
 drivers/net/ethernet/microsoft/mana/mana_en.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/microsoft/mana/mana_en.c +7 -3
index e68b8190bb7a..c3b6478cb1d3 100644
@@ -251,10 +251,10 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	struct netdev_queue *net_txq;
 	struct mana_stats_tx *tx_stats;
 	struct gdma_queue *gdma_sq;
+	int err, len, num_gso_seg;
 	unsigned int csum_type;
 	struct mana_txq *txq;
 	struct mana_cq *cq;
-	int err, len;
 
 	if (unlikely(!apc->port_is_up))
 		goto tx_drop;
@@ -407,6 +407,7 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	skb_queue_tail(&txq->pending_skbs, skb);
 
 	len = skb->len;
+	num_gso_seg = skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
 	net_txq = netdev_get_tx_queue(ndev, txq_idx);
 
 	err = mana_gd_post_work_request(gdma_sq, &pkg.wqe_req,
@@ -431,10 +432,13 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	/* skb may be freed after mana_gd_post_work_request. Do not use it. */
 	skb = NULL;
 
+	/* Populated the packet and bytes counters based on post GSO packet
+	 * calculations
+	 */
 	tx_stats = &txq->stats;
 	u64_stats_update_begin(&tx_stats->syncp);
-	tx_stats->packets++;
-	tx_stats->bytes += len;
+	tx_stats->packets += num_gso_seg;
+	tx_stats->bytes += len + ((num_gso_seg - 1) * gso_hs);
 	u64_stats_update_end(&tx_stats->syncp);
 
 tx_busy:

base-commit: 8909f5f4ecd551c2299b28e05254b77424c8c7dc

Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines

-----Original Message-----
From: Shradha Gupta <[email protected]>
Sent: Tuesday, June 17, 2025 7:34 AM
To: Dexuan Cui <[email protected]>; Wei Liu <[email protected]>; Haiyang Zhang <[email protected]>; KY Srinivasan <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Konstantin Taranov <[email protected]>; Souradeep Chakrabarti <[email protected]>; Erni Sri Satya Vennela <[email protected]>; Long Li <[email protected]>; Dipayaan Roy <[email protected]>; Shiraz Saleem <[email protected]>
Cc: Shradha Gupta <[email protected]>; [email protected]; [email protected]; linux- [email protected]; Paul Rosswurm <[email protected]>; Shradha Gupta <[email protected]>
Subject: [PATCH net-next] net: mana: Set tx_packets to post gso processing packet count

Quoted 6 lines

Allow tx_packets and tx_bytes counter in the driver to represent the packets transmitted post GSO processing.

Currently they are populated as bigger pre-GSO packets and bytes

#2 lore raw
In reply to Shradha Gupta
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 8 lines · On Tue, 17 Jun 2025 04:33:41 -0700 you wrote:

Allow tx_packets and tx_bytes counter in the driver to represent the packets transmitted post GSO processing.

Currently they are populated as bigger pre-GSO packets and bytes

[...]

Here is the summary with links:
- [net-next] net: mana: Set tx_packets to post gso processing packet count

    https://git.kernel.org/netdev/net-next/c/7399ef984022

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html