]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.10.7/net-mlx5e-count-gso-packets-correctly.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.10.7 / net-mlx5e-count-gso-packets-correctly.patch
1 From foo@baz Mon Mar 27 18:18:08 CEST 2017
2 From: Gal Pressman <galp@mellanox.com>
3 Date: Tue, 21 Mar 2017 15:59:18 +0200
4 Subject: net/mlx5e: Count GSO packets correctly
5
6 From: Gal Pressman <galp@mellanox.com>
7
8
9 [ Upstream commit d3a4e4da54c7adb420d5f48e89be913b14bdeff1 ]
10
11 TX packets statistics ('tx_packets' counter) used to count GSO packets
12 as one, even though it contains multiple segments.
13 This patch will increment the counter by the number of segments, and
14 align the driver with the behavior of other drivers in the stack.
15
16 Note that no information is lost in this patch due to 'tx_tso_packets'
17 counter existence.
18
19 Before, ethtool showed:
20 $ ethtool -S ens6 | egrep "tx_packets|tx_tso_packets"
21 tx_packets: 61340
22 tx_tso_packets: 60954
23 tx_packets_phy: 2451115
24
25 Now, we will see the more logical statistics:
26 $ ethtool -S ens6 | egrep "tx_packets|tx_tso_packets"
27 tx_packets: 2451115
28 tx_tso_packets: 60954
29 tx_packets_phy: 2451115
30
31 Fixes: e586b3b0baee ("net/mlx5: Ethernet Datapath files")
32 Signed-off-by: Gal Pressman <galp@mellanox.com>
33 Cc: kernel-team@fb.com
34 Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
35 Acked-by: Alexei Starovoitov <ast@kernel.org>
36 Signed-off-by: David S. Miller <davem@davemloft.net>
37 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
38 ---
39 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 5 +++--
40 1 file changed, 3 insertions(+), 2 deletions(-)
41
42 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
43 +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
44 @@ -272,15 +272,18 @@ static netdev_tx_t mlx5e_sq_xmit(struct
45 sq->stats.tso_bytes += skb->len - ihs;
46 }
47
48 + sq->stats.packets += skb_shinfo(skb)->gso_segs;
49 num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs;
50 } else {
51 bf = sq->bf_budget &&
52 !skb->xmit_more &&
53 !skb_shinfo(skb)->nr_frags;
54 ihs = mlx5e_get_inline_hdr_size(sq, skb, bf);
55 + sq->stats.packets++;
56 num_bytes = max_t(unsigned int, skb->len, ETH_ZLEN);
57 }
58
59 + sq->stats.bytes += num_bytes;
60 wi->num_bytes = num_bytes;
61
62 if (skb_vlan_tag_present(skb)) {
63 @@ -377,8 +380,6 @@ static netdev_tx_t mlx5e_sq_xmit(struct
64 if (bf)
65 sq->bf_budget--;
66
67 - sq->stats.packets++;
68 - sq->stats.bytes += num_bytes;
69 return NETDEV_TX_OK;
70
71 dma_unmap_wqe_err: