[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1490112919.16816.104.camel@edumazet-glaptop3.roam.corp.google.com>
Date: Tue, 21 Mar 2017 09:15:19 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Saeed Mahameed <saeedm@...lanox.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Or Gerlitz <ogerlitz@...lanox.com>,
Gal Pressman <galp@...lanox.com>
Subject: Re: [PATCH net 7/8] net/mlx5e: Count GSO packets correctly
On Tue, 2017-03-21 at 15:59 +0200, Saeed Mahameed wrote:
> From: Gal Pressman <galp@...lanox.com>
>
> TX packets statistics ('tx_packets' counter) used to count GSO packets
> as one, even though it contains multiple segments.
> This patch will increment the counter by the number of segments, and
> align the driver with the behavior of other drivers in the stack.
>
> Note that no information is lost in this patch due to 'tx_tso_packets'
> counter existence.
> Signed-off-by: Gal Pressman <galp@...lanox.com>
> Cc: kernel-team@...com
> Signed-off-by: Saeed Mahameed <saeedm@...lanox.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> index f193128bac4b..57f5e2d7ebd1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> @@ -274,15 +274,18 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
> sq->stats.tso_bytes += skb->len - ihs;
> }
>
> + sq->stats.packets += skb_shinfo(skb)->gso_segs;
> num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs;
This reminds me that mlx4 does not trust gso_segs yet, not sure why.
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index e0c5ffb3e3a6607456e1f191b0b8c8becfc71219..3ba89bc43d74d8c023776079bcd0bbadd70fb5c6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -978,8 +978,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
ring->tso_packets++;
- i = ((skb->len - lso_header_size) / shinfo->gso_size) +
- !!((skb->len - lso_header_size) % shinfo->gso_size);
+ i = shinfo->gso_segs;
tx_info->nr_bytes = skb->len + (i - 1) * lso_header_size;
ring->packets += i;
} else {
Powered by blists - more mailing lists