Skip to content

Commit d3a4e4d

Browse files
Gal Pressmandavem330
authored andcommitted
net/mlx5e: Count GSO packets correctly
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: e586b3b ("net/mlx5: Ethernet Datapath files") Signed-off-by: Gal Pressman <[email protected]> Cc: [email protected] Signed-off-by: Saeed Mahameed <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5f40b4e commit d3a4e4d

File tree

1 file changed

+3
-2
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+3
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tx.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,18 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
274274
sq->stats.tso_bytes += skb->len - ihs;
275275
}
276276

277+
sq->stats.packets += skb_shinfo(skb)->gso_segs;
277278
num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs;
278279
} else {
279280
bf = sq->bf_budget &&
280281
!skb->xmit_more &&
281282
!skb_shinfo(skb)->nr_frags;
282283
ihs = mlx5e_get_inline_hdr_size(sq, skb, bf);
284+
sq->stats.packets++;
283285
num_bytes = max_t(unsigned int, skb->len, ETH_ZLEN);
284286
}
285287

288+
sq->stats.bytes += num_bytes;
286289
wi->num_bytes = num_bytes;
287290

288291
ds_cnt = sizeof(*wqe) / MLX5_SEND_WQE_DS;
@@ -381,8 +384,6 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
381384
if (bf)
382385
sq->bf_budget--;
383386

384-
sq->stats.packets++;
385-
sq->stats.bytes += num_bytes;
386387
return NETDEV_TX_OK;
387388

388389
dma_unmap_wqe_err:

0 commit comments

Comments
 (0)