netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: mana: Set tx_packets to post gso processing packet count
@ 2025-06-17 11:33 Shradha Gupta
  2025-06-17 15:31 ` Haiyang Zhang
  2025-06-19 23:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Shradha Gupta @ 2025-06-17 11:33 UTC (permalink / raw)
  To: Dexuan Cui, Wei Liu, Haiyang Zhang, K. Y. Srinivasan, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Konstantin Taranov, Souradeep Chakrabarti, Erni Sri Satya Vennela,
	Long Li, Dipayaan Roy, Shiraz Saleem
  Cc: Shradha Gupta, netdev, linux-hyperv, linux-kernel, Paul Rosswurm,
	Shradha Gupta

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

Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
---
 drivers/net/ethernet/microsoft/mana/mana_en.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index e68b8190bb7a..c3b6478cb1d3 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH net-next] net: mana: Set tx_packets to post gso processing packet count
  2025-06-17 11:33 [PATCH net-next] net: mana: Set tx_packets to post gso processing packet count Shradha Gupta
@ 2025-06-17 15:31 ` Haiyang Zhang
  2025-06-19 23:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Haiyang Zhang @ 2025-06-17 15:31 UTC (permalink / raw)
  To: Shradha Gupta, Dexuan Cui, Wei Liu, KY Srinivasan, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Konstantin Taranov, Souradeep Chakrabarti, Erni Sri Satya Vennela,
	Long Li, Dipayaan Roy, Shiraz Saleem
  Cc: netdev@vger.kernel.org, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org, Paul Rosswurm, Shradha Gupta



> -----Original Message-----
> From: Shradha Gupta <shradhagupta@linux.microsoft.com>
> Sent: Tuesday, June 17, 2025 7:34 AM
> To: Dexuan Cui <decui@microsoft.com>; Wei Liu <wei.liu@kernel.org>;
> Haiyang Zhang <haiyangz@microsoft.com>; KY Srinivasan <kys@microsoft.com>;
> Andrew Lunn <andrew+netdev@lunn.ch>; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski
> <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Konstantin Taranov
> <kotaranov@microsoft.com>; Souradeep Chakrabarti
> <schakrabarti@linux.microsoft.com>; Erni Sri Satya Vennela
> <ernis@linux.microsoft.com>; Long Li <longli@microsoft.com>; Dipayaan Roy
> <dipayanroy@linux.microsoft.com>; Shiraz Saleem
> <shirazsaleem@microsoft.com>
> Cc: Shradha Gupta <shradhagupta@linux.microsoft.com>;
> netdev@vger.kernel.org; linux-hyperv@vger.kernel.org; linux-
> kernel@vger.kernel.org; Paul Rosswurm <paulros@microsoft.com>; Shradha
> Gupta <shradhagupta@microsoft.com>
> Subject: [PATCH net-next] 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
> 
> Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>

Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: mana: Set tx_packets to post gso processing packet count
  2025-06-17 11:33 [PATCH net-next] net: mana: Set tx_packets to post gso processing packet count Shradha Gupta
  2025-06-17 15:31 ` Haiyang Zhang
@ 2025-06-19 23:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-19 23:00 UTC (permalink / raw)
  To: Shradha Gupta
  Cc: decui, wei.liu, haiyangz, kys, andrew+netdev, davem, edumazet,
	kuba, pabeni, kotaranov, schakrabarti, ernis, longli, dipayanroy,
	shirazsaleem, netdev, linux-hyperv, linux-kernel, paulros,
	shradhagupta

Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

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
> 
> Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-19 22:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 11:33 [PATCH net-next] net: mana: Set tx_packets to post gso processing packet count Shradha Gupta
2025-06-17 15:31 ` Haiyang Zhang
2025-06-19 23:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).