net/mlx5e: Use PARTIAL_GSO for UDP segmentation
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / en_accel / en_accel.h
index f20074dbef32c3c2d2bfafcf500cbccde6ef84c9..1dd225380a66075eeceebe290209bfaf20cddf8c 100644 (file)
 #ifndef __MLX5E_EN_ACCEL_H__
 #define __MLX5E_EN_ACCEL_H__
 
-#ifdef CONFIG_MLX5_ACCEL
-
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include "en_accel/ipsec_rxtx.h"
 #include "en_accel/tls_rxtx.h"
 #include "en.h"
 
-static inline struct sk_buff *mlx5e_accel_handle_tx(struct sk_buff *skb,
-                                                   struct mlx5e_txqsq *sq,
-                                                   struct net_device *dev,
-                                                   struct mlx5e_tx_wqe **wqe,
-                                                   u16 *pi)
+static inline void
+mlx5e_udp_gso_handle_tx_skb(struct sk_buff *skb)
+{
+       int payload_len = skb_shinfo(skb)->gso_size + sizeof(struct udphdr);
+
+       udp_hdr(skb)->len = htons(payload_len);
+}
+
+static inline struct sk_buff *
+mlx5e_accel_handle_tx(struct sk_buff *skb,
+                     struct mlx5e_txqsq *sq,
+                     struct net_device *dev,
+                     struct mlx5e_tx_wqe **wqe,
+                     u16 *pi)
 {
 #ifdef CONFIG_MLX5_EN_TLS
        if (test_bit(MLX5E_SQ_STATE_TLS, &sq->state)) {
@@ -64,9 +71,10 @@ static inline struct sk_buff *mlx5e_accel_handle_tx(struct sk_buff *skb,
        }
 #endif
 
+       if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
+               mlx5e_udp_gso_handle_tx_skb(skb);
+
        return skb;
 }
 
-#endif /* CONFIG_MLX5_ACCEL */
-
 #endif /* __MLX5E_EN_ACCEL_H__ */