This commit adds support for hardware TSO for tunneled packets.

Signed-off-by: Shahaf Shuler <shah...@mellanox.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 4 +++-
 drivers/net/mlx5/mlx5_rxtx.c   | 9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 3edfd49..4de3595 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -696,7 +696,9 @@ struct priv *
        if (priv->tso)
                info->tx_offload_capa |= DEV_TX_OFFLOAD_TCP_TSO;
        if (priv->tunnel_en)
-               info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM;
+               info->tx_offload_capa |= (DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+                                         DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+                                         DEV_TX_OFFLOAD_GRE_TNL_TSO);
        if (priv_get_ifname(priv, &ifname) == 0)
                info->if_index = if_nametoindex(ifname);
        /* FIXME: RETA update/query API expects the callee to know the size of
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 145daa0..98e7205 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -488,9 +488,18 @@
                                                (1 << txq->wqe_n) *
                                                MLX5_WQE_SIZE);
                                unsigned int copy_b;
+                               const uint64_t is_tunneled =
+                                                       buf->ol_flags &
+                                                       (PKT_TX_TUNNEL_GRE |
+                                                        PKT_TX_TUNNEL_VXLAN);
 
                                tso_header_sz = buf->l2_len + buf->l3_len +
                                                buf->l4_len;
+
+                               if (is_tunneled && txq->tunnel_en) {
+                                       tso_header_sz += buf->outer_l2_len +
+                                                        buf->outer_l3_len;
+                               }
                                if (unlikely(tso_header_sz >
                                             MLX5_MAX_TSO_HEADER))
                                        break;
-- 
1.8.3.1

Reply via email to