aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorGal Pressman <galp@mellanox.com>2017-03-21 09:59:18 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-30 03:41:21 -0400
commit36bb24fadbaad57233c655d98bad058f188aab94 (patch)
treea4eff9941709e2f00a1c1551ae4e2ab37dc5d6d6 /drivers/net/ethernet
parent0ceb7181e87657ee9fec1b5d2c2a896ce4c44c3b (diff)
net/mlx5e: Count GSO packets correctly
[ Upstream commit d3a4e4da54c7adb420d5f48e89be913b14bdeff1 ] 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. Before, ethtool showed: $ ethtool -S ens6 | egrep "tx_packets|tx_tso_packets" tx_packets: 61340 tx_tso_packets: 60954 tx_packets_phy: 2451115 Now, we will see the more logical statistics: $ ethtool -S ens6 | egrep "tx_packets|tx_tso_packets" tx_packets: 2451115 tx_tso_packets: 60954 tx_packets_phy: 2451115 Fixes: e586b3b0baee ("net/mlx5: Ethernet Datapath files") Signed-off-by: Gal Pressman <galp@mellanox.com> Cc: kernel-team@fb.com Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tx.c5
1 files 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 cfb68371c397..574311018e6f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -272,15 +272,18 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
272 sq->stats.tso_bytes += skb->len - ihs; 272 sq->stats.tso_bytes += skb->len - ihs;
273 } 273 }
274 274
275 sq->stats.packets += skb_shinfo(skb)->gso_segs;
275 num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs; 276 num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs;
276 } else { 277 } else {
277 bf = sq->bf_budget && 278 bf = sq->bf_budget &&
278 !skb->xmit_more && 279 !skb->xmit_more &&
279 !skb_shinfo(skb)->nr_frags; 280 !skb_shinfo(skb)->nr_frags;
280 ihs = mlx5e_get_inline_hdr_size(sq, skb, bf); 281 ihs = mlx5e_get_inline_hdr_size(sq, skb, bf);
282 sq->stats.packets++;
281 num_bytes = max_t(unsigned int, skb->len, ETH_ZLEN); 283 num_bytes = max_t(unsigned int, skb->len, ETH_ZLEN);
282 } 284 }
283 285
286 sq->stats.bytes += num_bytes;
284 wi->num_bytes = num_bytes; 287 wi->num_bytes = num_bytes;
285 288
286 if (skb_vlan_tag_present(skb)) { 289 if (skb_vlan_tag_present(skb)) {
@@ -377,8 +380,6 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
377 if (bf) 380 if (bf)
378 sq->bf_budget--; 381 sq->bf_budget--;
379 382
380 sq->stats.packets++;
381 sq->stats.bytes += num_bytes;
382 return NETDEV_TX_OK; 383 return NETDEV_TX_OK;
383 384
384dma_unmap_wqe_err: 385dma_unmap_wqe_err: