From: Valentine Fatiev <valentinef@nvidia.com>
Subject: [PATCH] BACKPORT:
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h

Change-Id: Iddc680d6af5430b8c398aaf0071f69987145e807
---
 .../mellanox/mlx5/core/en_accel/ktls_txrx.h   | 62 +++++++++++++++++--
 1 file changed, 57 insertions(+), 5 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
@@ -14,18 +14,34 @@ struct mlx5e_accel_tx_tls_state {
 	u32 tls_tisn;
 };
 
+#ifdef HAVE_KTLS_STRUCTS
 u16 mlx5e_ktls_get_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *params);
-
 bool mlx5e_ktls_handle_tx_skb(struct net_device *netdev, struct mlx5e_txqsq *sq,
-			      struct sk_buff *skb,
-			      struct mlx5e_accel_tx_tls_state *state);
+		struct sk_buff *skb,
+		struct mlx5e_accel_tx_tls_state *state);
+#else
+static inline bool mlx5e_ktls_handle_tx_skb(struct net_device *netdev, struct mlx5e_txqsq *sq,
+		struct sk_buff *skb,
+		struct mlx5e_accel_tx_tls_state *state)
+{
+	return false;
+}
+
+static inline u16 mlx5e_ktls_get_stop_room(struct mlx5_core_dev *mdev,
+		struct mlx5e_params *params)
+{
+	return 0;
+}
+#endif
+#ifdef HAVE_KTLS_RX_SUPPORT
 void mlx5e_ktls_handle_rx_skb(struct mlx5e_rq *rq, struct sk_buff *skb,
 			      struct mlx5_cqe64 *cqe, u32 *cqe_bcnt);
-
+#endif
 void mlx5e_ktls_handle_ctx_completion(struct mlx5e_icosq_wqe_info *wi);
 void mlx5e_ktls_handle_get_psv_completion(struct mlx5e_icosq_wqe_info *wi,
 					  struct mlx5e_icosq *sq);
 
+#ifdef HAVE_KTLS_STRUCTS
 void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
 					   struct mlx5e_tx_wqe_info *wi,
 					   u32 *dma_fifo_cc);
@@ -40,7 +56,16 @@ mlx5e_ktls_tx_try_handle_resync_dump_com
 	}
 	return false;
 }
-
+#else
+static inline bool
+mlx5e_ktls_tx_try_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
+					  struct mlx5e_tx_wqe_info *wi,
+					  u32 *dma_fifo_cc)
+{
+	return false;
+}
+#endif
+#ifdef HAVE_KTLS_RX_SUPPORT
 bool mlx5e_ktls_rx_handle_resync_list(struct mlx5e_channel *c, int budget);
 
 static inline bool
@@ -48,6 +73,33 @@ mlx5e_ktls_rx_pending_resync_list(struct
 {
 	return budget && test_bit(MLX5E_SQ_STATE_PENDING_TLS_RX_RESYNC, &c->async_icosq.state);
 }
+#else
+static inline bool
+mlx5e_ktls_rx_handle_resync_list(struct mlx5e_channel *c, int budget)
+{
+	return false;
+}
+
+static inline bool
+mlx5e_ktls_rx_pending_resync_list(struct mlx5e_channel *c, int budget)
+{
+	return false;
+}
+
+static inline void mlx5e_ktls_handle_rx_skb(struct mlx5e_rq *rq,
+					    struct sk_buff *skb,
+					    struct mlx5_cqe64 *cqe,
+					    u32 *cqe_bcnt)
+{
+}
+#endif
+
+#ifndef HAVE_TLS_IS_SKB_TX_DEVICE_OFFLOADED
+static inline bool mlx5e_ktls_skb_offloaded(struct sk_buff *skb)
+{
+	        return skb->sk && tls_is_sk_tx_device_offloaded(skb->sk);
+}
+#endif
 
 static inline void
 mlx5e_ktls_handle_tx_wqe(struct mlx5_wqe_ctrl_seg *cseg,
