Commit 98795158 authored by Matthew Finlay's avatar Matthew Finlay Committed by David S. Miller

net/mlx5e: Add TX stateless offloads for tunneling

Add support for TSO and TX checksum when using hw assisted,
tunneled offloads.
Signed-off-by: default avatarMatthew Finlay <matt@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b3f63c3d
/* /*
* Copyright (c) 2015, Mellanox Technologies. All rights reserved. * Copyright (c) 2015-2016, Mellanox Technologies. All rights reserved.
* *
* This software is available to you under a choice of one of two * This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU * licenses. You may choose to be licensed under the terms of the GNU
...@@ -185,9 +185,14 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) ...@@ -185,9 +185,14 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
memset(wqe, 0, sizeof(*wqe)); memset(wqe, 0, sizeof(*wqe));
if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM;
if (skb->encapsulation)
eseg->cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM |
MLX5_ETH_WQE_L4_INNER_CSUM;
else else
eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM;
} else
sq->stats.csum_offload_none++; sq->stats.csum_offload_none++;
if (sq->cc != sq->prev_cc) { if (sq->cc != sq->prev_cc) {
...@@ -200,7 +205,12 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) ...@@ -200,7 +205,12 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
eseg->mss = cpu_to_be16(skb_shinfo(skb)->gso_size); eseg->mss = cpu_to_be16(skb_shinfo(skb)->gso_size);
opcode = MLX5_OPCODE_LSO; opcode = MLX5_OPCODE_LSO;
if (skb->encapsulation)
ihs = skb_inner_transport_offset(skb) + inner_tcp_hdrlen(skb);
else
ihs = skb_transport_offset(skb) + tcp_hdrlen(skb); ihs = skb_transport_offset(skb) + tcp_hdrlen(skb);
payload_len = skb->len - ihs; payload_len = skb->len - ihs;
wi->num_bytes = skb->len + wi->num_bytes = skb->len +
(skb_shinfo(skb)->gso_segs - 1) * ihs; (skb_shinfo(skb)->gso_segs - 1) * ihs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment