summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorSaeed Mahameed <saeedm@mellanox.com>2015-06-23 17:14:15 +0300
committerDavid S. Miller <davem@davemloft.net>2015-06-24 00:42:35 -0700
commitfb6c6f2529e7c87a99a2f85ae1bb5b3c468482ff (patch)
treed534c941b97418bf6f7c86a3cd65abf5e0ec4bbb /drivers/net
parent03289b88e3bcbdf2c8e0f1c92ce4e5a4cfbabf77 (diff)
net/mlx5e: Use skb_shinfo(skb)->gso_segs rather than counting them
Instead of counting number of gso fragments, we can use skb_shinfo(skb)->gso_segs. Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tx.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 471babd9df00..c0566b684778 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -143,16 +143,13 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
if (skb_is_gso(skb)) {
u32 payload_len;
- int num_pkts;
eseg->mss = cpu_to_be16(skb_shinfo(skb)->gso_size);
opcode = MLX5_OPCODE_LSO;
ihs = skb_transport_offset(skb) + tcp_hdrlen(skb);
payload_len = skb->len - ihs;
- num_pkts = (payload_len / skb_shinfo(skb)->gso_size) +
- !!(payload_len % skb_shinfo(skb)->gso_size);
MLX5E_TX_SKB_CB(skb)->num_bytes = skb->len +
- (num_pkts - 1) * ihs;
+ (skb_shinfo(skb)->gso_segs - 1) * ihs;
sq->stats.tso_packets++;
sq->stats.tso_bytes += payload_len;
} else {